Documentation
¶
Overview ¶
Package config handles loading, saving, and validating user configuration from JSON files, including project settings, plugin options, keymaps, and UI preferences.
Tasks plugin ¶
The embedded Tasks tab is off by default. It is turned on with the "tasks_plugin" feature flag, not with a plugin config key:
{
"features": { "flags": { "tasks_plugin": true } }
}
Tasks is a tab of the global space — [Agents] [Workspaces] [Tasks], reached with K or the Sidecar brand — not a project plugin, so it is not part of the project tab order and "plugins.tasks.position" no longer moves it. The field is still accepted and validated so older configs keep loading.
There is deliberately no Tasks store or JSONL path here. The embedded Tasks package performs its own normal configuration resolution.
Index ¶
- Constants
- Variables
- func AssertIsolatedPath(path string) error
- func CheckStateIsolation() error
- func ConfigPath() string
- func ExpandPath(path string) string
- func HostIDFor(host HostConfig) string
- func IsHostValueRejection(err error) bool
- func IsolationAsserted() bool
- func MoveProject(projectPath string, delta int) error
- func NormalizeClaimHost(entry string) (string, bool)
- func ParseNotificationExpiry(raw string) (time.Duration, error)
- func RealUserConfigDir() string
- func RealUserStateDir() string
- func RemoveProject(projectPath string) error
- func ResetTestConfigPath()
- func ResetTestStateDir()
- func Save(cfg *Config) error
- func SaveCommunityTheme(communityName string, userOverrides map[string]interface{}) error
- func SaveGlobalTheme(tc ThemeConfig) error
- func SaveLastOpenInApp(projectPath, appID string) error
- func SaveNotifications(mutate func(*NotificationsConfig)) error
- func SavePlugins(mutate func(*PluginsConfig)) error
- func SaveProjectTheme(projectPath string, theme *ThemeConfig) error
- func SaveSelection(mutate func(*SelectionConfig)) error
- func SaveTheme(themeName string) error
- func SaveThemeWithOverrides(themeName string, overrides map[string]interface{}) error
- func SaveUI(mutate func(*UIConfig)) error
- func SaveWorkspace(mutate func(*WorkspacePluginConfig)) error
- func SetConfigPath(path string)
- func SetTestConfigPath(path string)
- func SetTestStateDir(dir string)
- func StateDir() string
- func UpdateProject(projectPath string, mutate func(*ProjectConfig)) error
- func ValidateHost(existing []HostConfig, host HostConfig, skipIndex int) string
- func ValidateHostEnv(entry string) string
- func ValidateNotifications(c NotificationsConfig, configPath string) error
- func ValidateProject(existing []ProjectConfig, name, path string, skipIndex int) string
- func ValidateProjectName(existing []ProjectConfig, name string, skipIndex int) string
- type Config
- type ConversationsPluginConfig
- type DeliveryMode
- type DetectionConfig
- type FeaturesConfig
- type FileBrowserPluginConfig
- type GitStatusPluginConfig
- type HostConfig
- type HostsConfig
- type KeymapConfig
- type NativeNotificationsConfig
- type NotesPluginConfig
- type NotificationSourceConfig
- type NotificationsConfig
- type PluginsConfig
- type ProjectConfig
- type ProjectsConfig
- type QuietHoursConfig
- type SSHNotificationsConfig
- type SelectionConfig
- type SessionRestoreConfig
- type ShellsConfig
- type SidebarDisplayConfig
- type SoundCue
- type SoundNotificationsConfig
- type TDMonitorPluginConfig
- type TasksPluginConfig
- type TerminalNotifier
- type TerminalResourceProviderConfig
- type TerminalResourcesConfig
- type ThemeConfig
- type UIConfig
- type WorkspacePluginConfig
- type WorktreeSetupConfig
Constants ¶
const ( OverviewWorktreeScopeProject = "project" OverviewWorktreeScopeWorktree = "worktree" )
const ( // RemoteManifestsOff is the default. The manifests vendored into the binary // are the only upstream source and Sidecar never reaches the network for // one. RemoteManifestsOff = "off" // RemoteManifestsHerdrDev is Herdr's own published catalog. RemoteManifestsHerdrDev = "herdr.dev" )
The values detection.remoteManifests takes, besides an arbitrary catalog URL.
const ( // TasksPositionAfterWorkspaces places the Tasks tab immediately after the // workspaces tab. This is the default. TasksPositionAfterWorkspaces = "after-workspaces" // TasksPositionAfterNotes places the Tasks tab immediately after the notes // tab. TasksPositionAfterNotes = "after-notes" )
Tab positions for the Tasks plugin.
const ( ResumeAgentsOff = "off" ResumeAgentsAsk = "ask" ResumeAgentsAuto = "auto" )
Session restore resumeAgents values.
const ( NotesEditorBuiltin = "builtin" NotesEditorPane = "pane" )
const ( // MaxTerminalResourceProviders bounds how many instances may be configured. MaxTerminalResourceProviders = 16 // MaxTerminalResourceProviderIDChars bounds an instance ID, which is a // persisted key. MaxTerminalResourceProviderIDChars = 64 // MaxTerminalResourceClaimHosts bounds how many hosts one instance may // claim, and MaxClaimHostChars bounds one claimed hostname. MaxTerminalResourceClaimHosts = 16 MaxClaimHostChars = 253 // DefaultTerminalResourceTimeout, MinTerminalResourceTimeout and // MaxTerminalResourceTimeout clamp a per-instance resolve timeout. DefaultTerminalResourceTimeout = 10 * time.Second MinTerminalResourceTimeout = time.Second MaxTerminalResourceTimeout = 60 * time.Second )
Terminal resource provider bounds.
These mirror the protocol document's Limits table and internal/resource's constants. They are restated here rather than imported because internal/config is deliberately a leaf package: pulling in the resource document types would drag the Markdown renderer into everything that reads configuration. TestTerminalResourceBoundsMatchTheProtocol in internal/resourceprovider fails if the two ever drift.
const AllowRealStateEnv = "SIDECAR_ALLOW_REAL_STATE"
AllowRealStateEnv opts a process out of the automatic isolation that applies to every `go test` binary. Set it to "1" only in a test that deliberately proves the ordinary, unisolated path still works — and only with HOME already pointed at a temp dir.
const DefaultTombstoneRetention = 14 * 24 * time.Hour
DefaultTombstoneRetention is how long a forgotten shell record is kept when the config says nothing. Two weeks is long enough to cover "I deleted that yesterday and want it back" plus a holiday, and short enough that a long-lived project's shells.json does not grow one record per shell ever forgotten.
const HerdrCatalogURL = "https://herdr.dev/agent-detection/index.toml"
HerdrCatalogURL is the index RemoteManifestsHerdrDev resolves to. It is Herdr's own DEFAULT_CATALOG_URL (src/detect/manifest_update.rs:17).
const IsolationEnv = "SIDECAR_ISOLATED_STATE"
IsolationEnv is the promise a harness makes: this process must never read or write the real user's Sidecar state. Set it to "1".
The promise exists because tmux isolation and state isolation are separate axes (td-8d18de). A proof run can hold a private tmux socket and still share ~/.local/state/sidecar with the developer's live Sidecar, in which case it rewrites a manifest that instance is watching. Asserting isolation turns every path that resolves back into the real tree into a hard error instead of a silent overwrite.
const KeepTombstonesForever time.Duration = 0
KeepTombstonesForever is the sentinel a zero window carries: forgotten records are never expired. It is named so callers do not have to know that "forever" and 0 are the same statement.
const StickyExpiry time.Duration = 0
StickyExpiry is the sentinel a zero duration carries: a source whose toasts have no countdown.
Variables ¶
var ErrHostNotFound = errors.New("host not found")
ErrHostNotFound is what a mutation returns when nothing is registered under the name it was given. It is a sentinel rather than a formatted string so a caller can distinguish "you named a host I do not have" from "the configuration could not be written" without reading the message — a CLI has to answer those two with different exit codes.
Functions ¶
func AssertIsolatedPath ¶ added in v0.93.0
AssertIsolatedPath returns an error when isolation is asserted and path resolves inside the real user state or config tree. It returns nil otherwise: an ordinary run is never blocked from writing its own real files.
func CheckStateIsolation ¶ added in v0.93.0
func CheckStateIsolation() error
CheckStateIsolation validates the paths this process actually resolved.
func HostIDFor ¶ added in v1.11.0
func HostIDFor(host HostConfig) string
HostIDFor is the name an entry is known by: its ID, or its target when the ID is empty. It matches the defaulting hosts.FromConfig does, so the name a surface shows is the name the running registry uses.
func IsHostValueRejection ¶ added in v1.11.0
IsHostValueRejection reports whether an error is a refused value.
func IsolationAsserted ¶ added in v0.93.0
func IsolationAsserted() bool
IsolationAsserted reports whether this process claims isolated state.
A test binary asserts it by default. Isolation used to be opt-in, which meant the guard was silently inert in every package that had not thought about it, and `go test ./...` went on creating directories in the developer's real ~/.local/state/sidecar/projects tree — the same tree that holds the shell manifest td-8d18de destroyed. Defaulting to on makes forgetting to isolate a loud failure instead of a silent write.
func MoveProject ¶ added in v1.0.0
MoveProject changes a project's position in the list by delta. The list order is what the switcher and the Projects page show, so it is a real setting.
func NormalizeClaimHost ¶ added in v1.3.0
NormalizeClaimHost lowercases a claimed-hostname entry and reports whether it is a bare hostname. It is the single shape rule for claimHosts end to end: configuration validation refuses invalid entries with this, and the matcher snapshot sanitizes programmatically supplied sets with the same function, so a host that reaches the scanner has exactly the form URL host extraction produces.
The shape check is deliberately conservative: lowercase letters, digits, dots, hyphens, and interior underscores only. That rejects schemes (":"), ports (":"), paths ("/"), userinfo ("@"), wildcards ("*"), percent-escapes, whitespace, and empty strings in one stroke. Labels may not begin or end with a hyphen; underscores are tolerated anywhere for mDNS-style names.
func ParseNotificationExpiry ¶ added in v1.11.0
ParseNotificationExpiry validates the persisted duration vocabulary.
func RealUserConfigDir ¶ added in v0.93.0
func RealUserConfigDir() string
RealUserConfigDir returns $HOME/.config/sidecar, likewise unoverridable.
func RealUserStateDir ¶ added in v0.93.0
func RealUserStateDir() string
RealUserStateDir returns the state directory an ordinary run would use, ignoring XDG_STATE_HOME and any test override: $HOME/.local/state/sidecar.
It deliberately derives the root from $HOME rather than from the pre-override value of XDG_STATE_HOME. A harness launches Sidecar as a subprocess with the override already in its environment, so the process has no way to observe what XDG_STATE_HOME was before isolation was applied. $HOME is the one anchor that is still visible from inside, and it is what the XDG default expands to.
func RemoveProject ¶ added in v1.0.0
RemoveProject drops a project from the configured list.
func ResetTestConfigPath ¶
func ResetTestConfigPath()
ResetTestConfigPath clears the test config path override.
func ResetTestStateDir ¶ added in v0.75.0
func ResetTestStateDir()
ResetTestStateDir clears the test state directory override.
func Save ¶
Save writes the config to ~/.config/sidecar/config.json, preserving any keys it doesn't manage (e.g. "prompts").
func SaveCommunityTheme ¶
SaveCommunityTheme saves a community theme reference with optional user overrides. Only the scheme name is stored — the full palette is computed at runtime.
func SaveGlobalTheme ¶
func SaveGlobalTheme(tc ThemeConfig) error
SaveGlobalTheme saves a ThemeConfig as the global UI theme.
func SaveLastOpenInApp ¶ added in v0.75.0
SaveLastOpenInApp persists the last-used "open in" app ID. If projectPath matches a configured project, that project's LastOpenInApp is set. The global UI.LastOpenInApp is always set as a fallback.
func SaveNotifications ¶ added in v1.11.0
func SaveNotifications(mutate func(*NotificationsConfig)) error
SaveNotifications reloads immediately before applying a targeted mutation, validates the complete section, and writes only after validation succeeds.
func SavePlugins ¶ added in v1.0.0
func SavePlugins(mutate func(*PluginsConfig)) error
SavePlugins applies a change to the plugins section and writes it. It is the panel-enablement path: which surfaces Sidecar assembles, and the handful of inputs those surfaces read. Like the other helpers it reloads first, so a setting changed in Configuration never overwrites an edit made to the file since Sidecar started, and it validates before writing so an out-of-range interval cannot reach disk.
func SaveProjectTheme ¶
func SaveProjectTheme(projectPath string, theme *ThemeConfig) error
SaveProjectTheme updates a specific project's theme in config and saves.
func SaveSelection ¶ added in v1.1.0
func SaveSelection(mutate func(*SelectionConfig)) error
SaveSelection applies a change to the selection section — how text selection behaves in every surface that offers it — and writes it. Like the others it reloads first, so a setting changed in Configuration never overwrites an edit made to the file since Sidecar started.
func SaveThemeWithOverrides ¶
SaveThemeWithOverrides saves a theme name and full overrides map to config.
func SaveUI ¶ added in v1.0.0
SaveUI applies a change to the ui section and writes it. It reloads first, so a setting changed in Configuration never overwrites an edit made to the file since Sidecar started.
func SaveWorkspace ¶ added in v1.0.0
func SaveWorkspace(mutate func(*WorkspacePluginConfig)) error
SaveWorkspace applies a change to the plugins.workspace section and writes it. Like SaveUI it reloads first, so a setting changed in Configuration never overwrites an edit made to the file since Sidecar started.
func SetConfigPath ¶ added in v0.93.0
func SetConfigPath(path string)
SetConfigPath records the explicit config path (the -config flag) so that ConfigPath, and everything that derives a directory from it, follow it. Passing "" leaves the default in place.
func SetTestConfigPath ¶
func SetTestConfigPath(path string)
SetTestConfigPath sets a custom config path for testing. Call ResetTestConfigPath() in test cleanup to restore default behavior.
func SetTestStateDir ¶ added in v0.75.0
func SetTestStateDir(dir string)
SetTestStateDir sets a custom state directory for testing.
func StateDir ¶ added in v0.75.0
func StateDir() string
StateDir returns the directory for sidecar state files. Follows XDG Base Directory Specification: $XDG_STATE_HOME/sidecar (defaults to ~/.local/state/sidecar).
func UpdateProject ¶ added in v1.0.0
func UpdateProject(projectPath string, mutate func(*ProjectConfig)) error
UpdateProject applies a change to the project at a path. mutate receives the live entry from a freshly loaded configuration.
Removing or renaming a project deliberately leaves state.json's workdir-keyed entries alone: a stale key is harmless, and rewriting per-surface UI state as a side effect of a settings change is not.
func ValidateHost ¶ added in v1.11.0
func ValidateHost(existing []HostConfig, host HostConfig, skipIndex int) string
ValidateHost reports why an entry may not be saved, or "" when it is fine. skipIndex excludes one existing entry from the uniqueness check so editing a host does not collide with itself; pass -1 when adding.
The returned string is what a user reads, so it says what is wrong in plain language rather than naming a field. Reachability is deliberately not questioned: the target is whatever the user's ssh_config resolves, and a host that is merely switched off today is still a host worth keeping registered.
func ValidateHostEnv ¶ added in v1.11.0
ValidateHostEnv checks one KEY=VALUE entry. Env exists so a proof run can pin a host to an isolated tmux server and state tree, which means a malformed entry is not a cosmetic problem: it is isolation that silently did not apply.
func ValidateNotifications ¶ added in v1.11.0
func ValidateNotifications(c NotificationsConfig, configPath string) error
ValidateNotifications validates a prospective targeted save. Custom sound paths are resolved only for validation; the user's inspectable spelling is retained in config.json.
func ValidateProject ¶ added in v1.0.0
func ValidateProject(existing []ProjectConfig, name, path string, skipIndex int) string
ValidateProject reports why a name/path pair may not be added, or "" when it is fine. skipIndex excludes one existing entry from the uniqueness checks, so editing a project does not collide with itself; pass -1 when adding.
The returned string is the message a user reads, so it says what is wrong in plain language rather than naming a field.
func ValidateProjectName ¶ added in v1.0.0
func ValidateProjectName(existing []ProjectConfig, name string, skipIndex int) string
ValidateProjectName is the rename check: the path is already known good, so only the name is questioned.
Types ¶
type Config ¶
type Config struct {
Projects ProjectsConfig `json:"projects"`
Plugins PluginsConfig `json:"plugins"`
Keymap KeymapConfig `json:"keymap"`
UI UIConfig `json:"ui"`
Features FeaturesConfig `json:"features"`
// Selection configures text selection wherever it is offered. It is
// app-level because selection is one behaviour projected onto every
// surface, not a per-plugin setting.
Selection SelectionConfig `json:"selection"`
// TerminalResources configures external terminal resource providers. It is
// app-level rather than per-plugin because providers serve both workspace
// projections and are not project-tab plugins.
TerminalResources TerminalResourcesConfig `json:"terminalResources"`
// Notifications configures the notification system. It is app-level
// because the store, the toasts, and the centre are the shell's, not any
// plugin's.
Notifications NotificationsConfig `json:"notifications,omitempty"`
// Shells configures the shell records Sidecar owns in shells.json. It is
// app-level because every surface writes those records, including
// `sidecar shell forget` in a process that loads no plugins.
Shells ShellsConfig `json:"shells,omitempty"`
// Hosts registers other machines to observe over SSH. App-level because a
// host contributes rows to the global Sessions browser, which belongs to
// the shell rather than to any project or plugin.
Hosts HostsConfig `json:"hosts,omitempty"`
// Detection configures the agent screen-detection lane. App-level because
// the detection manifests answer for every surface that shows an agent
// state, and for `sidecar agent explain` in a process that loads no
// plugins at all.
Detection DetectionConfig `json:"detection,omitempty"`
}
Config is the root configuration structure.
func Load ¶
Load loads configuration from the path Sidecar is actually using — the -config flag's file, a test's fixture, or the default location. Every read-modify-write helper below goes through it, so a save can never merge against a different file than the one it is about to write.
func LoadFrom ¶
LoadFrom loads configuration from a specific path. If path is empty, uses ~/.config/sidecar/config.json
func (*Config) WorktreeSetupForProject ¶ added in v0.94.0
func (c *Config) WorktreeSetupForProject(projectPath string) WorktreeSetupConfig
WorktreeSetupForProject returns the project override when present, otherwise the workspace-wide default.
type ConversationsPluginConfig ¶
type ConversationsPluginConfig struct {
Enabled bool `json:"enabled"`
ClaudeDataDir string `json:"claudeDataDir"`
// DefaultCategoryFilter sets the default session category filter on startup.
// Example: ["interactive"] hides cron/system sessions by default.
// Empty or omitted means show all sessions (no filter).
DefaultCategoryFilter []string `json:"defaultCategoryFilter,omitempty"`
}
ConversationsPluginConfig configures the conversations plugin.
type DeliveryMode ¶ added in v1.11.0
type DeliveryMode string
DeliveryMode controls when an external notification channel is eligible.
const ( DeliveryOff DeliveryMode = "off" DeliveryBackground DeliveryMode = "background" DeliveryAlways DeliveryMode = "always" NativeProviderAuto = "auto" )
type DetectionConfig ¶ added in v1.12.0
type DetectionConfig struct {
// RemoteManifests names where, if anywhere, Sidecar may fetch newer
// agent-detection manifests from while it is running: "off" (the default),
// "herdr.dev", or the http(s) URL of a catalog index.
//
// Anything else is refused rather than guessed at. An unrecognised value
// could plausibly mean "the user wanted this on and mistyped it" or "the
// user wanted it off and mistyped it", and only one of those two readings
// can be wrong quietly: silently reading a typo as "on" would put a network
// fetch behind a setting nobody successfully turned on. So a value this
// package cannot resolve turns nothing on and is reported. The loader warns
// and keeps the value verbatim so `sidecar agent manifests` can show it back
// with the reason it was refused; RemoteCatalogURL is the gate, and it
// returns an error for such a value, so no caller can fetch on it.
RemoteManifests string `json:"remoteManifests,omitempty"`
}
DetectionConfig configures the screen-detection lane.
func (DetectionConfig) RemoteCatalogURL ¶ added in v1.12.0
func (c DetectionConfig) RemoteCatalogURL() (string, error)
RemoteCatalogURL resolves the setting to the catalog index URL to fetch, or "" when fetching is off. An unrecognised value is an error, never a URL and never a silent "on".
func (DetectionConfig) RemoteManifestsEnabled ¶ added in v1.12.0
func (c DetectionConfig) RemoteManifestsEnabled() bool
RemoteManifestsEnabled reports whether a runtime fetch is configured and resolvable.
type FeaturesConfig ¶
FeaturesConfig holds feature flag settings.
type FileBrowserPluginConfig ¶ added in v0.81.0
type FileBrowserPluginConfig struct {
// Enabled controls whether the file browser plugin is loaded. Default: true.
Enabled bool `json:"enabled"`
}
FileBrowserPluginConfig configures the file browser plugin.
type GitStatusPluginConfig ¶
type GitStatusPluginConfig struct {
Enabled bool `json:"enabled"`
RefreshInterval time.Duration `json:"refreshInterval"`
}
GitStatusPluginConfig configures the git status plugin.
type HostConfig ¶ added in v1.11.0
type HostConfig struct {
// ID is the local name shown in the UI and used to scope remote workspace
// IDs. Defaults to Target when empty.
ID string `json:"id,omitempty"`
// Target is the ssh destination.
Target string `json:"target"`
// Binary is an explicit path to sidecar on that host. Usually unnecessary:
// the connection runs through a login shell, which finds a Homebrew or
// package-managed install. Set it when the host puts sidecar somewhere a
// login shell does not look.
Binary string `json:"binary,omitempty"`
// Config is an optional -config path for the remote sidecar, so a host can
// be observed against a config other than its user default.
Config string `json:"config,omitempty"`
// Env is extra environment for the remote Sidecar, as KEY=VALUE strings.
//
// It exists so a proof run can pin a host to an isolated tmux server and
// state tree (TMUX_TMPDIR, XDG_STATE_HOME, SIDECAR_ISOLATED_STATE) exactly
// as a local proof run does. Without it the isolation discipline stops at
// the machine boundary, which is the point at which it matters most — the
// remote tree belongs to someone else.
Env []string `json:"env,omitempty"`
// Disabled keeps a host registered but unconnected, which is what a user
// wants for a machine that is off this week — deleting the entry to stop
// the reconnect attempts would lose its settings.
Disabled bool `json:"disabled,omitempty"`
}
HostConfig is one registered machine.
func AddHost ¶ added in v1.11.0
func AddHost(host HostConfig) (HostConfig, error)
AddHost registers a machine and returns the saved entry. It reloads first, so a host added here never clobbers a change made to the file since Sidecar started.
func FindHost ¶ added in v1.11.0
func FindHost(existing []HostConfig, id string) (HostConfig, int, bool)
FindHost looks up an entry by the name it is known by, returning its index in the list. It is state-free so a caller can resolve a name against a configuration it already has rather than loading a second copy.
func NormalizeHost ¶ added in v1.11.0
func NormalizeHost(host HostConfig) HostConfig
NormalizeHost trims every field and resolves the ID default, so what is written is what a reader would have inferred anyway. Env is copied rather than aliased: an entry saved from a form must not share a slice with the draft that produced it.
func RemoveHost ¶ added in v1.11.0
func RemoveHost(id string) (HostConfig, error)
RemoveHost drops a machine from the registry. Nothing on that machine is touched: the entry described how to watch it, not what runs there.
func UpdateHost ¶ added in v1.11.0
func UpdateHost(id string, mutate func(*HostConfig)) (HostConfig, error)
UpdateHost applies a change to the host known by id. mutate receives the live entry from a freshly loaded configuration; the result is normalized and validated before it is written, so an edit cannot save something an add would have refused.
type HostsConfig ¶ added in v1.11.0
type HostsConfig struct {
List []HostConfig `json:"list"`
}
HostsConfig registers remote machines running Sidecar.
Reachability is deliberately not configured here. The target is whatever the user's ssh_config already resolves — their keys, their ProxyJump, their agent — so Sidecar adds no second place to describe how to reach a machine, and anything that works in `ssh <target>` works here.
type KeymapConfig ¶
KeymapConfig holds key binding overrides.
type NativeNotificationsConfig ¶ added in v1.11.0
type NativeNotificationsConfig struct {
Mode DeliveryMode `json:"mode,omitempty"`
Provider string `json:"provider,omitempty"`
}
type NotesPluginConfig ¶
type NotesPluginConfig struct {
// DefaultEditor sets the default editor mode when pressing Enter on a note.
// Values: "builtin" (default) or "pane" ($EDITOR in the Notes pane).
DefaultEditor string `json:"defaultEditor,omitempty"`
}
NotesPluginConfig configures the notes plugin.
type NotificationSourceConfig ¶ added in v1.2.0
type NotificationSourceConfig struct {
Toast *bool `json:"toast,omitempty"`
Native *bool `json:"native,omitempty"`
Sound SoundCue `json:"sound,omitempty"`
Expiry string `json:"expiry,omitempty"`
}
NotificationSourceConfig is the per-source override. Pointer booleans keep an explicit false distinct from an omitted value that inherits the source registry default.
type NotificationsConfig ¶ added in v1.2.0
type NotificationsConfig struct {
Native NativeNotificationsConfig `json:"native,omitempty"`
Sound SoundNotificationsConfig `json:"sound,omitempty"`
QuietHours QuietHoursConfig `json:"quietHours,omitempty"`
SSH SSHNotificationsConfig `json:"ssh,omitempty"`
Sources map[string]NotificationSourceConfig `json:"sources,omitempty"`
}
NotificationsConfig is the app-level `notifications` section. External delivery remains off unless the user explicitly changes a channel mode.
func DefaultNotificationsConfig ¶ added in v1.11.0
func DefaultNotificationsConfig() NotificationsConfig
DefaultNotificationsConfig is intentionally silent. Source defaults only become relevant after a channel is enabled.
func (NotificationsConfig) SourceExpiries ¶ added in v1.2.0
func (c NotificationsConfig) SourceExpiries() map[string]time.Duration
SourceExpiries resolves configured expiry overrides. This remains tolerant for direct JSON repair and older files; interactive and CLI writes go through ValidateNotifications and reject invalid values before saving.
type PluginsConfig ¶
type PluginsConfig struct {
GitStatus GitStatusPluginConfig `json:"git-status"`
TDMonitor TDMonitorPluginConfig `json:"td-monitor"`
FileBrowser FileBrowserPluginConfig `json:"file-browser"`
Conversations ConversationsPluginConfig `json:"conversations"`
Workspace WorkspacePluginConfig `json:"workspace"`
Notes NotesPluginConfig `json:"notes"`
Tasks TasksPluginConfig `json:"tasks"`
}
PluginsConfig holds per-plugin configuration.
type ProjectConfig ¶
type ProjectConfig struct {
Name string `json:"name"` // display name for the project
Path string `json:"path"` // absolute path to project root (supports ~ expansion)
Theme *ThemeConfig `json:"theme,omitempty"` // per-project theme (nil = use global)
LastOpenInApp string `json:"lastOpenInApp,omitempty"` // last app used to open this project (e.g. "vscode", "goland")
OpenIn string `json:"openIn,omitempty"` // preferred "open in" app for this project; last-used is the fallback
WorktreeSetup *WorktreeSetupConfig `json:"worktreeSetup,omitempty"` // optional per-project setup policy
}
ProjectConfig represents a single project in the project switcher.
func AddProject ¶ added in v1.0.0
func AddProject(project ProjectConfig) (ProjectConfig, error)
AddProject appends a project to the configuration on disk and returns the saved entry. It reloads first, so a project added here never clobbers a change made to the file since Sidecar started.
type ProjectsConfig ¶
type ProjectsConfig struct {
Mode string `json:"mode"` // "single" for now
Root string `json:"root"` // "." default
List []ProjectConfig `json:"list"` // list of configured projects for switcher
}
ProjectsConfig configures project detection and layout.
type QuietHoursConfig ¶ added in v1.11.0
type SSHNotificationsConfig ¶ added in v1.11.0
type SSHNotificationsConfig struct {
// ManagedHosts lets a local viewer deliver notifications forwarded by a
// registered remote host. It controls local consumption and delivery, not
// whether the read-only remote status stream exists.
ManagedHosts bool `json:"managedHosts,omitempty"`
// Terminal is the opt-in direct transport used when Sidecar itself runs in
// an ordinary SSH terminal with no local viewer attached.
Terminal TerminalNotifier `json:"terminal,omitempty"`
}
SSHNotificationsConfig covers the two independent remote-work paths. Both default off so an upgrade never moves remote notification text onto a local desktop, or starts writing escape sequences into a remote terminal, without the user asking for it.
type SelectionConfig ¶ added in v1.1.0
type SelectionConfig struct {
// CopyOnSelect copies a finished selection without a copy chord.
// Default: false — a selection that silently replaces the clipboard is the
// single most complained-about behaviour in the editors that ship it, so
// selecting and copying stay separate acts unless asked otherwise.
CopyOnSelect bool `json:"copyOnSelect,omitempty"`
}
SelectionConfig configures text selection across surfaces.
type SessionRestoreConfig ¶ added in v1.11.0
type SessionRestoreConfig struct {
// RecreateShells recreates managed shells that were confirmed live in the
// previous tmux server, under their own names and existing working
// directories. It never replays an arbitrary --run command. Default: true.
RecreateShells bool `json:"recreateShells"`
// ResumeAgents is off | ask | auto. Default: ask, which paints the restored
// shells and layout and then presents one grouped summary; nothing paid or
// agent-mutating happens until the user confirms or runs the CLI. auto is
// explicit standing authorization, and applies only to exact session
// references an official integration reported.
ResumeAgents string `json:"resumeAgents,omitempty"`
}
SessionRestoreConfig configures cold restore after a tmux server replacement.
The two settings are independent on purpose. Getting a terminal back in the right directory costs nothing and loses nothing, so it is on by default. Resuming a conversation starts a provider process that can spend money and change a repository, so it is a separate decision that defaults to asking.
type ShellsConfig ¶ added in v1.9.0
type ShellsConfig struct {
// TombstoneRetention is how long a forgotten shell record stays restorable
// before a later write drops it: a Go duration string ("336h", "90m"), a
// whole number of days ("14d"), or "forever" / "never" to keep forgotten
// records indefinitely.
//
// Empty or unreadable means DefaultTombstoneRetention. Expiring a tombstone
// also lets a still-running session of that name be adopted again, which is
// the point: after the window, Sidecar has no memory of the forget.
TombstoneRetention string `json:"tombstoneRetention,omitempty"`
}
ShellsConfig is the app-level `shells` section: policy for the shell records Sidecar owns in each project's shells.json.
It is app-level rather than a workspace-plugin setting because the records are written by every surface — the workspace plugin, the global Sessions browser, and `sidecar shell forget|restore` in a process with no plugins at all — and a retention window that only one of them honoured would not be a retention window.
Example:
"shells": {
"tombstoneRetention": "30d"
}
func (ShellsConfig) TombstoneRetentionWindow ¶ added in v1.9.0
func (c ShellsConfig) TombstoneRetentionWindow() time.Duration
TombstoneRetentionWindow resolves the configured retention into a duration. An unreadable value falls back to the default with a warning rather than failing the load — one bad duration must not cost the user their startup, and least of all their shell records.
type SidebarDisplayConfig ¶ added in v0.81.0
type SidebarDisplayConfig struct {
// HideRepoPrefix strips the repo name prefix from worktree names (e.g., "myrepo-feature" → "feature").
// Default: false (show full name).
HideRepoPrefix bool `json:"hideRepoPrefix"`
// HideAgent hides the agent type label (e.g., "claude") on the second line. Default: false.
HideAgent bool `json:"hideAgent"`
// HideTask hides the linked task ID (e.g., "td-abc123") on the second line. Default: false.
HideTask bool `json:"hideTask"`
// HideStats hides the +/- line change stats on the second line. Default: false.
HideStats bool `json:"hideStats"`
}
SidebarDisplayConfig controls visibility of workspace sidebar entry elements.
type SoundCue ¶ added in v1.11.0
type SoundCue string
SoundCue is the configured sound behavior for one notification source.
type SoundNotificationsConfig ¶ added in v1.11.0
type SoundNotificationsConfig struct {
Mode DeliveryMode `json:"mode,omitempty"`
AttentionPath string `json:"attentionPath,omitempty"`
DonePath string `json:"donePath,omitempty"`
FailurePath string `json:"failurePath,omitempty"`
}
type TDMonitorPluginConfig ¶
type TDMonitorPluginConfig struct {
Enabled bool `json:"enabled"`
RefreshInterval time.Duration `json:"refreshInterval"`
DBPath string `json:"dbPath"`
}
TDMonitorPluginConfig configures the TD monitor plugin.
type TasksPluginConfig ¶ added in v0.95.0
type TasksPluginConfig struct {
// Position was the anchor the Tasks tab was inserted after while Tasks was
// a project plugin. Tasks is now a tab of the global space (Agents,
// Workspaces, Tasks), whose order is fixed, so the value is accepted,
// validated, and preserved for older configs but no longer moves anything.
// One of TasksPositionAfterWorkspaces (default) or TasksPositionAfterNotes;
// unknown values are coerced back to the default by Validate.
Position string `json:"position,omitempty"`
}
TasksPluginConfig configures the embedded Tasks plugin.
Whether the plugin loads at all is governed by the "tasks_plugin" feature flag (default off), not by a field here — that keeps enablement on the same lever as the other opt-in surfaces (see internal/features).
There is deliberately no store/JSONL path: the embedded Tasks package uses Tasks' own configuration resolution.
type TerminalNotifier ¶ added in v1.11.0
type TerminalNotifier string
TerminalNotifier names the outer terminal Sidecar encodes a notification sequence for when it runs directly inside an SSH terminal. It selects a fixed encoder and nothing else: no command, TTY path, or raw escape is configurable.
const ( TerminalNotifierOff TerminalNotifier = "off" TerminalNotifierAuto TerminalNotifier = "auto" TerminalNotifierGhostty TerminalNotifier = "ghostty" TerminalNotifierITerm2 TerminalNotifier = "iterm2" TerminalNotifierWezTerm TerminalNotifier = "wezterm" TerminalNotifierKitty TerminalNotifier = "kitty" )
type TerminalResourceProviderConfig ¶ added in v1.0.3
type TerminalResourceProviderConfig struct {
// ID is unique and stable. It is the persisted provider key and the
// authoritative identity of the instance: a provider cannot rename itself.
ID string `json:"id"`
// Command is an argv array executed without a shell. The first element may
// be an absolute path or resolve through PATH.
Command []string `json:"command"`
// PassEnv names variables whose current values are inherited on top of the
// documented base environment. Names only — inline secret values are not
// supported, and a passed value is never logged or rendered.
PassEnv []string `json:"passEnv,omitempty"`
// Enabled defaults to true; a configured instance is on unless it says
// otherwise.
Enabled bool `json:"enabled"`
// Timeout is the per-resolve timeout, clamped to [1s, 60s].
Timeout time.Duration `json:"timeout,omitempty"`
// ClaimHosts lists hostnames whose built-in URL spans this instance may
// reclassify into resource spans. It is Sidecar instance configuration,
// never a provider protocol field: the provider does not know it exists.
//
// Matching is case-insensitive; entries are normalized to lowercase here.
// An entry must be a bare hostname — no scheme, no port, no path, no
// wildcard. Listing "github.com" claims exactly hosts equal to
// "github.com", not its subdomains and not every site a greedy pattern can
// reach: a URL is reclassified only when this instance's own matcher also
// matches the entire URL string.
//
// On a frame Sidecar's own Markdown renderer drew — a rendered preview, a
// note, a document pane — the whole-match test may instead be satisfied by
// the rendered link label. That is what lets an issue-key matcher claim
// `[ZMS-37161](https://<site>.atlassian.net/browse/ZMS-37161)`, whose key
// never appears in the destination in a shape any matcher recognizes. The
// host gate is unchanged: the destination still decides who may claim.
ClaimHosts []string `json:"claimHosts,omitempty"`
}
TerminalResourceProviderConfig is one configured provider instance.
type TerminalResourcesConfig ¶ added in v1.0.3
type TerminalResourcesConfig struct {
// Providers is ordered, and the order is matcher precedence.
Providers []TerminalResourceProviderConfig `json:"providers,omitempty"`
}
TerminalResourcesConfig is the app-level `terminalResources` section.
It is app-level rather than per-plugin because providers serve both the project Workspace and the global Workspaces browser, and neither owns them. It is also deliberately explicit: Sidecar never scans a plugin directory, never executes every sidecar-* binary on PATH, and never lets a repository declare a provider. A repository must not be able to cause Sidecar to run code merely by being opened.
A process boundary is crash isolation, not a sandbox. Enabling a provider trusts that executable with the user's full OS privileges.
func (TerminalResourcesConfig) DisabledProviderIDs ¶ added in v1.0.3
func (c TerminalResourcesConfig) DisabledProviderIDs() []string
DisabledProviderIDs returns the IDs of instances that are configured but off. They keep a diagnostic status and contribute no matchers.
func (TerminalResourcesConfig) EnabledProviders ¶ added in v1.0.3
func (c TerminalResourcesConfig) EnabledProviders() []TerminalResourceProviderConfig
EnabledProviders returns the enabled instances in configuration order.
type ThemeConfig ¶
type ThemeConfig struct {
Name string `json:"name"`
Community string `json:"community,omitempty"` // community scheme name (resolved at runtime)
Overrides map[string]interface{} `json:"overrides,omitempty"` // user customizations on top
}
ThemeConfig configures the color theme.
type UIConfig ¶
type UIConfig struct {
ShowClock bool `json:"showClock"`
Theme ThemeConfig `json:"theme"`
NerdFontsEnabled bool `json:"nerdFontsEnabled"` // enables Nerd Font glyphs (pill tabs, icons, etc.)
LastOpenInApp string `json:"lastOpenInApp,omitempty"` // global fallback for last app used to open projects
// TerminalTitle templates the terminal window/tab title. Supported
// variables: {project} {worktree} {plugin} {dir}. Empty disables retitling.
TerminalTitle string `json:"terminalTitle"`
}
UIConfig configures UI appearance.
type WorkspacePluginConfig ¶
type WorkspacePluginConfig struct {
// DirPrefix prefixes workspace directory names with the repo name (e.g., 'myrepo-feature-auth')
// This helps associate conversations with the repo after workspace deletion. Default: true.
DirPrefix bool `json:"dirPrefix"`
// DefaultAgentType sets the default agent family selected when creating a workspace.
// Uses workspace.AgentType values (e.g. "claude", "codex", "opencode", "grok").
DefaultAgentType string `json:"defaultAgentType,omitempty"`
// Agents is an ordered allowlist of agent type IDs shown in Create Shell, Create Worktree,
// and Start Agent pickers (e.g. ["claude","codex","grok"]). Empty/omitted shows all
// built-in UI agents. Unknown IDs are ignored. "None (attach only)" is always offered
// in pickers regardless of this list. Stored agent types on existing workspaces still
// resolve even if hidden from pickers.
Agents []string `json:"agents,omitempty"`
// AgentStart maps agent family (AgentType string) to default startup command.
// Example: {"claude":"claude", "opencode":"opencode --profile fast", "grok":"grok"}.
// Per-workspace .sidecar-agent-start still takes precedence when present.
AgentStart map[string]string `json:"agentStart,omitempty"`
// TmuxCaptureMaxBytes caps tmux pane capture size for the preview pane. Default: 2MB.
TmuxCaptureMaxBytes int `json:"tmuxCaptureMaxBytes"`
// TerminalBackgrounds controls how background colors carried in captured
// pane output render:
//
// - "auto" (default) keeps canvas detection: when one background covers
// nearly every painted row of the live grid, default-background cells
// are filled with it so a fullscreen TUI shows no seams.
// - "bounded" renders short background spans (diffs, highlights, a
// few-line block) but drops the background of any run longer than
// TerminalBackgroundSpanMax consecutive rows. An application that
// paints most of its output one color degrades to plain text instead of
// repainting the whole pane.
// - "never" drops every carried background; rows render as plain text.
//
// Unknown values fall back to "auto".
TerminalBackgrounds string `json:"terminalBackgrounds,omitempty"`
// TerminalBackgroundSpanMax is the row cap for "bounded" mode. Default: 12.
TerminalBackgroundSpanMax int `json:"terminalBackgroundSpanMax,omitempty"`
// ResizeDebounceMs is the shared interval for live-pane SIGWINCH during
// layout motion (divider drag, interactive correction). Default: 300.
// 0 restores per-event paint and poll-driven resize. Negative values
// become 300. Unlike TmuxCaptureMaxBytes, 0 is not treated as unset.
ResizeDebounceMs int `json:"resizeDebounceMs"`
// AutoCreateShell creates a shell session the first time the workspaces tab is
// focused in a session, when no shell sessions exist yet. The shell honors
// DefaultAgentType; with none set it is a plain shell. Default: false.
AutoCreateShell bool `json:"autoCreateShell"`
// InteractiveExitKey is the keybinding to exit interactive mode. Default: "ctrl+\".
// Examples: "ctrl+]", "ctrl+\\", "ctrl+x"
InteractiveExitKey string `json:"interactiveExitKey,omitempty"`
// InteractiveAttachKey is the keybinding to attach from interactive mode. Default: "ctrl+]".
// When pressed in interactive mode, exits interactive and attaches to the tmux session.
InteractiveAttachKey string `json:"interactiveAttachKey,omitempty"`
// InteractiveCopyKey is the keybinding to copy selection in interactive mode. Default: "alt+c".
InteractiveCopyKey string `json:"interactiveCopyKey,omitempty"`
// InteractivePasteKey is the keybinding to paste clipboard in interactive mode. Default: "alt+v".
InteractivePasteKey string `json:"interactivePasteKey,omitempty"`
// CopyOnSelect copies terminal selections when a drag completes. Default: false.
CopyOnSelect bool `json:"copyOnSelect,omitempty"`
// OverviewWorktreeScope controls whether activating a worktree on the cross-project
// Overview enters the project root or scopes Sidecar to that worktree. Valid values
// are "project" (the default) and "worktree".
OverviewWorktreeScope string `json:"overviewWorktreeScope,omitempty"`
// SidebarDisplay controls what information is shown in the workspace sidebar entries.
SidebarDisplay SidebarDisplayConfig `json:"sidebarDisplay"`
// WorktreeSetup controls repository artifacts Sidecar may copy or execute when
// creating a worktree. The creation confirmation always names the discovered
// files and hook and requires an explicit per-operation selection.
WorktreeSetup WorktreeSetupConfig `json:"worktreeSetup"`
// SessionRestore controls what happens on the first Sidecar start after the
// tmux server that was hosting the managed shells has been replaced.
SessionRestore SessionRestoreConfig `json:"sessionRestore"`
}
WorkspacePluginConfig configures the workspace plugin.
type WorktreeSetupConfig ¶ added in v0.94.0
type WorktreeSetupConfig struct {
CopyEnvFiles bool `json:"copyEnvFiles"`
EnvFiles []string `json:"envFiles,omitempty"`
RunHook bool `json:"runHook"`
HookPath string `json:"hookPath,omitempty"`
HookRequired bool `json:"hookRequired"`
}
WorktreeSetupConfig configures the optional setup phase after git creates a worktree. Paths are relative to the canonical main worktree.