彻底删除支持不完整的Agent和相关代码,减轻维护工作量,等后续真正适配好了再加回来

This commit is contained in:
xintaofei
2026-03-17 18:10:31 +08:00
parent 63814381d7
commit 879d96f5a4
11 changed files with 19 additions and 1038 deletions

View File

@@ -169,22 +169,6 @@ async fn build_agent(
let refs: Vec<&str> = parts.iter().map(|s| s.as_str()).collect();
AcpAgent::from_args(&refs).map_err(|e| AcpError::SpawnFailed(e.to_string()))
}
AgentDistribution::Uvx {
package, args, env, ..
} => {
let merged_env = merge_agent_env(env, runtime_env);
let mut parts: Vec<String> = Vec::new();
for (k, v) in &merged_env {
parts.push(format!("{k}={v}"));
}
parts.push("uvx".into());
parts.push(package.into());
for a in args {
parts.push((*a).into());
}
let refs: Vec<&str> = parts.iter().map(|s| s.as_str()).collect();
AcpAgent::from_args(&refs).map_err(|e| AcpError::SpawnFailed(e.to_string()))
}
AgentDistribution::Binary {
version,
cmd,

View File

@@ -9,10 +9,6 @@ use crate::models::agent::AgentType;
/// Stores `Some(checks)` after a successful (all-pass) run;
/// stays `None` if checks failed so they are retried next time.
static NPX_ENV_CACHE: Mutex<Option<Vec<CheckItem>>> = Mutex::new(None);
/// Cache for UVX environment check results.
/// Stores `Some(checks)` after a successful (all-pass) run;
/// stays `None` if checks failed so they are retried next time.
static UVX_ENV_CACHE: Mutex<Option<Vec<CheckItem>>> = Mutex::new(None);
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "snake_case")]
@@ -57,7 +53,6 @@ pub async fn run_preflight(agent_type: AgentType) -> PreflightResult {
debug_assert_eq!(meta.agent_type, agent_type);
let checks = match &meta.distribution {
AgentDistribution::Npx { node_required, .. } => check_npx_environment(*node_required).await,
AgentDistribution::Uvx { .. } => check_uvx_environment().await,
AgentDistribution::Binary {
version,
cmd,
@@ -259,81 +254,6 @@ fn build_node_version_check(current_version: Option<&str>, required: &str) -> Ch
}
}
async fn check_uvx_environment() -> Vec<CheckItem> {
// Return cached result if a previous check passed
let cached = UVX_ENV_CACHE.lock().unwrap().clone();
if let Some(cached) = cached {
return cached;
}
// Run uv and uvx checks in parallel
let (uv_result, uvx_result) = tokio::join!(
crate::process::tokio_command("uv")
.arg("--version")
.output(),
crate::process::tokio_command("uvx")
.arg("--version")
.output(),
);
let install_fix = vec![FixAction {
label: "Install uv".into(),
kind: FixActionKind::OpenUrl,
payload: "https://docs.astral.sh/uv/getting-started/installation/".into(),
}];
let uv_check = match uv_result {
Ok(output) if output.status.success() => {
let version = String::from_utf8_lossy(&output.stdout).trim().to_string();
CheckItem {
check_id: "uv_available".into(),
label: "uv".into(),
status: CheckStatus::Pass,
message: format!("uv {version} available"),
fixes: vec![],
}
}
_ => CheckItem {
check_id: "uv_available".into(),
label: "uv".into(),
status: CheckStatus::Fail,
message: "uv is not installed or not in PATH".into(),
fixes: install_fix.clone(),
},
};
let uvx_check = match uvx_result {
Ok(output) if output.status.success() => {
let version = String::from_utf8_lossy(&output.stdout).trim().to_string();
CheckItem {
check_id: "uvx_available".into(),
label: "uvx".into(),
status: CheckStatus::Pass,
message: format!("uvx {version} available"),
fixes: vec![],
}
}
_ => CheckItem {
check_id: "uvx_available".into(),
label: "uvx".into(),
status: CheckStatus::Fail,
message: "uvx is not installed or not in PATH".into(),
fixes: install_fix,
},
};
let checks = vec![uv_check, uvx_check];
let all_passed = checks
.iter()
.all(|c| !matches!(c.status, CheckStatus::Fail));
if all_passed {
*UVX_ENV_CACHE.lock().unwrap() = Some(checks.clone());
}
checks
}
async fn check_binary_environment(
agent_type: AgentType,
version: &str,

View File

@@ -10,12 +10,6 @@ pub enum AgentDistribution {
/// Minimum Node.js version required, e.g. "22.12.0". None means no specific requirement.
node_required: Option<&'static str>,
},
Uvx {
version: &'static str,
package: &'static str,
args: &'static [&'static str],
env: &'static [(&'static str, &'static str)],
},
Binary {
version: &'static str,
cmd: &'static str,
@@ -43,7 +37,6 @@ impl AcpAgentMeta {
pub fn registry_version(&self) -> Option<&'static str> {
match &self.distribution {
AgentDistribution::Npx { version, .. }
| AgentDistribution::Uvx { version, .. }
| AgentDistribution::Binary { version, .. } => Some(*version),
}
}
@@ -78,76 +71,31 @@ pub fn current_platform() -> &'static str {
pub fn all_acp_agents() -> Vec<AgentType> {
vec![
AgentType::Auggie,
AgentType::Autohand,
AgentType::ClaudeCode,
AgentType::Cline,
AgentType::CodebuddyCode,
AgentType::Codex,
AgentType::CorustAgent,
AgentType::FactoryDroid,
AgentType::Gemini,
AgentType::GithubCopilot,
AgentType::Goose,
AgentType::Junie,
AgentType::Kimi,
AgentType::MinionCode,
AgentType::MistralVibe,
AgentType::OpenClaw,
AgentType::OpenCode,
AgentType::Qoder,
AgentType::QwenCode,
AgentType::Stakpak,
]
}
pub fn registry_id_for(agent_type: AgentType) -> &'static str {
match agent_type {
AgentType::Auggie => "auggie",
AgentType::Autohand => "autohand",
AgentType::ClaudeCode => "claude-acp",
AgentType::Cline => "cline",
AgentType::CodebuddyCode => "codebuddy-code",
AgentType::Codex => "codex-acp",
AgentType::CorustAgent => "corust-agent",
AgentType::FactoryDroid => "factory-droid",
AgentType::Gemini => "gemini",
AgentType::GithubCopilot => "github-copilot-cli",
AgentType::Goose => "goose",
AgentType::Junie => "junie",
AgentType::Kimi => "kimi",
AgentType::MinionCode => "minion-code",
AgentType::MistralVibe => "mistral-vibe",
AgentType::OpenClaw => "openclaw-acp",
AgentType::OpenCode => "opencode",
AgentType::Qoder => "qoder",
AgentType::QwenCode => "qwen-code",
AgentType::Stakpak => "stakpak",
}
}
pub fn from_registry_id(id: &str) -> Option<AgentType> {
match id {
"auggie" => Some(AgentType::Auggie),
"autohand" => Some(AgentType::Autohand),
"claude-acp" => Some(AgentType::ClaudeCode),
"cline" => Some(AgentType::Cline),
"codebuddy-code" => Some(AgentType::CodebuddyCode),
"codex-acp" => Some(AgentType::Codex),
"corust-agent" => Some(AgentType::CorustAgent),
"factory-droid" => Some(AgentType::FactoryDroid),
"gemini" => Some(AgentType::Gemini),
"github-copilot-cli" | "github-copilot" => Some(AgentType::GithubCopilot),
"goose" => Some(AgentType::Goose),
"junie" | "junie-acp" => Some(AgentType::Junie),
"kimi" => Some(AgentType::Kimi),
"minion-code" => Some(AgentType::MinionCode),
"mistral-vibe" => Some(AgentType::MistralVibe),
"openclaw-acp" => Some(AgentType::OpenClaw),
"opencode" => Some(AgentType::OpenCode),
"qoder" => Some(AgentType::Qoder),
"qwen-code" => Some(AgentType::QwenCode),
"stakpak" => Some(AgentType::Stakpak),
_ => None,
}
}
@@ -158,30 +106,6 @@ pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
Some(agent_type)
);
match agent_type {
AgentType::Auggie => AcpAgentMeta {
agent_type,
name: "Auggie CLI",
description: "Augment Code's powerful software agent, backed by industry-leading context engine",
distribution: AgentDistribution::Npx {
version: "0.19.0",
package: "@augmentcode/auggie@0.19.0",
args: &["--acp"],
env: &[("AUGMENT_DISABLE_AUTO_UPDATE", "1")],
node_required: None,
},
},
AgentType::Autohand => AcpAgentMeta {
agent_type,
name: "Autohand Code",
description: "Autohand Code - AI coding agent powered by Autohand AI",
distribution: AgentDistribution::Npx {
version: "0.2.1",
package: "@autohandai/autohand-acp@0.2.1",
args: &[],
env: &[],
node_required: None,
},
},
AgentType::ClaudeCode => AcpAgentMeta {
agent_type,
name: "Claude Code",
@@ -194,30 +118,6 @@ pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
node_required: None,
},
},
AgentType::Cline => AcpAgentMeta {
agent_type,
name: "Cline",
description: "Autonomous coding agent CLI - capable of creating/editing files, running commands, using the browser, and more",
distribution: AgentDistribution::Npx {
version: "2.8.0",
package: "cline@2.8.0",
args: &["--acp"],
env: &[],
node_required: None,
},
},
AgentType::CodebuddyCode => AcpAgentMeta {
agent_type,
name: "Codebuddy Code",
description: "Tencent Cloud's official intelligent coding tool",
distribution: AgentDistribution::Npx {
version: "2.63.1",
package: "@tencent-ai/codebuddy-code@2.63.1",
args: &["--acp"],
env: &[],
node_required: None,
},
},
AgentType::Codex => AcpAgentMeta {
agent_type,
name: "Codex CLI",
@@ -255,47 +155,6 @@ pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
],
},
},
AgentType::CorustAgent => AcpAgentMeta {
agent_type,
name: "Corust Agent",
description: "Co-building with a seasoned Rust partner.",
distribution: AgentDistribution::Binary {
version: "0.3.8",
cmd: "corust-agent-acp",
args: &[],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/Corust-ai/corust-agent-release/releases/download/v0.3.8/agent-darwin-arm64.tar.gz",
},
PlatformBinary {
platform: "darwin-x86_64",
url: "https://github.com/Corust-ai/corust-agent-release/releases/download/v0.3.8/agent-darwin-x64.tar.gz",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/Corust-ai/corust-agent-release/releases/download/v0.3.8/agent-linux-x64.tar.gz",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/Corust-ai/corust-agent-release/releases/download/v0.3.8/agent-windows-x64.zip",
},
],
},
},
AgentType::FactoryDroid => AcpAgentMeta {
agent_type,
name: "Factory Droid",
description: "Factory Droid - AI coding agent powered by Factory AI",
distribution: AgentDistribution::Npx {
version: "0.76.0",
package: "droid@0.76.0",
args: &["exec", "--output-format", "acp"],
env: &[("DROID_DISABLE_AUTO_UPDATE", "true"), ("FACTORY_DROID_AUTO_UPDATE_ENABLED", "false")],
node_required: None,
},
},
AgentType::Gemini => AcpAgentMeta {
agent_type,
name: "Gemini CLI",
@@ -308,161 +167,6 @@ pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
node_required: None,
},
},
AgentType::GithubCopilot => AcpAgentMeta {
agent_type,
name: "GitHub Copilot",
description: "GitHub's AI pair programmer",
distribution: AgentDistribution::Npx {
version: "1.0.6",
package: "@github/copilot@1.0.6",
args: &["--acp"],
env: &[],
node_required: None,
},
},
AgentType::Goose => AcpAgentMeta {
agent_type,
name: "goose",
description: "A local, extensible, open source AI agent that automates engineering tasks",
distribution: AgentDistribution::Binary {
version: "1.27.2",
cmd: "goose",
args: &["acp"],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/block/goose/releases/download/v1.27.2/goose-aarch64-apple-darwin.tar.bz2",
},
PlatformBinary {
platform: "darwin-x86_64",
url: "https://github.com/block/goose/releases/download/v1.27.2/goose-x86_64-apple-darwin.tar.bz2",
},
PlatformBinary {
platform: "linux-aarch64",
url: "https://github.com/block/goose/releases/download/v1.27.2/goose-aarch64-unknown-linux-gnu.tar.bz2",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/block/goose/releases/download/v1.27.2/goose-x86_64-unknown-linux-gnu.tar.bz2",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/block/goose/releases/download/v1.27.2/goose-x86_64-pc-windows-msvc.zip",
},
],
},
},
AgentType::Junie => AcpAgentMeta {
agent_type,
name: "Junie",
description: "AI Coding Agent by JetBrains",
distribution: AgentDistribution::Binary {
version: "888.195.0",
cmd: "junie",
args: &["--acp=true"],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/JetBrains/junie/releases/download/888.195/junie-release-888.195-macos-aarch64.zip",
},
PlatformBinary {
platform: "darwin-x86_64",
url: "https://github.com/JetBrains/junie/releases/download/888.195/junie-release-888.195-macos-amd64.zip",
},
PlatformBinary {
platform: "linux-aarch64",
url: "https://github.com/JetBrains/junie/releases/download/888.195/junie-release-888.195-linux-aarch64.zip",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/JetBrains/junie/releases/download/888.195/junie-release-888.195-linux-amd64.zip",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/JetBrains/junie/releases/download/888.195/junie-release-888.195-windows-amd64.zip",
},
],
},
},
AgentType::Kimi => AcpAgentMeta {
agent_type,
name: "Kimi CLI",
description: "Moonshot AI's coding assistant",
distribution: AgentDistribution::Binary {
version: "1.22.0",
cmd: "kimi",
args: &["acp"],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/MoonshotAI/kimi-cli/releases/download/1.22.0/kimi-1.22.0-aarch64-apple-darwin.tar.gz",
},
PlatformBinary {
platform: "linux-aarch64",
url: "https://github.com/MoonshotAI/kimi-cli/releases/download/1.22.0/kimi-1.22.0-aarch64-unknown-linux-gnu.tar.gz",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/MoonshotAI/kimi-cli/releases/download/1.22.0/kimi-1.22.0-x86_64-unknown-linux-gnu.tar.gz",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/MoonshotAI/kimi-cli/releases/download/1.22.0/kimi-1.22.0-x86_64-pc-windows-msvc.zip",
},
],
},
},
AgentType::MinionCode => AcpAgentMeta {
agent_type,
name: "Minion Code",
description: "An enhanced AI code assistant built on the Minion framework with rich development tools",
distribution: AgentDistribution::Uvx {
version: "0.1.44",
package: "minion-code@0.1.44",
args: &["acp"],
env: &[],
},
},
AgentType::MistralVibe => AcpAgentMeta {
agent_type,
name: "Mistral Vibe",
description: "Mistral's open-source coding assistant",
distribution: AgentDistribution::Binary {
version: "2.5.0",
cmd: "vibe-acp",
args: &[],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-darwin-aarch64-2.5.0.zip",
},
PlatformBinary {
platform: "darwin-x86_64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-darwin-x86_64-2.5.0.zip",
},
PlatformBinary {
platform: "linux-aarch64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-linux-aarch64-2.5.0.zip",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-linux-x86_64-2.5.0.zip",
},
PlatformBinary {
platform: "windows-aarch64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-windows-aarch64-2.5.0.zip",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/mistralai/mistral-vibe/releases/download/v2.5.0/vibe-acp-windows-x86_64-2.5.0.zip",
},
],
},
},
AgentType::OpenClaw => AcpAgentMeta {
agent_type,
name: "OpenClaw",
@@ -508,62 +212,5 @@ pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
],
},
},
AgentType::Qoder => AcpAgentMeta {
agent_type,
name: "Qoder CLI",
description: "AI coding assistant with agentic capabilities",
distribution: AgentDistribution::Npx {
version: "0.1.31",
package: "@qoder-ai/qodercli@0.1.31",
args: &["--acp"],
env: &[],
node_required: None,
},
},
AgentType::QwenCode => AcpAgentMeta {
agent_type,
name: "Qwen Code",
description: "Alibaba's Qwen coding assistant",
distribution: AgentDistribution::Npx {
version: "0.12.5",
package: "@qwen-code/qwen-code@0.12.5",
args: &["--acp", "--experimental-skills"],
env: &[],
node_required: None,
},
},
AgentType::Stakpak => AcpAgentMeta {
agent_type,
name: "Stakpak",
description: "Open-source DevOps agent in Rust with enterprise-grade security",
distribution: AgentDistribution::Binary {
version: "0.3.68",
cmd: "stakpak",
args: &["acp"],
env: &[],
platforms: &[
PlatformBinary {
platform: "darwin-aarch64",
url: "https://github.com/stakpak/agent/releases/download/v0.3.68/stakpak-darwin-aarch64.tar.gz",
},
PlatformBinary {
platform: "darwin-x86_64",
url: "https://github.com/stakpak/agent/releases/download/v0.3.68/stakpak-darwin-x86_64.tar.gz",
},
PlatformBinary {
platform: "linux-aarch64",
url: "https://github.com/stakpak/agent/releases/download/v0.3.68/stakpak-linux-aarch64.tar.gz",
},
PlatformBinary {
platform: "linux-x86_64",
url: "https://github.com/stakpak/agent/releases/download/v0.3.68/stakpak-linux-x86_64.tar.gz",
},
PlatformBinary {
platform: "windows-x86_64",
url: "https://github.com/stakpak/agent/releases/download/v0.3.68/stakpak-windows-x86_64.zip",
},
],
},
},
}
}