@lynn123411/dsh-kimi-cu 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  ## 概述
6
6
 
7
- - **读写本机 app 界面**:模型能看到并操作已打开的应用窗口——观察、点击、输入、滚动、拖拽,以及列出应用和窗口。macOS 走后台静默操作;Windows 走前台真实输入,会短暂占用鼠标键盘。
8
- - **安装检测与引导**:插件页详情页的状态卡显示「未安装 / 已安装但本机检查未通过 / 本机检查通过」,给出当前平台的官方安装命令、复制按钮与重新检测;模型也可以用 `kimi_cu_status` 工具查同样的状态。
7
+ - **读写本机界面**:macOS 通过 CodeAct 操作应用和浏览器,默认在后台执行;Windows 使用前台真实输入,会短暂占用鼠标键盘。
8
+ - **安装检测与引导**:插件页详情页的状态卡显示安装、权限与 MCP 连接状态,给出当前平台的官方安装命令、复制按钮与重新检测;模型也可以用 `kimi_cu_status` 工具查同样的状态。
9
9
  - **一键更新**:卡片读 KimiCU 官方的更新清单,有新版时按钮显示「更新到 x.y.z」;点一下由 KimiCU 自己的 `upgrade` 通道下载、校验签名并替换安装,过程中显示阶段文字,完成后就地更新版本号并重连 MCP。
10
10
  - **随包带操作技能**:`kimi-cu` 技能说明怎么绑定目标窗口、什么时候重新观察、坐标与 index 怎么用、投递成功与真的生效怎么区分;macOS 与 Windows 各一份。
11
11
 
@@ -19,7 +19,7 @@ dsh plugin --profile web add @lynn123411/dsh-kimi-cu
19
19
 
20
20
  开关在插件页「已安装插件」里本插件那一行的右侧:关掉后 `mcp__kimi-cu__*` 工具与随包技能一起消失,重新打开时重新探测并注册。
21
21
 
22
- MCP 连接在探测之后才注册,所以装好 KimiCU 之后要在插件页把本插件关一次再开一次(或重启 DSH),连接才会重新建立。
22
+ 装好 KimiCU 后,在插件详情页点「重新检测」。探测通过且桌面槽位可用时,插件会建立 MCP 连接。
23
23
 
24
24
  ## 配置
25
25
 
@@ -29,7 +29,7 @@ MCP 连接在探测之后才注册,所以装好 KimiCU 之后要在插件页
29
29
 
30
30
  | 行 | 内容 | 动作 |
31
31
  | --- | --- | --- |
32
- | 状态 | 状态标签(未安装 / 已安装但本机检查未通过 / 本机检查通过)、说明文字、安装位置附注 | 「重新检测」重新跑一次探测 |
32
+ | 状态 | 安装与连接状态、故障信息、安装位置附注 | 「重新检测」刷新本机检查并尝试补连 |
33
33
  | 版本 | 探测到的 KimiCU 版本号 | — |
34
34
  | 路径 | 探测到的可执行文件路径 | — |
35
35
  | 更新 | 更新清单的比对结果或当前阶段;失败时给失败原因与原始输出 | 「检查更新」/「更新到 x.y.z」/「已是最新」/「更新中」 |
