the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
feat: add background update check toggles
Ogulcan Celik9f4f1630893f
diff --git a/docs/next/website/src/content/docs/agents.mdx b/docs/next/website/src/content/docs/agents.mdxindex 3215f64f8..249be7025 100644--- a/docs/next/website/src/content/docs/agents.mdx+++ b/docs/next/website/src/content/docs/agents.mdx@@ -51,7 +51,7 @@ This means unusual new agent prompts may initially show as `idle` instead of `bl## Detection manifests-Bundled manifests live inside Herdr. Herdr also checks herdr.dev for remote manifest updates and applies valid per-agent rule updates automatically without requiring a Herdr restart. Remote manifests are stored in Herdr's state directory.+Bundled manifests live inside Herdr. Herdr also checks herdr.dev for remote manifest updates and applies valid per-agent rule updates automatically without requiring a Herdr restart. Remote manifests are stored in Herdr's state directory. Set `[update] manifest_check = false` to disable background remote manifest checks.Local overrides can replace a remote or bundled manifest from the platform config directory:diff --git a/docs/next/website/src/content/docs/configuration.mdx b/docs/next/website/src/content/docs/configuration.mdxindex 987b6973a..facfd1d1a 100644--- a/docs/next/website/src/content/docs/configuration.mdx+++ b/docs/next/website/src/content/docs/configuration.mdx@@ -33,17 +33,23 @@ Herdr shows first-run setup when `onboarding` is missing or true. Continuing froonboarding = false```-## Update channel+## UpdatesLinux and macOS direct installs use the stable update channel by default. Windows beta installs default to preview and cannot switch to stable until stable Windows releases are available.```toml[update]channel = "stable"+version_check = true+manifest_check = true```Set `channel = "preview"` to make `herdr update` install manually published preview builds from the current development branch. Homebrew, mise, and Nix installs ignore the preview channel and update through their package managers.+Set `version_check = false` to disable background checks for new Herdr versions. Manual `herdr update` still uses the configured channel.++Set `manifest_check = false` to disable background remote agent-detection manifest checks. Herdr still uses bundled manifests and local overrides.+## Reload configReload a running server after editing `config.toml`:diff --git a/src/app/mod.rs b/src/app/mod.rsindex dbc2d4169..a24267e5c 100644--- a/src/app/mod.rs+++ b/src/app/mod.rs@@ -115,6 +115,8 @@ pub struct App {pub(crate) next_animation_tick: Option<Instant>,pub(crate) next_auto_update_check: Option<Instant>,pub(crate) next_agent_manifest_update_check: Option<Instant>,+ pub(crate) update_version_check_enabled: bool,+ pub(crate) update_manifest_check_enabled: bool,pub(crate) agent_metadata_deadline: Option<Instant>,pub(crate) pending_agent_resume_deadline: Option<Instant>,pub(crate) selection_autoscroll_deadline: Option<Instant>,@@ -190,6 +192,10 @@ fn auto_updates_enabled(no_session: bool) -> bool {!no_session && !cfg!(debug_assertions)}+fn background_update_check_enabled(no_session: bool, check_enabled: bool) -> bool {+ auto_updates_enabled(no_session) && check_enabled+}+fn load_plugin_registry(no_session: bool) -> crate::app::state::InstalledPluginRegistry {if no_session {return std::collections::HashMap::new();@@ -646,9 +652,15 @@ impl App {// Background auto-update is disabled in monolithic no-session mode// and in debug/test builds so local development never mutates the// running binary out from under spawned test processes.- if auto_updates_enabled(no_session) {+ let version_check_enabled =+ background_update_check_enabled(no_session, config.update.version_check);+ let manifest_check_enabled =+ background_update_check_enabled(no_session, config.update.manifest_check);+ if version_check_enabled {let update_tx = event_tx.clone();std::thread::spawn(move || crate::update::auto_update(update_tx));+ }+ if manifest_check_enabled {let manifest_update_tx = event_tx.clone();std::thread::spawn(move || {crate::detect::manifest_update::auto_update(manifest_update_tx)@@ -679,10 +691,12 @@ impl App {last_pane_click: None,next_resize_poll: Instant::now() + RESIZE_POLL_INTERVAL,next_animation_tick: None,- next_auto_update_check: auto_updates_enabled(no_session)+ next_auto_update_check: version_check_enabled.then_some(Instant::now() + AUTO_UPDATE_CHECK_INTERVAL),- next_agent_manifest_update_check: auto_updates_enabled(no_session)+ next_agent_manifest_update_check: manifest_check_enabled.then_some(Instant::now() + AUTO_UPDATE_CHECK_INTERVAL),+ update_version_check_enabled: config.update.version_check,+ update_manifest_check_enabled: config.update.manifest_check,agent_metadata_deadline: None,pending_agent_resume_deadline: None,session_save_deadline: None,@@ -733,13 +747,15 @@ impl App {let pane_id_aliases = crate::persist::handoff_pane_aliases(snapshot, &workspaces);app.no_session = false;- if auto_updates_enabled(app.no_session) {- let now = Instant::now();+ let now = Instant::now();+ if background_update_check_enabled(app.no_session, app.update_version_check_enabled) {app.next_auto_update_check = app.state.update_available.is_none().then_some(now + AUTO_UPDATE_CHECK_INTERVAL);+ }+ if background_update_check_enabled(app.no_session, app.update_manifest_check_enabled) {app.next_agent_manifest_update_check = Some(now + AUTO_UPDATE_CHECK_INTERVAL);}app.state.detach_exits = false;@@ -1344,6 +1360,37 @@ impl App {self.state.pane_scrollback_limit_bytes = config.advanced.scrollback_limit_bytes;}+ if !invalid_section("update") {+ let now = Instant::now();+ let previous_version_check_enabled = self.update_version_check_enabled;+ let previous_manifest_check_enabled = self.update_manifest_check_enabled;+ self.update_version_check_enabled = config.update.version_check;+ self.update_manifest_check_enabled = config.update.manifest_check;++ if !self.update_version_check_enabled {+ self.next_auto_update_check = None;+ } else if !previous_version_check_enabled+ && background_update_check_enabled(+ self.no_session,+ self.update_version_check_enabled,+ )+ && self.state.update_available.is_none()+ {+ self.next_auto_update_check = Some(now);+ }++ if !self.update_manifest_check_enabled {+ self.next_agent_manifest_update_check = None;+ } else if !previous_manifest_check_enabled+ && background_update_check_enabled(+ self.no_session,+ self.update_manifest_check_enabled,+ )+ {+ self.next_agent_manifest_update_check = Some(now);+ }+ }+if !invalid_section("terminal") {self.state.default_shell = config.terminal.default_shell.clone();self.state.shell_mode = config.terminal.shell_mode;@@ -2332,12 +2379,14 @@ mod tests {std::fs::create_dir_all(path.parent().unwrap()).unwrap();std::fs::write(&path,- "[terminal]\ndefault_shell = \"nu\"\nshell_mode = \"non_login\"\nnew_cwd = \"home\"\n[keys]\nnew_workspace = \"prefix+m\"\nprefix = \"ctrl+a\"\n[ui]\nagent_panel_scope = \"current\"\nagent_panel_sort = \"priority\"\nredraw_on_focus_gained = false\nright_click_passthrough_modifier = \"ctrl\"\n[ui.toast]\ndelivery = \"herdr\"\n[experimental]\nswitch_ascii_input_source_in_prefix = true\n",+ "[terminal]\ndefault_shell = \"nu\"\nshell_mode = \"non_login\"\nnew_cwd = \"home\"\n[keys]\nnew_workspace = \"prefix+m\"\nprefix = \"ctrl+a\"\n[update]\nversion_check = false\nmanifest_check = false\n[ui]\nagent_panel_scope = \"current\"\nagent_panel_sort = \"priority\"\nredraw_on_focus_gained = false\nright_click_passthrough_modifier = \"ctrl\"\n[ui.toast]\ndelivery = \"herdr\"\n[experimental]\nswitch_ascii_input_source_in_prefix = true\n",).unwrap();std::env::set_var(crate::config::CONFIG_PATH_ENV_VAR, &path);let mut app = test_app();+ app.next_auto_update_check = Some(Instant::now());+ app.next_agent_manifest_update_check = Some(Instant::now());let report = app.reload_config();assert_eq!(report.status, crate::config::ConfigReloadStatus::Applied);@@ -2368,6 +2417,10 @@ mod tests {app.state.new_terminal_cwd,crate::config::NewTerminalCwdConfig::Home);+ assert!(!app.update_version_check_enabled);+ assert!(!app.update_manifest_check_enabled);+ assert!(app.next_auto_update_check.is_none());+ assert!(app.next_agent_manifest_update_check.is_none());assert!(app.state.switch_ascii_input_source_in_prefix);assert!(app.state.config_diagnostic.is_none());let toast = app.state.toast.as_ref().unwrap();diff --git a/src/app/runtime.rs b/src/app/runtime.rsindex 097f1aceb..6ef9a7861 100644--- a/src/app/runtime.rs+++ b/src/app/runtime.rs@@ -3,7 +3,7 @@ use std::time::{Duration, Instant};use crossterm::terminal;use super::{- auto_updates_enabled, repeat_key_identity, App, Mode, ANIMATION_INTERVAL,+ background_update_check_enabled, repeat_key_identity, App, Mode, ANIMATION_INTERVAL,AUTO_UPDATE_CHECK_INTERVAL, GIT_REMOTE_STATUS_REFRESH_INTERVAL, MIN_RENDER_INTERVAL,RESIZE_POLL_INTERVAL, SELECTION_AUTOSCROLL_INTERVAL,};@@ -432,7 +432,7 @@ impl App {}pub(crate) fn run_auto_update_check(&mut self) {- if !auto_updates_enabled(self.no_session) {+ if !background_update_check_enabled(self.no_session, self.update_version_check_enabled) {self.next_auto_update_check = None;return;}@@ -452,7 +452,7 @@ impl App {}pub(crate) fn run_agent_manifest_update_check(&mut self) {- if !auto_updates_enabled(self.no_session) {+ if !background_update_check_enabled(self.no_session, self.update_manifest_check_enabled) {self.next_agent_manifest_update_check = None;return;}diff --git a/src/config/model.rs b/src/config/model.rsindex 7b1e7bb7c..d07a425fb 100644--- a/src/config/model.rs+++ b/src/config/model.rs@@ -30,14 +30,17 @@ impl UpdateChannelConfig {#[derive(Debug, Clone, Copy, Deserialize)]#[serde(default)]pub struct UpdateConfig {- #[serde(default = "default_update_channel")]pub channel: UpdateChannelConfig,+ pub version_check: bool,+ pub manifest_check: bool,}impl Default for UpdateConfig {fn default() -> Self {Self {channel: default_update_channel(),+ version_check: true,+ manifest_check: true,}}}@@ -728,17 +731,23 @@ mod tests {use super::*;#[test]- fn update_channel_defaults_for_platform_and_parses() {+ fn update_config_defaults_and_parses() {let default_config = Config::default();assert_eq!(default_config.update.channel, default_update_channel());+ assert!(default_config.update.version_check);+ assert!(default_config.update.manifest_check);let toml = r#"[update]channel = "preview"+version_check = false+manifest_check = false"#;let config: Config = toml::from_str(toml).unwrap();assert_eq!(config.update.channel, UpdateChannelConfig::Preview);assert_eq!(config.update.channel.as_str(), "preview");+ assert!(!config.update.version_check);+ assert!(!config.update.manifest_check);}#[test]diff --git a/src/main.rs b/src/main.rsindex 3c66ff1d7..193e24d83 100644--- a/src/main.rs+++ b/src/main.rs@@ -143,10 +143,16 @@ const DEFAULT_CONFIG: &str = r##"# herdr configuration# new_cwd = "follow"[update]-# Update channel used by background checks and `herdr update`.+# Update channel used by background version checks and `herdr update`.# Use "stable" for normal releases or "preview" for opt-in preview builds.# channel = "stable"+# Check herdr.dev for new Herdr versions in the background.+# version_check = true++# Check herdr.dev for remote agent-detection manifest updates in the background.+# manifest_check = true+[keys]# Prefix key to enter prefix mode (default: "ctrl+b")# Examples: "ctrl+b", "f12", "esc", "-"