From b19efef0f3fae69d73faaae9212ce32b31760a64 Mon Sep 17 00:00:00 2001 From: leefer Date: Tue, 25 Aug 2026 22:52:33 +0800 Subject: [PATCH] =?UTF-8?q?Wave=203.1=EF=BC=9A=E8=80=81=E6=9D=BF=E5=8D=81?= =?UTF-8?q?=E9=A1=B9=E8=BF=94=E5=B7=A5=EF=BC=88kimi=20=E6=8D=A2=E4=BB=A3?= =?UTF-8?q?=20kimi-code/=E6=8E=88=E6=9D=83=E6=A3=80=E6=B5=8B/=E5=8F=AF?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=A4=E5=AE=9A/=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8+=E6=B5=8B=E8=AF=95=E8=BF=9E=E9=80=9A/?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=8E=AF=E5=A2=83=E8=AF=8A=E6=96=AD/?= =?UTF-8?q?=E5=A4=96=E9=93=BE/=E5=91=BD=E4=BB=A4=E5=A4=8D=E5=88=B6/?= =?UTF-8?q?=E5=AE=98=E6=96=B9=E5=9B=BE=E6=A0=87=E4=B8=BB=E8=89=B2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: multica-agent --- adapters/schema/adapter.schema.json | 49 +- adapters/tools/aider.yaml | 3 + adapters/tools/claude-code.yaml | 19 +- adapters/tools/cline.yaml | 3 + adapters/tools/codebuddy.yaml | 10 + adapters/tools/codex.yaml | 16 +- adapters/tools/copilot.yaml | 3 + adapters/tools/crush.yaml | 5 +- adapters/tools/cursor.yaml | 3 + adapters/tools/gemini.yaml | 12 + adapters/tools/goose.yaml | 5 +- adapters/tools/kimi.yaml | 165 +++--- adapters/tools/opencode.yaml | 3 + adapters/tools/qwen.yaml | 3 + apps/desktop/src-tauri/src/commands/cli.rs | 62 ++- apps/desktop/src-tauri/src/lib.rs | 5 + apps/desktop/src/components/CliMonogram.tsx | 32 +- apps/desktop/src/components/ConfigForm.tsx | 100 +++- apps/desktop/src/ipc/index.ts | 37 ++ apps/desktop/src/ipc/types.ts | 55 +- apps/desktop/src/pages/Catalog.tsx | 54 +- apps/desktop/src/pages/CliDetail.tsx | 58 +- apps/desktop/src/pages/Overview.tsx | 110 +++- apps/desktop/src/styles/global.css | 179 +++++- crates/agentdock-adapter/src/schema.rs | 69 +++ crates/agentdock-core/src/engine.rs | 550 ++++++++++++++++++- crates/agentdock-core/src/errors_zh.rs | 2 + crates/agentdock-core/src/lib.rs | 8 +- crates/agentdock-core/src/runtime_install.rs | 25 + crates/agentdock-core/src/types.rs | 73 +++ 30 files changed, 1594 insertions(+), 124 deletions(-) diff --git a/adapters/schema/adapter.schema.json b/adapters/schema/adapter.schema.json index a2c1d0d..825cc34 100644 --- a/adapters/schema/adapter.schema.json +++ b/adapters/schema/adapter.schema.json @@ -82,6 +82,7 @@ "properties": { "homepage": { "type": "string", "format": "uri" }, "docs": { "type": "string", "format": "uri" }, + "icon": { "type": "string", "format": "uri", "description": "官方图标地址(识别/许可说明与本地打包来源,不热链)" }, "allowed_hosts": { "type": "array", "items": { "type": "string" }, @@ -136,7 +137,17 @@ "type": "string", "enum": ["npm_update", "self_update_cmd", "channel_reinstall", "winget_upgrade", "pypi_upgrade", "manual"] }, - "command": { "type": "array", "items": { "type": "string" } } + "command": { "type": "array", "items": { "type": "string" } }, + "source": { + "type": "object", + "additionalProperties": false, + "required": ["kind"], + "properties": { + "kind": { "type": "string", "enum": ["npm", "pypi", "github"] }, + "package": { "type": "string", "description": "npm / pypi 包名" }, + "repo": { "type": "string", "description": "GitHub 仓库 owner/repo" } + } + } } }, "uninstall": { @@ -166,6 +177,22 @@ "notes_zh": { "type": "string" } } } + }, + "credential_files": { + "type": "array", + "items": { "type": "string" }, + "description": "登录态/OAuth 凭据文件或目录(存在任一即视为已授权,如 kimi-code ~/.kimi-code/credentials)" + }, + "test": { + "type": "object", + "additionalProperties": false, + "required": ["url"], + "properties": { + "url": { "type": "string", "format": "uri", "description": "测试连通端点 URL" }, + "key_header": { "type": "string", "description": "API Key 注入头名(如 x-api-key / Authorization)" }, + "bearer": { "type": "boolean", "default": false, "description": "Authorization 头是否带 Bearer 前缀" }, + "extra_headers": { "type": "array", "items": { "type": "string" }, "description": "额外请求头" } + } } } }, @@ -286,6 +313,26 @@ "updated_at": { "type": "string", "format": "date" }, "risks_zh": { "type": "array", "items": { "type": "string" } } } + }, + "models": { + "type": "object", + "additionalProperties": false, + "description": "该 CLI 可加载的模型(模型列表来源:CLI 自带列举命令或适配器按官方文档维护的清单)", + "properties": { + "command": { "type": "array", "items": { "type": "string" }, "description": "CLI 自带的模型列举命令(如 agent --list-models)" }, + "list": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": ["id"], + "properties": { + "id": { "type": "string" }, + "label_zh": { "type": "string" } + } + } + } + } } }, "definitions": { diff --git a/adapters/tools/aider.yaml b/adapters/tools/aider.yaml index 90d005f..b1c7feb 100644 --- a/adapters/tools/aider.yaml +++ b/adapters/tools/aider.yaml @@ -63,6 +63,9 @@ detect: update: method: pypi_upgrade command: [uv, tool, upgrade, aider-chat] + source: + kind: pypi + package: aider-chat uninstall: method: package_manager diff --git a/adapters/tools/claude-code.yaml b/adapters/tools/claude-code.yaml index 4186872..c121a03 100644 --- a/adapters/tools/claude-code.yaml +++ b/adapters/tools/claude-code.yaml @@ -22,7 +22,7 @@ platforms: official: homepage: https://claude.ai docs: https://code.claude.com/docs/en/setup - allowed_hosts: [claude.ai, registry.npmjs.org, github.com] + allowed_hosts: [claude.ai, registry.npmjs.org, github.com, api.anthropic.com] runtime_deps: [] @@ -57,6 +57,9 @@ detect: update: method: winget_upgrade command: [winget, upgrade, Anthropic.ClaudeCode] + source: + kind: npm + package: "@anthropic-ai/claude-code" uninstall: method: package_manager @@ -71,6 +74,11 @@ authorization: - mode: api_key env_keys: [ANTHROPIC_API_KEY] notes_zh: 设置 ANTHROPIC_API_KEY 后 CLI 优先使用 API Key + test: + url: https://api.anthropic.com/v1/models + key_header: x-api-key + extra_headers: + - "anthropic-version: 2023-06-01" # 配置机制(调研底稿 §2「配置机制」):用户级 ~/.claude/settings.json(JSON) # 官方确认:settings.json 内 env 块可注入环境变量;ANTHROPIC_API_KEY / ANTHROPIC_BASE_URL / @@ -116,6 +124,15 @@ configuration: storage: keyring docs_url: https://code.claude.com/docs/en/env-vars +models: + list: + - id: claude-sonnet-4 + label_zh: Claude Sonnet 4 + - id: claude-opus-4 + label_zh: Claude Opus 4 + - id: claude-haiku-4 + label_zh: Claude Haiku 4 + diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path diff --git a/adapters/tools/cline.yaml b/adapters/tools/cline.yaml index f1d43d0..98c1810 100644 --- a/adapters/tools/cline.yaml +++ b/adapters/tools/cline.yaml @@ -51,6 +51,9 @@ detect: update: method: npm_update command: [npm, update, -g, "cline"] + source: + kind: npm + package: cline uninstall: method: npm_uninstall diff --git a/adapters/tools/codebuddy.yaml b/adapters/tools/codebuddy.yaml index 8c989f9..1ff2498 100644 --- a/adapters/tools/codebuddy.yaml +++ b/adapters/tools/codebuddy.yaml @@ -54,6 +54,9 @@ detect: update: method: npm_update command: [npm, update, -g, "@tencent-ai/codebuddy-code"] + source: + kind: npm + package: "@tencent-ai/codebuddy-code" uninstall: method: npm_uninstall @@ -112,6 +115,13 @@ configuration: storage: file docs_url: https://codebuddy.ai/docs +models: + list: + - id: deepseek-v4-pro + label_zh: DeepSeek V4 Pro + - id: glm-5.3 + label_zh: GLM 5.3 + diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path diff --git a/adapters/tools/codex.yaml b/adapters/tools/codex.yaml index 482731a..b15a701 100644 --- a/adapters/tools/codex.yaml +++ b/adapters/tools/codex.yaml @@ -21,7 +21,7 @@ platforms: official: homepage: https://github.com/openai/codex docs: https://learn.chatgpt.com/docs/codex/cli - allowed_hosts: [chatgpt.com, github.com, releases.openai.com, registry.npmjs.org] + allowed_hosts: [chatgpt.com, github.com, api.github.com, releases.openai.com, registry.npmjs.org, api.openai.com] runtime_deps: [] @@ -56,6 +56,9 @@ detect: update: method: npm_update command: [npm, update, -g, "@openai/codex"] + source: + kind: npm + package: "@openai/codex" uninstall: method: npm_uninstall @@ -75,6 +78,10 @@ authorization: command: [codex, login, --with-api-key] env_keys: [OPENAI_API_KEY] notes_zh: API Key 从系统密钥库读取,经 stdin 注入,不进 argv + test: + url: https://api.openai.com/v1/models + key_header: Authorization + bearer: true # 配置机制(调研底稿 §1「配置机制」):用户级 ~/.codex/config.toml(TOML) # 官方确认可配:model / approval_policy / sandbox_mode / model_reasoning_effort / @@ -136,6 +143,13 @@ configuration: storage: keyring docs_url: https://learn.chatgpt.com/docs/config-file/config-advanced +models: + list: + - id: gpt-5.6-terra + label_zh: GPT-5.6 Terra(默认) + - id: gpt-5 + label_zh: GPT-5 + diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path diff --git a/adapters/tools/copilot.yaml b/adapters/tools/copilot.yaml index b273e6c..bdac492 100644 --- a/adapters/tools/copilot.yaml +++ b/adapters/tools/copilot.yaml @@ -50,6 +50,9 @@ detect: update: method: winget_upgrade command: [winget, upgrade, GitHub.Copilot] + source: + kind: npm + package: "@github/copilot" uninstall: method: package_manager diff --git a/adapters/tools/crush.yaml b/adapters/tools/crush.yaml index d0f03ac..68e50c5 100644 --- a/adapters/tools/crush.yaml +++ b/adapters/tools/crush.yaml @@ -22,7 +22,7 @@ platforms: official: homepage: https://github.com/charmbracelet/crush docs: https://github.com/charmbracelet/crush - allowed_hosts: [github.com, charm.sh] + allowed_hosts: [github.com, api.github.com, charm.sh] runtime_deps: [] @@ -62,6 +62,9 @@ detect: update: method: winget_upgrade command: [winget, upgrade, charmbracelet.crush] + source: + kind: github + repo: charmbracelet/crush uninstall: method: package_manager diff --git a/adapters/tools/cursor.yaml b/adapters/tools/cursor.yaml index 36b1aef..28de3d5 100644 --- a/adapters/tools/cursor.yaml +++ b/adapters/tools/cursor.yaml @@ -111,6 +111,9 @@ configuration: storage: keyring docs_url: https://cursor.com/docs/cli +models: + command: [agent, --list-models] + diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path diff --git a/adapters/tools/gemini.yaml b/adapters/tools/gemini.yaml index 275ea3a..e64a32f 100644 --- a/adapters/tools/gemini.yaml +++ b/adapters/tools/gemini.yaml @@ -46,6 +46,9 @@ detect: update: method: npm_update command: [npm, update, -g, "@google/gemini-cli"] + source: + kind: npm + package: "@google/gemini-cli" uninstall: method: npm_uninstall @@ -102,6 +105,15 @@ configuration: storage: keyring docs_url: https://geminicli.com/docs/get-started/authentication/ +models: + list: + - id: gemini-3-pro + label_zh: Gemini 3 Pro + - id: gemini-2.5-flash + label_zh: Gemini 2.5 Flash + - id: gemini-2.5-pro + label_zh: Gemini 2.5 Pro + diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path diff --git a/adapters/tools/goose.yaml b/adapters/tools/goose.yaml index bb57568..399e131 100644 --- a/adapters/tools/goose.yaml +++ b/adapters/tools/goose.yaml @@ -22,7 +22,7 @@ platforms: official: homepage: https://block.github.io/goose/ docs: https://block.github.io/goose/docs/ - allowed_hosts: [github.com, raw.githubusercontent.com, block.github.io] + allowed_hosts: [github.com, api.github.com, raw.githubusercontent.com, block.github.io] runtime_deps: [] @@ -56,6 +56,9 @@ detect: update: method: self_update_cmd command: [goose, update] + source: + kind: github + repo: aaif-goose/goose uninstall: method: manual_delete diff --git a/adapters/tools/kimi.yaml b/adapters/tools/kimi.yaml index b0af6c5..6d42fb8 100644 --- a/adapters/tools/kimi.yaml +++ b/adapters/tools/kimi.yaml @@ -1,57 +1,52 @@ # ============================================================ -# AgentDock 适配器 · Kimi CLI(月之暗面 Moonshot)(Wave 2.1) -# 数据依据:调研底稿 agent-cli-survey-2026-08-24.md(Kimi 章节)+ 架构 §3.3 -# 铁律:只走官方 code.kimi.com 脚本 / PyPI kimi-cli,严禁 npm(仿名包)。 +# AgentDock 适配器 · Kimi Code CLI(月之暗面 Moonshot)(Wave 3.1 换代) +# 换代依据:老板实测官方现行安装已切换至 kimi-code 线,本适配器弃用旧 kimi-cli(PyPI)线。 +# 核对来源(当日官方页面为准,2026-08-25): +# - 仓库/README:https://github.com/MoonshotAI/kimi-code +# - 官方文档:https://moonshotai.github.io/kimi-code/en/ +# - 配置:https://moonshotai.github.io/kimi-code/en/configuration/config-files.html +# - 数据位置:https://moonshotai.github.io/kimi-code/en/configuration/data-locations.html # ============================================================ id: kimi -name: Kimi CLI -name_zh: Kimi CLI +name: Kimi Code CLI +name_zh: Kimi Code CLI vendor: 月之暗面 status: available -adapter_version: 1.1.0 -license: Apache-2.0 +adapter_version: 1.2.0 +license: MIT platforms: windows: architectures: [x64] - notes: 原生支持(PowerShell 脚本安装,非 WSL) + notes: 原生支持(官方 PowerShell 脚本安装,需 Git for Windows 作 shell 环境) linux: distributions: [ubuntu] architectures: [x64] official: - homepage: https://github.com/MoonshotAI/kimi-cli - docs: https://moonshotai.github.io/kimi-cli/en/guides/getting-started.html - allowed_hosts: [code.kimi.com, pypi.org, github.com] + homepage: https://github.com/MoonshotAI/kimi-code + docs: https://moonshotai.github.io/kimi-code/en/ + allowed_hosts: [code.kimi.com, moonshotai.github.io, github.com, api.github.com, api.kimi.com, api.moonshot.cn] runtime_deps: - - id: uv + - id: git semver_range: ">=0" - required_for: [install] - - id: python - semver_range: ">=3.12" required_for: [run] install: - preferred: pypi_uv + preferred: official_script channels: - - id: pypi_uv - platforms: [windows, linux] - command: [uv, tool, install, kimi-cli] - package: kimi-cli - elevate: never - post_checks: [detect] - id: official_script platforms: [windows] script: - url: https://code.kimi.com/install.ps1 + url: https://code.kimi.com/kimi-code/install.ps1 kind: powershell_irm elevate: never post_checks: [detect] - id: official_script platforms: [linux] script: - url: https://code.kimi.com/install.sh + url: https://code.kimi.com/kimi-code/install.sh kind: bash_pipe elevate: never post_checks: [detect] @@ -61,110 +56,126 @@ detect: version_args: ["--version"] update: - method: pypi_upgrade - command: [uv, tool, upgrade, kimi-cli] + method: manual + command: [] + source: + kind: github + repo: MoonshotAI/kimi-code uninstall: - method: package_manager - command: [uv, tool, uninstall, kimi-cli] + method: manual_delete + command: [] keep_config_default: true authorization: modes: - mode: browser_oauth - command: [kimi, login] - notes_zh: Kimi Code 浏览器 OAuth(推荐) + command: [kimi] + notes_zh: 运行 kimi 后在界面输入 /login,选 Kimi Code OAuth(推荐) - mode: api_key - env_keys: [KIMI_API_KEY] - notes_zh: Moonshot 开放平台 API Key + notes_zh: Moonshot 开放平台 API Key(官方写入 config.toml providers;AgentDock 密钥存系统密钥库) + credential_files: + - "~/.kimi-code/credentials" + test: + url: https://api.moonshot.cn/v1/models + key_header: Authorization + bearer: true -# 配置机制(调研底稿 Kimi 章节):~/.kimi/config.toml(TOML,兼容 JSON) -# 可配 default_model、providers(type/base_url/api_key)、models 等; -# 环境变量:KIMI_API_KEY / KIMI_BASE_URL / KIMI_MODEL_NAME / KIMI_MODEL_TEMPERATURE。 +# 配置机制(官方 config-files 文档):~/.kimi-code/config.toml(TOML,snake_case) +# 常用字段:default_model / default_permission_mode(manual|yolo|auto)/ default_plan_mode; +# providers 表(type/base_url/api_key)、models 表(模型别名)。默认模型别名必须定义在 models 表。 +# 环境变量:KIMI_CODE_HOME(数据目录)、KIMI_MODEL_*(临时模型),密钥不自动从 shell 环境变量读取。 configuration: files: - - path: "~/.kimi/config.toml" + - path: "~/.kimi-code/config.toml" format: toml scope: user - environment: - - key: KIMI_API_KEY - sensitive: true - maps_to_field: api_key + environment: [] fields: - id: default_model label_zh: 默认模型 group: common - help_zh: 官方键 default_model,Kimi CLI 使用的默认模型 + help_zh: 官方键 default_model(模型别名,须已在 models 表定义),如 kimi-code/k3 required: false sensitive: false type: string storage: file - docs_url: https://moonshotai.github.io/kimi-cli/en/configuration/config-files.html - - id: env.KIMI_BASE_URL - label_zh: Base URL + docs_url: https://moonshotai.github.io/kimi-code/en/configuration/config-files.html + - id: default_permission_mode + label_zh: 权限模式 group: advanced - help_zh: 官方环境变量 KIMI_BASE_URL(自定义 OpenAI 兼容端点);写入 config.toml 的 env 表,若需进程级生效请以官方 env-vars 文档为准 + help_zh: 官方键 default_permission_mode,新会话默认权限模式 required: false sensitive: false - type: url + type: enum storage: file - docs_url: https://moonshotai.github.io/kimi-cli/en/configuration/env-vars.html + docs_url: https://moonshotai.github.io/kimi-code/en/configuration/config-files.html + options: + - value: manual + label_zh: 手动确认(每次询问) + - value: yolo + label_zh: 自动放行(可能仍会提问) + - value: auto + label_zh: 全自动(自主决定) - id: api_key label_zh: API Key group: auth - help_zh: 存入系统密钥库(对应环境变量 KIMI_API_KEY,Moonshot 开放平台获取) + help_zh: 存入系统密钥库(Moonshot 开放平台 API Key;官方也支持写入 config.toml providers.api_key,AgentDock 密钥不落明文) required: false sensitive: true type: string storage: keyring - docs_url: https://moonshotai.github.io/kimi-cli/en/configuration/env-vars.html + docs_url: https://moonshotai.github.io/kimi-code/en/configuration/config-files.html + +# 模型清单(官方 config-files 示例中 /login 预置的 managed:kimi-code 别名) +models: + list: + - id: kimi-code/k3 + label_zh: K3(旗舰推理) + - id: kimi-code/kimi-for-coding + label_zh: Kimi for Coding(均衡) + - id: kimi-code/kimi-for-coding-highspeed + label_zh: Kimi for Coding 高速版 diagnostics: - rule_id: path.not_installed - rule_id: path.not_in_path - - rule_id: dependency.uv - - rule_id: dependency.python_below_min + - rule_id: dependency.git - rule_id: version_conflict.multiple_copies - rule_id: config.corrupt documentation: - quickstart_zh: 安装后运行 `kimi login` 登录,或用 `kimi -p "提示词"` 无头执行。 - install_zh: 只走官方渠道:`uv tool install kimi-cli`(本适配器默认)或官方脚本 code.kimi.com/install.sh(install.ps1)。脚本会自动装 uv 并从 PyPI kimi-cli 安装。严禁 npm(npm 上的 kimi-code 是第三方仿名包)。 - auth_zh: ① Kimi Code 浏览器 OAuth(推荐,`kimi login`);② Moonshot 开放平台 API Key(platform 侧获取后粘贴,经 KIMI_API_KEY 注入)。`kimi logout` 清除 OAuth 凭据。 + quickstart_zh: 安装后运行 `kimi` 进入交互界面,首次启动输入 `/login` 选 Kimi Code OAuth 或 Moonshot API Key;也可 `kimi -p "提示词"` 无头执行。 + install_zh: 只走官方脚本:Windows `irm https://code.kimi.com/kimi-code/install.ps1 | iex`,macOS/Linux `curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash`(单二进制发行,无需 Node.js)。Windows 首次启动前需装 Git for Windows(作 shell 环境)。 + auth_zh: ① Kimi Code OAuth(推荐,TUI 内 /login);② Moonshot 开放平台 API Key。登录凭据存于 `~/.kimi-code/credentials/`,/logout 清除。 commands: - cmd: kimi - desc_zh: 启动交互式会话 - - cmd: kimi login - desc_zh: 登录(浏览器 OAuth 或 API Key) - - cmd: kimi logout - desc_zh: 清除 OAuth 凭据 + desc_zh: 启动交互式会话(TUI) - cmd: kimi -p "提示词" - desc_zh: 无头单次执行 - - cmd: kimi --output-format stream-json -p "提示词" - desc_zh: print 模式 JSON 流输出 - - cmd: kimi --quiet - desc_zh: 静默模式 + desc_zh: 无头单次执行(print 模式) - cmd: kimi --version desc_zh: 显示版本号 - - cmd: kimi info - desc_zh: 显示版本与协议信息 - cmd: kimi acp desc_zh: IDE 集成 stdio(ACP 协议) + - cmd: /login + desc_zh: 登录(Kimi Code OAuth 或 Moonshot API Key) + - cmd: /model + desc_zh: 切换模型 + - cmd: /mcp-config + desc_zh: 配置 MCP 服务器 params: - - param: -p / --prompt - desc_zh: 处理后退出(无头模式) - - param: --print - desc_zh: 打印模式 + - param: -p / --print + desc_zh: 无头模式,执行后退出 - param: --output-format desc_zh: 输出格式(如 stream-json) + - param: -m / --model + desc_zh: 指定模型别名 - param: --quiet desc_zh: 静默模式 - - param: --afk - desc_zh: 离键模式 - - param: --config-file - desc_zh: 指定配置文件路径 + - param: --session + desc_zh: 恢复指定会话 updated_at: "2026-08-25" risks_zh: - - 严禁 npm:npm 上的 kimi-code 是第三方仿名包,与月之暗面无关 - - 官方脚本会自动安装 uv 并从 PyPI kimi-cli 安装(Python 3.12–3.14) - - providers 表(type/base_url/api_key 多 provider)等高级配置本表单不覆盖,以官方 config-files 文档为准 + - 已换代:旧 PyPI `kimi-cli` 线废止,官方现行安装为 kimi-code 脚本(本适配器 1.2.0 已改) + - 官方密钥不自动从 shell 环境变量读取,需写入 config.toml providers 表;AgentDock 密钥存系统密钥库(测试连通直连官方接口),OAuth 登录为推荐路径 + - 模型别名与 providers/models 高级配置以官方 config-files 文档为准,本表单不覆盖 diff --git a/adapters/tools/opencode.yaml b/adapters/tools/opencode.yaml index 1c4a4e8..f563e6b 100644 --- a/adapters/tools/opencode.yaml +++ b/adapters/tools/opencode.yaml @@ -62,6 +62,9 @@ detect: update: method: self_update_cmd command: [opencode, upgrade] + source: + kind: npm + package: opencode-ai uninstall: method: npm_uninstall diff --git a/adapters/tools/qwen.yaml b/adapters/tools/qwen.yaml index f2e2cd6..9b083bf 100644 --- a/adapters/tools/qwen.yaml +++ b/adapters/tools/qwen.yaml @@ -47,6 +47,9 @@ detect: update: method: npm_update command: [npm, update, -g, "@qwen-code/qwen-code"] + source: + kind: npm + package: "@qwen-code/qwen-code" uninstall: method: npm_uninstall diff --git a/apps/desktop/src-tauri/src/commands/cli.rs b/apps/desktop/src-tauri/src/commands/cli.rs index 8976aff..0272f99 100644 --- a/apps/desktop/src-tauri/src/commands/cli.rs +++ b/apps/desktop/src-tauri/src/commands/cli.rs @@ -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) -> Result { + 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 { + 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 { + 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 { + 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 = state + .adapters() + .map(|ads| { + let mut hosts: Vec = 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 { + [ + "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() +} diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index a700fd4..1256602 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -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, diff --git a/apps/desktop/src/components/CliMonogram.tsx b/apps/desktop/src/components/CliMonogram.tsx index 5b68a63..33caa90 100644 --- a/apps/desktop/src/components/CliMonogram.tsx +++ b/apps/desktop/src/components/CliMonogram.tsx @@ -30,7 +30,29 @@ function fallbackAbbr(name: string): string { return name.replace(/\s+/g, "").slice(0, 2).toUpperCase(); } -/** CLI 单色字母头像(视觉规范 §7:双字母单色,--ad-bg-2 底 + 1px --ad-border) */ +/** + * 各工具官方图标主色(Wave 3.1 Req 10:按官方主色微调头像角标,不改动六色语义)。 + * 官方图标二进制资源待打包波由美术师统一下载本地化;此处以主色作为识别配色过渡。 + */ +const CLI_BRAND_COLORS: Record = { + codex: "#10A37F", + "claude-code": "#D97757", + gemini: "#4285F4", + copilot: "#8957E5", + kimi: "#5B5BEE", + qwen: "#615CED", + codebuddy: "#0052D9", + opencode: "#7C5CFF", + crush: "#F4B860", + goose: "#E84393", + aider: "#FF6B6B", + cursor: "#4A4A4A", + cline: "#6B6BFF", + warp: "#00E0FF", +}; + +/** CLI 单色字母头像(视觉规范 §7:双字母单色,--ad-bg-2 底 + 1px --ad-border) + * Wave 3.1:官方图标主色作为字母/角标识别配色(官方图标二进制待打包波本地化) */ export function CliMonogram({ id, name, @@ -41,10 +63,16 @@ export function CliMonogram({ size?: number; }) { const chars = CLI_MONOGRAMS[id] ?? fallbackAbbr(name); + const accent = CLI_BRAND_COLORS[id]; return (