config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 56 Imported by: 1 module, 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

Nested configuration document with dotted path navigation, deep merge and default stripping

Index

Constants

View Source
const (
	ConfigFilename = "config.yaml"
	BackendEnv     = "ICEBATH_CONFIG_BACKEND"
)
View Source
const (
	ColorReset  = "\033[0m"
	ColorBold   = "\033[1m"
	ColorDim    = "\033[2m"
	ColorYellow = "\033[33m"
	ColorCyan   = "\033[36m"
)

Terminal color codes the config notices use

View Source
const (
	PlatformSourceAll     = "all"
	PlatformSourceBundled = "bundled"
	PlatformSourceUser    = "user"
)

Platform manifest sources a scan reads, the bundled tree, the home's user plugins or both

View Source
const DefaultBackupKeep = 5

Backups a config writer keeps per reason

View Source
const DefaultIdentity = "You are Icebath Agent, built by " + IdentityAuthor + ". Be direct: match the length of your reply to the weight of " +
	"the ask \u2014 a one-line question gets a one-line answer, and finished work gets a short report of what " +
	"changed, what's verified, and what's left, never a replay of the process. No filler (\"Great question,\" " +
	"\"I'd be happy to\"), no restating the request back, no re-summarizing what you already said, no narrating " +
	"tool calls the user can see. Plain claims over adjectives; when unsure, say so plainly. Agree because it's " +
	"right, not because the user said it. Depth is earned \u2014 give it when the user asks for detail, teaches, or " +
	"the stakes demand it, not by default."

Identity text seeded into SOUL.md on first run and used when a home carries no SOUL.md

View Source
const DefaultSandboxImage = "localhost/icebath-sandbox:desktop"

Image icebath builds from docker/sandbox/Dockerfile for every container terminal backend unless pinned

View Source
const DefaultSkinName = "blackwall"

DefaultSkinName is the built in skin a config without display.skin gets, also reachable as "default"

View Source
const DefaultToolset = "icebath-cli"

Toolset selection every new config starts from

View Source
const DefaultVercelImage = "vercel/sandbox/universal:latest"

Image fresh Vercel sandboxes start from

View Source
const DisplayLanguageKey = "display.language"

Config key holding the display language

View Source
const EnvManagedDir = "ICEBATH_MANAGED_DIR"

EnvManagedDir is the IT only override naming the managed scope directory

View Source
const IdentityAuthor = "Nicholas W. Heyer"

IdentityAuthor is the builder the default identity names

View Source
const LegacySandboxImage = "nikolaik/python-nodejs:python3.11-nodejs20"

Container image the default sandbox used before the display stack, dropped by the v48 step

View Source
const LegacyVercelRuntime = "node24"

Vercel runtime the setup wizard seeded before images replaced runtimes

View Source
const RacyMtimeWindowNS int64 = 2_000_000_000

Age under which a stat signature cannot rule out a same tick write after the stat

View Source
const TermuxInstallCommand = "pkg install proot-distro && proot-distro install debian && proot-distro login debian -- " +
	"sh -c 'apt-get update && apt-get install -y curl ca-certificates && curl -fsSL https://icebath.app | sh'"

Installs icebath on Termux inside a Debian userland, the Linux release having no Termux build

View Source
const TurnLimitUnlimited = math.MaxInt

Iteration cap meaning no limit

Variables

View Source
var (
	FacadeStdout io.Writer = termutil.Stdout
	FacadeStdin  io.Reader = os.Stdin
)

Streams the facade prompts read from and its plain output is printed to

View Source
var EnvRefusalOut io.Writer = os.Stderr

Stream that receives env write refusals, standard error outside tests

View Source
var EnvWriterLaunchDenylist = func() map[string]bool { return map[string]bool{} }

External provider launch env names, installed by pkg/provider so ACP argv authority stays unwritable

View Source
var ErrCoreEnvNamesUnregistered = errors.New("config: the provider bridge must register CoreDeclaredEnvNames before platform secrets are listed")

Errors when the provider bridge has not registered the core declared env names

View Source
var ErrEnvPermissions = errors.New(".env file is readable by other users")

Error of a .env file that is not owner only readable

View Source
var FacadeNoticeOut io.Writer = os.Stderr

Stream that receives managed mode refusals and managed key notices, standard error outside tests

View Source
var HomeSubdirs = []string{"cron", "sessions", "logs", "logs/curator", "memories", "pairing", "hooks", "image_cache", "audio_cache", "skills"}

Subdirectories every home carries

View Source
var IsMultiplexActive func(ctx context.Context) bool

Multiplex predicate of agent.secret_scope that pkg/provider installs, nil in a process without a multiplexer

View Source
var KnownContainerTypes = map[string]string{
	"providers":        "mapping",
	"model.aliases":    "mapping",
	"plugins.enabled":  "list",
	"plugins.disabled": "list",
}

Container roots absent from the defaults whose readers fix their shape

View Source
var LegacySandboxImages = []string{LegacySandboxImage, "nikolaik/python-nodejs:python3.14-nodejs22"}

Every earlier default sandbox image a saved terminal image may still equal

View Source
var ManagedConfigHonored = func() bool {
	backend, err := GetConfigBackend(context.Background())
	if err != nil {
		panic(err)
	}
	return backend.HonorsManagedConfig()
}

Whether the selected config backend takes managed files, an unavailable backend exiting like the Python SystemExit

View Source
var OptionalEnvVars = NewOptionalEnvTable(optionalEnvDecl)

Optional env table of setup, the keys page and the child env policy, provider and platform entries joining later

View Source
var ParseFailureOut io.Writer = os.Stderr

Stream the parse failure warning is written to

View Source
var PlatformSecretEnvSuffixes = []string{"_TOKEN", "_SECRET", "_KEY", "_PASSWORD", "_JSON"}

Env name suffixes that make a platform variable a secret unless its declaration says otherwise

View Source
var RequiredEnvVars = map[string]EnvVar{}

Env variables every install must set, none since the setup wizard picks the provider

View Source
var RuamelDefaultIndent = SafeDumpIndent{Mapping: 2, Sequence: 2, Offset: 0}

Indentation of a ruamel YAML instance left at its defaults, sequences indentless under a mapping key

View Source
var ScalarAsOneItemListKeys = map[string]bool{"agent.disabled_toolsets": true, "skills.disabled": true}

List slots whose readers accept a bare name as a one item list

View Source
var SecretConfigKeys = secretConfigKeys

Exported lowercase config key names whose values are secrets

View Source
var SuppressWarningsOn func(ctx context.Context, platform string) bool

Whether a chat platform hides warning notices, installed by the settings package

View Source
var TerminalConfigEnvMap = func() [][2]string {
	out := [][2]string{{"backend", "TERMINAL_ENV"}}
	for _, key := range []string{
		"degraded_mode", "cwd", "temp_dir", "timeout", "lifetime_seconds",
		"docker_image", "docker_forward_env", "modal_image",
		"daytona_image", "vercel_runtime", "vercel_image", "ssh_host", "ssh_user", "ssh_port", "ssh_key",
		"container_cpu", "container_memory", "container_disk", "container_persistent",
		"docker_volumes", "docker_env", "docker_mount_cwd_to_workspace", "docker_network",
		"docker_extra_args", "docker_shm_size", "docker_run_as_host_user", "docker_snap_compat",
		"docker_persist_across_processes", "docker_shared_container_key",
		"docker_orphan_reaper", "sandbox_dir", "persistent_shell",
	} {
		out = append(out, [2]string{key, "TERMINAL_" + strings.ToUpper(key)})
	}
	return out
}()

Terminal config keys in declaration order with the env var each one mirrors

View Source
var ValidReasoningEfforts = []string{"minimal", "low", "medium", "high", "xhigh", "max", "ultra"}

Reasoning effort levels a bare string may name

View Source
var YAMLWarningOut io.Writer = os.Stderr

Stream Python warnings of YAML loads are written to

Functions

func ActiveConfigParseFailure

func ActiveConfigParseFailure(h string) (string, bool)

Recorded parse error while the active config file is byte identical to the one that failed

func AddIssue

func AddIssue(issues *[]ConfigIssue, severity, message, hint string)

Appends an issue built from its severity, message and fix hint

func AppendMappingKey

func AppendMappingKey(m map[string]any, key string)

Moves a key to the end of the mapping order the way a Python dict insert of a new key does

func ApplyManagedOverlay

func ApplyManagedOverlay(doc map[string]any) map[string]any

ApplyManagedOverlay deep merges administrator pinned values on top of the document, unchanged without a scope

func ApplyTerminalConfigToEnv

func ApplyTerminalConfigToEnv(ctx context.Context, h string, opts TerminalEnvOptions) error

Bridges terminal config keys into the env vars terminal tools read, explicit file keys overriding env values

func AsBool

func AsBool(v any) (bool, bool)

Boolean view of a YAML scalar: a boolean, a number of any Go kind as nonzero, or the usual truthy and falsy spellings

func AsFloat

func AsFloat(v any) (float64, bool)

Float view of a YAML scalar: a number of any Go kind, a *big.Int included, or numeric text

func AsInt

func AsInt(v any) (int, bool)

Integer view of a YAML scalar: an integer of any Go kind within the int range, a whole float within it or decimal text

func AsMap

func AsMap(v any) map[string]any

Map view of a value

func AsStrings

func AsStrings(v any) []string

String list view of a list or a comma separated string, null items skipped and other items as their plain text

func AtomicConfigReplace

func AtomicConfigReplace(ctx context.Context, h, configPath string, data map[string]any, extraContentOnCreate string) error

Persists the complete desired config state, omitted mapping keys deliberately deleted

func AtomicConfigWrite

func AtomicConfigWrite(ctx context.Context, h, configPath string, data map[string]any, extraContentOnCreate string) error

Persists a config without letting an incomplete mapping delete existing settings

