Wave 3.1:老板十项返工(kimi 换代 kimi-code/授权检测/可更新判定/模型列表+测试连通/系统环境诊断/外链/命令复制/官方图标主色)

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-08-25 22:52:33 +08:00
co-authored by multica-agent
parent 0cec468ae6
commit b19efef0f3
30 changed files with 1594 additions and 124 deletions
+61 -1
View File
@@ -7,7 +7,7 @@
use std::collections::BTreeMap;
use agentdock_adapter::{AdapterAction, DryRunPlan};
use agentdock_core::{ActionEvent, ActionOpts, AuthFlowEvent, AuthStatus, ConfigFormState, ConfigVerifyResult, DetectResult, Engine, WriteResult};
use agentdock_core::{ActionEvent, ActionOpts, AuthFlowEvent, AuthStatus, ConfigFormState, ConfigVerifyResult, ConnectionTestResult, DetectResult, Engine, ModelListResult, SystemEnvReport, UpdateCheckResult, WriteResult};
use agentdock_diag::DiagnosticReport;
use serde_json::json;
use tauri::Emitter;
@@ -166,3 +166,63 @@ pub fn diagnose_all(state: tauri::State<'_, Engine>) -> Result<Vec<DiagnosticRep
let env = agentdock_platform::detect::detect_env();
state.diagnose_all(&env).map_err(|e| e.to_string())
}
/// 系统环境诊断(Wave 3.1 Req 7):检查缺失/过低的系统依赖,标注影响哪些 CLI。
#[tauri::command(rename = "diagnoseSystem")]
pub fn diagnose_system(state: tauri::State<'_, Engine>) -> Result<SystemEnvReport, String> {
let env = agentdock_platform::detect::detect_env();
state.diagnose_system(&env).map_err(|e| e.to_string())
}
/// 「可更新」判定(Wave 3.1 Req 4):官方源最新版本 vs 本地已装版本对比。
#[tauri::command(rename = "checkUpdate")]
pub fn check_update(id: String, state: tauri::State<'_, Engine>) -> Result<UpdateCheckResult, String> {
state.check_update(&id).map_err(|e| e.to_string())
}
/// 模型列表(Wave 3.1 Req 5)。
#[tauri::command(rename = "listModels")]
pub fn list_models(id: String, state: tauri::State<'_, Engine>) -> Result<ModelListResult, String> {
state.list_models(&id).map_err(|e| e.to_string())
}
/// 测试连通(Wave 3.1 Req 5):密钥从密钥库读取直连官方接口测一次。
#[tauri::command(rename = "testConnection")]
pub fn test_connection(id: String, state: tauri::State<'_, Engine>) -> Result<ConnectionTestResult, String> {
state.test_connection(&id).map_err(|e| e.to_string())
}
/// 用系统默认浏览器打开外链(Wave 3.1 Req 8),目标主机须在白名单内。
#[tauri::command(rename = "openExternal")]
pub fn open_external(url: String, state: tauri::State<'_, Engine>) -> Result<(), String> {
let allowed: Vec<String> = state
.adapters()
.map(|ads| {
let mut hosts: Vec<String> = ads
.iter()
.flat_map(|a| a.official.as_ref().map(|o| o.allowed_hosts.clone()).unwrap_or_default())
.collect();
hosts.extend(well_known_docs_hosts().iter().cloned());
hosts
})
.unwrap_or_else(|_| well_known_docs_hosts());
if !agentdock_core::is_url_host_allowed(&url, &allowed) {
return Err("目标链接不在白名单内".to_string());
}
agentdock_core::open_with_shell(&url).map_err(|e| e.to_string())
}
/// 官方文档/主页常见主机(与适配器 allowed_hosts 合并,覆盖 docs.* 站点)。
fn well_known_docs_hosts() -> Vec<String> {
[
"opencode.ai", "moonshotai.github.io", "code.kimi.com", "github.com",
"code.claude.com", "geminicli.com", "qwen.ai", "codebuddy.ai", "docs.cline.bot",
"aider.chat", "cursor.com", "docs.warp.dev", "warp.dev", "block.github.io",
"charm.sh", "docs.github.com", "learn.chatgpt.com", "claude.ai",
"nodejs.org", "python.org", "git-scm.com", "docs.astral.sh", "learn.microsoft.com",
"aka.ms", "pypi.org", "registry.npmjs.org", "api.github.com", "chatgpt.com",
]
.iter()
.map(|s| s.to_string())
.collect()
}
+5
View File
@@ -60,6 +60,11 @@ pub fn run() {
commands::cli::cancel_authorize,
commands::cli::diagnose,
commands::cli::diagnose_all,
commands::cli::diagnose_system,
commands::cli::check_update,
commands::cli::list_models,
commands::cli::test_connection,
commands::cli::open_external,
commands::runtime::preview_runtime_install,
commands::runtime::open_runtime_page,
commands::runtime::install_runtime,