Help us shape the future of Go! Take the 2026 Go Developer Survey

settings

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package settings resolves the desktop app's typed settings and on-disk locations. Desktop-owned overrides use the HIVE_DESKTOP_ prefix; XDG and shared Hive inputs remain external boundaries.

Index

Constants

View Source
const (
	EnvDataDir     = "HIVE_DESKTOP_DATA_DIR"
	EnvHiveDataDir = config.EnvDesktopDataDir
	EnvConfigDir   = "HIVE_DESKTOP_CONFIG_DIR"
	EnvFlowsDir    = "HIVE_DESKTOP_FLOWS_DIR"
	EnvActionsPath = "HIVE_DESKTOP_ACTIONS_PATH"
	EnvMockMode    = "HIVE_DESKTOP_DEVELOPMENT_MOCKS_MODE"
	EnvE2EHarness  = "HIVE_DESKTOP_E2E_HARNESS"

	EnvHTTPEnabled = "HIVE_DESKTOP_HTTP_ENABLED"
	EnvHTTPPort    = "HIVE_DESKTOP_HTTP_PORT"

	// EnvAgentWorkspacesDir is the environment name behind
	// agent_workspaces.dir. Named here, duplicating the settings.go struct
	// tag, because a struct tag cannot reference a const and startup reports
	// provenance by name.
	EnvAgentWorkspacesDir = "HIVE_DESKTOP_AGENT_WORKSPACES_DIR"

	EnvPerfEnabled = "HIVE_DESKTOP_DEVELOPMENT_PERF_ENABLED"
)
View Source
const (
	MinInterfaceScale = 75
	MaxInterfaceScale = 150
	MinDocumentScale  = 75
	MaxDocumentScale  = 200
	MinCodeScale      = 75
	MaxCodeScale      = 200
	MinTerminalScale  = 60
	MaxTerminalScale  = 500
	DefaultScale      = 100
)

stores/useSurfaceScale.ts repeats these; these govern the file.

View Source
const (
	MinPollInterval                        = 60 * time.Second
	DefaultTerminalSessionAgeThresholdDays = 5
	MinTerminalSessionAgeThresholdDays     = 1
	MaxTerminalSessionAgeThresholdDays     = 365
	// MaxDebugPause prevents a stale development setting from making startup
	// appear permanently hung while still allowing deliberate crash-window tests.
	MaxDebugPause = 10 * time.Minute
)
View Source
const (
	WebhookPortMin = 20000
	WebhookPortMax = 32767
)
View Source
const (
	ChannelStable = "stable"
	ChannelBeta   = "beta"
	ChannelDev    = "dev"

	DeliveryAuto   = "auto"
	DeliverySystem = "system"
	DeliveryApp    = "app"

	MockLive        = "live"
	MockFeed        = "feed"
	MockPipeline    = "pipeline"
	MockOnboarding  = "onboarding"
	MockActionSmoke = "action-smoke"
)
View Source
const (
	// MaxMenuBarFeeds keeps the menu bar dropdown short enough to scan; the
	// full inbox is the main window's job.
	MaxMenuBarFeeds         = 3
	DefaultMenuBarItemLimit = 3
	MaxMenuBarItemLimit     = 10
)
View Source
const EnvGitHubAPIBase = "HIVE_DESKTOP_DEVELOPMENT_GITHUB_API_BASE"

EnvGitHubAPIBase is the environment name behind development.github.api_base. It is named here because startup reports whether the value it is running with came from the environment or from settings.yaml.

View Source
const EnvLogLevel = "HIVE_DESKTOP_LOG_LEVEL"
View Source
const MaxActionRunRetention = 10_000

EditorSettings names the editor "Open in editor" actions launch on a directory. Command is a single word — a CLI launcher name (zed, code) or an absolute path — never a command line: the same rule agent commands follow (ADR a-workspace-declares-its-own-authority), so a flag cannot ride in through a settings string. Empty means none configured. MaxActionRunRetention bounds retention.action_runs. Each run keeps its full log, so the bound is what caps the database's size.

View Source
const MaxReviewLabels = 4