func AtomicJSONWrite

func AtomicJSONWrite(ctx context.Context, path string, data any) error

Writes data as two space indented JSON through a synced temp file keeping the existing mode and owner

func AtomicJSONWriteMode

func AtomicJSONWriteMode(ctx context.Context, path string, data any, mode os.FileMode, opts ...jsonutil.Option) error

Atomic json.dump with the given dump options whose temp file and target carry the given mode

func AtomicJSONWriteModeSyncDir

func AtomicJSONWriteModeSyncDir(ctx context.Context, path string, data any, mode os.FileMode, opts ...jsonutil.Option) error

Mode carrying atomic JSON write that also syncs the resolved target directory so the rename survives power loss

func AtomicJSONWriteWith

func AtomicJSONWriteWith(ctx context.Context, path string, data any, opts ...jsonutil.Option) error

Atomic json.dump with the given dump options, ensure_ascii escapes only for a payload that is not valid UTF-8

func AtomicWrite

func AtomicWrite(path string, data []byte, mode os.FileMode) error

Writes data to path through a temporary sibling and a rename

func AtomicYAMLWrite

func AtomicYAMLWrite(ctx context.Context, path string, data any, extra string) error

Writes data as YAML plus extra through a synced temp file, keeping the existing mode and owner

func AtomicYAMLWriteCreateMode

func AtomicYAMLWriteCreateMode(ctx context.Context, path string, data any, extra string, createMode os.FileMode) error

Writes like AtomicYAMLWrite with a new file created at the given mode

func BackupConfig

func BackupConfig(ctx context.Context, configPath, reason string, keep int) (string, error)

Copies config into the backups dir, empty when skipped or failed, errors when no backend serves config

func BackupsDir

func BackupsDir(configPath string) string

Directory holding the dated config backups beside a config file

func BackupsDirDisplay

func BackupsDirDisplay(h string) string

Display form of the config backups dir of a home

func BootstrapDeployment

func BootstrapDeployment(ctx context.Context, home, projectEnv string) error

Publishes the deployment from an explicit dotenv load home and project file before its first config read

func BundledPlatformDirNames

func BundledPlatformDirNames(h string) []string

Directory names of the bundled platform plugins that have a manifest path

func Canonicalize

func Canonicalize(doc map[string]any) (map[string]any, error)

Document as stored, refused when its agent section is set to something other than a mapping

func CfgGet

func CfgGet(cfg map[string]any, keys ...string) (any, bool)

Value at a nested key path through mappings only, false on any miss

func CheckNonASCIICredential

func CheckNonASCIICredential(key, value string) string

CheckNonASCIICredential strips non ASCII characters from a credential and warns on stderr which ones went

func Clone

func Clone(v any) any

Deep copy of a YAML shaped value

func ConfigCacheVersion

func ConfigCacheVersion(ctx context.Context, configPath string) ([]any, error)

Signature for a parse cache that also changes on a same tick same size rewrite

func ConfigCacheVersionOrNone

func ConfigCacheVersionOrNone(ctx context.Context, configPath string) ([]any, error)

Cache version, nil when the config is absent or cannot be read, other errors returned

func ConfigCheckDiagnostics

func ConfigCheckDiagnostics(cfg map[string]any, getEnv func(name string) string, src CheckDiagnosticsSources) ([]string, error)

Saved toolset problems plus each disabled bundled platform whose required credentials are all configured

func ConfigCommand

func ConfigCommand(ctx context.Context, h string, args ConfigArgs, src ConfigCommandSources) error

Runs one config subcommand, a backend write refusal printed as an error with status 1

func ConfigDestination

func ConfigDestination(ctx context.Context, configPath string) (string, error)

Where a write to a config path lands, the file path or the backend own name

func ConfigExists

func ConfigExists(ctx context.Context, configPath string) (bool, error)

Reports whether a config file exists

func ConfigFromJSON

func ConfigFromJSON(v any) any

Decoded JSON as config mappings in document key order with integers as Go ints

func ConfigStructureIssueLines

func ConfigStructureIssueLines(issues []ConfigIssue) []string

Severity tagged lines with each first hint line for an unknown provider error

func ConfigVersion

func ConfigVersion(ctx context.Context, configPath string) ([]any, error)

Cache signature of a config file, the stat error when it cannot be stat'ed

func ConfigVersionOrNone

func ConfigVersionOrNone(ctx context.Context, configPath string) ([]any, error)

Version, nil when the config is absent or cannot be stat'ed, other errors returned

func ContainerSlots

func ContainerSlots() map[string]string

Dotted key to list or mapping for every container slot the defaults and known container table fix

func ContentDigest

func ContentDigest(data []byte) string

Short hex digest of data for cache keys

func CoreDeclaredEnvNames

func CoreDeclaredEnvNames() (map[string]bool, error)

Every env name core declares, the static table plus provider profile names, from the provider bridge

func CustomEndpointKeyEnv

func CustomEndpointKeyEnv(identity string) string

Env name holding a custom endpoint key, one slot per endpoint identity

func DecodeEnvBytes

func DecodeEnvBytes(raw []byte) string

Text of a dotenv file, the BOM dropped and invalid UTF-8 read as Latin-1

func DeepMerge

func DeepMerge(base, override map[string]any) map[string]any

Override merged into base, maps recursing and a null over a map section ignored

func DeploymentEnvNames

func DeploymentEnvNames(ctx context.Context) ([]string, error)

Deployment env names of the selected backend, never launch residue

func DetectInstallMethod

func DetectInstallMethod(ctx context.Context, h, projectRoot string) (string, error)

Install method from the code stamp, a home stamp, the managed marker, a package manager layout or a git checkout

func DiagnosticMetadata

func DiagnosticMetadata(event WakeEvent) map[string]any

Diagnostic notification category of a trusted internal diagnostic only wake, empty for everything else

func DiagnosticTurnMuted

func DiagnosticTurnMuted(ctx context.Context, displayMetadata map[string]any, platform string) bool

A diagnostic category wake mutes its turn only when the owning policy hides diagnostics

func DiagnosticWakeMuted

func DiagnosticWakeMuted(ctx context.Context, event WakeEvent) bool

Only trusted diagnostic only wakes mute a turn, a recorded mute snapshot winning

func DisplayLanguageError

func DisplayLanguageError(value string, cat LanguageCatalog) string

Refusal for an unsupported display language, empty when the value is blank or resolves

func DropOtherAccess

func DropOtherAccess(ctx context.Context, path string)

Strips the world permission bits of a config file a writer just placed, group bits and setgid staying for shared group homes, managed installs and containers keeping their modes

func EditConfig

func EditConfig(ctx context.Context, h string) error

Opens the config file in the user editor, seeding a missing file first

func EffectiveUserConfig

func EffectiveUserConfig(ctx context.Context) map[string]any

Active profile effective user config, empty when it cannot be read so presentation fails open

func EnsureIcebathHome

func EnsureIcebathHome(ctx context.Context, h string) error

Ensures the home skeleton once per home path, refusing a deleted named profile

func EnvFloat

func EnvFloat(key string, def float64) float64

Float value of an environment variable, an infinity for one too large, def when unset, blank or not a number

func EnvInt

func EnvInt(key string, def int64) int64

Integer value of an environment variable saturated to int64, def when unset, blank or not a decimal integer

func EnvLineDefinesKey

func EnvLineDefinesKey(line, key string) bool

Reports whether a dotenv line assigns key in exactly the shapes the env loader parses

func EnvRefLookup

func EnvRefLookup(name string) (string, bool)

Env reference lookup load_config expands config templates with, the process env

func EnvRefVarName

func EnvRefVarName(body string) string

Variable name a reference body reads, empty for a non env source or a blank env source

func EnvVarEnabled

func EnvVarEnabled(name string) bool

True when the named variable trimmed and lowercased is 1, true, yes or on

func EnvWriteRefusal

func EnvWriteRefusal(ctx context.Context, h, key, action string) string

Refusal text when a managed install or an administrator pinned key forbids writing key, empty when allowed

func ExecInContainer

func ExecInContainer(info *ContainerExecInfo, cliArgs []string) (code int, err error)

Replaces this process with the same command inside the managed container

func Expand

func Expand(v any, lookup Lookup) any

Document with every string value expanded, keys and non strings untouched

func ExpandString

func ExpandString(s string, lookup Lookup) string

Value with every ${VAR} and ${env:VAR} reference replaced, unresolved references kept verbatim

func ExplicitPaths

func ExplicitPaths(doc map[string]any) map[string]bool

Leaf paths present in a raw document

func FailedReadError

func FailedReadError(m map[string]any) error

Read error of a mapping served as the fallback for an unreadable config, nil for ordinary data

func FastSafeLoad

func FastSafeLoad(data []byte) (any, error)

Parsed YAML root of file bytes read as utf-8 text under the shared safe_load policy, nil for an empty document

func FileCacheVersion

func FileCacheVersion(path string, alwaysDigest bool) ([]any, error)

Signature plus content digest of a file, digesting on every call when alwaysDigest is set

func FileCacheVersionOf

func FileCacheVersionOf(path string, fi os.FileInfo) []any

Cache version of a file from a stat result the caller took, with the racy digest

func FileSignature

func FileSignature(fi os.FileInfo) [4]int64

Change detection key of a stat result as mtime ns, size, inode and ctime ns

func FormatConfigParseFailure

func FormatConfigParseFailure(configPath string, err error, fallback string) string

User copy for an unreadable or unparseable config file naming what happens and how to fix it

func FormatDockerUpdateMessage

func FormatDockerUpdateMessage() string

User facing guidance for icebath update inside the published Docker image

func FormatManagedMessage

func FormatManagedMessage(ctx context.Context, h, action string) string

User facing refusal for an action on a package manager managed install

func GetActiveGoodbye

func GetActiveGoodbye(ctx context.Context, fallback string) string

