Skip to main content

crabtalk_runtime/
config.rs

1//! System subsystem — task executor and memory configuration.
2
3use serde::{Deserialize, Serialize};
4
5/// Top-level `[system]` configuration.
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7#[serde(default)]
8pub struct SystemConfig {
9    /// The default system agent config (model, thinking, etc.).
10    pub crab: wcore::AgentConfig,
11    /// Task executor pool configuration (`[system.tasks]`).
12    pub tasks: TasksConfig,
13    /// Built-in memory configuration (`[system.memory]`).
14    pub memory: MemoryConfig,
15}
16
17/// Task executor pool configuration.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(default)]
20pub struct TasksConfig {
21    /// Maximum number of concurrently InProgress tasks (default 4).
22    pub max_concurrent: usize,
23    /// Maximum number of tasks returned by queries (default 16).
24    pub viewable_window: usize,
25    /// Per-task execution timeout in seconds (default 300).
26    pub task_timeout: u64,
27}
28
29impl Default for TasksConfig {
30    fn default() -> Self {
31        Self {
32            max_concurrent: 4,
33            viewable_window: 16,
34            task_timeout: 300,
35        }
36    }
37}
38
39/// Built-in memory configuration.
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(default)]
42pub struct MemoryConfig {
43    /// Maximum entries returned by auto-recall (default 5).
44    pub recall_limit: usize,
45}
46
47impl Default for MemoryConfig {
48    fn default() -> Self {
49        Self { recall_limit: 5 }
50    }
51}