MaxReviewLabels is how many labels the comment composer offers: one per key, 1 to 4.

Variables

View Source
var DefaultReviewLabels = []ReviewLabel{
	{Title: "Clarify this", Icon: "circle-help"},
	{Title: "Verify this", Icon: "search-check"},
	{Title: "Needs tests", Icon: "flask-conical"},
	{Title: "Looks good", Icon: "check"},
}

DefaultReviewLabels ship when settings.yaml names none.

Functions

func ActionsPath

func ActionsPath() string

func AllocateWebhookPort

func AllocateWebhookPort(ctx context.Context) (int, error)

AllocateWebhookPort offers a stable candidate for the settings UI. Runtime automatic allocation binds port zero directly and does not use this probe.

func BootstrapPath

func BootstrapPath() string

BootstrapPath is the fixed location of the bootstrap pointer file. It is deliberately anchored to the default XDG config location and is NEVER affected by a config-dir override — otherwise relocating the config dir would move the very file that records where the config dir went. It mirrors the config-dir resolution's default-location logic (XDG_CONFIG_HOME, then ~/.config) but ignores the movable desktop config-directory override.

func ClampScale added in v0.69.0

func ClampScale(percent, low, high int) int

ClampScale reads 0 as the default and clamps rather than rejects, so one bad field can't block startup.

func ConfigDir

func ConfigDir() string

func DataDir

func DataDir() string

Package-level helpers are retained for isolated tests and e2e harnesses. Production runtime code uses the Paths snapshot injected from main.

func E2EHarnessMarkerValid added in v0.69.0

func E2EHarnessMarkerValid() bool

E2EHarnessMarkerValid reports whether HIVE_DESKTOP_E2E_HARNESS carries the 256-bit hex marker cmd/desktop/e2e/scripts/run-docker.sh mints. It keeps mock mode alone from enabling what only the e2e harness may use.

func FlowsDir

func FlowsDir() string

func LogHiveDataDir

func LogHiveDataDir(logger zerolog.Logger, paths Paths, probeErr error)

LogHiveDataDir records which hive.db this run opens. probeErr is why the login shell could not be read, if it could not. A failed probe hides a HIVE_DATA_DIR that the user exports from a shell startup file, so the app falls back to its own data dir and can open a different hive.db than the run before did.

func MockMode

func MockMode() string

func NewLogger

func NewLogger(serviceName, path string, level zerolog.Level, extra ...io.Writer) (zerolog.Logger, func(), error)

NewLogger builds the desktop root logger. An extra writer receives the encoded JSON event, the seam the telemetry log bridge attaches to.

func ReportsDir

func ReportsDir() string

func ResolveLogLevel

func ResolveLogLevel() (zerolog.Level, error)

ResolveLogLevel validates the process log-level override once at startup.

func ResolveNotificationDelivery

func ResolveNotificationDelivery(value string) string

func SaveBootstrap

func SaveBootstrap(b Bootstrap) error

SaveBootstrap writes the pointer file, creating its parent directory. An entirely empty Bootstrap is still written (an empty file), which reads back as "no overrides".

func SaveSettings

func SaveSettings(cfg Settings) error

func SettingsPath

func SettingsPath() string

func StateDir

func StateDir() string

func ValidListenerPort

func ValidListenerPort(port int) bool

Types

type AgentWorkspacesSettings

type AgentWorkspacesSettings struct {
	Dir string `yaml:"dir,omitempty" env:"HIVE_DESKTOP_AGENT_WORKSPACES_DIR"`
	// SessionEndDelay is the grace between a chat asking to end its own
	// session and the session being ended: the request arrives from inside the
	// agent's own tool call, and the delay lets that call return first. Zero
	// takes the shipped value.
	SessionEndDelay time.Duration `yaml:"session_end_delay,omitempty" env:"HIVE_DESKTOP_AGENT_WORKSPACES_SESSION_END_DELAY"`
}

AgentWorkspacesSettings locates the agent-workspace root. Empty resolves to <ConfigDir>/workspaces; a leading `~` is expanded at read time. It is configurable because iCloud Drive is an expected destination (spec §4.4).