func GetActiveSkinName

func GetActiveSkinName(ctx context.Context) string

Name of the active skin, default for a routed home that never chose one

func GetConfigPath

func GetConfigPath(h string) string

Main config file of the resolved home

func GetConfigValue

func GetConfigValue(ctx context.Context, h, key string, asJSON, raw bool, src ConfigCommandSources) error

Prints the value in effect for a setting or an env shaped key, credentials masked unless raw or redaction is off

func GetEnvPath

func GetEnvPath(h string) string

Secrets file holding the API keys of the resolved home

func GetEnvValue

func GetEnvValue(ctx context.Context, h, key string) (string, bool, error)

Value from the scoped process env, else the home .env, a failed scoped read returned as an error

func GetEnvValuePreferDotenv

func GetEnvValuePreferDotenv(ctx context.Context, h, key string) (string, error)

Credential from the home .env first, an unresolved op reference yielding to the scoped value

func GetManagedUpdateCommand

func GetManagedUpdateCommand(ctx context.Context, h string) string

Upgrade guidance for a nix managed install, empty when no nix system manages it

func GetProjectRoot

func GetProjectRoot() string

Source tree the running code was built from, else the directory holding the running binary

func InitSkinFromConfig

func InitSkinFromConfig(ctx context.Context, cfg map[string]any)

Activates display.skin of a config, default when it is unset, blank or not a string

func InitializeHome

func InitializeHome(ctx context.Context, h string, subdirs []string, ensured map[string]bool) error

Creates the home skeleton, private unless managed, and seeds the default soul

func InstallMethodStamp

func InstallMethodStamp(root string) (string, error)

Install method the stamp beside the binary of root names, empty when unstamped or unsupported

func InstallSkinColorFilter

func InstallSkinColorFilter(fn func(string) string)

InstallSkinColorFilter routes every GetColor result through fn, nil removing the filter

func InvalidateEnvCache

func InvalidateEnvCache()

Drops every .env memo so the next load sees a write even on coarse mtime filesystems

func InvalidateEnvFileCache

func InvalidateEnvFileCache(path string)

InvalidateEnvFileCache drops one path from the dotenv memo, every path when the path is empty

func InvalidateManagedCache

func InvalidateManagedCache()

InvalidateManagedCache drops cached managed config and env

func IsDiagnosticNotice

func IsDiagnosticNotice(level, key string) bool

Warning or error notices and every credit service notice are diagnostics

func IsEnvConfigKey

func IsEnvConfigKey(key string) bool

Reports whether config set routes this credential shaped dotless key to .env

func IsEnvManaged

func IsEnvManaged(name string) bool

IsEnvManaged is true when the env var name is pinned by the managed .env layer

func IsKeyManaged

func IsKeyManaged(dotted string) bool

IsKeyManaged is true when the exact dotted key is pinned by the managed layer

func IsLegacyTemplateSoul

func IsLegacyTemplateSoul(text string) bool

Reports whether a SOUL.md still holds an earlier auto seeded text nobody edited, never the current default

func IsManaged

func IsManaged(ctx context.Context, h string) bool

Reports whether a package manager manages this install

func IsNixInstallMethod

func IsNixInstallMethod(method string) bool

Reports whether nix owns the method, a nix store install or a nixos or home-manager module

func IsOSError

func IsOSError(err error) bool

Reports whether an error is an operating system error rather than a parse failure

func IsPackageManagerInstallMethod

func IsPackageManagerInstallMethod(method string) bool

Reports whether a package manager other than nix or docker owns the install and its updates

func IsReleaseBinaryInstallMethod

func IsReleaseBinaryInstallMethod(method string) bool

Reports whether icebath update replaces the binary from a published release for the method

func IsSSHRemoteTildeCwd

func IsSSHRemoteTildeCwd(backend, cwd string) bool

Reports whether the remote SSH shell must expand a tilde cwd itself

func IsWarningStatus

func IsWarningStatus(eventType string, message any) bool

Warn events and diagnostic classified messages are warning statuses

func IsYAMLError

func IsYAMLError(err error) bool

Reports whether err is a failure of the shared YAML reader or writer

func KeepingReadBase

func KeepingReadBase[T any](ctx context.Context, read func() (T, error)) (T, error)

Runs a pre write guard read without making it the base a later document save diffs against

func KeyString

func KeyString(keyValue any) string

Map key under which a non str Python key is stored, never equal to a key a YAML str produces

func ListConfigBackups

func ListConfigBackups(configPath, reason string) []string

Existing backups newest first, filtered to one reason when given

func LoadEnv

func LoadEnv(h string) map[string]string

Parsed .env of a home, empty for a frozen worker whose secrets arrive through its scope

func LoadEnvFile

func LoadEnvFile(path string) map[string]string

Assignments of a dotenv file memoised on its exact bytes, a fresh map per call, empty when unreadable

func LoadManagedConfig

func LoadManagedConfig() map[string]any

LoadManagedConfig is the parsed managed config.yaml, empty when absent, malformed, or not honored

func LoadManagedEnv

func LoadManagedEnv() map[string]string

LoadManagedEnv is the parsed managed .env, empty when absent

func LoadNewestGoodBackup

func LoadNewestGoodBackup(ctx context.Context, configPath string) (map[string]any, error)

Raw mapping of the newest good backup, nil when absent, unreadable, not a mapping or the backend has no files

func LoadUserEffective

func LoadUserEffective(configPath string, lookup Lookup) (map[string]any, error)

Effective user layer of a config path, a broken file served from the last good parse

func LoadUserEffectiveFailClosed

func LoadUserEffectiveFailClosed(configPath string, lookup Lookup) (map[string]any, error)

Effective user layer of a config path, a broken file returning its parse error

func LoadYAMLFileReadonly

func LoadYAMLFileReadonly(path string) (any, error)

Parse of a YAML file shared until its cache version changes, the result must never be mutated

func LockConfig

func LockConfig(ctx context.Context) (context.Context, func())

Takes the process config lock unless ctx already holds it, returning the holding ctx and its release

func LooksStructuredValue

func LooksStructuredValue(value string) bool

Reports whether a string plausibly encodes a YAML or JSON list or mapping

func ManagedConfigKeys

func ManagedConfigKeys() []string

ManagedConfigKeys lists the dotted leaf keys the managed config pins

func ManagedDir

func ManagedDir() string

ManagedDir resolves the managed scope directory, empty when no scope is present

func ManagedError

func ManagedError(ctx context.Context, h, action string)

Prints the managed install refusal for an action to standard error

func ManagedSystem

func ManagedSystem(ctx context.Context, h string) string

Package manager owning the install from ICEBATH_MANAGED or the home marker, empty when unmanaged

func MappingKeyOrder

func MappingKeyOrder(path string, keys ...string) []string

Keys of the mapping at a key path of a YAML file in loaded dict order, nil when the file or the mapping is absent

func MappingKeys

func MappingKeys(m map[string]any) []string

Keys of a mapping in file or insertion order, keys without a recorded position following in sorted order

func MappingPyKey

func MappingPyKey(m map[string]any, key string) (any, bool)

Non str Python key a string key of a mapping stands for, false for an ordinary str key

func MaskSecret

func MaskSecret(value, empty string) string

Masks a secret for display as head...tail, shorter values become stars and empty ones the empty label

func MergePartialSave

func MergePartialSave(raw, override map[string]any) map[string]any

Override over raw for a partial save, omitted sections kept and shared sections deep merged

func ModelForcesMaxCompletionTokens

func ModelForcesMaxCompletionTokens(model string) bool

Whether an OpenAI model family rejects max_tokens and needs max_completion_tokens

func MtimeIsRacy

func MtimeIsRacy(mtimeNS int64) bool

Reports whether a timestamp is too recent to rule out a same tick write after the stat

func NixMergeConfig

func NixMergeConfig(nixJSONPath, configPath string) error

Deep merges the Nix settings JSON into config.yaml, Nix keys replacing those on disk and every other key kept

func NixRenderSettings

func NixRenderSettings(settingsJSON string) (string, error)

Nix module settings JSON with the package config version added when absent, as json.dump writes it

func NormalizeProxyEnvVars

func NormalizeProxyEnvVars()

Rewrites the proxy and bypass variables of the process to their canonical forms in place

func NormalizeProxyURL

func NormalizeProxyURL(proxyURL string) string

The socks5 form of a socks proxy URL, other values stripped, empty for a blank value

func NoteRuntimeImport

func NoteRuntimeImport(name string)

Records that a runtime component started, after which no worker policy may bind

func PackageManagerOfPath

func PackageManagerOfPath(binary string) string

Package manager whose install layout a binary path sits in, empty for none

func ParseCLIValue

func ParseCLIValue(key, value string) (any, error)

Value the CLI writes for typed text: bool, null, int, float, list or mapping, text of string settings kept verbatim

func ParseEnv

func ParseEnv(text string) map[string]string

Assignments of dotenv text, export prefixes and comments honored

func ParseEnvValue

func ParseEnvValue(raw string) string

Dotenv value with surrounding quotes removed and double quote escapes reversed

func ParseReasoningEffort

func ParseReasoningEffort(effort any) map[string]any

Reasoning config of a level, nil for empty or unknown input and enabled false for a disable spelling

func PatchUpdateCommandForMethod

func PatchUpdateCommandForMethod(method, command string) func()

Makes method's update command read command until the returned restore runs

func PinnedKeys

func PinnedKeys(ctx context.Context) []string

Dotted keys a document save in ctx stores even when unchanged

func PinnedTerminalBackend

func PinnedTerminalBackend() string

PinnedTerminalBackend is the non empty terminal.backend the managed config pins, else empty

func PinningKeys

func PinningKeys(ctx context.Context, keys ...string) context.Context

Context in which a document save stores keys at the user layer even when unchanged from the inherited value

func PlatformManifestSecretEnvs

