aboutsummaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-23 21:27:26 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-23 21:37:05 +0300
commitdb67e9d74ffafc9c63bdf78fcf712419359f634b (patch)
tree9d181b55e65aaf6a2fad2d6cf785bb09a8d9748f /src/config
parent1bab1d2ce21507747ea1f506fb891fe7cd5a13c9 (diff)
feat: restore agent sessions
refs #233
Diffstat (limited to 'src/config')
-rw-r--r--src/config/io.rs23
-rw-r--r--src/config/model.rs22
2 files changed, 45 insertions, 0 deletions
diff --git a/src/config/io.rs b/src/config/io.rs
index fe415d1c..2c6d78ab 100644
--- a/src/config/io.rs
+++ b/src/config/io.rs
@@ -175,6 +175,14 @@ fn load_live_config_from_str(content: &str) -> Result<LoadedConfig, Vec<String>>
);
load_live_section(
table,
+ "session",
+ "session config",
+ &mut diagnostics,
+ &mut invalid_sections,
+ |section| config.session = section,
+ );
+ load_live_section(
+ table,
"ui",
"ui config",
&mut diagnostics,
@@ -464,6 +472,21 @@ mod tests {
}
#[test]
+ fn load_live_config_parses_session_section() {
+ let loaded = load_live_config_from_str(
+ r#"
+[session]
+resume_agents_on_restore = true
+"#,
+ )
+ .unwrap();
+
+ assert!(loaded.config.session.resume_agents_on_restore);
+ assert!(loaded.diagnostics.is_empty());
+ assert!(loaded.invalid_sections.is_empty());
+ }
+
+ #[test]
fn remove_keybinding_config_sections_removes_keys_tables_only() {
let content = r#"onboarding = false
diff --git a/src/config/model.rs b/src/config/model.rs
index 68a55b0f..8894b300 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -72,6 +72,14 @@ pub struct TerminalConfig {
pub new_cwd: NewTerminalCwdConfig,
}
+#[derive(Debug, Default, Deserialize)]
+#[serde(default)]
+pub struct SessionConfig {
+ /// Resume supported AI-agent panes into their native conversation sessions
+ /// when restoring a Herdr session. Default: false.
+ pub resume_agents_on_restore: bool,
+}
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ConfigReloadStatus {
@@ -105,6 +113,7 @@ pub struct Config {
pub onboarding: Option<bool>,
pub theme: ThemeConfig,
pub terminal: TerminalConfig,
+ pub session: SessionConfig,
pub keys: KeysConfig,
pub ui: UiConfig,
pub worktrees: WorktreesConfig,
@@ -490,6 +499,19 @@ new_cwd = "~/Projects"
}
#[test]
+ fn resume_agents_on_restore_defaults_off_and_parses() {
+ let default_config = Config::default();
+ assert!(!default_config.session.resume_agents_on_restore);
+
+ let toml = r#"
+[session]
+resume_agents_on_restore = true
+"#;
+ let config: Config = toml::from_str(toml).unwrap();
+ assert!(config.session.resume_agents_on_restore);
+ }
+
+ #[test]
fn agent_panel_scope_config_parses() {
let toml = r#"
[ui]