type Appearance

type Appearance struct {
	Theme string `yaml:"theme,omitempty" env:"HIVE_DESKTOP_APPEARANCE_THEME"`
	// FontFamily names the family the app's chrome draws with and
	// MonoFontFamily the one its monospace text draws with, neither of which
	// touches a terminal — that has its own family below. Empty is the bundled
	// face; a CSS generic keyword (system-ui, ui-monospace) is the platform
	// stack.
	FontFamily     string `yaml:"font_family,omitempty"      env:"HIVE_DESKTOP_APPEARANCE_FONT_FAMILY"`
	MonoFontFamily string `yaml:"mono_font_family,omitempty" env:"HIVE_DESKTOP_APPEARANCE_MONO_FONT_FAMILY"`
	// InterfaceScale, DocumentScale, CodeScale and TerminalScale size each
	// surface as a percent of its shipped size, independently of the others.
	// 0 means 100; see scale.go for the ranges.
	InterfaceScale int `yaml:"interface_scale,omitempty" env:"HIVE_DESKTOP_APPEARANCE_INTERFACE_SCALE"`
	DocumentScale  int `yaml:"document_scale,omitempty"  env:"HIVE_DESKTOP_APPEARANCE_DOCUMENT_SCALE"`
	CodeScale      int `yaml:"code_scale,omitempty"      env:"HIVE_DESKTOP_APPEARANCE_CODE_SCALE"`
	TerminalScale  int `yaml:"terminal_scale,omitempty"  env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SCALE"`
	// TerminalFontFamily names an installed monospace family for the terminal
	// only, leaving the rest of the UI alone. Empty is the bundled face.
	TerminalFontFamily string `yaml:"terminal_font_family,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_FAMILY"`
	// TerminalFontWeight is the CSS weight normal cells draw at, and
	// TerminalFontWeightBold the weight a bold cell draws at. Zero means
	// nothing persisted; the frontend owns the defaults and the valid set.
	TerminalFontWeight     int `yaml:"terminal_font_weight,omitempty"      env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_WEIGHT"`
	TerminalFontWeightBold int `yaml:"terminal_font_weight_bold,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_FONT_WEIGHT_BOLD"`
	// TerminalLineHeight multiplies the cell height and TerminalLetterSpacing
	// widens the cell by whole device pixels. Zero means nothing persisted, so
	// the letter-spacing default has to stay zero — moving it would make "no
	// extra tracking" unselectable.
	TerminalLineHeight    float64 `yaml:"terminal_line_height,omitempty"    env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_LINE_HEIGHT"`
	TerminalLetterSpacing int     `yaml:"terminal_letter_spacing,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_LETTER_SPACING"`
	// TerminalShowScrollbars shows scrollbars in single-pane and zoomed Code terminals.
	TerminalShowScrollbars bool `yaml:"terminal_show_scrollbars,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_SCROLLBARS"`
	// TerminalMonochromeAgentIcons draws Code's agent icons in the color of the
	// icons around them rather than in full color.
	TerminalMonochromeAgentIcons bool `yaml:"terminal_monochrome_agent_icons,omitempty" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_MONOCHROME_AGENT_ICONS"`
	// TerminalShowWindows lists every active session's tmux windows in the
	// terminal sidebar, not just the attached session's. On by default.
	TerminalShowWindows bool `yaml:"terminal_show_windows" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_WINDOWS"`
	// TerminalShowStatusBar gives the attached session the same status bar a
	// chat has, plus git and pull-request state. On by default.
	TerminalShowStatusBar bool `yaml:"terminal_show_status_bar" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_STATUS_BAR"`
	// TerminalPoolSize is how many sessions the terminal view keeps attached at
	// once for instant switching (ADR terminal-attach-pool). Like the other appearance values it
	// is carried verbatim and healed by the frontend: anything outside 1-6 reads
	// as the default, 3.
	TerminalPoolSize int `yaml:"terminal_pool_size" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_POOL_SIZE"`
	// TerminalShowSessionAge marks old Hive sessions in the terminal sidebar.
	// The threshold is measured in whole days from the session's creation time.
	TerminalShowSessionAge          bool `yaml:"terminal_show_session_age"           env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SHOW_SESSION_AGE"`
	TerminalSessionAgeThresholdDays int  `yaml:"terminal_session_age_threshold_days" env:"HIVE_DESKTOP_APPEARANCE_TERMINAL_SESSION_AGE_THRESHOLD_DAYS"`
	// CanvasLineSpacing and CanvasPageWidth are preset names interpreted by the
	// frontend. Empty takes the shipped defaults.
	CanvasLineSpacing string `yaml:"canvas_line_spacing,omitempty" env:"HIVE_DESKTOP_APPEARANCE_CANVAS_LINE_SPACING"`
	CanvasPageWidth   string `yaml:"canvas_page_width,omitempty"   env:"HIVE_DESKTOP_APPEARANCE_CANVAS_PAGE_WIDTH"`
}