@@ -61,7 +61,7 @@ MCP 连接不占 patch 行:宿主半边探测到可执行文件之后调用 `m
61
61
 
62
62
  Windows 的路径公式只在 `resolve.ts` 的 `windowsMcpCommand` 里有一份。覆盖值存在时只用覆盖值,不回退到默认目录;旧目录安装会同时标 `legacy-install` 与 `mcp-command-missing`,卡片按「本机检查未通过」处理,不会在连接指向的文件不存在时报「本机检查通过」。
63
63
 
64
- `doctor` 只检查调用者上下文,所以「本机检查通过」不表示后台 Service 已就绪——服务权限要看 `xpc-ping`(见随包 macOS 技能)。
64
+ `doctor` 报告服务与调用者上下文的检查;服务不可达时可用 `xpc-ping` 进一步诊断(见随包 macOS 技能)。
65
65
 
66
66
  ### 更新链路
67
67
 
@@ -76,25 +76,26 @@ macOS 与 Windows 各有一份更新清单,版本号互不可比。页面打
76
76
  - **阶段**:`==>` 开头的行映射成「正在下载/校验/替换/重连」,认不出的行保持上一个阶段。
77
77
  - **失败分类**:只看错误行(跳过 `==>` 与 `✓` 进度行),分网络、校验失败、权限不足、已有升级在跑、超时五类,另有 unknown 兜底。
78
78
  - **单飞锁与超时**:同一时刻只允许一次更新;5 分钟超时只放弃等待,不 kill 子进程,锁留到它真的退出。
79
- - **重连**:升级后读到新版本号才调 `mcpManager.restart('kimi-cu')`;重启失败时卡片提示重启 DSH。
79
+ - **断流**:如果浏览器收不到最终事件,会显示更新结果未知。可重新检测本机版本与 MCP 连接。服务端仍跟踪原进程退出并处理后续重连。
80
+ - **版本与重连**:确认已装入目标版本或更新版本后,通过 `mcpManager.restart('kimi-cu')` 重建仍在注册的连接。启动命令变更或旧注册已撤回时重新注册。管理器报告已连接后,卡片才确认重连成功。
80
81
 
81
82
  安装不执行、更新却执行,是因为两者要的权限不同:安装器要用户在系统设置里授予辅助功能与屏幕录制,后台执行拿不到;更新走 KimiCU 自带的 `upgrade`,下载、校验、替换、回滚都由它完成,不需要交互式密码。
82
83
 
83
84
  ### 桌面操作独占槽位
84
85
 
85
- 宿主把「控制桌面」当成独占能力:`@deepseek-ai/dsh-computer-use` 只放行一个提供方,第二个 `computerUse.register()` 直接抛错并报出已占位的名字。KimiCU 的工具走 MCP,宿主看不见它在控制桌面,所以本插件也占位(名字 `kimi-cu`),并且**占到了才注册 MCP 连接**:槽位已被别的后端占着时不抢、也不交出工具,只写一条 warning。两个可选服务谁先到不确定,所以注册动作收在 `syncMcp()` 里,条件齐了才动手。
86
+ 本机检查通过、MCP 启动文件存在且管理器可用时,插件会注册 MCP 连接。如果宿主提供 `computerUse` 服务,插件会先调用 `computerUse.register()` 为 `kimi-cu` 占用桌面操作槽位。自定义宿主组合可以省略 `computerUse`,此时 KimiCU 仍由 MCP 管理器接入,连接没有 `computerUse` 提供的独占保护。槽位冲突会显示占用方。MCP 注册或连接终态失败时撤回注册并释放槽位,后续可重新检测补连。管理器报告清理未完成时,保留槽位至宿主停止,避免旧连接和新后端同时控制桌面。
86
87
 
87
88
  ### 技能按平台分两条
88
89
 
89
- 两份技能的工具面与操作语义不同:macOS 是后台静默、AX 树,带 `paste` / `drag_paths` / `js`;Windows 是前台真实输入、UIA 树,带 `turn_ended`,没有 `paste` / `drag_paths` / `js`。合成一份会让模型在错误的平台上调用不存在的工具,所以各扫各的目录,技能名都叫 `kimi-cu`。
90
+ 两份技能的工具面与操作语义不同:macOS 使用 CodeAct 的 `js` / `js_reset` 和 AX 树,Windows 使用直接工具、前台真实输入和 UIA 树。各平台分别扫描对应目录,技能名都叫 `kimi-cu`;实际工具以已连接服务的 schema 为准。
90
91
 
91
92
  两条技能行都写 `providerName: kimi-cu` 与 `includeDefaultRoots: false`,只扫本包对应平台的 `skills/`;项目与用户技能目录仍归内核那条默认行。技能目录用 `createRequire(baseUrl).resolve(...)` 算成绝对路径:bundle patch 的 `!!js` 以 profile 目录为 `baseUrl`,写相对路径会解析到别处。
92
93
 
93
94
  ### 工具调用上限与连接数
94
95
 
95
- 注册给管理器的条目把单次工具调用上限设成 5 分钟:内核 `mcp-client` 的默认值更短,KimiCU 的 `js` cell 可以跑循环和批量操作,超时会被客户端取消;更长的任务拆成多个 cell。
96
+ 注册给管理器的条目把单次工具调用上限设成 5 分钟;超时会被客户端取消,长任务应拆成可验证的步骤。macOS 的官方启动脚本检查系统和 App 版本,App 低于脚本要求时可能自动升级。
96
97
 
97
- 宿主只起一个 KimiCU MCP 连接,所有 session 共用。KimiCU 的快照与 index 缓存是连接级的:两个 session 同时操作同一个应用,后一次观察会顶掉前一次的参照。
98
+ 宿主只起一个 KimiCU MCP 连接,所有 session 共用。macOS 的持久 JS 会话和观察状态也随连接共享;多个 session 应错开操作,重新观察后再使用目标标识。
98
99
 
99
100
  ## 模型体验
100
101
 
@@ -102,19 +103,19 @@ macOS 与 Windows 各有一份更新清单,版本号互不可比。页面打
102
103
 
103
104
  > Check whether KimiCU (Kimi Computer Use) is installed and ready on this machine, and get the platform-specific install or repair steps. Call this when the mcp__kimi-cu__* tools are missing or a KimiCU call fails with a connection error.
104
105
 
105
- 参数一个:`refresh`(布尔,绕过缓存重新探测)。返回一段 JSON,含平台、是否安装、路径、版本、`doctor` 结果、MCP 命令、安装计划与附注。
106
+ `refresh` 是布尔参数。启用时绕过缓存重新检测,并尝试补连。工具返回 JSON,含平台、安装与版本信息、`doctor` 结果、MCP 命令与实时状态、安装计划。
106
107
 
107
- MCP 工具在模型侧的名字是 `mcp__kimi-cu__<name>`(例如 `mcp__kimi-cu__list_apps`)。随包技能说明这些工具的用法与边界,并要求在 `mcp__kimi-cu__*` 缺失或连接失败时先调 `kimi_cu_status`,把安装或修复步骤转告用户,不要在缺装时假装能操作。
108
+ MCP 工具在模型侧的名字是 `mcp__kimi-cu__<name>`(例如 macOS 的 `mcp__kimi-cu__js`,或 Windows 的 `mcp__kimi-cu__list_apps`)。随包技能说明这些工具的用法与边界,并要求在 `mcp__kimi-cu__*` 缺失或连接失败时先调 `kimi_cu_status`,把安装或修复步骤转告用户,不要在缺装时假装能操作。
108
109
 
109
110
  ## 限制
110
111
 
111
- - **桌面操作是独占能力**:槽位被别的后端占着时不交出 `mcp__kimi-cu__*` 工具,只写一条 warning;槽位后来空出来要重启 DSH 才会补位——宿主的登记没有变更事件可订阅。
112
- - **一条连接服务所有 session**:两个 session 同时操作同一个应用时要错开,技能要求每次动作前重新观察。
113
- - **`doctor` 只检查调用者上下文**:「本机检查通过」不表示后台 Service 已就绪,服务权限要看 `xpc-ping`。
114
- - **安装只给命令**:插件不执行安装脚本,权限授予只能在系统设置里由用户确认。
112
+ - **桌面操作是独占能力**:槽位被其他后端占用时会显示冲突。对方释放后,可点「重新检测」补连。
113
+ - **一条连接服务所有 session**:macOS 的持久 JS 变量、句柄和 reset 在会话间共享,`scope:"cell"` 也能读取已有持久变量;多个 session 必须错开操作,无法保证会话隔离。
114
+ - **服务权限诊断**:服务不可达时使用 `xpc-ping` 检查后台 Service 的状态与权限。
115
+ - **安装与升级**:首次安装由用户执行安装命令;macOS 官方启动脚本在 App 版本过低时可能自动执行升级。系统权限由用户授予。
115
116
  - **更新超时只放弃等待**:5 分钟到点后卡片报超时,子进程可能仍在跑。
116
117
  - **平台不受支持时不连**:卡片说明一句,不注册 MCP,模型看不到 `mcp__kimi-cu__*`。
117
- - **Windows 走旧 13 工具 MCP**:没有 `paste`、`drag_paths`、`js`、`list_windows`、`get_window`,多一个 `turn_ended`;前台真实输入会短暂占用鼠标键盘。
118
+ - **Windows 使用前台真实输入**:会短暂占用鼠标键盘;具体工具以已连接服务的 schema 为准。
118
119
  - **技能目录按包名解析**:bundle patch 里不能写相对路径。
119
120
 
120
121
  ## 验证
@@ -130,10 +131,18 @@ cd plugins/dsh-kimi-cu && pnpm check
130
131
  - `smoke-client.mjs`:按 Web shell 的方式装载浏览器 bundle,断言包 id 自注册、`inject` 与真正读的服务一致、字典键集中英对齐、状态卡注册在 `plugins.bundle.config` 且 key 是包名,以及未声明服务的读取会抛。
131
132
  - `test-exclusivity.mjs`:用可注入的 `fakeDetect` 验独占槽位(没有 `computerUse` 时照常注册、槽位空着时先占位再注册、被别的后端占着时不注册也不顶掉、占位后别人再注册被拒),不读真探测器。
132
133
  - `test-status.mjs`:检测的纯逻辑(缓存与单飞、`refresh` 绕过缓存、两平台的路径公式、覆盖值与旧目录的附注)。
133
- - `test-update.mjs`:更新链路(清单解析、版本比较、阶段映射、失败分类、单飞锁与超时)。
134
+ - `test-update.mjs`:更新链路(清单解析、版本比较、阶段映射、失败分类、单飞锁与超时),以及真实 Connection 对匿名、普通认证与 owner 请求的准入。
134
135
  - `test-card.mjs`:用真 react 把状态卡画进 jsdom(四种状态、安装块、检查项、更新按钮的四种文案、失败与原始输出)。
135
136
  - `assert:lib-untracked.mjs`:`lib/` 是构建产物镜像,不入 git。
136
137
  - `check-bundle.mjs`:清单面、文本面与契约面(内核真 `Config` schema、两平台分支、技能目录)。
137
138
  - `tools/probes/preset-skills.mjs` 各跑一次 `skills/macos` 与 `skills/windows`:随包技能能被内核的技能发现机制找到。
138
139
 
139
- 浏览器里验收:打开插件页本插件的详情页,状态卡应显示「本机检查通过」与探测到的版本、路径;点「重新检测」应重新跑一次探测;把 KimiCU 的安装移走再检测,状态应变成「未安装」并给出官方安装命令。真装载用 `node tools/host-smoke.mjs`。
140
+ 浏览器里打开插件详情页,确认卡片与当前安装、权限和 MCP 状态一致,并验证「重新检测」能更新状态。宿主装载由 `node tools/host-smoke.mjs` 验证。
141
+
142
+ ## 上游
143
+
144
+ - KimiCU(Kimi Computer Use)由 Moonshot AI 提供,许可 `Proprietary`。本包只接本机装的 KimiCU MCP 服务与官方更新通道,不重新分发 app;两份 `kimi-cu` 技能正文写在本仓库,按两个平台各自的工具面维护。
145
+ - 官方 macOS 插件包 `https://cdn.kimi.com/kimi-computer-use/latest/kimi-cu-plugin.zip` 提供 CodeAct 技能与启动脚本;本包的 macOS 技能按其工具面自行维护。
146
+ - macOS 使用 App 内的官方 `Contents/Resources/kimi-cu-mcp` 启动 CodeAct;Windows 使用 `kimi-cu.exe mcp`。实际工具取决于安装的服务版本。
147
+ - 安装命令与更新清单:macOS `https://cdn.kimi.com/kimi-computer-use/latest/setup_macos.sh`、`https://cdn.kimi.com/kimi-computer-use/latest/version.json`;Windows `https://cdn.kimi.com/kimi-computer-use-windows/latest/setup_windows.ps1`、`https://cdn.kimi.com/kimi-computer-use-windows/latest/version.json`。
148
+ - 上游文档:`https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html`(英文版在 `/en/` 下同名路径)。
package/lib/client.js CHANGED
@@ -32,6 +32,9 @@ var import_react = require("react");
32
32
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
33
33
 
