Skip to main content

walrus_daemon/hook/system/
mod.rs

1//! System subsystem — task executor and memory configuration.
2//!
3//! Groups `[system.tasks]` and `[system.memory]` config under a single
4//! `SystemConfig` struct. Task registry and tool dispatch live in `task/`.
5
6use serde::{Deserialize, Serialize};
7
8pub mod memory;
9pub mod task;
10
11/// Top-level `[system]` configuration.
12#[derive(Debug, Clone, Serialize, Deserialize, Default)]
13#[serde(default)]
14pub struct SystemConfig {
15    /// The default system agent config (model, heartbeat, thinking).
16    pub walrus: wcore::AgentConfig,
17    /// Task executor pool configuration (`[system.tasks]`).
18    pub tasks: TasksConfig,
19    /// Built-in memory configuration (`[system.memory]`).
20    pub memory: MemoryConfig,
21}
22
23/// Task executor pool configuration.
24#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(default)]
26pub struct TasksConfig {
27    /// Maximum number of concurrently InProgress tasks (default 4).
28    pub max_concurrent: usize,
29    /// Maximum number of tasks returned by queries (default 16).
30    pub viewable_window: usize,
31    /// Per-task execution timeout in seconds (default 300).
32    pub task_timeout: u64,
33}
34
35impl Default for TasksConfig {
36    fn default() -> Self {
37        Self {
38            max_concurrent: 4,
39            viewable_window: 16,
40            task_timeout: 300,
41        }
42    }
43}
44
45/// Built-in memory configuration.
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(default)]
48pub struct MemoryConfig {
49    /// Maximum entries returned by auto-recall (default 5).
50    pub recall_limit: usize,
51    /// Whether the agent can edit Walrus.md via the soul tool (default true).
52    pub soul_editable: bool,
53}
54
55impl Default for MemoryConfig {
56    fn default() -> Self {
57        Self {
58            recall_limit: 5,
59            soul_editable: true,
60        }
61    }
62}