type AppletsSettings added in v0.69.0

type AppletsSettings struct {
	// Disabled lists the applets the user turned off. An id with no such applet stays
	// listed, so an applet being rewritten stays off.
	Disabled []string `yaml:"disabled,omitempty"`
}

AppletsSettings holds what the user has chosen to do with their applets. Where an applet shows is not here: its applet.yaml says.

func (*AppletsSettings) Forget added in v0.69.0

func (a *AppletsSettings) Forget(id string)

Forget removes every choice made about an id, for a new applet taking that id.

type Bootstrap

type Bootstrap struct {
	DataDir   string `yaml:"data_dir,omitempty"`
	ConfigDir string `yaml:"config_dir,omitempty"`
}

Bootstrap holds the persisted directory overrides set from the System settings screen. Empty fields mean "use the default resolution".

DataDir is the data-dir root (the HIVE_DESKTOP_DATA_DIR equivalent) under which StateDir and the core hive.db live. ConfigDir is the desktop config root (the directory holding flows/ and actions.yml).

func LoadBootstrap

func LoadBootstrap() (Bootstrap, error)

LoadBootstrap reads the pointer file. A missing file is not an error: it returns a zero Bootstrap so first-run and default setups behave identically.

type DaemonSettings added in v0.68.0

type DaemonSettings struct {
	// HivePath is the hive binary that runs the daemon. Empty looks hive up
	// on the login-shell PATH.
	HivePath string `yaml:"hive_path,omitempty" env:"HIVE_DESKTOP_DAEMON_HIVE_PATH"`
}

DaemonSettings configures the experimental hive daemon, which Hive Desktop uses when experimental.daemon is on in the Hive config.

type DebugSettings

type DebugSettings struct {
	PauseIngest time.Duration `yaml:"pause_ingest" env:"HIVE_DESKTOP_DEVELOPMENT_DEBUG_PAUSE_INGEST"`
	PauseCommit time.Duration `yaml:"pause_commit" env:"HIVE_DESKTOP_DEVELOPMENT_DEBUG_PAUSE_COMMIT"`
}

type DevToolsSettings

type DevToolsSettings struct {
	Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_DEVTOOLS_ENABLED"`
}

DevToolsSettings makes the in-app developer tools reachable in a build that was not served by Vite (ADR developer-tools-are-reachable-in-a-shipped-build-behind-a-setting). Off in a shipped build; the dev task turns it on through launch.env.

type DevelopmentSettings

type DevelopmentSettings struct {
	Mocks    MockSettings      `yaml:"mocks"`
	GitHub   GitHubDevSettings `yaml:"github,omitempty"`
	Vite     ServerSettings    `yaml:"vite"             envPrefix:"HIVE_DESKTOP_DEVELOPMENT_VITE_"`
	Wails    ServerSettings    `yaml:"wails"            envPrefix:"HIVE_DESKTOP_DEVELOPMENT_WAILS_"`
	Pprof    PprofSettings     `yaml:"pprof"`
	Perf     PerfSettings      `yaml:"perf"`
	Metrics  MetricsSettings   `yaml:"metrics"`
	DevTools DevToolsSettings  `yaml:"devtools"`
	Debug    DebugSettings     `yaml:"debug"`
}