func PlatformManifestSecretEnvs(h, source string, strict bool) (map[string]bool, error)

Secret env names one source's platform manifests declare, the bundled set read once at startup minus core names

func PlatformManifestSecretScan

func PlatformManifestSecretScan(h string) (map[string]bool, bool, error)

A home's user platform plugin secrets read strictly and whether every plugin dir and manifest was read

func PlatformManifestStamp

func PlatformManifestStamp(h string) string

Change detection key over every user platform plugin manifest of a home, changing on any add, removal or edit

func PlatformPluginManifestDirNames

func PlatformPluginManifestDirNames(h string) ([]string, error)

Directory names of every readable platform plugin manifest across the bundled and user sources

func PresentNotification

func PresentNotification(ctx context.Context, present func(context.Context) error, platform string, diagnostic bool) (bool, error)

Awaits the presenter only when its classified content is visible and reports whether it ran

func PrintConfigWarnings

func PrintConfigWarnings(ctx context.Context, h string, cfg map[string]any, removedNote func(section, name string) string)

Writes config structure warnings to stderr, the loaded config checked when cfg is nil

func ProbeConfigReadable

func ProbeConfigReadable(ctx context.Context, configPath string) error

Error while a config file cannot be read, with no parse

func QuoteEnvValue

func QuoteEnvValue(value string) string

Value quoted for a dotenv line when it carries whitespace, quotes, a hash or a backslash

func RacyContentDigest

func RacyContentDigest(path string, sig [4]int64) string

Empty once the signature has settled, a digest of the file bytes while the later of mtime and ctime is racy

func ReadConfigDoc

func ReadConfigDoc(ctx context.Context, configPath string) (any, error)

Parsed root of a config file, nil when empty

func ReadConfigDocReadonly

func ReadConfigDocReadonly(ctx context.Context, configPath string) (any, error)

Signature cached parse of a config file, shared and never to be mutated

func ReadDocument

func ReadDocument(path string) (map[string]any, error)

Parsed user document of a YAML file, empty when the file is absent or blank

func ReadEnvLines

func ReadEnvLines(path string) ([]string, error)

Dotenv lines decoded as utf-8-sig with replacement, each normalized and ending in one newline

func ReadErrorFix

func ReadErrorFix(err error) string

Fix advice for a config read error

func ReadRawConfig

func ReadRawConfig(ctx context.Context, h string) (map[string]any, error)

Raw config.yaml of a home with no defaults or expansion, a private copy the caller may mutate

func ReadRawConfigReadonly

func ReadRawConfigReadonly(ctx context.Context, h string) (map[string]any, error)

Raw config.yaml of a home shared with the cache, the result must never be mutated

func ReadUser

func ReadUser(h string) (map[string]any, error)

Raw user config of a home, no defaults merged and no references expanded

func ReadUserConfigRaw

func ReadUserConfigRaw(ctx context.Context, configPath string) (map[string]any, error)

User config.yaml as written with no cache, ONLY legal for write-back round-trips and raw-file diagnostics, behavioral reads use load_config()

func RebaseForSave

func RebaseForSave(cfg, liveRaw map[string]any, mergeExisting bool, loadConfig func() map[string]any) map[string]any

Config a save persists, a frozen worker landing only its own edits on the live file

func RecommendedUpdateCommand

func RecommendedUpdateCommand(ctx context.Context, h string) (string, error)

Update command for this install, the managed guidance winning over a stale code stamp

func RecommendedUpdateCommandForMethod

func RecommendedUpdateCommandForMethod(method string) string

Update command or guidance for an install method, icebath update when the method has no steward

func RedactConfigValue

func RedactConfigValue(value any) any

Copy of a config value with credential shaped keys masked, env templates left visible

func RedactKey

func RedactKey(key string) string

Masked API key for display, a dim not set label when empty

func RefSnapshot

func RefSnapshot(v any, lookup Lookup) map[string]*string

Names referenced by the document mapped to the values the expansion saw

func RefuseFailedRead

func RefuseFailedRead(h, configPath string, data any) error

Refusal to save a fail open fallback, nil for ordinary data

func RefuseOverwrite

func RefuseOverwrite(configPath, reason string, err error, fix string) error

Error for a write that must not replace an existing config file

func RefusedLockedOmissionPrefixes

func RefusedLockedOmissionPrefixes(ctx context.Context) []string

Dotted prefixes a document save in ctx must write whole

func RefusingLockedOmissions

func RefusingLockedOmissions(ctx context.Context, prefixes ...string) context.Context

Context in which a document save refuses a locked changed key under prefixes instead of omitting it

func RegisterConfigBackend

func RegisterConfigBackend(kind string, factory func() ConfigBackend)

Serves backend kind from factory, panicking on an invalid kind or a second registration

func RegisterConfigBootstrapEnv

func RegisterConfigBootstrapEnv(apply func(ctx context.Context, backendNames func(kind string) []string, home, projectEnv string) error)

Installs the env loader publication of the deployment env the bootstrap runs before the first selection

func RegisterConfigFacade

func RegisterConfigFacade(h FacadeHooks)

Installs the facade collaborators, called from an init of the package that owns them

func RegisterPolicyNote

func RegisterPolicyNote(note func(setter, homeKey string, raw any))

Installs the redaction policy recorder the log formatter reads, setter names the policy kind

func RegisterRedactionSwitch

func RegisterRedactionSwitch(enabled func(ctx context.Context) bool)

Installs the effective redaction switch for the active profile, called from the redaction owner init

func RegisterSettingsHooks

func RegisterSettingsHooks(h SettingsHooks)

Installs the settings registry lookups the CLI writer consults

func RegisterSkillConfigVars

func RegisterSkillConfigVars(fn func() ([]SkillConfigVar, error))

Installs the reader of the skill declared config variables

func ReloadEnv

func ReloadEnv(h string) (int, error)

Re-reads the home .env into the process env, removing known keys it dropped unless the file is unreadable

func RemoveEnvValue

func RemoveEnvValue(path, key string) (bool, error)

Removes every assignment of key from a dotenv file, reporting whether one existed

func RemoveHomeEnvValue

func RemoveHomeEnvValue(ctx context.Context, h, key string) (bool, error)

Removes key from the home .env and the published env, reporting whether a line defined it

func RenderNotification

func RenderNotification(ctx context.Context, render func() error, platform string, diagnostic bool) (bool, error)

Runs the renderer only when its classified content is visible and reports whether it ran

func RequireEnvWritable

func RequireEnvWritable(ctx context.Context, h, key, action string) error

Error carrying the refusal when the .env write lock forbids key

func RequireFileTooling

func RequireFileTooling(ctx context.Context, what string) error

Refuses a file copy tool when the selected backend has no config file

func RequireParseableUserConfig

func RequireParseableUserConfig(ctx context.Context, h string, ignoreUserConfig bool) error

Refuses an existing invalid config before a non interactive run, missing and empty files pass

func RequireReadableConfigBeforeWrite

func RequireReadableConfigBeforeWrite(ctx context.Context, configPath string) (map[string]any, error)

Mapping of an existing config file, refusing an unreadable or unparseable one before a write replaces it

func ResetActiveSkinsForTests

func ResetActiveSkinsForTests()

Drops the process and per home active skins so the next read loads the default skin again

func ResetBootstrapForTests

func ResetBootstrapForTests()

Marks the process as not yet bootstrapped so the next backend selection publishes the deployment again

func ResetCache

func ResetCache()

Forgets every cached config document and the last good expansions

func ResetConfigParseFailures

func ResetConfigParseFailures()

Clears the warned signatures and recorded parse failures

func ResetTimezoneCache

func ResetTimezoneCache()

Drops every cached zone so the next call resolves the env and config again

func ResetWorkerPolicyForTests

func ResetWorkerPolicyForTests()

Clears the process worker policy and runtime marks, the seam tests reach by replacing policy

func ResolveDisplayLanguage

func ResolveDisplayLanguage(value string, cat LanguageCatalog) (string, bool)

Canonical language id after plugin discovery, false when no layer supplies it

func ResolvePerModelProviderRouting

func ResolvePerModelProviderRouting(model string, models any) map[string]any

Per model provider routing entry matched with the override spelling tolerance, empty when none matches

func ResolvePerModelReasoningEffort

func ResolvePerModelReasoningEffort(model string, overrides any) map[string]any

Per model reasoning override with spelling tolerance, prefixed keys matched in reverse, nil when none parses

func ResolveTurnLimit

func ResolveTurnLimit(raw any, fallback int) int

Iteration cap from a raw max_turns value, the fallback for null, a bool, a NaN and unparseable values

func RunBudgetSeconds

func RunBudgetSeconds(value any) *float64

Positive seconds of a run budget from a number of any Go kind or numeric text, nil for no budget: absent, a bool, unreadable, zero or less

func RunningSourceTree

func RunningSourceTree() string

RunningSourceTree is the module tree holding this binary's own source, empty when no such tree exists here

func SafeDump

func SafeDump(data any) ([]byte, error)

YAML text of data as safe_dump writes it with sort_keys off, the setting every caller in the tree passes

func SafeDumpTo

func SafeDumpTo(w io.Writer, data any, opts SafeDumpOptions) error

Writes data to w as YAML under the given options, nothing written when the data cannot be represented

func SafeDumpWith

func SafeDumpWith(data any, opts SafeDumpOptions) ([]byte, error)

YAML text of data under the given safe_dump options

func SafeLoad

func SafeLoad(stream any) (any, error)

Value of one YAML document given as a Python str, bytes or a reader yielding bytes, as builds it

func SafeLoadText

func SafeLoadText(data []byte, sig bool) (any, error)

Value of a YAML file's bytes read the way open with utf-8 or utf-8-sig and read does, universal newlines included

func SafeStrftime

func SafeStrftime(value time.Time, format string) string

Time written in a strftime format

