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
+69
View File
@@ -47,6 +47,9 @@ pub struct Adapter {
pub diagnostics: Vec<Diagnostic>,
#[serde(default)]
pub documentation: Option<Documentation>,
/// 该 CLI 可加载的模型(模型列表来源:CLI 自带列举命令或适配器按官方文档维护的清单)
#[serde(default)]
pub models: Option<Models>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@@ -87,6 +90,9 @@ pub struct Official {
pub docs: Option<String>,
#[serde(rename = "allowed_hosts", default)]
pub allowed_hosts: Vec<String>,
/// 官方图标地址(仅作识别/许可说明与本地打包来源,不热链)
#[serde(default)]
pub icon: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@@ -167,6 +173,23 @@ pub struct Update {
pub method: Option<String>,
#[serde(default)]
pub command: Vec<String>,
/// 「可更新」判定依据来源(官方源最新版本,与本地版本 semver 对比)
#[serde(default)]
pub source: Option<UpdateSource>,
}
/// 官方源最新版本查询来源(npm registry / PyPI / GitHub Releases)。
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct UpdateSource {
/// npm | pypi | github
pub kind: String,
/// npm / pypi 包名(kind = npm|pypi 时)
#[serde(default)]
pub package: Option<String>,
/// GitHub 仓库(owner/repokind = github 时)
#[serde(default)]
pub repo: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@@ -185,6 +208,30 @@ pub struct Uninstall {
pub struct Authorization {
#[serde(default)]
pub modes: Vec<AuthMode>,
/// 授权判定信号:登录态/OAuth 凭据文件或目录(存在任一即视为已授权)。
/// 无 status_command 的 CLI(如 kimi-code 的 ~/.kimi-code/credentials)用此判授权。
#[serde(rename = "credential_files", default)]
pub credential_files: Vec<String>,
/// 「测试连通」端点(已授权时直连官方接口测一次)
#[serde(default)]
pub test: Option<ConnectionTest>,
}
/// 「测试连通」端点声明(密钥从密钥库读取,直连官方接口,成功/失败如实显示)。
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct ConnectionTest {
/// 探测端点 URL(通常为官方模型列表/账号接口)
pub url: String,
/// API Key 注入头名(如 x-api-key / Authorization
#[serde(rename = "key_header", default)]
pub key_header: Option<String>,
/// Authorization 头是否带 Bearer 前缀(key_header = Authorization 时)
#[serde(default)]
pub bearer: bool,
/// 额外请求头(如 anthropic-version: 2023-06-01
#[serde(rename = "extra_headers", default)]
pub extra_headers: Vec<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@@ -314,6 +361,28 @@ pub struct DocParam {
pub desc_zh: Option<String>,
}
/// 该 CLI 可加载的模型(Wave 3.1 Req 5:默认模型 → 模型列表)。
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct Models {
/// CLI 自带的模型列举命令(如 `agent --list-models`),存在则优先用它实时调取
#[serde(default)]
pub command: Vec<String>,
/// 适配器按官方文档维护的模型清单(无 CLI 列举命令时使用)
#[serde(default)]
pub list: Vec<ModelEntry>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct ModelEntry {
/// 模型 ID(如 kimi-code/k3
pub id: String,
/// 中文名/说明(可选)
#[serde(rename = "label_zh", default)]
pub label_zh: Option<String>,
}
fn default_true() -> bool {
true
}