type EditorSettings

type EditorSettings struct {
	Command string `yaml:"command,omitempty" env:"HIVE_DESKTOP_EDITOR_COMMAND"`
}

type GitHubDevSettings

type GitHubDevSettings struct {
	APIBase string `yaml:"api_base,omitempty" env:"HIVE_DESKTOP_DEVELOPMENT_GITHUB_API_BASE"`
}

GitHubDevSettings redirects the GitHub REST/GraphQL base at cmd/desktop/devserver, the development caching proxy and event simulator (ADR devserver-github-proxy). Empty — the shipped value — means api.github.com.

Only the API base moves. The OAuth base stays github.com: a device-flow token exchange has no business passing through dev tooling, and it draws no rate-limit budget, so redirecting it would be all risk and no benefit.

type HTTPSettings

type HTTPSettings struct {
	Enabled bool   `yaml:"enabled" env:"HIVE_DESKTOP_HTTP_ENABLED"`
	Host    string `yaml:"host"    env:"HIVE_DESKTOP_HTTP_HOST"`
	Port    int    `yaml:"port"    env:"HIVE_DESKTOP_HTTP_PORT"`
}

HTTPSettings configures the local loopback HTTP server that hosts both the webhook listener and the agent API. On by default: it is loopback-only, so it is reachable only from this machine.

type MenuBarFeed struct {
	// Feed is a feed id, "<flow id>/<feed node id>".
	Feed string `yaml:"feed"`
	// Zero uses DefaultMenuBarItemLimit.
	Limit int `yaml:"limit,omitempty"`
}
func (f MenuBarFeed) ItemLimit() int
type MenuBarSettings struct {
	Feeds []MenuBarFeed `yaml:"feeds,omitempty"`
}

MenuBarSettings preserves feed order and permits missing feeds.

func (m MenuBarSettings) Validate() error

type MetricsSettings

type MetricsSettings struct {
	Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_METRICS_ENABLED"`
}

MetricsSettings gates the local Prometheus scrape endpoint, mounted on the shared HTTP server the way pprof is (ADR pprof-debug-endpoint). Independent of telemetry.enabled: the same instruments feed both readers.

type MockSettings

type MockSettings struct {
	Mode string `yaml:"mode" env:"HIVE_DESKTOP_DEVELOPMENT_MOCKS_MODE"`
}

type NotificationSettings

type NotificationSettings struct {
	Enabled  bool   `yaml:"enabled"  env:"HIVE_DESKTOP_NOTIFICATIONS_ENABLED"`
	Delivery string `yaml:"delivery" env:"HIVE_DESKTOP_NOTIFICATIONS_DELIVERY"`
	Sound    bool   `yaml:"sound"    env:"HIVE_DESKTOP_NOTIFICATIONS_SOUND"`
}

type OnboardingSettings

type OnboardingSettings struct {
	Completed bool `yaml:"completed,omitempty"`
}

OnboardingSettings records that first run was walked to its end. It is the one thing first run cannot infer: every other step has its own signal (a usable Hive config, a connected account, a resolved notification grant), but the closing hand-off to the agent leaves nothing behind to read.

type Paths

type Paths struct {
	DataDir string
	// HiveDataDir holds hive.db, shared with the external hive CLI. It is
	// HIVE_DESKTOP_HIVE_DATA_DIR, then HIVE_DATA_DIR, then DataDir. Dev sets the
	// first to the installed hive data dir so sessions created in dev land in
	// the real database while desktop state stays isolated.
	HiveDataDir string
	StateDir    string
	ConfigDir   string
	FlowsDir    string
	ActionsPath string
	AppletsDir  string
	// AgentWorkspacesDir is the agent-workspace root: agent_workspaces.dir,
	// resolved and `~`-expanded, or <ConfigDir>/workspaces when unset.
	AgentWorkspacesDir   string
	SettingsPath         string
	CredentialsIndexPath string
	LogFile              string
	// ReportsDir holds the diagnostic bundles "Report a problem" writes. It is
	// resolved here so the reporter and the system service's path allowlist
	// cannot disagree about where they live.
	ReportsDir          string
	DataDirOverridden   bool
	ConfigDirOverridden bool
}