func SafeWorkerEnabled

func SafeWorkerEnabled() bool

Reports whether a safe mode worker policy is bound

func SanitizeEnvFile

func SanitizeEnvFile(ctx context.Context, h string) (int, error)

Rewrites the home .env with normalized line formatting and returns how many lines changed

func SanitizeEnvLines

func SanitizeEnvLines(lines []string) []string

Lines with endings normalized to one newline, assignments trimmed and comments or blanks kept verbatim

func SanitizeNoProxyEntries

func SanitizeNoProxyEntries(noProxyValue string) string

Bypass list with bracketed and CIDR IPv6 entries rewritten to bare literals, the input itself when nothing changed

func Save

func Save(h string, doc Tree) error

Writes the effective document of a home, dropping values equal to the defaults the user never set

func SaveAnthropicAPIKey

func SaveAnthropicAPIKey(ctx context.Context, h, value string, save func(name, value string) error) error

Persists an Anthropic API key and clears the OAuth token slot

func SaveAnthropicOAuthToken

func SaveAnthropicOAuthToken(ctx context.Context, h, value string, save func(name, value string) error) error

Persists an Anthropic OAuth or setup token and clears the API key slot

func SaveConfig

func SaveConfig(ctx context.Context, h string, cfg map[string]any, opts SaveOptions) error

Saves a config to the home config.yaml, defaults the user never set stripped and managed leaves dropped

func SaveEnvValue

func SaveEnvValue(h, key, value string) error

Saves or replaces one assignment in the home .env, refused writes printed and skipped

func SaveEnvValueContext

func SaveEnvValueContext(ctx context.Context, h, key, value string) error

Saves one .env assignment, matching export lines too, and publishes it to the scope or process env

func SaveUser

func SaveUser(ctx context.Context, h string, doc map[string]any) error

Writes the raw user document of a home exactly as given

func ScopedEnvironGet

func ScopedEnvironGet(ctx context.Context, key string) (string, bool, error)

Reads an env name through the registered secret scope, the plain process env when none is registered

func SecureDir

func SecureDir(ctx context.Context, h, path string)

Owner only directory unless managed, container defaults or ICEBATH_HOME_MODE say otherwise

func SecureFile

func SecureFile(ctx context.Context, h, path string)

Owner only config file unless managed or in a container

func SeedConfigFile

func SeedConfigFile(ctx context.Context, h, configPath, template string) (bool, error)

Creates a missing config by copying the example template, else writing the stripped defaults

func SetConfigValue

func SetConfigValue(ctx context.Context, h, key, value string, src ConfigCommandSources) error

Sets a setting through the settings writer, env shaped keys going to .env; any other key is refused

func SetEnvValue

func SetEnvValue(path, key, value string) error

Writes or replaces one assignment in a dotenv file, keeping every other line

func SetMappingClass

func SetMappingClass(m map[string]any, class string)

Records the Python dict subclass a mapping loaded as, such as ordereddict for a YAML omap

func SetMappingKeys

func SetMappingKeys(m map[string]any, keys []string)

Records the key order of a mapping so later readers iterate it the way the file or builder did

func SetMappingPyKey

func SetMappingPyKey(m map[string]any, key string, keyValue any)

Records that a string key of a mapping stands for a non str Python key such as True, 1 or None

func ShlexQuote

func ShlexQuote(s string) string

Word quoted for a POSIX shell: as it is when every character is safe unquoted, otherwise in single quotes with each inner single quote closed, escaped and reopened

func ShowConfig

func ShowConfig(ctx context.Context, out io.Writer, src ShowSources) error

Prints the configuration of the home in ctx: paths, masked keys, then every settings group

func ShowValue

func ShowValue(v any) string

Text of a config value as a person reads it: text as it is, null, true or false, numbers and times as YAML writes them, containers as compact JSON

func SkinCommand

func SkinCommand(ctx context.Context, args SkinArgs, src ConfigCommandSources, stdout, stderr io.Writer) (int, error)

Runs icebath skin list, use or set and returns the process exit status

func SnapshotCurrent

func SnapshotCurrent(snap map[string]*string, lookup Lookup) bool

Reports whether every referenced name still resolves to the snapshot value

func SortedEnvNames

func SortedEnvNames(table map[string]EnvVar) []string

Names of an env catalog in sorted order

func SortedKeys

func SortedKeys(m map[string]any) []string

Sorted keys of a map

func SplitPath

func SplitPath(key string) []string

Segments of a dotted path, a backslash before a dot keeping the dot literal

func StaticCoreEnvNames

func StaticCoreEnvNames() map[string]bool

Copy of the names core declared before platform manifests were read

func StripDefaults

func StripDefaults(doc, defaults map[string]any, preserve map[string]bool) map[string]any

Document without values equal to the defaults, preserved paths kept even when equal

func SupportsFileTooling

func SupportsFileTooling(ctx context.Context) (bool, error)

Reports whether tools that copy, edit or back up the config file itself may run

func SwapConfigVersion

func SwapConfigVersion(f func(ctx context.Context, configPath string) ([]any, error)) (restore func())

Replaces the config version answer until the returned restore runs

func SwapFileReadUserDoc

func SwapFileReadUserDoc(f func(b FileBackend, ctx context.Context, home string) (any, error)) (restore func())

Replaces the file layer user document read until the returned restore runs

func SwapParseEnvText

func SwapParseEnvText(fn func(string) map[string]string) func(string) map[string]string

SwapParseEnvText installs the dotenv parser the memo calls and returns the one it replaced

func SwapSafeDump

func SwapSafeDump(f func(any) ([]byte, error)) func()

Replaces the dumper behind AtomicYAMLWrite and returns the restore func, for tests simulating a failed dump

func TerminalConfigEnvVarForKey

func TerminalConfigEnvVarForKey(key string) (string, bool)

Env var mirrored by a dotted terminal config key, false outside the terminal section

func TerminalEnvValueText

func TerminalEnvValueText(v any) string

Env text of a terminal config value, JSON for a list or mapping and the Python str otherwise

func TimeNow

func TimeNow(ctx context.Context) time.Time

Current time in the configured zone, else in server local time so later and earlier instants keep their own offsets

func TimeZone

func TimeZone(ctx context.Context) (*time.Location, bool)

Configured zone of the active profile and true, nil and false for server local time

func TimezoneName

func TimezoneName(ctx context.Context) string

Configured IANA name of the active profile even when invalid, empty for server local time

func Truthy

func Truthy(v any) bool

Reports whether a value spells a truthy setting

func TryLockConfig

func TryLockConfig(ctx context.Context) (context.Context, func(), bool)

Takes the process config lock without blocking, true when ctx already holds it or the lock was free

func UnsetConfigValue

func UnsetConfigValue(ctx context.Context, h, key string, src ConfigCommandSources) error

Removes a setting's value through the settings writer or an env shaped key from .env, refusing managed, locked and unknown keys

func UseAnthropicClaudeCodeCredentials

func UseAnthropicClaudeCodeCredentials(ctx context.Context, h string, save func(name, value string) error) error

Clears both Anthropic slots so the Claude Code credential files are used

func ValidateEnvName

func ValidateEnvName(key string) error

Fails when key is not a portable environment variable name

func ValidateEnvNameForWrite

func ValidateEnvNameForWrite(key string) error

Rejects an invalid name or one on the writer denylist before a generic persistence write

func ValidateQuotedContainers

func ValidateQuotedContainers(cfg map[string]any, issues *[]ConfigIssue)

Warning for each container slot holding one quoted string that parses as a list or mapping

func ValidateTimezone

func ValidateTimezone(cfg map[string]any, issues *[]ConfigIssue)

Error when timezone is not a string or names a zone the tz database cannot load

func ValidateVoice

func ValidateVoice(cfg map[string]any, issues *[]ConfigIssue)

Error when voice submit_mode is present and neither direct nor draft

func ValidateWebBackends

func ValidateWebBackends(cfg map[string]any, issues *[]ConfigIssue, removedNote func(section, name string) string)

Warning for each web backend selection naming a backend removed from the tree

func VersionToken

func VersionToken(version []any) float64

Number that changes with a backend version, zero for no config

func WarnConfigParseFailure

func WarnConfigParseFailure(ctx context.Context, configPath string, err error, fallback string) error

Records a config parse failure and warns once per signature, errors when the corrupt backup has no backend

func WarnDeprecatedCwdEnvVars

func WarnDeprecatedCwdEnvVars(w io.Writer, h string)

Warns about MESSAGING_CWD and TERMINAL_CWD left in the home .env instead of terminal.cwd

func WarnIfCredentialFileBroadlyReadable

func WarnIfCredentialFileBroadlyReadable(path, label string, log *slog.Logger) bool

Warns with a chmod 600 hint when a POSIX credential file is group or world readable, true when it warned

func WarningNotificationsEnabled

func WarningNotificationsEnabled(ctx context.Context, platform string) bool

Whether diagnostics show on the platform of the profile in ctx

func WorkerConfigSnapshot

func WorkerConfigSnapshot() map[string]any

Detached copy of the frozen worker config, nil when the ordinary loader owns config

func WriteChanges

func WriteChanges(ctx context.Context, configPath string, changes Changes) error

One changes write where a nil set value stores an explicit null for a backend with levels

func WriteConfigDocument

func WriteConfigDocument(ctx context.Context, configPath string, document map[string]any, extraContentOnCreate string) error

Replaces a config document, merged comment preserving onto the file by the file backend

func WriteConfigKey

func WriteConfigKey(ctx context.Context, configPath, keyPath string, value any) error

Sets one dotted key, nil removing it

func WriteConfigKeys

func WriteConfigKeys(ctx context.Context, configPath string, updates []KeyValue) error

Sets several related dotted keys as one write, a nil value removing its key

func WriteEnvLines

func WriteEnvLines(ctx context.Context, path string, lines []string, preserveMode bool) error