34
34
  // src/shared/status.ts
35
+ function isMcpConnecting(state) {
36
+ return state === "connecting" || state === "reconnecting";
37
+ }
35
38
  var STATUS_ROUTE_PATH = "/api/dsh-kimi-cu/status";
36
39
 
37
40
  // src/client/status-remote.ts
@@ -64,30 +67,41 @@ async function fetchUpdateCheck() {
64
67
  }
65
68
  }
66
69
  async function startUpdate(onEvent) {
70
+ let accepted = false;
67
71
  try {
68
72
  const response = await fetch(UPDATE_ROUTE_PATH, { method: "POST", cache: "no-store" });
69
- if (!response.ok) return { ok: false, message: "HTTP " + String(response.status) };
70
- if (response.body === null) return { ok: false, message: "empty response" };
73
+ if (!response.ok) return { kind: "error", message: "HTTP " + String(response.status) };
74
+ accepted = true;
75
+ if (response.body === null) return { kind: "interrupted" };
71
76
  const reader = response.body.getReader();
72
77
  const decoder = new TextDecoder();
73
78
  let pending = "";
74
79
  for (; ; ) {
75
80
  const { done, value } = await reader.read();
76
- if (done) break;
77
- pending += decoder.decode(value, { stream: true });
81
+ pending += done ? decoder.decode() : decoder.decode(value, { stream: true });
78
82
  const lines = pending.split("\n");
79
- pending = lines.pop() ?? "";
83
+ pending = done ? "" : lines.pop() ?? "";
80
84
  for (const line of lines) {
81
85
  if (line.trim() === "") continue;
86
+ let event;
82
87
  try {
83
- onEvent(JSON.parse(line));
88
+ event = JSON.parse(line);
84
89
  } catch {
90
+ continue;
91
+ }
92
+ if (event?.type !== "stage" && event?.type !== "done" && event?.type !== "error") continue;
93
+ onEvent(event);
94
+ if (event.type !== "stage") {
95
+ void reader.cancel().catch(() => {
96
+ });
97
+ return { kind: "complete" };
85
98
  }
86
99
  }
100
+ if (done) return { kind: "interrupted" };
87
101
  }
88
- return { ok: true };
89
102
  } catch (error) {
90
- return { ok: false, message: error instanceof Error ? error.message : String(error) };
103
+ if (accepted || error instanceof TypeError) return { kind: "interrupted" };
104
+ return { kind: "error", message: error instanceof Error ? error.message : String(error) };
91
105
  }
92
106
  }
