Skip to main content

par_term_config/config/
acp.rs

1//! ACP (Agent Communication Protocol) agent configuration types.
2//!
3//! These types are used to configure custom ACP agents in `config.yaml`
4//! under the `ai_inspector_custom_agents` key.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8
9fn default_acp_protocol() -> String {
10    "acp".to_string()
11}
12
13fn default_acp_type() -> String {
14    "coding".to_string()
15}
16
17/// Action metadata for a custom ACP agent entry.
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
19pub struct CustomAcpAgentActionConfig {
20    #[serde(default)]
21    pub command: Option<String>,
22    #[serde(default)]
23    pub description: Option<String>,
24}
25
26/// User-defined ACP agent configuration sourced from `config.yaml`.
27#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
28pub struct CustomAcpAgentConfig {
29    pub identity: String,
30    pub name: String,
31    pub short_name: String,
32    #[serde(default = "default_acp_protocol")]
33    pub protocol: String,
34    #[serde(default = "default_acp_type")]
35    pub r#type: String,
36    #[serde(default)]
37    pub active: Option<bool>,
38    pub run_command: HashMap<String, String>,
39    #[serde(default)]
40    pub env: HashMap<String, String>,
41    #[serde(default)]
42    pub ollama_context_length: Option<u32>,
43    #[serde(default)]
44    pub install_command: Option<String>,
45    #[serde(default)]
46    pub actions: HashMap<String, HashMap<String, CustomAcpAgentActionConfig>>,
47}