Skip to content
Draft
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
3 changes: 2 additions & 1 deletion src/app/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ pub(super) fn runtime_hosts_agent(

fn live_runtime_agent(runtime: &crate::terminal::TerminalRuntime) -> Option<crate::detect::Agent> {
let job = crate::detect::foreground_job(runtime.child_pid()?)?;
crate::detect::identify_agent_in_job(&job)
let wrappers = crate::detect::detection_wrappers();
crate::detect::identify_agent_in_job(&job, &wrappers)
.map(|(agent, _)| agent)
.or_else(|| {
job.processes
Expand Down
1 change: 1 addition & 0 deletions src/config/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use super::{model::LoadedConfig, Config, CONFIG_PATH_ENV_VAR};

const KNOWN_TOP_LEVEL_CONFIG_KEYS: &[&str] = &[
"advanced",
"detection",
"experimental",
"keys",
"onboarding",
Expand Down
14 changes: 13 additions & 1 deletion src/config/model.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::BTreeSet, num::NonZeroUsize};
use std::{collections::BTreeSet, collections::HashMap, num::NonZeroUsize};

use crossterm::event::KeyModifiers;
use serde::{de, Deserialize, Deserializer, Serialize};
Expand Down Expand Up @@ -284,6 +284,17 @@ pub fn validated_sidebar_bounds(min: u16, max: u16) -> Option<(u16, u16)> {
}
}

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
pub struct DetectionConfig {
/// Map of wrapper process names to detection strategy.
/// Value `"inspect"` scans the wrapper's argv for a known agent name.
/// Value `"inspect:<agent>"` does the same but falls back to `<agent>` if nothing found.
/// Any other value is a fixed agent label (e.g. `"claude"`).
#[serde(default)]
pub wrappers: HashMap<String, String>,
}

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
pub struct Config {
Expand All @@ -298,6 +309,7 @@ pub struct Config {
pub advanced: AdvancedConfig,
pub experimental: ExperimentalConfig,
pub remote: RemoteConfig,
pub detection: DetectionConfig,
}

#[derive(Debug)]
Expand Down
Loading