diff options
Diffstat (limited to 'makima/src/daemon/config.rs')
| -rw-r--r-- | makima/src/daemon/config.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/makima/src/daemon/config.rs b/makima/src/daemon/config.rs index 9a00166..b7cb1e8 100644 --- a/makima/src/daemon/config.rs +++ b/makima/src/daemon/config.rs @@ -223,6 +223,48 @@ pub struct ProcessConfig { /// Set to 0 to disable. Default: 300 (5 minutes). #[serde(default = "default_heartbeat_commit_interval", alias = "heartbeatcommitintervalsecs")] pub heartbeat_commit_interval_secs: u64, + + /// Checkpoint patch storage configuration for task recovery. + #[serde(default)] + pub checkpoint_patches: CheckpointPatchConfig, +} + +/// Configuration for checkpoint patch storage in PostgreSQL. +/// Patches are stored to enable task recovery when local worktrees are lost. +#[derive(Debug, Clone, Deserialize)] +#[serde(default)] +pub struct CheckpointPatchConfig { + /// Enable patch storage in PostgreSQL (default: true). + #[serde(default = "default_true")] + pub enabled: bool, + + /// Maximum patch size in bytes (default: 10MB). + /// Patches larger than this will not be stored. + #[serde(default = "default_max_patch_size", alias = "maxpatchsizebytes")] + pub max_patch_size_bytes: usize, + + /// TTL for patches in hours (default: 168 = 7 days). + /// Patches older than this will be automatically cleaned up. + #[serde(default = "default_patch_ttl_hours", alias = "ttlhours")] + pub ttl_hours: u64, +} + +fn default_max_patch_size() -> usize { + 10 * 1024 * 1024 // 10MB +} + +fn default_patch_ttl_hours() -> u64 { + 168 // 7 days +} + +impl Default for CheckpointPatchConfig { + fn default() -> Self { + Self { + enabled: true, + max_patch_size_bytes: default_max_patch_size(), + ttl_hours: default_patch_ttl_hours(), + } + } } fn default_claude_command() -> String { @@ -255,6 +297,7 @@ impl Default for ProcessConfig { env_vars: HashMap::new(), bubblewrap: BubblewrapConfig::default(), heartbeat_commit_interval_secs: default_heartbeat_commit_interval(), + checkpoint_patches: CheckpointPatchConfig::default(), } } } @@ -576,6 +619,7 @@ impl DaemonConfig { env_vars: HashMap::new(), bubblewrap: BubblewrapConfig::default(), heartbeat_commit_interval_secs: 300, + checkpoint_patches: CheckpointPatchConfig::default(), }, local_db: LocalDbConfig { path: PathBuf::from("/tmp/makima-daemon-test/state.db"), |