Replaces a dotenv file with lines verbatim, keeping its mode when asked or securing it under the process home

func WritePlatformConfigField

func WritePlatformConfigField(ctx context.Context, h, platformKey, fieldKey string, value any, raw bool) error

Persists one field under platforms.<platform>, raw edits only the user file

func WriteUserConfig

func WriteUserConfig(ctx context.Context, h, configPath string, userConfig map[string]any) error

Writes the raw user config of home h, reporting the change to the saved observer when one is installed

func YAMLErrorDetails

func YAMLErrorDetails(err error) string

Single line details text, the YAML problem or the exception text with whitespace runs collapsed

func YAMLErrorLocation

func YAMLErrorLocation(err error) string

Line of the problem mark, else the context mark, of a YAML error such as line 12, empty without one

Types

type BotProfile

type BotProfile struct {
	Name string
	Dir  string
}

Profile directory the bot mode roster names

type Changes

type Changes struct {
	Document             map[string]any
	Set                  []KeyValue
	Unset                []string
	ExtraContentOnCreate string
}

Write to one profile user layer, the document applied first

type CheckDiagnosticsSources

type CheckDiagnosticsSources struct {
	PlatformToolsetDiagnostics func(platformToolsets any, cfg map[string]any) []string
	DisabledPlugins            func() map[string]bool
	BundledPlatformManifests   func() ([]PlatformManifest, error)
}

Readers the check diagnostics consult, supplied by the toolset validation and plugin discovery owners

type ConfigArgs

type ConfigArgs struct {
	Command string
	Key     string
	Value   *string
	JSON    bool
	Raw     bool
}

Parsed config command line, an empty command meaning show

type ConfigBackend

type ConfigBackend interface {
	Name() string
	ReadUserDoc(ctx context.Context, home string) (any, error)
	ReadUserDocReadonly(ctx context.Context, home string) (any, error)
	Version(ctx context.Context, home string) ([]any, error)
	CacheVersion(ctx context.Context, home string, version []any) ([]any, error)
	Exists(ctx context.Context, home string) (bool, error)
	ProbeReadable(ctx context.Context, home string) error
	WriteChanges(ctx context.Context, home string, changes Changes) error
	Locked(ctx context.Context, home, dotted string) (string, bool, error)
	SupportsFileTooling() bool
	HonorsManagedConfig() bool
	Boot(ctx context.Context, home string) error
	ProtectedEnvNames() []string
	DeploymentEnvNames() []string
	BootstrapEnvNames() []string
	PreserveReadBase(ctx context.Context) (restore func())
	DoctorWarnings(ctx context.Context, home string) []DoctorWarning
	ApplyInMemory(ctx context.Context, home string, doc map[string]any) error
	Describe(ctx context.Context, home string) string
	Destination(ctx context.Context, home string) (string, error)
}

Store of the user config layer every config read and write goes through

func GetConfigBackend

func GetConfigBackend(ctx context.Context) (ConfigBackend, error)

Backend the environment selects, file by default, unavailable for a kind this build lacks

func LocalFileLayer

func LocalFileLayer(configPath string) (ConfigBackend, string)

Local file backend of a path whichever backend is selected, for the PM dependency runtime

type ConfigBackendUnavailable

type ConfigBackendUnavailable struct{ Message string }

Selected backend cannot serve config, an exit and never a fall back to defaults

func (*ConfigBackendUnavailable) Error

func (e *ConfigBackendUnavailable) Error() string

func (*ConfigBackendUnavailable) SystemExitCode

func (e *ConfigBackendUnavailable) SystemExitCode() string

type ConfigCommandSources

type ConfigCommandSources struct {
	// Registers the settings blocks plugins declare, so their keys are known before a lookup
	LoadPluginSettings  func()
	IsEnvSettingKey     func(key string) bool
	SaveEnvSetting      func(ctx context.Context, h, key, value string) error
	ReadEnvSetting      func(h, key string) (string, bool)
	RemoveEnvSetting    func(ctx context.Context, h, key string) (bool, error)
	DropStaleModelRoute func(modelCfg map[string]any, provider string, cfg map[string]any) (map[string]any, bool)
	Language            LanguageCatalog
	Show                func(ctx context.Context, h string) (ShowSources, error)
	CheckDiagnostics    CheckDiagnosticsSources
}

Readers and writers config set, get, unset, show and check reach outside this package

type ConfigExit

type ConfigExit struct{ Code int }

Process exit status a config command ends with, its message already printed

func (*ConfigExit) Error

func (e *ConfigExit) Error() string

type ConfigIssue

type ConfigIssue struct {
	Severity string
	Message  string
	Hint     string
}

One detected config structure problem with severity error or warning

func ConfigLoadIssue

func ConfigLoadIssue(err error) ConfigIssue

Config issue for a load failure, storage problems kept apart from a broken config file

func ValidateConfigStructure

func ValidateConfigStructure(cfg map[string]any, removedNote func(section, name string) string) []ConfigIssue

Structure problems of a loaded config, removedNote explains a removed tool backend or returns empty

func ValidateLoadedConfigStructure

func ValidateLoadedConfigStructure(ctx context.Context, h string, lookup Lookup, removedNote func(section, name string) string) []ConfigIssue

Structure issues of the loaded config, a single load issue when the config cannot be loaded

type ConfigLockedError

type ConfigLockedError struct {
	*ConfigWriteError
	Path     string
	LockedBy string
}

Write touching a path an upper level locks

func NewConfigLockedError

func NewConfigLockedError(path, lockedBy, message string) *ConfigLockedError

Builds a lock refusal with the default message naming the locking level

func (*ConfigLockedError) Unwrap

func (e *ConfigLockedError) Unwrap() error

type ConfigValueError

type ConfigValueError struct{ *ConfigWriteError }

Value the backend cannot store with nothing sent

func NewConfigValueError

func NewConfigValueError(message, code string) *ConfigValueError

Builds a value refusal, the code defaulting to config_value_invalid

func (*ConfigValueError) Unwrap

func (e *ConfigValueError) Unwrap() error

type ConfigWriteError

type ConfigWriteError struct {
	Message string
	Code    string
}

Config write the backend refused or could not complete with nothing changed

func NewConfigWriteError

func NewConfigWriteError(message, code string) *ConfigWriteError

Builds a write refusal, the code defaulting to config_write_failed

func (*ConfigWriteError) Error

func (e *ConfigWriteError) Error() string

type ContainerExecInfo

type ContainerExecInfo struct {
	Backend       string
	ContainerName string
	ExecUser      string
	IcebathBin    string
}

Container mode metadata the NixOS activation wrote, nil when off, inside the container or in dev mode

func GetContainerExecInfo

func GetContainerExecInfo(h string) (*ContainerExecInfo, error)

Reads the home container mode file, only a missing file reads as container mode off

type DiagnosticText

type DiagnosticText string

Producer owned diagnostic classification carried on the two argument status callback, a plain string otherwise

type DoctorWarning

type DoctorWarning struct {
	Message string
	Hint    string
	Issue   string
}

Message, hint and issue line of one doctor warning a backend raises

type EnvValueError

type EnvValueError struct{ Msg string }

Refusal of a .env write for an invalid, denylisted or locked key

func (*EnvValueError) Error

func (e *EnvValueError) Error() string

func (*EnvValueError) ErrorKind

func (e *EnvValueError) ErrorKind() string

Kind of the refusal, the ValueError family invalid values belong to

type EnvVar

type EnvVar struct {
	Description string
	Prompt      string
	URL         string
	Help        string
	// Masked when typed and shown
	Password bool
	// provider, tool, skill, messaging or setting
	Category string
	// Model tools the variable unlocks
	Tools []string
	// Hidden from the setup checklist
	Advanced bool
	// Entry declares no password key, readers fall back to their own default
	PasswordOmitted bool
}

Setting shown in the setup checklist and the keys page, with the file it routes to

type FacadeHooks

type FacadeHooks struct {
	ApplyUserMoAPresets         func(merged map[string]any, raw any)
	DotenvUnreadable            func(path string) bool
	ExtraEnvKeys                func() []string
	MaskedSecretPrompt          func(prompt string) (string, error)
	ScopedSecret                func(ctx context.Context, key string) (string, bool, error)
	SecretScopeBound            func(ctx context.Context) bool
	PublishScopedEnv            func(ctx context.Context, key string, value *string) bool
	SaveProviderEnvCredential   func(ctx context.Context, h, key, value string) error
	RemoveProviderEnvCredential func(ctx context.Context, h, key string) (bool, error)
	CoreDeclaredEnvNames        func() map[string]bool
}

Collaborators the config facade runs from packages that import config

type FailedConfigRead

type FailedConfigRead struct {
	Data      map[string]any
	ReadError error
}

Fail open fallback a reader serves for an unreadable config that writers refuse to persist

type FileBackend

type FileBackend struct {
	// contains filtered or unexported fields
}

User layer as a local YAML file, a home config.yaml or one explicit path

func (FileBackend) ApplyInMemory

func (FileBackend) ApplyInMemory(context.Context, string, map[string]any) error

The file backend persists migrations to the file and refuses an in memory apply

func (FileBackend) Boot

func (FileBackend) BootstrapEnvNames

func (FileBackend) BootstrapEnvNames() []string

func (FileBackend) CacheVersion

func (b FileBackend) CacheVersion(ctx context.Context, home string, version []any) ([]any, error)

Version plus the racy content digest of the file taken from its own signature

func (FileBackend) ConfigPath

func (b FileBackend) ConfigPath(home string) string

File a home user layer lives in, or the explicit file

func (FileBackend) DeploymentEnvNames

func (FileBackend) DeploymentEnvNames() []string

func (FileBackend) Describe

func (b FileBackend) Describe(_ context.Context, home string) string

func (FileBackend) Destination

func (b FileBackend) Destination(_ context.Context, home string) (string, error)