93
107
 
@@ -99,6 +113,23 @@ var NOTE_KEYS = {
99
113
  "mcp-command-missing": "note.mcp-command-missing",
100
114
  "detection-failed": "note.detection-failed"
101
115
  };
116
+ function mcpHintKey(state) {
117
+ switch (state) {
118
+ case "connected":
119
+ return null;
120
+ case "connecting":
121
+ return "status.mcpConnecting";
122
+ case "reconnecting":
123
+ return "status.mcpReconnecting";
124
+ case "conflict":
125
+ return "status.mcpConflict";
126
+ case "failed":
127
+ case "registration-failed":
128
+ return "status.mcpFailed";
129
+ default:
130
+ return "status.mcpDisconnected";
131
+ }
132
+ }
102
133
  var CHECK_KEYS = {
103
134
  accessibility: "check.accessibility",
104
135
  "screen-recording": "check.screen-recording",
@@ -143,13 +174,30 @@ function ConfigCard(props) {
143
174
  alive = false;
144
175
  };
145
176
  }, []);
177
+ (0, import_react.useEffect)(() => {
178
+ const mcpState = state.kind === "ok" ? state.status.mcpStatus?.state : void 0;
179
+ if (!isMcpConnecting(mcpState)) return;
180
+ let alive = true;
181
+ const timer = setTimeout(() => {
182
+ void fetchStatus(false).then((result) => {
183
+ if (alive) setState(result);
184
+ });
185
+ }, 1e3);
186
+ return () => {
187
+ alive = false;
188
+ clearTimeout(timer);
189
+ };
190
+ }, [state]);
146
191
  const recheck = () => {
147
192
  setState({ kind: "loading" });
148
193
  setCopied(false);
149
194
  setCopyFailed(false);
150
195
  setRun({ kind: "idle" });
151
- loadUpdate();
152
- void fetchStatus(true).then((result) => setState(result));
196
+ setUpdate({ kind: "checking" });
197
+ void fetchStatus(true).then((result) => {
198
+ setState(result);
199
+ loadUpdate();
200
+ });
153
201
  };