Paths is the immutable startup snapshot of every desktop-owned location. Runtime code receives this value instead of resolving process environment repeatedly.

func ResolvePaths

func ResolvePaths(b Bootstrap, opts ResolveOptions) Paths

ResolvePaths applies explicit environment overrides over bootstrap and settings values, then XDG defaults.

type PathsSettings

type PathsSettings struct {
	Tmux string `yaml:"tmux,omitempty" env:"HIVE_DESKTOP_PATHS_TMUX"`
}

PathsSettings locates the external binaries the app execs. Each is the escape hatch for an install discovery does not know about (ADR tmux-discovery): empty — the shipped value — searches PATH and the usual package-manager prefixes.

type PerfSettings

type PerfSettings struct {
	Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_PERF_ENABLED"`
}

PerfSettings gates the UI performance recorder, which appends spans the frontend emits to perf.jsonl under the state directory (ADR ui-performance-spans-are-recorded-to-jsonl). Off in a shipped build; the dev task turns it on through launch.env.

type PollingSettings

type PollingSettings struct {
	Interval time.Duration `yaml:"interval" env:"HIVE_DESKTOP_POLLING_INTERVAL"`
}

type PprofSettings

type PprofSettings struct {
	Enabled bool `yaml:"enabled" env:"HIVE_DESKTOP_DEVELOPMENT_PPROF_ENABLED"`
}

PprofSettings gates the pprof endpoint; when enabled it mounts on the shared HTTP server (ADR pprof-debug-endpoint), so it has no host/port of its own.

type ProfileSettings

type ProfileSettings struct {
	Order []string `yaml:"order,omitempty"`
}

ProfileSettings configures the profile rail. Order names flow ids in the order they should appear; an id it omits sorts alphabetically after every id it names, so the list never has to be exhaustive and a newly created profile lands at the end rather than somewhere unspecified. An id naming no flow is ignored, so deleting a profile does not invalidate the setting.

type ProfileTelemetrySettings

type ProfileTelemetrySettings struct {
	Enabled  bool   `yaml:"enabled"            env:"HIVE_DESKTOP_TELEMETRY_PROFILES_ENABLED"`
	Endpoint string `yaml:"endpoint,omitempty" env:"HIVE_DESKTOP_TELEMETRY_PROFILES_ENDPOINT"`
	User     string `yaml:"user,omitempty"     env:"HIVE_DESKTOP_TELEMETRY_PROFILES_USER"`
	Token    string `yaml:"token,omitempty"    env:"HIVE_DESKTOP_TELEMETRY_PROFILES_TOKEN"`
}

ProfileTelemetrySettings configures direct Pyroscope export. Grafana Cloud Profiles has its own endpoint and basic-auth user, independent of OTLP.

type ResolveOptions

type ResolveOptions struct {
	// MockMode only affects the isolated onboarding flow path.
	MockMode string
	// AgentWorkspacesDir is settings' agent_workspaces.dir. Empty resolves to
	// <ConfigDir>/workspaces; a leading `~` is expanded here.
	AgentWorkspacesDir string
	// Env reads the HIVE_DESKTOP_* overrides. Nil is the process environment.
	Env func(string) string
	// Getenv reads the hive data dir variables. main passes the login shell's
	// environment, where a user exports HIVE_DATA_DIR for the CLI. nil reads
	// only HIVE_DESKTOP_HIVE_DATA_DIR from this process, so a test that
	// isolates DataDir never reaches a HIVE_DATA_DIR in the developer's shell.
	Getenv func(string) string
}

ResolveOptions carries the settings-derived inputs to path resolution. They are arguments rather than a post-hoc copy because Paths is a snapshot: every field is resolved once, by one function.

type RetentionSettings added in v0.62.0

type RetentionSettings struct {
	// ActionRuns is how many finished runs of actions.yml actions to keep,
	// each with its log.
	ActionRuns int `yaml:"action_runs,omitempty" env:"HIVE_DESKTOP_RETENTION_ACTION_RUNS"`
}

