@lynn123411/dsh-kimi-cu 0.2.1 → 0.3.1
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 +127 -18
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +160 -0
- package/docs/preview.zh.svg +160 -0
- package/lib/client.js +226 -44
- package/lib/client.js.map +3 -3
- package/lib/index.js +432 -86
- package/lib/index.js.map +3 -3
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +14 -16
- package/scripts/smoke-host.mjs +5 -0
- package/scripts/test-card.mjs +141 -9
- package/scripts/test-exclusivity.mjs +158 -0
- package/scripts/test-update.mjs +317 -0
- package/skills/macos/kimi-cu/SKILL.md +10 -22
- package/DETAILS.md +0 -96
package/lib/client.js
CHANGED
|
@@ -48,6 +48,49 @@ async function fetchStatus(refresh = false) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// src/shared/update.ts
|
|
52
|
+
var UPDATE_ROUTE_PATH = "/api/dsh-kimi-cu/update";
|
|
53
|
+
|
|
54
|
+
// src/client/update-remote.ts
|
|
55
|
+
async function fetchUpdateCheck() {
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(UPDATE_ROUTE_PATH, { cache: "no-store" });
|
|
58
|
+
if (!response.ok) return { kind: "error", message: "HTTP " + String(response.status) };
|
|
59
|
+
const body = await response.json();
|
|
60
|
+
if (typeof body.error === "string") return { kind: "error", message: body.error };
|
|
61
|
+
return { kind: "ok", check: body };
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return { kind: "error", message: error instanceof Error ? error.message : String(error) };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function startUpdate(onEvent) {
|
|
67
|
+
try {
|
|
68
|
+
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" };
|
|
71
|
+
const reader = response.body.getReader();
|
|
72
|
+
const decoder = new TextDecoder();
|
|
73
|
+
let pending = "";
|
|
74
|
+
for (; ; ) {
|
|
75
|
+
const { done, value } = await reader.read();
|
|
76
|
+
if (done) break;
|
|
77
|
+
pending += decoder.decode(value, { stream: true });
|
|
78
|
+
const lines = pending.split("\n");
|
|
79
|
+
pending = lines.pop() ?? "";
|
|
80
|
+
for (const line of lines) {
|
|
81
|
+
if (line.trim() === "") continue;
|
|
82
|
+
try {
|
|
83
|
+
onEvent(JSON.parse(line));
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { ok: true };
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
51
94
|
// src/client/ConfigCard.tsx
|
|
52
95
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
96
|
var NOTE_KEYS = {
|
|
@@ -68,6 +111,9 @@ function checkLabel(tr, check) {
|
|
|
68
111
|
const key = CHECK_KEYS[check.id];
|
|
69
112
|
return key === void 0 ? check.label : tr(key);
|
|
70
113
|
}
|
|
114
|
+
function toUpdateState(result) {
|
|
115
|
+
return result.kind === "ok" ? { kind: "ready", check: result.check } : { kind: "unavailable", message: result.message };
|
|
116
|
+
}
|
|
71
117
|
function docsUrl(install) {
|
|
72
118
|
const language = typeof navigator === "undefined" ? "en" : navigator.language.toLowerCase();
|
|
73
119
|
return language.startsWith("zh") ? install.docsUrl : install.docsUrlEn;
|
|
@@ -78,11 +124,21 @@ function ConfigCard(props) {
|
|
|
78
124
|
const [state, setState] = (0, import_react.useState)({ kind: "loading" });
|
|
79
125
|
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
80
126
|
const [copyFailed, setCopyFailed] = (0, import_react.useState)(false);
|
|
127
|
+
const [update, setUpdate] = (0, import_react.useState)({ kind: "checking" });
|
|
128
|
+
const [run, setRun] = (0, import_react.useState)({ kind: "idle" });
|
|
129
|
+
const loadUpdate = () => {
|
|
130
|
+
setUpdate({ kind: "checking" });
|
|
131
|
+
void fetchUpdateCheck().then((result) => setUpdate(toUpdateState(result)));
|
|
132
|
+
};
|
|
81
133
|
(0, import_react.useEffect)(() => {
|
|
82
134
|
let alive = true;
|
|
83
135
|
void fetchStatus(false).then((result) => {
|
|
84
136
|
if (alive) setState(result);
|
|
85
137
|
});
|
|
138
|
+
void fetchUpdateCheck().then((result) => {
|
|
139
|
+
if (!alive) return;
|
|
140
|
+
setUpdate(toUpdateState(result));
|
|
141
|
+
});
|
|
86
142
|
return () => {
|
|
87
143
|
alive = false;
|
|
88
144
|
};
|
|
@@ -91,6 +147,8 @@ function ConfigCard(props) {
|
|
|
91
147
|
setState({ kind: "loading" });
|
|
92
148
|
setCopied(false);
|
|
93
149
|
setCopyFailed(false);
|
|
150
|
+
setRun({ kind: "idle" });
|
|
151
|
+
loadUpdate();
|
|
94
152
|
void fetchStatus(true).then((result) => setState(result));
|
|
95
153
|
};
|
|
96
154
|
const copy = (command) => {
|
|
@@ -105,18 +163,37 @@ function ConfigCard(props) {
|
|
|
105
163
|
() => setCopyFailed(true)
|
|
106
164
|
);
|
|
107
165
|
};
|
|
166
|
+
const updateNow = () => {
|
|
167
|
+
setRun({ kind: "running", stage: "checking" });
|
|
168
|
+
void startUpdate((event) => {
|
|
169
|
+
if (event.type === "stage") {
|
|
170
|
+
setRun({ kind: "running", stage: event.stage });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (event.type === "error") {
|
|
174
|
+
setRun({ kind: "failed", failure: event.kind, raw: event.raw });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
setRun({ kind: "done", upToDate: event.upToDate, version: event.version, reconnect: event.reconnect });
|
|
178
|
+
void fetchStatus(true).then((result) => setState(result));
|
|
179
|
+
loadUpdate();
|
|
180
|
+
}).then((outcome) => {
|
|
181
|
+
if (!outcome.ok) setRun({ kind: "failed", failure: "unknown", raw: outcome.message ?? "" });
|
|
182
|
+
});
|
|
183
|
+
};
|
|
108
184
|
if (state.kind === "loading") {
|
|
109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-
|
|
185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.loading") }) });
|
|
110
186
|
}
|
|
111
187
|
if (state.kind === "error") {
|
|
112
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-
|
|
114
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-
|
|
115
|
-
|
|
188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.state") }),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-value", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint dsh-kimi-cu-error", children: t("status.error") }) }),
|
|
191
|
+
/* @__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: "outline", size: "sm", onClick: recheck, children: t("status.retry") }) })
|
|
192
|
+
] }) });
|
|
116
193
|
}
|
|
117
194
|
const status = state.status;
|
|
118
195
|
if (!status.supported) {
|
|
119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-card", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.unsupported") }) });
|
|
120
197
|
}
|
|
121
198
|
const install = status.install;
|
|
122
199
|
const docs = install === null ? null : docsUrl(install);
|
|
@@ -126,47 +203,96 @@ function ConfigCard(props) {
|
|
|
126
203
|
const notReady = doctorFailed || status.installed && commandMissing;
|
|
127
204
|
const showInstall = !status.installed || legacy || commandMissing;
|
|
128
205
|
const badge = !status.installed ? t("status.missing.title") : notReady ? t("status.notReady.title") : t("status.ready.title");
|
|
206
|
+
const updateHint = (() => {
|
|
207
|
+
if (run.kind === "running") return tr("update.stage." + run.stage);
|
|
208
|
+
if (run.kind === "failed") return tr("update.failed." + run.failure);
|
|
209
|
+
if (run.kind === "done") {
|
|
210
|
+
if (run.upToDate || run.version === null) return t("update.hint.latest");
|
|
211
|
+
return t("update.done") + " " + run.version;
|
|
212
|
+
}
|
|
213
|
+
if (update.kind === "checking") return t("update.hint.checking");
|
|
214
|
+
if (update.kind === "unavailable") return t("update.hint.unavailable");
|
|
215
|
+
return update.check.hasUpdate ? t("update.hint.available") : t("update.hint.latest");
|
|
216
|
+
})();
|
|
217
|
+
const updateLabel = (() => {
|
|
218
|
+
if (run.kind === "running") return t("update.running");
|
|
219
|
+
if (run.kind === "failed") return t("status.retry");
|
|
220
|
+
if (run.kind === "done") return t("update.latest");
|
|
221
|
+
if (update.kind === "ready") {
|
|
222
|
+
return update.check.hasUpdate ? t("update.to") + " " + (update.check.latest ?? "") : t("update.latest");
|
|
223
|
+
}
|
|
224
|
+
if (update.kind === "unavailable") return t("update.action");
|
|
225
|
+
return t("update.check");
|
|
226
|
+
})();
|
|
227
|
+
const updateDisabled = run.kind === "running" || run.kind === "done" || update.kind === "checking" || update.kind === "ready" && !update.check.hasUpdate;
|
|
228
|
+
const updateAction = update.kind === "ready" && !update.check.hasUpdate ? loadUpdate : updateNow;
|
|
129
229
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-card", children: [
|
|
130
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-
|
|
131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.state") }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-value", children: [
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: !status.installed || notReady ? "danger" : "info", children: badge }),
|
|
234
|
+
status.installed ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.missing.hint") }),
|
|
235
|
+
status.installed && !notReady && !legacy ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.ready.hint") }) : null,
|
|
236
|
+
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
|
+
] }),
|
|
238
|
+
/* @__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") }) })
|
|
133
239
|
] }),
|
|
134
|
-
status.installed ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
135
|
-
|
|
136
|
-
t("status.version"),
|
|
137
|
-
": ",
|
|
138
|
-
|
|
240
|
+
status.installed ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.version") }),
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-value", children: status.version ?? "\u2014" })
|
|
244
|
+
] }),
|
|
245
|
+
status.path === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.path") }),
|
|
247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-value dsh-kimi-cu-path", children: status.path })
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("update.label") }),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-value", children: [
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: run.kind === "failed" ? "dsh-kimi-cu-hint dsh-kimi-cu-error" : "dsh-kimi-cu-hint", children: updateHint }),
|
|
253
|
+
run.kind === "done" && run.reconnect === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("update.reconnectFailed") }) : null
|
|
254
|
+
] }),
|
|
255
|
+
/* @__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: "outline", size: "sm", disabled: updateDisabled, onClick: updateAction, children: updateLabel }) })
|
|
139
256
|
] }),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
": ",
|
|
143
|
-
|
|
257
|
+
run.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label" }),
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-span", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { className: "dsh-kimi-cu-raw", children: [
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("update.raw") }),
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "dsh-kimi-cu-command", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: run.raw }) })
|
|
262
|
+
] }) })
|
|
263
|
+
] }) : null
|
|
264
|
+
] }) : null,
|
|
265
|
+
notReady ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
266
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.checks") }),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-span", children: [
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.notReady.hint") }),
|
|
269
|
+
status.doctor.checks.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dsh-kimi-cu-checks", children: status.doctor.checks.map((check) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: check.ok ? "dsh-kimi-cu-check-ok" : "dsh-kimi-cu-check-bad", children: [
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: check.ok ? "\u2705" : "\u274C" }),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: checkLabel(tr, check) })
|
|
272
|
+
] }, 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
|
|
144
274
|
] })
|
|
145
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-note", children: t("status.missing.hint") }),
|
|
146
|
-
status.notes.map((note) => NOTE_KEYS[note] === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-note", children: tr(NOTE_KEYS[note]) }, note)),
|
|
147
|
-
notReady ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-section", children: [
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-note", children: t("status.notReady.hint") }),
|
|
149
|
-
status.doctor.checks.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dsh-kimi-cu-checks", children: status.doctor.checks.map((check) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: check.ok ? "dsh-kimi-cu-check-ok" : "dsh-kimi-cu-check-bad", children: [
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: check.ok ? "\u2705" : "\u274C" }),
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: checkLabel(tr, check) })
|
|
152
|
-
] }, check.id)) }),
|
|
153
|
-
doctorFailed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-note", children: status.platform === "darwin" ? t("fix.macos") : t("fix.windows") }) : null
|
|
154
275
|
] }) : null,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
158
|
-
|
|
159
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
276
|
+
showInstall && install !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.install") }),
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-span", children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "dsh-kimi-cu-command", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: install.command }) }),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-actions", children: [
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => copy(install.command), children: copied ? t("status.copied") : t("status.copy") }),
|
|
282
|
+
docs === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "dsh-kimi-cu-link", href: docs, target: "_blank", rel: "noreferrer", children: t("status.docs") })
|
|
283
|
+
] }),
|
|
284
|
+
copyFailed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-hint", children: t("status.copyFailed") }) : null,
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "dsh-kimi-cu-steps", children: install.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: tr("step." + step) }, step)) })
|
|
286
|
+
] })
|
|
287
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-kimi-cu-row", children: [
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-label", children: t("status.docs.label") }),
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-kimi-cu-span", children: docs === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "dsh-kimi-cu-link", href: docs, target: "_blank", rel: "noreferrer", children: t("status.docs") }) })
|
|
290
|
+
] })
|
|
165
291
|
] });
|
|
166
292
|
}
|
|
167
293
|
|
|
168
294
|
// src/client/ConfigCard.css
|
|
169
|
-
var ConfigCard_default = "/* \u63D2\u4EF6\u9875\u4E0A\u7684 KimiCU \u72B6\u6001\u5361\u3002 */\n\n.dsh-kimi-cu-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.dsh-kimi-cu-
|
|
295
|
+
var ConfigCard_default = "/* \u63D2\u4EF6\u9875\u4E0A\u7684 KimiCU \u72B6\u6001\u5361\uFF1A\u6BCF\u884C\u90FD\u662F\u300C\u6807\u7B7E | \u5185\u5BB9 | \u52A8\u4F5C\u300D\u4E09\u5217\uFF0C\u52A8\u4F5C\u6C38\u8FDC\u5728\u6700\u53F3\u5217\u3002 */\n\n.dsh-kimi-cu-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.dsh-kimi-cu-row {\n display: grid;\n grid-template-columns: 56px minmax(0, 1fr) auto;\n align-items: start;\n column-gap: 12px;\n}\n\n.dsh-kimi-cu-label {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 20px;\n}\n\n.dsh-kimi-cu-value {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n}\n\n.dsh-kimi-cu-span {\n grid-column: 2 / -1;\n display: flex;\n flex-direction: column;\n gap: 8px;\n min-width: 0;\n}\n\n.dsh-kimi-cu-control {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.dsh-kimi-cu-hint {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-kimi-cu-error {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.dsh-kimi-cu-path {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n word-break: break-all;\n}\n\n.dsh-kimi-cu-command {\n margin: 0;\n padding: 10px 12px;\n border-radius: var(--dsw-radius-sm);\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-primary);\n font-size: 12px;\n line-height: 18px;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.dsh-kimi-cu-actions {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.dsh-kimi-cu-link {\n color: var(--dsw-alias-label-primary);\n font-size: 12px;\n line-height: 18px;\n text-decoration: underline;\n}\n\n.dsh-kimi-cu-checks {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-kimi-cu-checks li {\n display: flex;\n gap: 6px;\n}\n\n.dsh-kimi-cu-check-ok {\n color: var(--dsw-alias-label-secondary);\n}\n\n.dsh-kimi-cu-check-bad {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.dsh-kimi-cu-steps {\n margin: 0;\n padding-left: 18px;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-kimi-cu-raw summary {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n cursor: pointer;\n}\n\n.dsh-kimi-cu-raw pre {\n margin-top: 8px;\n}\n";
|
|
170
296
|
|
|
171
297
|
// src/client/locales.ts
|
|
172
298
|
var NS = "kimiCu";
|
|
@@ -178,9 +304,9 @@ var en = {
|
|
|
178
304
|
"status.unsupported": "This plugin supports macOS and Windows only; no KimiCU connection starts on this platform.",
|
|
179
305
|
"status.missing.title": "KimiCU is not installed",
|
|
180
306
|
"status.missing.hint": "Install the official runtime, then check again.",
|
|
181
|
-
"status.notReady.title": "KimiCU is installed but
|
|
307
|
+
"status.notReady.title": "KimiCU is installed but local checks failed",
|
|
182
308
|
"status.notReady.hint": "Fix the failed checks below, then check again.",
|
|
183
|
-
"status.ready.title": "
|
|
309
|
+
"status.ready.title": "Local checks passed",
|
|
184
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.",
|
|
185
311
|
"status.copy": "Copy command",
|
|
186
312
|
"status.copied": "Copied",
|
|
@@ -188,6 +314,10 @@ var en = {
|
|
|
188
314
|
"status.docs": "Official docs",
|
|
189
315
|
"status.version": "Version",
|
|
190
316
|
"status.path": "Path",
|
|
317
|
+
"status.state": "Status",
|
|
318
|
+
"status.checks": "Checks",
|
|
319
|
+
"status.install": "Install",
|
|
320
|
+
"status.docs.label": "Docs",
|
|
191
321
|
"step.install": "Install the official KimiCU runtime.",
|
|
192
322
|
"step.grant-permissions": "In System Settings, grant Accessibility and Screen Recording to KimiCU.",
|
|
193
323
|
"step.reload-plugin": "Turn this plugin off and on again on the Plugins page, or restart DSH.",
|
|
@@ -205,7 +335,31 @@ var en = {
|
|
|
205
335
|
"fix.macos": "Open System Settings \u2192 Privacy & Security and enable Accessibility and Screen Recording for KimiCU.",
|
|
206
336
|
"fix.windows": "KimiCU needs the same privilege level as the target app; use its control panel to enable administrator mode when needed.",
|
|
207
337
|
"doctor.failed": "doctor reported a failure",
|
|
208
|
-
"doctor.notRun": "doctor was not run"
|
|
338
|
+
"doctor.notRun": "doctor was not run",
|
|
339
|
+
"update.check": "Check for updates",
|
|
340
|
+
"update.action": "Update",
|
|
341
|
+
"update.to": "Update to",
|
|
342
|
+
"update.latest": "Up to date",
|
|
343
|
+
"update.running": "Updating\u2026",
|
|
344
|
+
"update.done": "Updated to",
|
|
345
|
+
"update.raw": "Show raw output",
|
|
346
|
+
"update.label": "Update",
|
|
347
|
+
"update.hint.available": "A newer version is available.",
|
|
348
|
+
"update.hint.latest": "Already the newest version.",
|
|
349
|
+
"update.hint.unavailable": "Couldn't read the update manifest.",
|
|
350
|
+
"update.hint.checking": "Checking for updates\u2026",
|
|
351
|
+
"update.reconnectFailed": "The new version is installed; restart DSH to load it.",
|
|
352
|
+
"update.stage.checking": "Checking for updates\u2026",
|
|
353
|
+
"update.stage.downloading": "Downloading\u2026",
|
|
354
|
+
"update.stage.verifying": "Verifying the download\u2026",
|
|
355
|
+
"update.stage.installing": "Installing\u2026",
|
|
356
|
+
"update.stage.restarting": "Reconnecting the MCP server\u2026",
|
|
357
|
+
"update.failed.network": "Couldn't reach the KimiCU update server; check the network and retry.",
|
|
358
|
+
"update.failed.verify": "The downloaded package failed verification; nothing was changed.",
|
|
359
|
+
"update.failed.permission": "Couldn't replace the KimiCU install; run the installer from a terminal with administrator rights.",
|
|
360
|
+
"update.failed.busy": "Another update is already running; wait for it to finish.",
|
|
361
|
+
"update.failed.timeout": "The update did not finish within 5 minutes; it may still be running. Check again later.",
|
|
362
|
+
"update.failed.unknown": "The update failed."
|
|
209
363
|
};
|
|
210
364
|
var zh = {
|
|
211
365
|
"status.loading": "\u6B63\u5728\u68C0\u6D4B KimiCU\u2026",
|
|
@@ -215,9 +369,9 @@ var zh = {
|
|
|
215
369
|
"status.unsupported": "\u672C\u63D2\u4EF6\u53EA\u652F\u6301 macOS \u4E0E Windows\uFF1B\u5F53\u524D\u5E73\u53F0\u4E0D\u4F1A\u542F\u52A8 KimiCU \u8FDE\u63A5\u3002",
|
|
216
370
|
"status.missing.title": "\u672A\u68C0\u6D4B\u5230 KimiCU",
|
|
217
371
|
"status.missing.hint": "\u5148\u5B89\u88C5\u5B98\u65B9\u8FD0\u884C\u65F6\uFF0C\u518D\u56DE\u6765\u91CD\u65B0\u68C0\u6D4B\u3002",
|
|
218
|
-
"status.notReady.title": "\u5DF2\u5B89\u88C5 KimiCU\uFF0C\u4F46\
|
|
372
|
+
"status.notReady.title": "\u5DF2\u5B89\u88C5 KimiCU\uFF0C\u4F46\u672C\u673A\u68C0\u67E5\u672A\u901A\u8FC7",
|
|
219
373
|
"status.notReady.hint": "\u6309\u4E0B\u9762\u5931\u8D25\u7684\u68C0\u67E5\u9879\u4FEE\u590D\uFF0C\u518D\u91CD\u65B0\u68C0\u6D4B\u3002",
|
|
220
|
-
"status.ready.title": "
|
|
374
|
+
"status.ready.title": "\u672C\u673A\u68C0\u67E5\u901A\u8FC7",
|
|
221
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",
|
|
222
376
|
"status.copy": "\u590D\u5236\u547D\u4EE4",
|
|
223
377
|
"status.copied": "\u5DF2\u590D\u5236",
|
|
@@ -225,6 +379,10 @@ var zh = {
|
|
|
225
379
|
"status.docs": "\u5B98\u65B9\u6587\u6863",
|
|
226
380
|
"status.version": "\u7248\u672C",
|
|
227
381
|
"status.path": "\u8DEF\u5F84",
|
|
382
|
+
"status.state": "\u72B6\u6001",
|
|
383
|
+
"status.checks": "\u672C\u673A\u68C0\u67E5",
|
|
384
|
+
"status.install": "\u5B89\u88C5",
|
|
385
|
+
"status.docs.label": "\u6587\u6863",
|
|
228
386
|
"step.install": "\u5B89\u88C5\u5B98\u65B9 KimiCU \u8FD0\u884C\u65F6\u3002",
|
|
229
387
|
"step.grant-permissions": "\u5728\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u4E3A KimiCU \u5F00\u542F\u8F85\u52A9\u529F\u80FD\u4E0E\u5C4F\u5E55\u5F55\u5236\u3002",
|
|
230
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",
|
|
@@ -242,7 +400,31 @@ var zh = {
|
|
|
242
400
|
"fix.macos": "\u6253\u5F00\u7CFB\u7EDF\u8BBE\u7F6E \u2192 \u9690\u79C1\u4E0E\u5B89\u5168\u6027\uFF0C\u4E3A KimiCU \u5F00\u542F\u8F85\u52A9\u529F\u80FD\u4E0E\u5C4F\u5E55\u5F55\u5236\u3002",
|
|
243
401
|
"fix.windows": "KimiCU \u9700\u8981\u4E0E\u76EE\u6807\u5E94\u7528\u540C\u7EA7\u7684\u6743\u9650\uFF1B\u9700\u8981\u65F6\u5728\u5B83\u7684\u63A7\u5236\u9762\u677F\u91CC\u5F00\u542F\u7BA1\u7406\u5458\u6A21\u5F0F\u3002",
|
|
244
402
|
"doctor.failed": "doctor \u62A5\u544A\u4E86\u5931\u8D25",
|
|
245
|
-
"doctor.notRun": "doctor \u6CA1\u6709\u8DD1\u8D77\u6765"
|
|
403
|
+
"doctor.notRun": "doctor \u6CA1\u6709\u8DD1\u8D77\u6765",
|
|
404
|
+
"update.check": "\u68C0\u67E5\u66F4\u65B0",
|
|
405
|
+
"update.action": "\u66F4\u65B0",
|
|
406
|
+
"update.to": "\u66F4\u65B0\u5230",
|
|
407
|
+
"update.latest": "\u5DF2\u662F\u6700\u65B0",
|
|
408
|
+
"update.running": "\u66F4\u65B0\u4E2D\u2026",
|
|
409
|
+
"update.done": "\u5DF2\u66F4\u65B0\u5230",
|
|
410
|
+
"update.raw": "\u67E5\u770B\u539F\u59CB\u8F93\u51FA",
|
|
411
|
+
"update.label": "\u66F4\u65B0",
|
|
412
|
+
"update.hint.available": "\u6709\u65B0\u7248\u672C\u53EF\u7528\u3002",
|
|
413
|
+
"update.hint.latest": "\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002",
|
|
414
|
+
"update.hint.unavailable": "\u8BFB\u4E0D\u5230\u66F4\u65B0\u6E05\u5355\u3002",
|
|
415
|
+
"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",
|
|
417
|
+
"update.stage.checking": "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0",
|
|
418
|
+
"update.stage.downloading": "\u6B63\u5728\u4E0B\u8F7D",
|
|
419
|
+
"update.stage.verifying": "\u6B63\u5728\u6821\u9A8C\u4E0B\u8F7D\u5305",
|
|
420
|
+
"update.stage.installing": "\u6B63\u5728\u66FF\u6362\u5B89\u88C5",
|
|
421
|
+
"update.stage.restarting": "\u6B63\u5728\u91CD\u8FDE MCP \u670D\u52A1",
|
|
422
|
+
"update.failed.network": "\u8FDE\u4E0D\u4E0A KimiCU \u7684\u66F4\u65B0\u670D\u52A1\u5668\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",
|
|
423
|
+
"update.failed.verify": "\u4E0B\u8F7D\u7684\u5B89\u88C5\u5305\u6821\u9A8C\u6CA1\u901A\u8FC7\uFF0C\u5DF2\u4E2D\u6B62\uFF0C\u6CA1\u6709\u6539\u52A8\u73B0\u6709\u5B89\u88C5\u3002",
|
|
424
|
+
"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
|
+
"update.failed.busy": "\u5DF2\u7ECF\u6709\u4E00\u4E2A\u66F4\u65B0\u5728\u8FDB\u884C\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u518D\u8BD5\u3002",
|
|
426
|
+
"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",
|
|
427
|
+
"update.failed.unknown": "\u66F4\u65B0\u5931\u8D25\u3002"
|
|
246
428
|
};
|
|
247
429
|
|
|
248
430
|
// src/client/index.ts
|