154
202
  const copy = (command) => {
155
203
  setCopyFailed(false);
@@ -175,10 +223,11 @@ function ConfigCard(props) {
175
223
  return;
176
224
  }
177
225
  setRun({ kind: "done", upToDate: event.upToDate, version: event.version, reconnect: event.reconnect });
178
- void fetchStatus(true).then((result) => setState(result));
226
+ void fetchStatus(false).then((result) => setState(result));
179
227
  loadUpdate();
180
228
  }).then((outcome) => {
181
- if (!outcome.ok) setRun({ kind: "failed", failure: "unknown", raw: outcome.message ?? "" });
229
+ if (outcome.kind === "interrupted") setRun({ kind: "interrupted" });
230
+ if (outcome.kind === "error") setRun({ kind: "failed", failure: "unknown", raw: outcome.message });
182
231
  });
183
232
  };
184
233
  if (state.kind === "loading") {
@@ -199,13 +248,16 @@ function ConfigCard(props) {
199
248
  const docs = install === null ? null : docsUrl(install);
200
249
  const legacy = status.notes.includes("legacy-install");
201
250
  const commandMissing = status.notes.includes("mcp-command-missing");
202
- const doctorFailed = status.installed && status.doctor.ran && !status.doctor.ok;
203
- const notReady = doctorFailed || status.installed && commandMissing;
251
+ const doctorFailed = status.installed && !status.doctor.ok;
252
+ const mcpHint = mcpHintKey(status.mcpStatus?.state);
253
+ const localCheckFailed = doctorFailed || commandMissing;
254
+ const notReady = localCheckFailed || mcpHint !== null;
204
255
  const showInstall = !status.installed || legacy || commandMissing;
205
- const badge = !status.installed ? t("status.missing.title") : notReady ? t("status.notReady.title") : t("status.ready.title");
256
+ const badge = !status.installed ? t("status.missing.title") : localCheckFailed ? t("status.notReady.title") : mcpHint === null ? t("status.ready.title") : t("status.mcpNotReady");
206
257
  const updateHint = (() => {
207
258
  if (run.kind === "running") return tr("update.stage." + run.stage);
208
259
  if (run.kind === "failed") return tr("update.failed." + run.failure);
260
+ if (run.kind === "interrupted") return t("update.interrupted");
209
261
  if (run.kind === "done") {
210
262
  if (run.upToDate || run.version === null) return t("update.hint.latest");
211
263
  return t("update.done") + " " + run.version;
@@ -217,6 +269,7 @@ function ConfigCard(props) {
217
269
  const updateLabel = (() => {
218
270
  if (run.kind === "running") return t("update.running");
219
271
  if (run.kind === "failed") return t("status.retry");
272
+ if (run.kind === "interrupted") return t("update.action");
220
273
  if (run.kind === "done") return t("update.latest");
221
274
  if (update.kind === "ready") {
222
275
  return update.check.hasUpdate ? t("update.to") + " " + (update.check.latest ?? "") : t("update.latest");
@@ -224,7 +277,7 @@ function ConfigCard(props) {
224
277
  if (update.kind === "unavailable") return t("update.action");
225
278
  return t("update.check");
226
279
  })();
227
- const updateDisabled = run.kind === "running" || run.kind === "done" || update.kind === "checking" || update.kind === "ready" && !update.check.hasUpdate;
280
+ const updateDisabled = run.kind === "running" || run.kind === "done" || run.kind === "interrupted" || update.kind === "checking" || update.kind === "ready" && !update.check.hasUpdate;
228
281
  const updateAction = update.kind === "ready" && !update.check.hasUpdate ? loadUpdate : updateNow;
229
282
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-card", children: [
230
283
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
@@ -233,6 +286,10 @@ function ConfigCard(props) {
233
286
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: !status.installed || notReady ? "danger" : "info", children: badge }),
234
287
  status.installed ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.missing.hint") }),
235
288
  status.installed && !notReady && !legacy ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.ready.hint") }) : null,
289
+ status.installed && mcpHint !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-hint", children: [
290
+ tr(mcpHint),
291
+ status.mcpStatus?.lastError ? " \xB7 " + status.mcpStatus.lastError : ""
292
+ ] }) : null,
236
293
  status.notes.map((note) => NOTE_KEYS[note] === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: tr(NOTE_KEYS[note]) }, note))
237
294
  ] }),