func (FileBackend) DoctorWarnings

func (FileBackend) DoctorWarnings(context.Context, string) []DoctorWarning

func (FileBackend) Exists

func (b FileBackend) Exists(_ context.Context, home string) (bool, error)

func (FileBackend) HonorsManagedConfig

func (FileBackend) HonorsManagedConfig() bool

func (FileBackend) Locked

A local file has no levels so nothing is ever locked

func (FileBackend) Name

func (b FileBackend) Name() string

func (FileBackend) PreserveReadBase

func (FileBackend) PreserveReadBase(context.Context) func()

func (FileBackend) ProbeReadable

func (b FileBackend) ProbeReadable(_ context.Context, home string) error

Reads one byte so an unreadable file reports its error without a parse

func (FileBackend) ProtectedEnvNames

func (FileBackend) ProtectedEnvNames() []string

func (FileBackend) ReadPath

func (FileBackend) ReadPath(path string) (any, error)

Parsed root of a file, nil when empty, the open error when it cannot be read

func (FileBackend) ReadPathReadonly

func (FileBackend) ReadPathReadonly(path string) (any, error)

Shared cached parse of a file, never to be mutated

func (FileBackend) ReadUserDoc

func (b FileBackend) ReadUserDoc(ctx context.Context, home string) (any, error)

func (FileBackend) ReadUserDocReadonly

func (b FileBackend) ReadUserDocReadonly(_ context.Context, home string) (any, error)

func (FileBackend) SupportsFileTooling

func (FileBackend) SupportsFileTooling() bool

func (FileBackend) Version

func (b FileBackend) Version(_ context.Context, home string) ([]any, error)

func (FileBackend) VersionPath

func (FileBackend) VersionPath(path string) ([]any, error)

Stat signature of a file as the file backend versions it

func (FileBackend) WriteChanges

func (b FileBackend) WriteChanges(ctx context.Context, home string, changes Changes) error

func (FileBackend) WritePath

func (FileBackend) WritePath(ctx context.Context, path string, changes Changes) error

Applies the document, then each set key, then each unset key with comment preserving writers

type HomeInitializationError

type HomeInitializationError struct {
	Message string
	Err     error
}

Home skeleton that cannot be used, distinct from an invalid YAML document

func (*HomeInitializationError) Error

func (e *HomeInitializationError) Error() string

func (*HomeInitializationError) Unwrap

func (e *HomeInitializationError) Unwrap() error

type InvalidUserConfigError

type InvalidUserConfigError struct {
	Path    string
	Err     error
	Message string
}

Error of a config.yaml that does not parse

func (*InvalidUserConfigError) Error

func (e *InvalidUserConfigError) Error() string

func (*InvalidUserConfigError) Unwrap

func (e *InvalidUserConfigError) Unwrap() error

type KeyValue

type KeyValue struct {
	Key   string
	Value any
}

Dotted key and value of one set in a write, nil unsetting it in WriteConfigKeys

type LanguageCatalog

type LanguageCatalog interface {
	DiscoverPlugins() error
	ResetLanguageCache()
	ResolveLanguageID(value string) (string, bool)
	SupportedLanguages() []string
}

Language layers the display language check consults, implemented by the i18n and plugin owners

type Lookup

type Lookup func(name string) (string, bool)

Resolves an environment variable name to its value, false when unset

func EnvRefLookupContext

func EnvRefLookupContext(ctx context.Context) Lookup

Lookup a config reference expands through, the bound profile secret scope when one is installed and the process env otherwise

func ProfileEnvLookup

func ProfileEnvLookup(ctx context.Context, h string) Lookup

Lookup of an env name for the profile a home belongs to: the bound profile secret scope when ctx carries one, else the home's .env and then the env an unscoped read may see

type MissingEnvVar

type MissingEnvVar struct {
	Name string
	EnvVar
	IsRequired bool
}

One env variable the install lacks, its catalog entry and whether it is required

func GetMissingEnvVars

func GetMissingEnvVars(ctx context.Context, h string, requiredOnly bool) ([]MissingEnvVar, error)

Env variables with no value in the scoped process env or the home .env, required ones first

type NamedEnvVar

type NamedEnvVar struct {
	Name  string
	Entry EnvVar
}

One optional env entry under its variable name, the unit an ordered table or fill is made of

type NamedPlatformManifest

type NamedPlatformManifest struct {
	DirName  string
	Manifest map[string]any
}

Platform plugin manifest with the directory it was found in

type NonASCIICredentialError

type NonASCIICredentialError struct {
	Key string
}

Error of a credential whose bytes are not plain ASCII

func (*NonASCIICredentialError) Error

func (e *NonASCIICredentialError) Error() string

type OptionalEnvState

type OptionalEnvState struct {
	// contains filtered or unexported fields
}

Saved table contents and armed fill a test puts back afterwards

type OptionalEnvTable

type OptionalEnvTable struct {
	// contains filtered or unexported fields
}

Insertion ordered optional env table that runs one armed fill before it is first read

func NewOptionalEnvTable

func NewOptionalEnvTable(decl []NamedEnvVar) *OptionalEnvTable

Table holding the declared entries in declaration order with no fill armed

func (*OptionalEnvTable) Arm

func (t *OptionalEnvTable) Arm(fill func() []NamedEnvVar, published func([]NamedEnvVar))

Arms the fill the next read runs and the callback its published entries are handed to, nil disarms

func (*OptionalEnvTable) Copy

func (t *OptionalEnvTable) Copy() map[string]EnvVar

Plain map copy of the entries after the armed fill ran

func (*OptionalEnvTable) Delete

func (t *OptionalEnvTable) Delete(name string)

Removes a name without running the fill

func (*OptionalEnvTable) Entry

func (t *OptionalEnvTable) Entry(name string) EnvVar

Entry of a name after the armed fill ran, the zero entry when the table has none

func (*OptionalEnvTable) Get

func (t *OptionalEnvTable) Get(name string) (EnvVar, bool)

Entry of a name after the armed fill ran, false when the table has none

func (*OptionalEnvTable) Has

func (t *OptionalEnvTable) Has(name string) bool

Reports whether the table holds a name after the armed fill ran

func (*OptionalEnvTable) Items

func (t *OptionalEnvTable) Items() []NamedEnvVar

Entries in insertion order after the armed fill ran

func (*OptionalEnvTable) Names

func (t *OptionalEnvTable) Names() []string

Names in insertion order after the armed fill ran

func (*OptionalEnvTable) RawGet

func (t *OptionalEnvTable) RawGet(name string) (EnvVar, bool)

Entry of a name as the table stands with no fill run, the read a fill itself makes

func (*OptionalEnvTable) RawNames

func (t *OptionalEnvTable) RawNames() []string

Names in insertion order as the table stands with no fill run

func (*OptionalEnvTable) Set

func (t *OptionalEnvTable) Set(name string, entry EnvVar)

Stores an entry without running the fill, a new name going last and a known one keeping its place

type PathError

type PathError struct {
	Kind string
	Msg  string
}

Python exception class and message of a dotted path write that cannot be navigated

func (*PathError) Error

func (e *PathError) Error() string

type PhantomKeyError

type PhantomKeyError struct {
	Part, Path, Shadowed, Escaped string
}

Refusal to create a nested key beside a literal dotted sibling it would shadow

func (*PhantomKeyError) Error

func (e *PhantomKeyError) Error() string

type PlatformManifest

type PlatformManifest struct {
	Name         string
	ManifestName string
	RequiredEnv  []string
}

Bundled platform plugin manifest as the diagnostics read it

func BundledPlatformManifests

func BundledPlatformManifests(h string) ([]PlatformManifest, error)

Bundled platform plugins with their manifest name and required env, the shape config check reads

type RoundtripDoc

type RoundtripDoc struct {
	Node   *yaml.Node
	Source []byte
}

One loaded round trip document with the source it came from

func (*RoundtripDoc) Root

func (d *RoundtripDoc) Root() (*yaml.Node, error)

Root mapping of the document, created empty for an empty document

type RoundtripYAML

type RoundtripYAML struct{}

Comment, quote and order keeping editor for user authored YAML, lines never folded

func NewRoundtripYAML

func NewRoundtripYAML() *RoundtripYAML

Fresh round trip editor, every operation owns its own parser and emitter state

func (*RoundtripYAML) Dump

func (r *RoundtripYAML) Dump(doc *RoundtripDoc, w io.Writer) error

Writes the document with two space mappings, indented block sequences and untouched source lines kept

func (*RoundtripYAML) Load

func (r *RoundtripYAML) Load(stream any) (*RoundtripDoc, error)

Parses a document for editing through the round trip loader, nil node for an empty stream

type RuntimeError

type RuntimeError struct{ Msg string }

Python RuntimeError a config writer raises, the class the config command turns into a clean refusal

func (*RuntimeError) Error

func (e *RuntimeError) Error() string

type SafeDumpIndent

type SafeDumpIndent struct {
	Mapping, Sequence, Offset int
}

Block indentation of mappings and sequences and the dash offset inside a sequence indent

type SafeDumpOptions

type SafeDumpOptions struct {
	DefaultFlowStyle bool
	SortKeys         bool
	AllowUnicode     bool
	Width            int
	Indent           *SafeDumpIndent
	Version          string
}

Formatting choices of safe_dump, DefaultSafeDumpOptions holds the values a caller gets by passing none

func DefaultSafeDumpOptions

func DefaultSafeDumpOptions() SafeDumpOptions

Options safe_dump writes with when the caller passes none

type SafeWorkerPolicy

type SafeWorkerPolicy struct {
	// contains filtered or unexported fields
}

Frozen bootstrap policy of an admission owned worker

func BindSafeWorkerPolicy

func BindSafeWorkerPolicy(safeMode, ignoreUserConfig bool, cfg map[string]any) (*SafeWorkerPolicy, error)