RetentionSettings bounds the history the app keeps. Zero leaves the pipeline's own default.

func (RetentionSettings) Validate added in v0.62.0

func (r RetentionSettings) Validate() error

type ReviewLabel added in v0.65.0

type ReviewLabel struct {
	Title string `yaml:"title"`
	Icon  string `yaml:"icon,omitempty"`
}

ReviewLabel is one preset comment. Icon names a lucide icon from the set the frontend bundles; the frontend draws an unknown or empty one as a tag.

type ReviewSettings added in v0.65.0

type ReviewSettings struct {
	// Labels are the preset comments the composer applies with keys 1 to 4,
	// in order. Empty is DefaultReviewLabels.
	Labels []ReviewLabel `yaml:"labels,omitempty"`
}

ReviewSettings shapes commenting on Drive documents.

func (ReviewSettings) EffectiveLabels added in v0.65.0

func (r ReviewSettings) EffectiveLabels() []ReviewLabel

EffectiveLabels is Labels, or DefaultReviewLabels when it is empty.

func (ReviewSettings) Validate added in v0.65.0

func (r ReviewSettings) Validate() error

type ServerSettings

type ServerSettings struct {
	Host string `yaml:"host" env:"HOST"`
	Port int    `yaml:"port" env:"PORT"`
}

type SessionCondition added in v0.68.0

type SessionCondition struct {
	Field  string   `yaml:"field"`
	Op     string   `yaml:"op"`
	Values []string `yaml:"values,omitempty"`
	Value  string   `yaml:"value,omitempty"`
	Days   int      `yaml:"days,omitempty"`
}

SessionCondition is one filter chip. Which of Values, Value, and Days is set depends on Field.

type SessionFilter added in v0.68.0

type SessionFilter struct {
	// Match is "all" or "any"; empty reads as "all".
	Match      string             `yaml:"match,omitempty"`
	Conditions []SessionCondition `yaml:"conditions,omitempty"`
}

type SessionView added in v0.68.0

type SessionView struct {
	ID     string        `yaml:"id"`
	Name   string        `yaml:"name"`
	Filter SessionFilter `yaml:"filter"`
}

SessionView is a named filter over the Code tab's sessions. The frontend owns the set of fields and operators, so a field or operator this build does not know still loads and round-trips. A condition key beyond Values, Value, and Days does not survive a save.

type Settings

type Settings struct {
	Version       int                  `yaml:"version"`
	Polling       PollingSettings      `yaml:"polling"`
	Updates       UpdateSettings       `yaml:"updates"`
	Notifications NotificationSettings `yaml:"notifications"`
	// No omitempty: with terminal_show_windows off and nothing else set the
	// struct is all-zero, and an omitted section would read back as defaults.
	Appearance      Appearance              `yaml:"appearance"`
	Applets         AppletsSettings         `yaml:"applets,omitempty"`
	Profiles        ProfileSettings         `yaml:"profiles,omitempty"`
	MenuBar         MenuBarSettings         `yaml:"menu_bar,omitempty"`
	HTTP            HTTPSettings            `yaml:"http"`
	Telemetry       TelemetrySettings       `yaml:"telemetry"`
	Keybindings     map[string][]string     `yaml:"keybindings,omitempty"`
	Paths           PathsSettings           `yaml:"paths,omitempty"`
	Daemon          DaemonSettings          `yaml:"daemon,omitempty"`
	Editor          EditorSettings          `yaml:"editor,omitempty"`
	Retention       RetentionSettings       `yaml:"retention,omitempty"`
	AgentWorkspaces AgentWorkspacesSettings `yaml:"agent_workspaces,omitempty"`
	Review          ReviewSettings          `yaml:"review,omitempty"`
	Views           ViewsSettings           `yaml:"views,omitempty"`
	Onboarding      OnboardingSettings      `yaml:"onboarding,omitempty"`
	Development     DevelopmentSettings     `yaml:"development"`
	// contains filtered or unexported fields
}