238
295
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-control", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "ghost", size: "sm", disabled: run.kind === "running", onClick: recheck, children: t("status.recheck") }) })
@@ -262,7 +319,7 @@ function ConfigCard(props) {
262
319
  ] }) })
263
320
  ] }) : null
264
321
  ] }) : null,
265
- notReady ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
322
+ doctorFailed ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
266
323
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.checks") }),
267
324
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-span", children: [
268
325
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.notReady.hint") }),
@@ -270,7 +327,7 @@ function ConfigCard(props) {
270
327
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: check.ok ? "\u2705" : "\u274C" }),
271
328
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: checkLabel(tr, check) })
272
329
  ] }, check.id)) }),
273
- doctorFailed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: status.platform === "darwin" ? t("fix.macos") : t("fix.windows") }) : null
330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: status.platform === "darwin" ? t("fix.macos") : t("fix.windows") })
274
331
  ] })
275
332
  ] }) : null,
276
333
  showInstall && install !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
@@ -306,8 +363,14 @@ var en = {
306
363
  "status.missing.hint": "Install the official runtime, then check again.",
307
364
  "status.notReady.title": "KimiCU is installed but local checks failed",
308
365
  "status.notReady.hint": "Fix the failed checks below, then check again.",
366
+ "status.mcpFailed": "MCP connection failed",
367
+ "status.mcpNotReady": "MCP is not ready",
368
+ "status.mcpConflict": "Another provider owns desktop control",
369
+ "status.mcpConnecting": "Connecting to the MCP server\u2026",
370
+ "status.mcpReconnecting": "Reconnecting to the MCP server\u2026",
371
+ "status.mcpDisconnected": "MCP is disconnected. Check again to reconnect.",
309
372
  "status.ready.title": "Local checks passed",
310
- "status.ready.hint": "If the model cannot see the mcp__kimi-cu__* tools, turn this plugin off and on again on the Plugins page, or restart DSH.",
373
+ "status.ready.hint": "If the model cannot see the mcp__kimi-cu__* tools, check the connection again.",
311
374
  "status.copy": "Copy command",
312
375
  "status.copied": "Copied",
313
376
  "status.copyFailed": "Copy failed; select the command manually.",
@@ -320,11 +383,11 @@ var en = {
320
383
  "status.docs.label": "Docs",
321
384
  "step.install": "Install the official KimiCU runtime.",
322
385
  "step.grant-permissions": "In System Settings, grant Accessibility and Screen Recording to KimiCU.",
323
- "step.reload-plugin": "Turn this plugin off and on again on the Plugins page, or restart DSH.",
386
+ "step.recheck": "Click Check again on this page to connect KimiCU.",
324
387
  "step.upgrade": "Upgrade KimiCU to 0.3.8 or later.",
325
388
  "note.legacy-install": "An older KimiCU install was found; upgrade it so the MCP row can use the new path.",
326
389
  "note.override-missing": "KIMI_CU_WINDOWS_EXE points to a file that does not exist; fix the path or unset it.",
327
- "note.mcp-command-missing": "The MCP row will launch a file that does not exist; upgrade KimiCU or point KIMI_CU_WINDOWS_EXE at the installed kimi-cu.exe.",
390
+ "note.mcp-command-missing": "The MCP launcher is missing; update or reinstall KimiCU. On Windows, you can also point KIMI_CU_WINDOWS_EXE at the installed kimi-cu.exe.",
328
391
  "note.detection-failed": "Detection failed; see the error and try again.",
329
392
  "check.accessibility": "Accessibility",
330
393
  "check.screen-recording": "Screen Recording",
@@ -348,7 +411,8 @@ var en = {
348
411
  "update.hint.latest": "Already the newest version.",
349
412
  "update.hint.unavailable": "Couldn't read the update manifest.",
350
413
  "update.hint.checking": "Checking for updates\u2026",
351
- "update.reconnectFailed": "The new version is installed; restart DSH to load it.",
414
+ "update.reconnectFailed": "The new version is installed. MCP has not connected. Check again to see the current connection status.",
415
+ "update.interrupted": "The connection was interrupted and the update outcome is unknown. Check the installed version and MCP connection before retrying.",
352
416
  "update.stage.checking": "Checking for updates\u2026",
353
417
  "update.stage.downloading": "Downloading\u2026",
354
418
  "update.stage.verifying": "Verifying the download\u2026",
@@ -359,6 +423,7 @@ var en = {
359
423
  "update.failed.permission": "Couldn't replace the KimiCU install; run the installer from a terminal with administrator rights.",
360
424
  "update.failed.busy": "Another update is already running; wait for it to finish.",
361
425
  "update.failed.timeout": "The update did not finish within 5 minutes; it may still be running. Check again later.",
426
+ "update.failed.unconfirmed": "The installer exited, but the installed version could not be verified.",
362
427
  "update.failed.unknown": "The update failed."
363
428
  };
364
429
  var zh = {
@@ -371,8 +436,14 @@ var zh = {
371
436
  "status.missing.hint": "\u5148\u5B89\u88C5\u5B98\u65B9\u8FD0\u884C\u65F6\uFF0C\u518D\u56DE\u6765\u91CD\u65B0\u68C0\u6D4B\u3002",
372
437
  "status.notReady.title": "\u5DF2\u5B89\u88C5 KimiCU\uFF0C\u4F46\u672C\u673A\u68C0\u67E5\u672A\u901A\u8FC7",
373
438
  "status.notReady.hint": "\u6309\u4E0B\u9762\u5931\u8D25\u7684\u68C0\u67E5\u9879\u4FEE\u590D\uFF0C\u518D\u91CD\u65B0\u68C0\u6D4B\u3002",
439
+ "status.mcpFailed": "MCP \u8FDE\u63A5\u5931\u8D25",
440
+ "status.mcpNotReady": "MCP \u5C1A\u672A\u5C31\u7EEA",
441
+ "status.mcpConflict": "\u684C\u9762\u64CD\u4F5C\u5DF2\u7531\u5176\u4ED6\u540E\u7AEF\u5360\u7528",
442
+ "status.mcpConnecting": "\u6B63\u5728\u8FDE\u63A5 MCP\u2026",
443
+ "status.mcpReconnecting": "\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5 MCP\u2026",
444
+ "status.mcpDisconnected": "MCP \u672A\u8FDE\u63A5\u3002\u70B9\u51FB\u91CD\u65B0\u68C0\u6D4B\u53EF\u5C1D\u8BD5\u8FDE\u63A5\u3002",
374
445
  "status.ready.title": "\u672C\u673A\u68C0\u67E5\u901A\u8FC7",
375
- "status.ready.hint": "\u5982\u679C\u6A21\u578B\u770B\u4E0D\u5230 mcp__kimi-cu__* \u5DE5\u5177\uFF0C\u8BF7\u5728\u63D2\u4EF6\u9875\u628A\u672C\u63D2\u4EF6\u5173\u4E00\u6B21\u518D\u5F00\u4E00\u6B21\uFF0C\u6216\u91CD\u542F DSH\u3002",
446
+ "status.ready.hint": "\u5982\u679C\u6A21\u578B\u770B\u4E0D\u5230 mcp__kimi-cu__* \u5DE5\u5177\uFF0C\u8BF7\u91CD\u65B0\u68C0\u6D4B\u8FDE\u63A5\u3002",
376
447
  "status.copy": "\u590D\u5236\u547D\u4EE4",
377
448
  "status.copied": "\u5DF2\u590D\u5236",
378
449
  "status.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u62E9\u547D\u4EE4\u3002",
@@ -385,11 +456,11 @@ var zh = {
385
456
  "status.docs.label": "\u6587\u6863",
386
457
  "step.install": "\u5B89\u88C5\u5B98\u65B9 KimiCU \u8FD0\u884C\u65F6\u3002",
387
458
  "step.grant-permissions": "\u5728\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u4E3A KimiCU \u5F00\u542F\u8F85\u52A9\u529F\u80FD\u4E0E\u5C4F\u5E55\u5F55\u5236\u3002",
388
- "step.reload-plugin": "\u5728\u63D2\u4EF6\u9875\u628A\u672C\u63D2\u4EF6\u5173\u4E00\u6B21\u518D\u5F00\u4E00\u6B21\uFF0C\u6216\u91CD\u542F DSH\u3002",
459
+ "step.recheck": "\u56DE\u5230\u672C\u9875\uFF0C\u70B9\u51FB\u91CD\u65B0\u68C0\u6D4B\u4EE5\u8FDE\u63A5 KimiCU\u3002",
389
460
  "step.upgrade": "\u628A KimiCU \u5347\u7EA7\u5230 0.3.8 \u6216\u66F4\u65B0\u7248\u672C\u3002",
390
461
  "note.legacy-install": "\u68C0\u6D4B\u5230\u65E7\u7248 KimiCU \u5B89\u88C5\u76EE\u5F55\uFF1B\u5347\u7EA7\u540E MCP \u884C\u624D\u80FD\u7528\u4E0A\u65B0\u8DEF\u5F84\u3002",
391
462
  "note.override-missing": "KIMI_CU_WINDOWS_EXE \u6307\u5411\u7684\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1B\u6539\u8DEF\u5F84\u6216\u53BB\u6389\u5B83\u3002",
392
- "note.mcp-command-missing": "MCP \u884C\u8981\u542F\u52A8\u7684\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1B\u5347\u7EA7 KimiCU\uFF0C\u6216\u628A KIMI_CU_WINDOWS_EXE \u6307\u5411\u5DF2\u5B89\u88C5\u7684 kimi-cu.exe\u3002",
463
+ "note.mcp-command-missing": "MCP \u542F\u52A8\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1B\u8BF7\u66F4\u65B0\u6216\u91CD\u65B0\u5B89\u88C5 KimiCU\u3002Windows \u4E5F\u53EF\u628A KIMI_CU_WINDOWS_EXE \u6307\u5411\u5DF2\u5B89\u88C5\u7684 kimi-cu.exe\u3002",
393
464
  "note.detection-failed": "\u68C0\u6D4B\u5931\u8D25\uFF1B\u770B\u9519\u8BEF\u4FE1\u606F\u540E\u91CD\u8BD5\u3002",
394
465
  "check.accessibility": "\u8F85\u52A9\u529F\u80FD",
395
466
  "check.screen-recording": "\u5C4F\u5E55\u5F55\u5236",
@@ -413,7 +484,8 @@ var zh = {
413
484
  "update.hint.latest": "\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002",
414
485
  "update.hint.unavailable": "\u8BFB\u4E0D\u5230\u66F4\u65B0\u6E05\u5355\u3002",
415
486
  "update.hint.checking": "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",
416
- "update.reconnectFailed": "\u65B0\u7248\u672C\u5DF2\u88C5\u597D\uFF1B\u91CD\u542F DSH \u540E\u751F\u6548\u3002",
487
+ "update.reconnectFailed": "\u65B0\u7248\u672C\u5DF2\u5B89\u88C5\uFF0CMCP \u5C1A\u672A\u8FDE\u901A\u3002\u8BF7\u91CD\u65B0\u68C0\u6D4B\u8FDE\u63A5\u72B6\u6001\u3002",
488
+ "update.interrupted": "\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u66F4\u65B0\u7ED3\u679C\u672A\u77E5\u3002\u8BF7\u91CD\u65B0\u68C0\u6D4B\u7248\u672C\u548C MCP \u8FDE\u63A5\u540E\u518D\u8BD5\u3002",
417
489
  "update.stage.checking": "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0",
418
490
  "update.stage.downloading": "\u6B63\u5728\u4E0B\u8F7D",
419
491
  "update.stage.verifying": "\u6B63\u5728\u6821\u9A8C\u4E0B\u8F7D\u5305",
@@ -424,6 +496,7 @@ var zh = {
424
496
  "update.failed.permission": "\u6CA1\u6709\u6743\u9650\u66FF\u6362 KimiCU \u7684\u5B89\u88C5\uFF0C\u8BF7\u5728\u7EC8\u7AEF\u91CC\u7528\u7BA1\u7406\u5458\u6743\u9650\u8FD0\u884C\u5B89\u88C5\u811A\u672C\u3002",
425
497
  "update.failed.busy": "\u5DF2\u7ECF\u6709\u4E00\u4E2A\u66F4\u65B0\u5728\u8FDB\u884C\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u518D\u8BD5\u3002",
426
498
  "update.failed.timeout": "\u66F4\u65B0\u8D85\u8FC7 5 \u5206\u949F\u8FD8\u6CA1\u7ED3\u675F\uFF0C\u5B83\u53EF\u80FD\u4ECD\u5728\u540E\u53F0\u8FDB\u884C\uFF1B\u7A0D\u540E\u70B9\u300C\u91CD\u65B0\u68C0\u6D4B\u300D\u770B\u7ED3\u679C\u3002",
499
+ "update.failed.unconfirmed": "\u5B89\u88C5\u7A0B\u5E8F\u5DF2\u9000\u51FA\uFF0C\u65E0\u6CD5\u786E\u8BA4\u76EE\u6807\u7248\u672C\u5DF2\u5B89\u88C5\u3002",
427
500
  "update.failed.unknown": "\u66F4\u65B0\u5931\u8D25\u3002"
428
501
  };
429
502