Binds a troubleshooting worker bypass that always ignores user config, refusing ordinary execution

func BindWorkerConfig

func BindWorkerConfig(cfg map[string]any) (*SafeWorkerPolicy, error)

Binds an ordinary managed worker frozen session config with plugins and providers loading as usual

func CurrentSafeWorkerPolicy

func CurrentSafeWorkerPolicy() *SafeWorkerPolicy

Bound worker policy, nil when the ordinary loader owns config

type SaveOptions

type SaveOptions struct {
	KeepDefaults  bool
	PreserveKeys  [][]string
	MergeExisting bool
}

How a save treats defaults and the file already on disk

type Secrets

type Secrets struct {
	// contains filtered or unexported fields
}

Secrets of one home, the .env file layered over the process environment

func NewSecrets

func NewSecrets(home string) *Secrets

Secret resolver for a home directory

func (*Secrets) File

func (s *Secrets) File() map[string]string

Current .env assignments, reparsed whenever the file bytes change

func (*Secrets) First

func (s *Secrets) First(names ...string) (string, string, bool)

First of several variable names that resolves, with the name that answered

func (*Secrets) Get

func (s *Secrets) Get(name string) (string, bool)

Value of name from the .env file, then the process environment

func (*Secrets) Lookup

func (s *Secrets) Lookup() Lookup

Lookup function over the resolver

func (*Secrets) Path

func (s *Secrets) Path() string

Path of the .env file behind the resolver

func (*Secrets) Remove

func (s *Secrets) Remove(name string) (bool, error)

Removes a secret from the .env file

func (*Secrets) Set

func (s *Secrets) Set(name, value string) error

Writes a secret to the .env file

func (*Secrets) String

func (s *Secrets) String(name string) string

Value of name or an empty string

type SecureSaveResult

type SecureSaveResult struct {
	Success   bool
	StoredAs  string
	Validated bool
}

Outcome of a secure env save through the credential lifecycle

func SaveEnvValueSecure

func SaveEnvValueSecure(ctx context.Context, h, key, value string) (SecureSaveResult, error)

Saves a credential through the provider credential lifecycle, refreshing config mirrors of the old value

type SettingsHooks

type SettingsHooks struct {
	// Whether the registry holds a key
	Known func(key string) bool
	// Writes the text typed for a registered key through the settings writer, the stored value back; known false for any other key
	Set func(ctx context.Context, key, text string) (stored any, known bool, err error)
	// Removes the value a registered key holds in config.yaml, whether one was there; known false for any other key
	Reset func(ctx context.Context, key string) (wasSet, known bool, err error)
	// Value in effect for a registered key, known false for any other key
	Get func(ctx context.Context, key string) (value any, known bool)
	// Settings groups config show prints for the home in ctx
	Show func(ctx context.Context) []ShowGroup
	// Every registered key, for the closest-match suggestion
	Keys func() []string
}

Settings registry calls the CLI makes, installed by the settings package

type ShowGroup

type ShowGroup struct {
	Title string
	Rows  []ShowRow
}

One settings group as config show prints it

type ShowRow

type ShowRow struct {
	Label, Value, Source string
}

One setting as config show prints it: its label, its value as text and where the value came from

type ShowSources

type ShowSources struct {
	ConfigPath    string
	EnvPath       string
	ProjectRoot   string
	EnvValue      func(name string) string
	AnthropicKey  func() string
	SkillSettings func() ([]SkillConfigVar, map[string]any, error)
	MaskSecret    func(value, empty string) string
}

Readers config show consults, supplied by the facade, auth, skills and redaction owners

type SkillConfigVar

type SkillConfigVar struct {
	Key         string
	Skill       string
	Description string
	Prompt      string
	Default     any
}

One skill declared config variable as config show lists it

func GetMissingSkillConfigVars

func GetMissingSkillConfigVars(ctx context.Context, h string) ([]SkillConfigVar, error)

Skill declared settings under skills.config that are missing or blank in the loaded config

type SkinArgs

type SkinArgs struct {
	Command string
	Name    string
	Key     string
	Value   string
	Skin    string
}

Parsed skin command line, an empty command meaning list

type SkinConfig

type SkinConfig struct {
	Name string
	// Where the definition came from, builtin or user
	Source      string
	Description any
	Colors      map[string]any
	LightColors map[string]any
	DarkColors  map[string]any
	Spinner     map[string]any
	Branding    map[string]any
	ToolPrefix  any
	ToolEmojis  map[string]any
	BannerHero  any
	CustomCSS   string
}

Complete skin configuration, every mapping keeping its file or definition key order

func GetActiveSkin

func GetActiveSkin(ctx context.Context) *SkinConfig

Active skin of the routed home or the process, initialized from the profile config on first use

func LoadSkin

func LoadSkin(ctx context.Context, name string) *SkinConfig

Skin by name, a user file first, then the built in, then the default

func SetActiveSkin

func SetActiveSkin(ctx context.Context, name string) *SkinConfig

Switches the active skin of the routed home or the process and returns it

func (*SkinConfig) GetBranding

func (s *SkinConfig) GetBranding(key, fallback string) string

Branding string under key, fallback when the skin lacks it or sets it to null

func (*SkinConfig) GetColor

func (s *SkinConfig) GetColor(key, fallback string) string

Color under key as text, fallback when the skin lacks it or sets it to null, both through the installed filter

func (*SkinConfig) GetSpinnerWings

func (s *SkinConfig) GetSpinnerWings() [][2]string

Spinner wing pairs of two, a null side left empty and any other entry skipped

type SkinListing

type SkinListing struct {
	Name        any
	Description any
	Source      string
}

One listed skin with its name, description and source

func ListSkins

func ListSkins(ctx context.Context) []SkinListing

Built in skins then user skins whose names no earlier entry took

type SystemExitError

type SystemExitError interface {
	error
	SystemExitCode() string
}

Error a config backend raises when it cannot serve the config, carrying its exit message

type TerminalEnvOptions

type TerminalEnvOptions struct {
	Env      map[string]string
	Config   map[string]any
	Override *bool
}

Where the terminal bridge reads and writes env values, the process environment when Env is nil

type Tree

type Tree map[string]any

Configuration document as nested maps the way YAML decodes it

func Defaults

func Defaults() Tree

Schema defaults with every mapping iterating in the upstream declaration order

func Load

func Load(h string, lookup Lookup) (Tree, error)

Effective config of a home through the process context

func LoadContext

func LoadContext(ctx context.Context, h string, lookup Lookup) (Tree, error)

Effective config of a home, defaults merged under the user file, references expanded and the managed overlay on top

func LoadReadonly

func LoadReadonly(ctx context.Context, h string, lookup Lookup) (Tree, error)

Effective config of a home without the defensive copy, the cached value must never be mutated

func (Tree) Bool

func (t Tree) Bool(path string, fallback bool) bool

Boolean at a path, the fallback when absent or not boolean like

func (Tree) Clone

func (t Tree) Clone() Tree

Copy of the tree

func (Tree) Float

func (t Tree) Float(path string, fallback float64) float64

Float at a path, the fallback when absent or not numeric

func (Tree) Get

func (t Tree) Get(path string) any

Value at a dotted path, nil when absent

func (Tree) Has

func (t Tree) Has(path string) bool

Reports whether a path exists even when its value is null

func (Tree) Int

func (t Tree) Int(path string, fallback int) int

Integer at a path, the fallback when absent or not numeric

func (Tree) Lookup

func (t Tree) Lookup(path string) (any, bool)

Value at a dotted path and whether it exists

func (Tree) Map

func (t Tree) Map(path string) map[string]any

Map at a path, nil when absent or not a map

func (Tree) Set

func (t Tree) Set(path string, value any) error

Sets the value at a dotted path, creating intermediate maps and refusing to shadow a dotted sibling

func (Tree) String

func (t Tree) String(path, fallback string) string

Text at a path: a string as it is, a boolean or number in plain decimal, the fallback when absent, null or another kind

func (Tree) Strings

func (t Tree) Strings(path string) []string

String list at a path, nil when absent

func (Tree) Sub

func (t Tree) Sub(path string) Tree

Subtree at a path, an empty tree when absent

func (Tree) Unset

func (t Tree) Unset(path string) bool

Removes the value at a dotted path and every map it leaves empty, reporting whether it existed

type UserLayer

type UserLayer struct {
	Doc        any
	Version    []any
	Locks      map[string]string
	Provenance string
}

One read of a profile user layer

type WakeEvent

type WakeEvent interface {
	WakeInternal() bool
	WakeMetadata() map[string]any
	WakeReplyMuted() (muted bool, set bool)
	WakeSourcePlatform() string
}

Message event surface the diagnostic wake policy reads, the gateway MessageEvent satisfying it

type WorkerPolicyError

type WorkerPolicyError struct{ Kind, Msg string }

TypeError, ValueError or RuntimeError a worker policy bind raises

func (*WorkerPolicyError) Error

func (e *WorkerPolicyError) Error() string

func (*WorkerPolicyError) ErrorKind

func (e *WorkerPolicyError) ErrorKind() string

Kind of refusal, TypeError, ValueError or RuntimeError

type YAMLError

type YAMLError struct{ Err error }

Failure of the shared YAML reader or writer, a ruamel YAMLError or the Python exception a load raised

func (*YAMLError) Error

func (e *YAMLError) Error() string

func (*YAMLError) ErrorKind

func (e *YAMLError) ErrorKind() string

Kind of the underlying failure: the class a ruamel error or a load exception carries, YAMLError for a writer failure without one

func (*YAMLError) Unwrap

func (e *YAMLError) Unwrap() error

type YAMLSet

type YAMLSet struct{ Items []any }

Set a YAML !!set loads to, members in insertion order

func (YAMLSet) String

func (s YAMLSet) String() string

Members in insertion order between braces, strings quoted

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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