Settings is the typed settings.yaml schema. Environment override provenance is process-local and is never serialized.

func DefaultSettings

func DefaultSettings() Settings

func LoadPersistedSettings

func LoadPersistedSettings() (Settings, error)

Package-level helpers remain for isolated tests and e2e harnesses. Runtime composition owns and injects one Store at its resolved Paths.SettingsPath.

func LoadSettings

func LoadSettings() (Settings, error)

func (Settings) EnvironmentOverridden

func (s Settings) EnvironmentOverridden(name string) bool

func (Settings) GitHubAPIBase

func (s Settings) GitHubAPIBase() string

GitHubAPIBase returns the canonical API base override, or "" for the client's own api.github.com default. The trailing slash is trimmed because the client concatenates paths onto this value directly.

func (Settings) MockMode

func (s Settings) MockMode() string

func (Settings) UnknownKeys

func (s Settings) UnknownKeys() error

UnknownKeys reports the settings.yaml keys this build does not declare, one line each, or nil. The load ignores them and a save drops them.

func (Settings) Validate

func (s Settings) Validate() error

type Store

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

Store serializes access to one settings.yaml and keeps environment overrides process-local. All mutations go through Update so concurrent UI/background writes cannot lose each other.

func NewStore

func NewStore(path string) *Store

func (*Store) Effective

func (s *Store) Effective() (Settings, error)

func (*Store) Persisted

func (s *Store) Persisted() (Settings, error)

func (*Store) Update

func (s *Store) Update(mutate func(*Settings) error) (Settings, error)

Update atomically applies mutate to persisted settings, then returns the effective value after environment overrides are reapplied.

type TelemetrySettings

type TelemetrySettings struct {
	Enabled    bool                     `yaml:"enabled"               env:"HIVE_DESKTOP_TELEMETRY_ENABLED"`
	Endpoint   string                   `yaml:"endpoint,omitempty"    env:"HIVE_DESKTOP_TELEMETRY_ENDPOINT"`
	InstanceID string                   `yaml:"instance_id,omitempty" env:"HIVE_DESKTOP_TELEMETRY_INSTANCE_ID"`
	HostID     string                   `yaml:"host_id,omitempty"     env:"HIVE_DESKTOP_TELEMETRY_HOST_ID"`
	Token      string                   `yaml:"token,omitempty"       env:"HIVE_DESKTOP_TELEMETRY_TOKEN"`
	Profiles   ProfileTelemetrySettings `yaml:"profiles,omitempty"`
}

TelemetrySettings configures OTLP export of the app's own signals. It is top-level rather than under development because it is the user's own observability, not a debug facility.

Endpoint is the signal-less OTLP base; on Grafana Cloud InstanceID is the OTLP instance id from the stack's OpenTelemetry tile, not the stack id. HostID becomes the OpenTelemetry host.id resource attribute. It is optional because it is a stable machine identifier the user must choose to disclose (ADR telemetry-carries-the-opentelemetry-host-identifier-configured-for-the-machine).

Endpoint, InstanceID, and Token may be a internal/platform/secrets reference — "env:NAME", "file:/path", "op://vault/item/field" — so one 1Password item can hold a whole destination. They differ in whether a literal is allowed: Token *requires* a reference, because a literal there is a credential in a dotfiles-managed file, while Endpoint and InstanceID name a destination and are ordinarily written out.

A reference is resolved at launch, so Validate checks Endpoint's URL shape only when it is written out. The resolved value is checked either way, by the telemetry package.

type UpdateSettings

type UpdateSettings struct {
	Enabled bool   `yaml:"enabled"           env:"HIVE_DESKTOP_UPDATES_ENABLED"`
	Channel string `yaml:"channel,omitempty" env:"HIVE_DESKTOP_UPDATES_CHANNEL"`
}

type ViewsSettings added in v0.68.0

type ViewsSettings struct {
	Code []SessionView `yaml:"code,omitempty"`
}

ViewsSettings holds the user's saved views, one list per surface.

func (ViewsSettings) Validate added in v0.68.0

func (v ViewsSettings) Validate() error

Jump to

Keyboard shortcuts

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