BlueGit

ict rusty-teams

Files

rusty-teams / crates / agents / src / profile.rs

profile.rs

profile.rs 2.3 KiB Download Raw
1use serde::{Deserialize, Serialize};
2
3const CLAUDE_COMMAND: &str =
4 "claude -p --output-format stream-json --verbose --session-id {session_id}";
5const COPILOT_COMMAND: &str = "copilot -p {prompt} --output-format json --session-id {session_id}";
6
7#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
8pub enum Environment {
9 #[default]
10 Host,
11 Wsl {
12 distro: Option<String>,
13 },
14}
15
16#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
17pub enum OutputFormat {
18 #[default]
19 ClaudeStreamJson,
20 CopilotJsonl,
21 Text,
22}
23
24#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
25#[serde(default)]
26pub struct AgentProfile {
27 pub id: String,
28 pub name: String,
29 pub environment: Environment,
30 pub command: String,
31 pub output: OutputFormat,
32 pub open_session_command: String,
33 pub mcp_config_flag: String,
34}
35
36impl AgentProfile {
37 pub fn claude_wsl() -> Self {
38 Self {
39 id: "claude".to_string(),
40 name: "Claude Code (WSL)".to_string(),
41 environment: Environment::Wsl { distro: None },
42 command: CLAUDE_COMMAND.to_string(),
43 output: OutputFormat::ClaudeStreamJson,
44 open_session_command: "wt.exe wsl.exe --cd {cwd} -e claude --resume {session_id}"
45 .to_string(),
46 mcp_config_flag: "--mcp-config".to_string(),
47 }
48 }
49
50 pub fn claude_host() -> Self {
51 Self {
52 id: "claude-host".to_string(),
53 name: "Claude Code".to_string(),
54 environment: Environment::Host,
55 command: CLAUDE_COMMAND.to_string(),
56 output: OutputFormat::ClaudeStreamJson,
57 open_session_command: "wt.exe -d {cwd} claude --resume {session_id}".to_string(),
58 mcp_config_flag: "--mcp-config".to_string(),
59 }
60 }
61
62 pub fn copilot_wsl() -> Self {
63 Self {
64 id: "copilot".to_string(),
65 name: "Copilot CLI (WSL)".to_string(),
66 environment: Environment::Wsl { distro: None },
67 command: COPILOT_COMMAND.to_string(),
68 output: OutputFormat::CopilotJsonl,
69 open_session_command: "wt.exe wsl.exe --cd {cwd} -e copilot --resume {session_id}"
70 .to_string(),
71 mcp_config_flag: "--additional-mcp-config".to_string(),
72 }
73 }
74}