Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/agentsight/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ struct JsonFullConfig {
#[serde(default)]
deadloop: Option<JsonDeadloop>,
#[serde(default)]
reactive: Option<JsonReactive>,
#[serde(default)]
cgroup_filter_enabled: Option<bool>,
#[serde(default)]
cgroup_ids: Option<Vec<u64>>,
Expand Down Expand Up @@ -348,6 +350,17 @@ pub struct JsonRuntime {
pub sls_logtail_path: Option<String>,
}

/// Reactive exporter configuration section
#[derive(serde::Deserialize, Clone, Debug)]
struct JsonReactive {
#[serde(default)]
enabled: Option<bool>,
#[serde(default)]
debounce_secs: Option<u64>,
#[serde(default)]
workspace: Option<String>,
}

/// 加密配置:可选公钥(PEM 字符串)或公钥文件路径
#[derive(serde::Deserialize)]
struct JsonEncryption {
Expand Down Expand Up @@ -747,6 +760,14 @@ pub struct AgentsightConfig {
// --- Runtime Resource Limits ---
/// Bounded channel capacities, pending queue limits, etc.
pub runtime_limits: RuntimeLimits,

// --- Reactive Exporter Configuration ---
/// Enable the reactive exporter (observe→act pipeline)
pub reactive_enabled: Option<bool>,
/// Minimum seconds between consecutive checkpoint actions
pub reactive_debounce_secs: Option<u64>,
/// Workspace path for ws-ckpt checkpoint
pub reactive_workspace: Option<String>,
}

impl Default for AgentsightConfig {
Expand Down Expand Up @@ -821,6 +842,11 @@ impl Default for AgentsightConfig {

// Runtime resource limits
runtime_limits: RuntimeLimits::default(),

// Reactive exporter defaults (disabled by default)
reactive_enabled: None,
reactive_debounce_secs: None,
reactive_workspace: None,
}
}
}
Expand Down Expand Up @@ -961,6 +987,13 @@ impl AgentsightConfig {
}
}

// 解析 reactive exporter 配置
if let Some(ref r) = parsed.reactive {
self.reactive_enabled = r.enabled;
self.reactive_debounce_secs = r.debounce_secs;
self.reactive_workspace = r.workspace.clone();
}

// Parse cgroup filter settings
if let Some(v) = parsed.cgroup_filter_enabled {
self.cgroup_filter_enabled = v;
Expand Down Expand Up @@ -1796,4 +1829,22 @@ mod tests {
assert!(config.features.token_consumption_enabled);
assert!(config.features.sls_logtail_enabled);
}

#[test]
fn test_load_reactive_config() {
let dir = std::env::temp_dir().join(format!("test_reactive_{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("agentsight.json");
std::fs::write(
&path,
r#"{"reactive": {"enabled": true, "debounce_secs": 10, "workspace": "/home/test"}}"#,
)
.unwrap();
let mut config = AgentsightConfig::default();
config.load_from_file(&path).unwrap();
assert_eq!(config.reactive_enabled, Some(true));
assert_eq!(config.reactive_debounce_secs, Some(10));
assert_eq!(config.reactive_workspace, Some("/home/test".to_string()));
std::fs::remove_dir_all(&dir).ok();
}
}
1 change: 1 addition & 0 deletions src/agentsight/src/genai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod id_resolver;
pub mod instance_id;
pub mod logtail;
mod openai_parse;
pub mod reactive;
pub mod semantic;
pub mod storage;

Expand Down
Loading
Loading