@i14ks/ccv 0.45.0 → 0.46.0
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/bundle/ccv.mjs +441 -116
- package/package.json +1 -1
- package/web/assets/{abnfDiagram-S7VZAUFO-CNj02zRV.js → abnfDiagram-S7VZAUFO-Bqp0keXX.js} +1 -1
- package/web/assets/{architectureDiagram-YGSQEFNW-UnapXBnq.js → architectureDiagram-YGSQEFNW-QzTjlCie.js} +1 -1
- package/web/assets/{blockDiagram-APKKGZFW-By1mA1_j.js → blockDiagram-APKKGZFW-B2FjM_pa.js} +1 -1
- package/web/assets/{c4Diagram-KJ2TOQU5-DxR8Tp-K.js → c4Diagram-KJ2TOQU5-CLtReqpv.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-CfcIu3Ah.js → chunk-2Q5K7J3B-LzZPcVjw.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-Ddk-Fv2Y.js → chunk-5VM5RSS4-Bg9H60kN.js} +1 -1
- package/web/assets/{chunk-HFQBQIA3-DqPjzTQu.js → chunk-HFQBQIA3-zN88yezm.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-VUIzkY_4.js → chunk-JWPE2WC7-puWxpX88.js} +1 -1
- package/web/assets/{chunk-KQLB2F66-Bi85gKHH.js → chunk-KQLB2F66-LOgYMAbX.js} +2 -2
- package/web/assets/{chunk-KS47KZWR-BZwBvPDM.js → chunk-KS47KZWR-DsV1l8GN.js} +1 -1
- package/web/assets/{chunk-OY52VR5R-B_DWv6kS.js → chunk-OY52VR5R-B-3a7aEt.js} +1 -1
- package/web/assets/{chunk-TU62E6Q5-BZ5M8LNU.js → chunk-TU62E6Q5-BBAw39la.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DcC5f1oO.js → chunk-XXDRQBXY-CUUNDCi0.js} +1 -1
- package/web/assets/{classDiagram-v2-L25IHNXF-CiZfI5zH.js → classDiagram-v2-L25IHNXF-BFB6qpyQ.js} +1 -1
- package/web/assets/{codemirror-B_zWrnLp.js → codemirror-BUfL2BC4.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-OecldNrx.js → cose-bilkent-JH36ORCC-h5GUpH0i.js} +1 -1
- package/web/assets/{cynefin-EF2NZ3EQ-BHDQXZEc.js → cynefin-EF2NZ3EQ-C0WBM4M-.js} +1 -1
- package/web/assets/{cynefinDiagram-L36ESFBY-COnZzGKx.js → cynefinDiagram-L36ESFBY-ojD4oji5.js} +1 -1
- package/web/assets/{dagre-SPEB5RXH-XxNubJTv.js → dagre-SPEB5RXH-kOXetVrP.js} +1 -1
- package/web/assets/{diagram-3B7GL73J-BEpsszbY.js → diagram-3B7GL73J-Be_DXgKj.js} +1 -1
- package/web/assets/{diagram-DNEMPZML-DAKChpAZ.js → diagram-DNEMPZML-DOaoUsOv.js} +1 -1
- package/web/assets/{diagram-L3MUGCDN-CvDcHjXy.js → diagram-L3MUGCDN-Cxl9h2A1.js} +1 -1
- package/web/assets/{diagram-LA4NIPWU-BO-n7J3S.js → diagram-LA4NIPWU-BuY_La_r.js} +1 -1
- package/web/assets/{diagram-MHCOC4E2-BW8MchVY.js → diagram-MHCOC4E2-DNHkV7oi.js} +1 -1
- package/web/assets/{diagram-XPFHEONP-DjiEBmkx.js → diagram-XPFHEONP-DiWHVc5F.js} +1 -1
- package/web/assets/{ebnfDiagram-UZSYDL2S-DKGunvzj.js → ebnfDiagram-UZSYDL2S-DDc7v0vH.js} +1 -1
- package/web/assets/{elk-XV6XMXQE-b9lmTG03.js → elk-XV6XMXQE-ChA__87R.js} +1 -1
- package/web/assets/{erDiagram-EYBAPDEH-DT_k1OGC.js → erDiagram-EYBAPDEH-9DkQVmpd.js} +1 -1
- package/web/assets/{flowDiagram-MALGAFMO-BUqGlWOn.js → flowDiagram-MALGAFMO-85oUCDA9.js} +1 -1
- package/web/assets/{ganttDiagram-23REXITY-Cbr_kL7O.js → ganttDiagram-23REXITY-Tzi438Ud.js} +1 -1
- package/web/assets/{gitGraphDiagram-STJD7YCW-Cw6S4Bcr.js → gitGraphDiagram-STJD7YCW-DRHc1L8Y.js} +1 -1
- package/web/assets/{index-DQnArn0a.js → index-2yPtUEjB.js} +1 -1
- package/web/assets/index-B1REGe-R.css +1 -0
- package/web/assets/{index-DnFYUU1x.js → index-BvY8TANJ.js} +1 -1
- package/web/assets/{index-BO8effSp.js → index-CK7BxYBP.js} +1 -1
- package/web/assets/{index-D7DCXKEo.js → index-CL1z_ACK.js} +1 -1
- package/web/assets/index-C_yOXZE5.js +152 -0
- package/web/assets/{index-CnRY1mXR.js → index-Ce51ELTJ.js} +1 -1
- package/web/assets/{index-BYJrmc8N.js → index-CkWkBjEu.js} +1 -1
- package/web/assets/{index-qkpXZNl3.js → index-Czfs4nks.js} +1 -1
- package/web/assets/{index-Du5Qar1T.js → index-D6OVWVvu.js} +1 -1
- package/web/assets/{index-CfWAy0wv.js → index-D7B78fBr.js} +1 -1
- package/web/assets/{index-Ch08lakn.js → index-D8prWI_9.js} +1 -1
- package/web/assets/{index-Ctc6whsQ.js → index-DSCMGgTU.js} +1 -1
- package/web/assets/{index-BLmLDrEY.js → index-D_HA9EKR.js} +1 -1
- package/web/assets/{index-dkD_YPIB.js → index-DdCA2bPh.js} +1 -1
- package/web/assets/{index-B5vdEupB.js → index-DnrCohlM.js} +1 -1
- package/web/assets/{index-BoggcMUx.js → index-Dxj5KidP.js} +1 -1
- package/web/assets/{index-Cl3pbMFT.js → index-JfTN2Clg.js} +1 -1
- package/web/assets/{index-B_SP1UWv.js → index-dg0dwLUZ.js} +1 -1
- package/web/assets/{index-DvFMS_gT.js → index-fZsOIrjz.js} +1 -1
- package/web/assets/{index-HQJZpoPE.js → index-jon8dFyn.js} +1 -1
- package/web/assets/{infoDiagram-KBXO4MBG-CusT957H.js → infoDiagram-KBXO4MBG-BffKyROV.js} +1 -1
- package/web/assets/{ishikawaDiagram-M35NCXHK-DlxUISb3.js → ishikawaDiagram-M35NCXHK-37_pqbhO.js} +1 -1
- package/web/assets/{journeyDiagram-OPLOXDXO-B7X0y02x.js → journeyDiagram-OPLOXDXO-B9E5pvMQ.js} +1 -1
- package/web/assets/{kanban-definition-BZKZHSQY-DzEKGEDz.js → kanban-definition-BZKZHSQY-hIyBxfyB.js} +1 -1
- package/web/assets/{mermaid.core-BM9CG8VU.js → mermaid.core-ChOxnUYV.js} +4 -4
- package/web/assets/{mindmap-definition-I2QAS2VK-DgE3KgdI.js → mindmap-definition-I2QAS2VK-C4Ed0z-u.js} +1 -1
- package/web/assets/{pegDiagram-FD4XPPHP-2wTO2ZJT.js → pegDiagram-FD4XPPHP-BgKeMkeu.js} +1 -1
- package/web/assets/{pieDiagram-J4AKIIQI-CKRDBux_.js → pieDiagram-J4AKIIQI-CBPbO_O4.js} +1 -1
- package/web/assets/{quadrantDiagram-XTYBLID2-Ceg_KG7b.js → quadrantDiagram-XTYBLID2-CFKGTA0q.js} +1 -1
- package/web/assets/{railroadDiagram-MRQ6NCDL-DkyGV8eQ.js → railroadDiagram-MRQ6NCDL-BIwKP6FP.js} +1 -1
- package/web/assets/{requirementDiagram-Y7LWUY3S-DEpWnvQ5.js → requirementDiagram-Y7LWUY3S-Big4Ix1i.js} +1 -1
- package/web/assets/{sankeyDiagram-WGJFYUXA-D06-ObVT.js → sankeyDiagram-WGJFYUXA-DCbAXigB.js} +1 -1
- package/web/assets/{sequenceDiagram-5NDRBG5M-CNgwRsPl.js → sequenceDiagram-5NDRBG5M-e3P8Am5E.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-DLPIeXe1.js → sizeCapture-INFHLROL-DKMlCS9Z.js} +1 -1
- package/web/assets/{stateDiagram-v2-FJ4FJNEA-CjTQ5dpG.js → stateDiagram-v2-FJ4FJNEA-CYUxk0oE.js} +1 -1
- package/web/assets/{swimlanes-UMQ2AFYF-eJkqG_t9.js → swimlanes-UMQ2AFYF-GucEiYIi.js} +1 -1
- package/web/assets/swimlanesDiagram-OMPLPG4O-Bc0BkwRd.js +8 -0
- package/web/assets/{timeline-definition-SEUHKTQE-CUTdCFpH.js → timeline-definition-SEUHKTQE-C-LrsvQ2.js} +1 -1
- package/web/assets/{usecaseDiagram-AFA6YXN4-BHojL49I.js → usecaseDiagram-AFA6YXN4-0HNZ_Bga.js} +1 -1
- package/web/assets/{vennDiagram-NNMJR3RB-Bk5isaer.js → vennDiagram-NNMJR3RB-CdccvXeO.js} +1 -1
- package/web/assets/{wardleyDiagram-S7YFUSEH-DolRO_uR.js → wardleyDiagram-S7YFUSEH-CvfIM8El.js} +1 -1
- package/web/assets/{xychartDiagram-GGNKY7IX-V3IUgdp-.js → xychartDiagram-GGNKY7IX-C6tfXUfl.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-B1IBfUz9.css +0 -1
- package/web/assets/index-BdwT0-rx.js +0 -152
- package/web/assets/swimlanesDiagram-OMPLPG4O-D-nejod0.js +0 -8
package/bundle/ccv.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// dist/ccv.js
|
|
4
4
|
import { spawn as spawn4 } from "node:child_process";
|
|
5
|
-
import { readFile as
|
|
6
|
-
import
|
|
5
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
6
|
+
import path35 from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
|
|
@@ -147,7 +147,7 @@ function envDefaults() {
|
|
|
147
147
|
// ../host/dist/server.js
|
|
148
148
|
import { createServer } from "node:http";
|
|
149
149
|
import { createReadStream as createReadStream2, existsSync as existsSync7, statSync as statSync3 } from "node:fs";
|
|
150
|
-
import
|
|
150
|
+
import path34 from "node:path";
|
|
151
151
|
import { homedir as homedir9 } from "node:os";
|
|
152
152
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
153
153
|
import { WebSocketServer } from "ws";
|
|
@@ -786,12 +786,12 @@ function snippet(text, at, length) {
|
|
|
786
786
|
// ../host/dist/workspace-ids.js
|
|
787
787
|
function workspaceIdRemap(paths, sessionsOf) {
|
|
788
788
|
const byLegacy = /* @__PURE__ */ new Map();
|
|
789
|
-
for (const
|
|
790
|
-
const id = workspaceIdFromPath(
|
|
791
|
-
for (const legacy of formerWorkspaceIdsFromPath(
|
|
789
|
+
for (const path36 of paths) {
|
|
790
|
+
const id = workspaceIdFromPath(path36);
|
|
791
|
+
for (const legacy of formerWorkspaceIdsFromPath(path36)) {
|
|
792
792
|
const group = byLegacy.get(legacy) ?? [];
|
|
793
793
|
if (!group.some((target) => target.id === id))
|
|
794
|
-
group.push({ id, path:
|
|
794
|
+
group.push({ id, path: path36 });
|
|
795
795
|
byLegacy.set(legacy, group);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
@@ -1958,7 +1958,7 @@ function clipInput(input) {
|
|
|
1958
1958
|
|
|
1959
1959
|
// ../host/dist/session.js
|
|
1960
1960
|
function uiSystemPromptAppend(cwd) {
|
|
1961
|
-
const markdown = "You are running inside Claude Code Visual, a GUI for Claude Code. When the user opens a .md file in this app, it is rendered as formatted, human-readable text (headings, lists, code blocks, tables) by default \u2014 not shown as raw markdown source. A toggle lets them switch to the raw source view if they want to edit it. So when producing a report, plan, summary, or any other document meant for the user to read, prefer writing it to a .md file rather than only in chat \u2014 the user will see it rendered, not as plain marked-up text.";
|
|
1961
|
+
const markdown = "You are running inside Claude Code Visual, a GUI for Claude Code. When the user opens a .md file in this app, it is rendered as formatted, human-readable text (headings, lists, code blocks, tables) by default \u2014 not shown as raw markdown source. A toggle lets them switch to the raw source view if they want to edit it. So when producing a report, plan, summary, or any other document meant for the user to read, prefer writing it to a .md file rather than only in chat \u2014 the user will see it rendered, not as plain marked-up text.\n\nMCP servers that need sign-in (status needs-auth) are authorized from this app's Extensions window: open it from the menu and press \xAB\u0410\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u0442\u044C\xBB next to the server. Do not tell the user to run /mcp in a terminal \u2014 there is no terminal session for that here, and the button runs the same OAuth flow.";
|
|
1962
1962
|
if (!cwd)
|
|
1963
1963
|
return markdown;
|
|
1964
1964
|
return markdown + `
|
|
@@ -2071,6 +2071,12 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2071
2071
|
cwd;
|
|
2072
2072
|
journal = new Journal();
|
|
2073
2073
|
#query = null;
|
|
2074
|
+
/**
|
|
2075
|
+
* Сколько раз поднимали процесс CLI. Вход в MCP-сервер живёт внутри
|
|
2076
|
+
* процесса (локальный колбэк слушает он же), и по смене поколения хост
|
|
2077
|
+
* узнаёт, что вход оборвался вместе с процессом.
|
|
2078
|
+
*/
|
|
2079
|
+
#generation = 0;
|
|
2074
2080
|
/**
|
|
2075
2081
|
* Разговор, который был до нас, — прочитанный транскрипт продолженной сессии.
|
|
2076
2082
|
*
|
|
@@ -2301,6 +2307,10 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2301
2307
|
return this.#options.accountId ?? MAIN_ACCOUNT_ID;
|
|
2302
2308
|
}
|
|
2303
2309
|
/** Каталог конфигурации аккаунта сессии; null — унаследованный хостом. */
|
|
2310
|
+
/** Номер текущего процесса CLI; растёт с каждым перезапуском. */
|
|
2311
|
+
get generation() {
|
|
2312
|
+
return this.#generation;
|
|
2313
|
+
}
|
|
2304
2314
|
get configDir() {
|
|
2305
2315
|
return this.#options.configDir ?? null;
|
|
2306
2316
|
}
|
|
@@ -2458,6 +2468,7 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2458
2468
|
this.#resetTasks();
|
|
2459
2469
|
const q = query2({ prompt: this.#inbox, options: options2 });
|
|
2460
2470
|
this.#query = q;
|
|
2471
|
+
this.#generation += 1;
|
|
2461
2472
|
void this.#consume(q);
|
|
2462
2473
|
if (restarted)
|
|
2463
2474
|
void this.#resume(q);
|
|
@@ -3173,9 +3184,7 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
3173
3184
|
* локальный колбэк, единственный, что работает без своего домена.
|
|
3174
3185
|
*/
|
|
3175
3186
|
async authenticateMcpServer(name) {
|
|
3176
|
-
|
|
3177
|
-
throw new Error("\u0421\u0435\u0441\u0441\u0438\u044F \u0435\u0449\u0451 \u043D\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D\u0430");
|
|
3178
|
-
const q = this.#query;
|
|
3187
|
+
const q = await this.#ensureQuery();
|
|
3179
3188
|
if (typeof q.mcpAuthenticate !== "function") {
|
|
3180
3189
|
throw new Error("\u042D\u0442\u0430 \u0432\u0435\u0440\u0441\u0438\u044F Agent SDK \u043D\u0435 \u0443\u043C\u0435\u0435\u0442 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u0442\u044C MCP-\u0441\u0435\u0440\u0432\u0435\u0440\u044B");
|
|
3181
3190
|
}
|
|
@@ -3186,6 +3195,36 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
3186
3195
|
callbackExpected: response.callbackExpected === true
|
|
3187
3196
|
};
|
|
3188
3197
|
}
|
|
3198
|
+
/**
|
|
3199
|
+
* Процесс CLI, готовый отвечать на управляющие вызовы.
|
|
3200
|
+
*
|
|
3201
|
+
* Если процесса нет (обрыв, VPN, кончились попытки переподключения), его
|
|
3202
|
+
* поднимают ради входа, а не отвечают «сессия ещё не запущена»: человеку
|
|
3203
|
+
* нужен вход, а не первый промпт ради него.
|
|
3204
|
+
*/
|
|
3205
|
+
async #ensureQuery() {
|
|
3206
|
+
if (this.#closing)
|
|
3207
|
+
throw new Error("\u0421\u0435\u0441\u0441\u0438\u044F \u0437\u0430\u043A\u0440\u044B\u0442\u0430");
|
|
3208
|
+
if (!this.#query) {
|
|
3209
|
+
this.reconnect("\u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u043D\u0443\u0436\u0435\u043D \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440");
|
|
3210
|
+
if (!this.#query) {
|
|
3211
|
+
throw new Error(networkGuard.blockedReason() ?? "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441\u0441 Claude");
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
const q = this.#query;
|
|
3215
|
+
let timer;
|
|
3216
|
+
const ready = await Promise.race([
|
|
3217
|
+
q.initializationResult().then(() => true, () => false),
|
|
3218
|
+
new Promise((resolve) => {
|
|
3219
|
+
timer = setTimeout(() => resolve(false), RESUME_TIMEOUT_MS);
|
|
3220
|
+
timer.unref?.();
|
|
3221
|
+
})
|
|
3222
|
+
]);
|
|
3223
|
+
clearTimeout(timer);
|
|
3224
|
+
if (!ready || q !== this.#query)
|
|
3225
|
+
throw new Error("\u041F\u0440\u043E\u0446\u0435\u0441\u0441 Claude \u043D\u0435 \u043E\u0442\u043E\u0437\u0432\u0430\u043B\u0441\u044F");
|
|
3226
|
+
return q;
|
|
3227
|
+
}
|
|
3189
3228
|
/**
|
|
3190
3229
|
* Отдать CLI адрес редиректа, вставленный руками, — когда браузер не на этой
|
|
3191
3230
|
* машине и до `localhost` хоста не достучался. Резолвится после входа.
|
|
@@ -7035,9 +7074,9 @@ function parsePatch(raw) {
|
|
|
7035
7074
|
body = "";
|
|
7036
7075
|
}
|
|
7037
7076
|
total += body.length;
|
|
7038
|
-
const
|
|
7077
|
+
const path36 = status === "deleted" ? oldPath : newPath || oldPath;
|
|
7039
7078
|
files.push({
|
|
7040
|
-
path:
|
|
7079
|
+
path: path36,
|
|
7041
7080
|
oldPath: status === "renamed" ? oldPath : "",
|
|
7042
7081
|
status,
|
|
7043
7082
|
added: count(body, "+"),
|
|
@@ -7049,10 +7088,10 @@ function parsePatch(raw) {
|
|
|
7049
7088
|
return { files, truncated };
|
|
7050
7089
|
}
|
|
7051
7090
|
function stripPrefix(value) {
|
|
7052
|
-
const
|
|
7053
|
-
if (
|
|
7091
|
+
const path36 = unquote(value.trim());
|
|
7092
|
+
if (path36 === "/dev/null")
|
|
7054
7093
|
return "";
|
|
7055
|
-
return
|
|
7094
|
+
return path36.replace(/^[ab]\//, "");
|
|
7056
7095
|
}
|
|
7057
7096
|
function count(body, mark) {
|
|
7058
7097
|
let n = 0;
|
|
@@ -10533,11 +10572,142 @@ function exists3(file) {
|
|
|
10533
10572
|
return access2(file, constants2.X_OK).then(() => true, () => false);
|
|
10534
10573
|
}
|
|
10535
10574
|
|
|
10536
|
-
// ../host/dist/mcp-
|
|
10537
|
-
import {
|
|
10575
|
+
// ../host/dist/mcp-credentials.js
|
|
10576
|
+
import { createHash } from "node:crypto";
|
|
10577
|
+
import { readFile as readFile20, rename as rename3, writeFile as writeFile18 } from "node:fs/promises";
|
|
10538
10578
|
import path32 from "node:path";
|
|
10579
|
+
function mcpOAuthKey(name, config) {
|
|
10580
|
+
if (!config || typeof config !== "object")
|
|
10581
|
+
return null;
|
|
10582
|
+
const c = config;
|
|
10583
|
+
if (typeof c.url !== "string")
|
|
10584
|
+
return null;
|
|
10585
|
+
const shape = JSON.stringify({ type: c.type, url: c.url, headers: c.headers || {} });
|
|
10586
|
+
const hash = createHash("sha256").update(shape).digest("hex").substring(0, 16);
|
|
10587
|
+
return `${name}|${hash}`;
|
|
10588
|
+
}
|
|
10589
|
+
async function readMcpCredentialRecords(configDir, name) {
|
|
10590
|
+
let parsed;
|
|
10591
|
+
try {
|
|
10592
|
+
parsed = JSON.parse(await readFile20(path32.join(configDir, ".credentials.json"), "utf8"));
|
|
10593
|
+
} catch {
|
|
10594
|
+
return null;
|
|
10595
|
+
}
|
|
10596
|
+
if (!parsed || typeof parsed !== "object")
|
|
10597
|
+
return null;
|
|
10598
|
+
const store = parsed.mcpOAuth;
|
|
10599
|
+
if (store === void 0)
|
|
10600
|
+
return [];
|
|
10601
|
+
if (!store || typeof store !== "object")
|
|
10602
|
+
return null;
|
|
10603
|
+
const records = [];
|
|
10604
|
+
for (const [key, value] of Object.entries(store)) {
|
|
10605
|
+
if (!key.startsWith(`${name}|`) || !value || typeof value !== "object")
|
|
10606
|
+
continue;
|
|
10607
|
+
const v = value;
|
|
10608
|
+
const filled = (field) => typeof v[field] === "string" && v[field].length > 0;
|
|
10609
|
+
records.push({
|
|
10610
|
+
key,
|
|
10611
|
+
hasClient: filled("clientId"),
|
|
10612
|
+
hasAccessToken: filled("accessToken"),
|
|
10613
|
+
hasRefreshToken: filled("refreshToken"),
|
|
10614
|
+
expiresAt: typeof v.expiresAt === "number" ? v.expiresAt : null
|
|
10615
|
+
});
|
|
10616
|
+
}
|
|
10617
|
+
return records;
|
|
10618
|
+
}
|
|
10619
|
+
function usableToken(record, now = Date.now()) {
|
|
10620
|
+
if (!record.hasAccessToken)
|
|
10621
|
+
return false;
|
|
10622
|
+
if (record.hasRefreshToken)
|
|
10623
|
+
return true;
|
|
10624
|
+
return record.expiresAt === null || record.expiresAt > now;
|
|
10625
|
+
}
|
|
10626
|
+
function diagnoseSignIn(records, expectedKey) {
|
|
10627
|
+
if (records === null)
|
|
10628
|
+
return null;
|
|
10629
|
+
const own = expectedKey ? records.filter((r) => r.key === expectedKey) : records;
|
|
10630
|
+
const others = expectedKey ? records.filter((r) => r.key !== expectedKey) : [];
|
|
10631
|
+
const mine = own[0];
|
|
10632
|
+
if (mine && usableToken(mine)) {
|
|
10633
|
+
return null;
|
|
10634
|
+
}
|
|
10635
|
+
if (others.some((r) => usableToken(r))) {
|
|
10636
|
+
return {
|
|
10637
|
+
kind: "token-under-other-key",
|
|
10638
|
+
message: "\u0422\u043E\u043A\u0435\u043D \u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D, \u043D\u043E \u043F\u043E\u0434 \u0434\u0440\u0443\u0433\u043E\u0439 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u043E\u0439 \u044D\u0442\u043E\u0433\u043E \u043F\u043B\u0430\u0433\u0438\u043D\u0430 (\u0434\u0440\u0443\u0433\u043E\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438\u043B\u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430). \u041E\u0431\u044B\u0447\u043D\u043E \u044D\u0442\u043E \u0434\u0443\u0431\u043B\u0438 \u043F\u043B\u0430\u0433\u0438\u043D\u0430 \u2014 \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0432\u043A\u043B\u0430\u0434\u043A\u0443 \xAB\u041F\u043B\u0430\u0433\u0438\u043D\u044B\xBB."
|
|
10639
|
+
};
|
|
10640
|
+
}
|
|
10641
|
+
if (mine?.hasAccessToken) {
|
|
10642
|
+
return {
|
|
10643
|
+
kind: "token-expired",
|
|
10644
|
+
message: "\u0422\u043E\u043A\u0435\u043D \u043F\u0440\u043E\u0441\u0440\u043E\u0447\u0435\u043D, \u0430 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0435\u0433\u043E \u043D\u0435\u0447\u0435\u043C \u2014 \u0432\u043E\u0439\u0434\u0438\u0442\u0435 \u0437\u0430\u043D\u043E\u0432\u043E."
|
|
10645
|
+
};
|
|
10646
|
+
}
|
|
10647
|
+
if (mine?.hasClient) {
|
|
10648
|
+
return {
|
|
10649
|
+
kind: "client-without-token",
|
|
10650
|
+
message: "\u041A\u043B\u0438\u0435\u043D\u0442 \u0443 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D, \u043D\u043E \u0442\u043E\u043A\u0435\u043D \u043D\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D: \u0440\u0435\u0434\u0438\u0440\u0435\u043A\u0442 \u043D\u0430 localhost \u043D\u0435 \u0434\u043E\u0448\u0451\u043B \u0434\u043E CLI \u0438\u043B\u0438 \u043E\u0431\u043C\u0435\u043D \u043A\u043E\u0434\u0430 \u043D\u0430 \u0442\u043E\u043A\u0435\u043D \u043D\u0435 \u0443\u0434\u0430\u043B\u0441\u044F. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437; \u0435\u0441\u043B\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043F\u043E\u043A\u0430\u0437\u0430\u043B \u043E\u0448\u0438\u0431\u043A\u0443 \u043D\u0430 localhost \u2014 \u0432\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u0435\u0433\u043E \u0441\u0442\u0440\u043E\u043A\u0438."
|
|
10651
|
+
};
|
|
10652
|
+
}
|
|
10653
|
+
return {
|
|
10654
|
+
kind: "no-record",
|
|
10655
|
+
message: "\u0412\u0445\u043E\u0434 \u0443 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043D\u0435 \u043D\u0430\u0447\u0430\u043B\u0441\u044F: CLI \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u043B \u0434\u0430\u0436\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044E \u043A\u043B\u0438\u0435\u043D\u0442\u0430. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0441\u0441\u044B\u043B\u043A\u0443 \u0432\u0445\u043E\u0434\u0430 \u0438 \u043F\u0440\u043E\u0439\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u0434\u043E \u043A\u043E\u043D\u0446\u0430."
|
|
10656
|
+
};
|
|
10657
|
+
}
|
|
10658
|
+
function registryPath(configDir) {
|
|
10659
|
+
return path32.join(configDir, "plugins", "installed_plugins.json");
|
|
10660
|
+
}
|
|
10661
|
+
async function readRegistry(configDir) {
|
|
10662
|
+
try {
|
|
10663
|
+
const raw = JSON.parse(await readFile20(registryPath(configDir), "utf8"));
|
|
10664
|
+
const plugins = raw.plugins;
|
|
10665
|
+
if (!plugins || typeof plugins !== "object")
|
|
10666
|
+
return null;
|
|
10667
|
+
for (const value of Object.values(plugins))
|
|
10668
|
+
if (!Array.isArray(value))
|
|
10669
|
+
return null;
|
|
10670
|
+
return { raw, plugins };
|
|
10671
|
+
} catch {
|
|
10672
|
+
return null;
|
|
10673
|
+
}
|
|
10674
|
+
}
|
|
10675
|
+
async function findDuplicatePlugins(configDir) {
|
|
10676
|
+
const registry = await readRegistry(configDir);
|
|
10677
|
+
if (!registry)
|
|
10678
|
+
return [];
|
|
10679
|
+
const str4 = (v) => typeof v === "string" ? v : "";
|
|
10680
|
+
return Object.entries(registry.plugins).filter(([, records]) => records.length > 1).map(([id, records]) => ({
|
|
10681
|
+
id,
|
|
10682
|
+
records: records.map((r) => ({
|
|
10683
|
+
scope: str4(r.scope),
|
|
10684
|
+
version: str4(r.version),
|
|
10685
|
+
installPath: str4(r.installPath)
|
|
10686
|
+
}))
|
|
10687
|
+
}));
|
|
10688
|
+
}
|
|
10689
|
+
async function keepSinglePluginRecord(configDir, id) {
|
|
10690
|
+
const registry = await readRegistry(configDir);
|
|
10691
|
+
if (!registry)
|
|
10692
|
+
throw new Error("\u0420\u0435\u0435\u0441\u0442\u0440 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0438\u043B\u0438 \u0432 \u043D\u0435\u0437\u043D\u0430\u043A\u043E\u043C\u043E\u043C \u0444\u043E\u0440\u043C\u0430\u0442\u0435");
|
|
10693
|
+
const records = registry.plugins[id];
|
|
10694
|
+
if (!records || records.length < 2)
|
|
10695
|
+
return;
|
|
10696
|
+
const stamp = (r) => typeof r.lastUpdated === "string" ? Date.parse(r.lastUpdated) || 0 : 0;
|
|
10697
|
+
const pool = records.some((r) => r.scope === "user") ? records.filter((r) => r.scope === "user") : records;
|
|
10698
|
+
const keep = [...pool].sort((a, b) => stamp(b) - stamp(a))[0];
|
|
10699
|
+
registry.plugins[id] = [keep];
|
|
10700
|
+
const file = registryPath(configDir);
|
|
10701
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
10702
|
+
await writeFile18(tmp, JSON.stringify({ ...registry.raw, plugins: registry.plugins }, null, 2), "utf8");
|
|
10703
|
+
await rename3(tmp, file);
|
|
10704
|
+
}
|
|
10705
|
+
|
|
10706
|
+
// ../host/dist/mcp-config.js
|
|
10707
|
+
import { readFile as readFile21, writeFile as writeFile19, mkdir as mkdir18 } from "node:fs/promises";
|
|
10708
|
+
import path33 from "node:path";
|
|
10539
10709
|
var MCP_FILE = ".mcp.json";
|
|
10540
|
-
var LOCAL_SETTINGS2 =
|
|
10710
|
+
var LOCAL_SETTINGS2 = path33.join(".claude", "settings.local.json");
|
|
10541
10711
|
var queues = /* @__PURE__ */ new Map();
|
|
10542
10712
|
function serialize(cwd, work) {
|
|
10543
10713
|
const previous = queues.get(cwd) ?? Promise.resolve();
|
|
@@ -10546,7 +10716,7 @@ function serialize(cwd, work) {
|
|
|
10546
10716
|
return next;
|
|
10547
10717
|
}
|
|
10548
10718
|
async function readProjectServers(cwd) {
|
|
10549
|
-
const file = await readJson(
|
|
10719
|
+
const file = await readJson(path33.join(cwd, MCP_FILE));
|
|
10550
10720
|
const servers = file?.mcpServers;
|
|
10551
10721
|
if (!servers || typeof servers !== "object")
|
|
10552
10722
|
return {};
|
|
@@ -10554,23 +10724,23 @@ async function readProjectServers(cwd) {
|
|
|
10554
10724
|
}
|
|
10555
10725
|
function addProjectServer(cwd, name, config) {
|
|
10556
10726
|
return serialize(cwd, async () => {
|
|
10557
|
-
const file = await readJson(
|
|
10727
|
+
const file = await readJson(path33.join(cwd, MCP_FILE)) ?? {};
|
|
10558
10728
|
const servers = file.mcpServers ?? {};
|
|
10559
10729
|
servers[name] = config;
|
|
10560
10730
|
file.mcpServers = servers;
|
|
10561
|
-
await writeJson(
|
|
10731
|
+
await writeJson(path33.join(cwd, MCP_FILE), file);
|
|
10562
10732
|
await approve(cwd, name);
|
|
10563
10733
|
});
|
|
10564
10734
|
}
|
|
10565
10735
|
function removeProjectServer(cwd, name) {
|
|
10566
10736
|
return serialize(cwd, async () => {
|
|
10567
|
-
const file = await readJson(
|
|
10737
|
+
const file = await readJson(path33.join(cwd, MCP_FILE));
|
|
10568
10738
|
const servers = file?.mcpServers;
|
|
10569
10739
|
if (!servers || !(name in servers))
|
|
10570
10740
|
return false;
|
|
10571
10741
|
delete servers[name];
|
|
10572
|
-
await writeJson(
|
|
10573
|
-
const settingsPath =
|
|
10742
|
+
await writeJson(path33.join(cwd, MCP_FILE), file);
|
|
10743
|
+
const settingsPath = path33.join(cwd, LOCAL_SETTINGS2);
|
|
10574
10744
|
const settings = await readJson(settingsPath);
|
|
10575
10745
|
const enabled = settings?.enabledMcpjsonServers;
|
|
10576
10746
|
if (settings && Array.isArray(enabled) && enabled.includes(name)) {
|
|
@@ -10581,7 +10751,7 @@ function removeProjectServer(cwd, name) {
|
|
|
10581
10751
|
});
|
|
10582
10752
|
}
|
|
10583
10753
|
async function approve(cwd, name) {
|
|
10584
|
-
const file =
|
|
10754
|
+
const file = path33.join(cwd, LOCAL_SETTINGS2);
|
|
10585
10755
|
const settings = await readJson(file) ?? {};
|
|
10586
10756
|
const enabled = Array.isArray(settings.enabledMcpjsonServers) ? settings.enabledMcpjsonServers : [];
|
|
10587
10757
|
if (!enabled.includes(name))
|
|
@@ -10620,25 +10790,31 @@ function describeConfig(config) {
|
|
|
10620
10790
|
}
|
|
10621
10791
|
async function readJson(file) {
|
|
10622
10792
|
try {
|
|
10623
|
-
const raw = await
|
|
10793
|
+
const raw = await readFile21(file, "utf8");
|
|
10624
10794
|
const parsed = JSON.parse(raw);
|
|
10625
10795
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
10626
10796
|
} catch (error) {
|
|
10627
10797
|
if (error.code === "ENOENT")
|
|
10628
10798
|
return null;
|
|
10629
10799
|
if (error instanceof SyntaxError) {
|
|
10630
|
-
throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${
|
|
10800
|
+
throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${path33.basename(file)}: ${error.message}`);
|
|
10631
10801
|
}
|
|
10632
10802
|
throw error;
|
|
10633
10803
|
}
|
|
10634
10804
|
}
|
|
10635
10805
|
async function writeJson(file, data) {
|
|
10636
|
-
await mkdir18(
|
|
10637
|
-
await
|
|
10806
|
+
await mkdir18(path33.dirname(file), { recursive: true });
|
|
10807
|
+
await writeFile19(file, `${JSON.stringify(data, null, 2)}
|
|
10638
10808
|
`, "utf8");
|
|
10639
10809
|
}
|
|
10640
10810
|
|
|
10641
10811
|
// ../host/dist/server.js
|
|
10812
|
+
function accountOf(session) {
|
|
10813
|
+
return session instanceof ClaudeSession ? session.accountId : MAIN_ACCOUNT_ID;
|
|
10814
|
+
}
|
|
10815
|
+
function generationOf(session) {
|
|
10816
|
+
return session instanceof ClaudeSession ? session.generation : 0;
|
|
10817
|
+
}
|
|
10642
10818
|
var SIDE_TITLE = "\xB7 \u0432\u043E\u043F\u0440\u043E\u0441 \u043D\u0430 \u043F\u043E\u043B\u044F\u0445";
|
|
10643
10819
|
var FINDER_TITLE = "\xB7 \u043F\u043E\u0438\u0441\u043A \u043F\u0440\u043E\u0435\u043A\u0442\u0430";
|
|
10644
10820
|
var HISTORY_PAGE = 250;
|
|
@@ -10661,8 +10837,8 @@ var HostServer = class {
|
|
|
10661
10837
|
#settings;
|
|
10662
10838
|
#finder;
|
|
10663
10839
|
#sessions = /* @__PURE__ */ new Map();
|
|
10664
|
-
/**
|
|
10665
|
-
#
|
|
10840
|
+
/** Идущие OAuth-входы MCP, ключ — сессия и сервер. */
|
|
10841
|
+
#mcpAuthRuns = /* @__PURE__ */ new Map();
|
|
10666
10842
|
#antigravity;
|
|
10667
10843
|
#codex;
|
|
10668
10844
|
/** Боковые сессии («вопрос на полях») по id родителя — не больше одной на разговор. */
|
|
@@ -10842,7 +11018,7 @@ var HostServer = class {
|
|
|
10842
11018
|
const status = await new AuthCli(configDir).status().catch(() => null);
|
|
10843
11019
|
if (!status?.loggedIn)
|
|
10844
11020
|
return null;
|
|
10845
|
-
const used = this.#accounts.all.find((a) =>
|
|
11021
|
+
const used = this.#accounts.all.find((a) => path34.resolve(this.#accounts.effectiveDir(a.id)).toLowerCase() === configDir.toLowerCase());
|
|
10846
11022
|
return {
|
|
10847
11023
|
configDir,
|
|
10848
11024
|
email: status.email,
|
|
@@ -11148,13 +11324,13 @@ var HostServer = class {
|
|
|
11148
11324
|
workspaceFolders: await Promise.all(this.#diskFolders.map(async (name) => {
|
|
11149
11325
|
const id = folderIdFor(name);
|
|
11150
11326
|
const color = this.#folders.diskFolderColor(id);
|
|
11151
|
-
const unopened = await listUnopened(
|
|
11327
|
+
const unopened = await listUnopened(path34.join(this.#projectsRoot(), name), this.#workspaces.allPaths());
|
|
11152
11328
|
return {
|
|
11153
11329
|
id,
|
|
11154
11330
|
name,
|
|
11155
11331
|
...color ? { color } : {},
|
|
11156
11332
|
unopened,
|
|
11157
|
-
path:
|
|
11333
|
+
path: path34.join(this.#projectsRoot(), name)
|
|
11158
11334
|
};
|
|
11159
11335
|
}))
|
|
11160
11336
|
};
|
|
@@ -11223,10 +11399,10 @@ var HostServer = class {
|
|
|
11223
11399
|
const name = folderNameOf(folderId);
|
|
11224
11400
|
if (!name || !this.#diskFolders.includes(name))
|
|
11225
11401
|
throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u043D\u0430 \u0434\u0438\u0441\u043A\u0435");
|
|
11226
|
-
parent =
|
|
11402
|
+
parent = path34.join(root, name);
|
|
11227
11403
|
}
|
|
11228
|
-
const to =
|
|
11229
|
-
if (
|
|
11404
|
+
const to = path34.join(parent, path34.basename(workspace.path));
|
|
11405
|
+
if (path34.resolve(to).toLowerCase() === path34.resolve(workspace.path).toLowerCase())
|
|
11230
11406
|
return;
|
|
11231
11407
|
await this.#relocate(workspace.path, to);
|
|
11232
11408
|
}
|
|
@@ -11238,7 +11414,7 @@ var HostServer = class {
|
|
|
11238
11414
|
if (name === old)
|
|
11239
11415
|
return;
|
|
11240
11416
|
const root = this.#projectsRoot();
|
|
11241
|
-
await this.#relocate(
|
|
11417
|
+
await this.#relocate(path34.join(root, old), path34.join(root, name));
|
|
11242
11418
|
await this.#folders.renameDiskFolder(folderId, folderIdFor(name), name);
|
|
11243
11419
|
this.#sendFolders();
|
|
11244
11420
|
}
|
|
@@ -11246,13 +11422,13 @@ var HostServer = class {
|
|
|
11246
11422
|
const name = folderNameOf(folderId);
|
|
11247
11423
|
if (!name)
|
|
11248
11424
|
return;
|
|
11249
|
-
const dir =
|
|
11425
|
+
const dir = path34.join(this.#projectsRoot(), name);
|
|
11250
11426
|
const foreign = await foreignContent(dir, this.#workspaces.allPaths());
|
|
11251
11427
|
if (foreign) {
|
|
11252
11428
|
throw new Error(`\u0412 \u043F\u0430\u043F\u043A\u0435 \u0435\u0441\u0442\u044C \xAB${foreign}\xBB, \u044D\u0442\u043E \u043D\u0435 \u043F\u0440\u043E\u0435\u043A\u0442 ccv \u2014 \u0443\u0431\u0435\u0440\u0438\u0442\u0435 \u044D\u0442\u043E \u0438 \u0443\u0434\u0430\u043B\u0438\u0442\u0435 \u043F\u0430\u043F\u043A\u0443 \u0441\u043D\u043E\u0432\u0430`);
|
|
11253
11429
|
}
|
|
11254
11430
|
for (const project of this.#workspaces.allPaths().filter((p) => isInside(dir, p))) {
|
|
11255
|
-
await this.#relocate(project,
|
|
11431
|
+
await this.#relocate(project, path34.join(this.#projectsRoot(), path34.basename(project)));
|
|
11256
11432
|
}
|
|
11257
11433
|
await removeEmptyDir(dir);
|
|
11258
11434
|
await this.#folders.forgetDiskFolder(folderId);
|
|
@@ -11358,7 +11534,7 @@ var HostServer = class {
|
|
|
11358
11534
|
await this.#refreshDiskFolders();
|
|
11359
11535
|
if (!name || !this.#diskFolders.includes(name))
|
|
11360
11536
|
throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u043D\u0430 \u0434\u0438\u0441\u043A\u0435");
|
|
11361
|
-
parent =
|
|
11537
|
+
parent = path34.join(this.#projectsRoot(), name);
|
|
11362
11538
|
}
|
|
11363
11539
|
const { workspace, warnings } = await this.#workspaces.create(parent, frame.name, frame.init);
|
|
11364
11540
|
await this.#refreshDiskFolders();
|
|
@@ -11410,6 +11586,8 @@ var HostServer = class {
|
|
|
11410
11586
|
return;
|
|
11411
11587
|
}
|
|
11412
11588
|
case "session.reconnect":
|
|
11589
|
+
if (!frame.force)
|
|
11590
|
+
this.#refuseDuringMcpAuth(frame.sessionId);
|
|
11413
11591
|
this.#requireSession(frame.sessionId).reconnect("\u043F\u043E \u043F\u0440\u043E\u0441\u044C\u0431\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F");
|
|
11414
11592
|
return;
|
|
11415
11593
|
case "session.archive": {
|
|
@@ -11594,6 +11772,8 @@ var HostServer = class {
|
|
|
11594
11772
|
this.#requireSession(frame.sessionId).sendPrompt(frame.text, frame.images, false, frame.attachments);
|
|
11595
11773
|
return;
|
|
11596
11774
|
case "prompt.edit":
|
|
11775
|
+
if (!frame.force)
|
|
11776
|
+
this.#refuseDuringMcpAuth(frame.sessionId);
|
|
11597
11777
|
await networkGuard.ensureFresh();
|
|
11598
11778
|
this.#approveAfterLimit(frame.sessionId);
|
|
11599
11779
|
await this.#requireSession(frame.sessionId).editPrompt(frame.userIndex, frame.text, frame.images, frame.attachments, frame.rewindFiles === true);
|
|
@@ -11711,27 +11891,30 @@ var HostServer = class {
|
|
|
11711
11891
|
case "mcp.auth": {
|
|
11712
11892
|
const session = this.#requireSession(frame.sessionId);
|
|
11713
11893
|
const { name } = frame;
|
|
11714
|
-
const
|
|
11894
|
+
const accountId = frame.accountId ?? accountOf(session);
|
|
11895
|
+
this.#stopMcpAuth(frame.sessionId, name);
|
|
11896
|
+
let helper = null;
|
|
11715
11897
|
try {
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11898
|
+
if (accountId !== accountOf(session))
|
|
11899
|
+
helper = this.#mcpAuthHelper(session, accountId);
|
|
11900
|
+
const target = helper ?? session;
|
|
11901
|
+
const start = await target.authenticateMcpServer(name);
|
|
11902
|
+
this.#watchMcpAuth({
|
|
11719
11903
|
sessionId: frame.sessionId,
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11904
|
+
name,
|
|
11905
|
+
accountId,
|
|
11906
|
+
target,
|
|
11907
|
+
helper,
|
|
11908
|
+
generation: generationOf(target),
|
|
11909
|
+
url: start.requiresUserAction ? start.url : "",
|
|
11910
|
+
callbackExpected: start.callbackExpected
|
|
11727
11911
|
});
|
|
11728
|
-
this.#watchMcpAuth(frame.sessionId, name);
|
|
11729
11912
|
} catch (error) {
|
|
11913
|
+
await helper?.close("\u0432\u0445\u043E\u0434 \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u043D\u0430\u0447\u0430\u043B\u0441\u044F");
|
|
11730
11914
|
const message = error instanceof Error ? error.message : String(error);
|
|
11731
|
-
this.#
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
state: { ...base, active: false, error: message }
|
|
11915
|
+
this.#broadcastMcpAuth(frame.sessionId, {
|
|
11916
|
+
...this.#idleAuthState(name, accountId),
|
|
11917
|
+
error: message
|
|
11735
11918
|
});
|
|
11736
11919
|
this.#reportOperation(frame.sessionId, "mcp", false, message);
|
|
11737
11920
|
}
|
|
@@ -11739,25 +11922,40 @@ var HostServer = class {
|
|
|
11739
11922
|
}
|
|
11740
11923
|
case "mcp.auth_callback": {
|
|
11741
11924
|
const session = this.#requireSession(frame.sessionId);
|
|
11925
|
+
const run = this.#mcpAuthRuns.get(`${frame.sessionId}/${frame.name}`);
|
|
11926
|
+
const target = run?.target ?? session;
|
|
11927
|
+
if (run)
|
|
11928
|
+
this.#broadcastMcpAuth(frame.sessionId, this.#runState(run, "exchanging", null));
|
|
11742
11929
|
try {
|
|
11743
|
-
await
|
|
11930
|
+
await target.submitMcpOAuthCallback(frame.name, frame.callbackUrl.trim());
|
|
11744
11931
|
} catch (error) {
|
|
11745
11932
|
const message = error instanceof Error ? error.message : String(error);
|
|
11746
|
-
this.#
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
url: "",
|
|
11753
|
-
callbackExpected: true,
|
|
11754
|
-
done: false,
|
|
11755
|
-
error: message
|
|
11756
|
-
}
|
|
11933
|
+
this.#broadcastMcpAuth(frame.sessionId, run ? this.#runState(run, "waiting", message) : {
|
|
11934
|
+
...this.#idleAuthState(frame.name, accountOf(session)),
|
|
11935
|
+
active: true,
|
|
11936
|
+
stage: "waiting",
|
|
11937
|
+
callbackExpected: true,
|
|
11938
|
+
error: message
|
|
11757
11939
|
});
|
|
11758
11940
|
}
|
|
11759
11941
|
return;
|
|
11760
11942
|
}
|
|
11943
|
+
case "plugin.dedupe": {
|
|
11944
|
+
const session = this.#requireSession(frame.sessionId);
|
|
11945
|
+
let ok = true;
|
|
11946
|
+
let message = `\u0423 \u043F\u043B\u0430\u0433\u0438\u043D\u0430 \xAB${frame.id}\xBB \u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0430 \u043E\u0434\u043D\u0430 \u0437\u0430\u043F\u0438\u0441\u044C`;
|
|
11947
|
+
try {
|
|
11948
|
+
await keepSinglePluginRecord(this.#accounts.effectiveDir(accountOf(session)), frame.id);
|
|
11949
|
+
await session.reloadPlugins().catch(() => void 0);
|
|
11950
|
+
} catch (error) {
|
|
11951
|
+
ok = false;
|
|
11952
|
+
message = error instanceof Error ? error.message : String(error);
|
|
11953
|
+
}
|
|
11954
|
+
this.#reportOperation(frame.sessionId, "plugin", ok, message);
|
|
11955
|
+
await this.#sendPluginList(frame.sessionId);
|
|
11956
|
+
await this.#sendMcpList(frame.sessionId).catch(() => void 0);
|
|
11957
|
+
return;
|
|
11958
|
+
}
|
|
11761
11959
|
case "plugin.list":
|
|
11762
11960
|
await this.#sendPluginList(frame.sessionId);
|
|
11763
11961
|
return;
|
|
@@ -12353,7 +12551,9 @@ var HostServer = class {
|
|
|
12353
12551
|
}
|
|
12354
12552
|
async #sendPluginList(sessionId) {
|
|
12355
12553
|
const { plugins, marketplaces, catalog } = await this.#plugins.list();
|
|
12356
|
-
this.#
|
|
12554
|
+
const session = this.#sessions.get(sessionId);
|
|
12555
|
+
const duplicates = await findDuplicatePlugins(this.#accounts.effectiveDir(session ? accountOf(session) : MAIN_ACCOUNT_ID));
|
|
12556
|
+
this.#broadcast({ type: "plugin.list", sessionId, plugins, marketplaces, duplicates, catalog });
|
|
12357
12557
|
}
|
|
12358
12558
|
/**
|
|
12359
12559
|
* Общий хвост для всех команд `claude plugin`.
|
|
@@ -12378,65 +12578,187 @@ var HostServer = class {
|
|
|
12378
12578
|
this.#reportOperation(sessionId, "plugin", ok, message);
|
|
12379
12579
|
await this.#sendPluginList(sessionId);
|
|
12380
12580
|
}
|
|
12581
|
+
/** Состояние входа, которого нет или который закончился. */
|
|
12582
|
+
#idleAuthState(name, accountId) {
|
|
12583
|
+
return {
|
|
12584
|
+
name,
|
|
12585
|
+
accountId,
|
|
12586
|
+
active: false,
|
|
12587
|
+
stage: "finished",
|
|
12588
|
+
url: "",
|
|
12589
|
+
callbackExpected: false,
|
|
12590
|
+
done: false,
|
|
12591
|
+
error: null,
|
|
12592
|
+
diagnostic: null,
|
|
12593
|
+
otherAccounts: []
|
|
12594
|
+
};
|
|
12595
|
+
}
|
|
12596
|
+
#runState(run, stage, error) {
|
|
12597
|
+
return {
|
|
12598
|
+
...this.#idleAuthState(run.name, run.accountId),
|
|
12599
|
+
active: true,
|
|
12600
|
+
stage,
|
|
12601
|
+
url: run.url,
|
|
12602
|
+
callbackExpected: run.callbackExpected,
|
|
12603
|
+
error
|
|
12604
|
+
};
|
|
12605
|
+
}
|
|
12606
|
+
#broadcastMcpAuth(sessionId, state) {
|
|
12607
|
+
this.#broadcast({ type: "mcp.auth", sessionId, state });
|
|
12608
|
+
}
|
|
12609
|
+
/**
|
|
12610
|
+
* Отказать в перезапуске процесса CLI, пока в нём идёт вход: локальный
|
|
12611
|
+
* колбэк слушает именно этот процесс, и с ним умрёт и вход. Клиент
|
|
12612
|
+
* спрашивает человека и повторяет кадр с `force`.
|
|
12613
|
+
*/
|
|
12614
|
+
#refuseDuringMcpAuth(sessionId) {
|
|
12615
|
+
for (const run of this.#mcpAuthRuns.values()) {
|
|
12616
|
+
if (run.sessionId === sessionId && run.helper === null) {
|
|
12617
|
+
throw new Error(`\u0418\u0434\u0451\u0442 \u0432\u0445\u043E\u0434 \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \xAB${run.name}\xBB \u2014 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 Claude \u0435\u0433\u043E \u043F\u0440\u0435\u0440\u0432\u0451\u0442`);
|
|
12618
|
+
}
|
|
12619
|
+
}
|
|
12620
|
+
}
|
|
12621
|
+
/**
|
|
12622
|
+
* Вспомогательная сессия под другим аккаунтом — ради одного входа.
|
|
12623
|
+
*
|
|
12624
|
+
* MCP-токен ложится в `.credentials.json` того аккаунта, под которым идёт
|
|
12625
|
+
* процесс CLI, а копировать этот файл между аккаунтами нельзя: там же вход в
|
|
12626
|
+
* claude.ai. Поэтому вход для второго аккаунта — это его собственный процесс
|
|
12627
|
+
* в том же каталоге (те же плагины и `.mcp.json`), без промптов. В список
|
|
12628
|
+
* сессий он не попадает и закрывается, как только вход кончился.
|
|
12629
|
+
*/
|
|
12630
|
+
#mcpAuthHelper(parent, accountId) {
|
|
12631
|
+
if (!(parent instanceof ClaudeSession)) {
|
|
12632
|
+
throw new Error("\u0412\u0445\u043E\u0434 \u0434\u043B\u044F \u0434\u0440\u0443\u0433\u043E\u0433\u043E \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0441\u0435\u0441\u0441\u0438\u044F\u0445 Claude");
|
|
12633
|
+
}
|
|
12634
|
+
const account = this.#accounts.find(accountId);
|
|
12635
|
+
if (!account)
|
|
12636
|
+
throw new Error("\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D");
|
|
12637
|
+
const helper = new ClaudeSession({
|
|
12638
|
+
workspaceId: "",
|
|
12639
|
+
accountId: account.id,
|
|
12640
|
+
configDir: account.configDir,
|
|
12641
|
+
cwd: parent.cwd
|
|
12642
|
+
});
|
|
12643
|
+
helper.start();
|
|
12644
|
+
return helper;
|
|
12645
|
+
}
|
|
12646
|
+
#stopMcpAuth(sessionId, name) {
|
|
12647
|
+
const key = `${sessionId}/${name}`;
|
|
12648
|
+
const run = this.#mcpAuthRuns.get(key);
|
|
12649
|
+
if (!run)
|
|
12650
|
+
return;
|
|
12651
|
+
clearInterval(run.timer);
|
|
12652
|
+
this.#mcpAuthRuns.delete(key);
|
|
12653
|
+
void run.helper?.close("\u0432\u0445\u043E\u0434 \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043A\u043E\u043D\u0447\u0435\u043D");
|
|
12654
|
+
}
|
|
12655
|
+
/** Погасить все входы сессии — она закрывается. */
|
|
12656
|
+
#stopMcpAuthFor(sessionId) {
|
|
12657
|
+
for (const run of [...this.#mcpAuthRuns.values()]) {
|
|
12658
|
+
if (run.sessionId === sessionId)
|
|
12659
|
+
this.#stopMcpAuth(sessionId, run.name);
|
|
12660
|
+
}
|
|
12661
|
+
}
|
|
12662
|
+
/**
|
|
12663
|
+
* Объяснить незавершённый вход по записи в хранилище токенов аккаунта.
|
|
12664
|
+
* Только наличие полей; при незнакомом формате — `null`.
|
|
12665
|
+
*/
|
|
12666
|
+
async #diagnoseMcpAuth(run) {
|
|
12667
|
+
try {
|
|
12668
|
+
const status = (await run.target.mcpServerStatus()).find((s) => s.name === run.name);
|
|
12669
|
+
const expected = mcpOAuthKey(run.name, status?.config);
|
|
12670
|
+
const records = await readMcpCredentialRecords(this.#accounts.effectiveDir(run.accountId), run.name);
|
|
12671
|
+
return diagnoseSignIn(records, expected);
|
|
12672
|
+
} catch {
|
|
12673
|
+
return null;
|
|
12674
|
+
}
|
|
12675
|
+
}
|
|
12676
|
+
/**
|
|
12677
|
+
* Другие аккаунты, у которых у сервера нет пригодного токена. Аккаунт, чьё
|
|
12678
|
+
* хранилище не прочитать (macOS держит его в связке ключей), не предлагаем:
|
|
12679
|
+
* о нём ничего не известно.
|
|
12680
|
+
*/
|
|
12681
|
+
async #accountsMissingMcpToken(name, except) {
|
|
12682
|
+
const missing = [];
|
|
12683
|
+
for (const account of this.#accounts.all) {
|
|
12684
|
+
if (account.id === except)
|
|
12685
|
+
continue;
|
|
12686
|
+
const records = await readMcpCredentialRecords(this.#accounts.effectiveDir(account.id), name);
|
|
12687
|
+
if (records !== null && !records.some((r) => usableToken(r)))
|
|
12688
|
+
missing.push(account.id);
|
|
12689
|
+
}
|
|
12690
|
+
return missing;
|
|
12691
|
+
}
|
|
12381
12692
|
/**
|
|
12382
12693
|
* Дождаться, пока сервер выйдет из `needs-auth`.
|
|
12383
12694
|
*
|
|
12384
12695
|
* О конце входа CLI не сообщает ничем: после колбэка он молча меняет токены
|
|
12385
12696
|
* и переподключает сервер у себя. Остаётся спрашивать статус, пока не
|
|
12386
12697
|
* изменится, — недолго, потому что вход человек либо проходит за минуты,
|
|
12387
|
-
* либо бросает.
|
|
12698
|
+
* либо бросает. Заодно следим, не сменился ли процесс CLI: вход живёт в нём.
|
|
12388
12699
|
*/
|
|
12389
|
-
#watchMcpAuth(
|
|
12700
|
+
#watchMcpAuth(init) {
|
|
12701
|
+
const { sessionId, name } = init;
|
|
12390
12702
|
const key = `${sessionId}/${name}`;
|
|
12391
|
-
clearInterval(this.#mcpAuthWatch.get(key));
|
|
12392
12703
|
const startedAt = Date.now();
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12704
|
+
let busy = false;
|
|
12705
|
+
const fail = async (run, error, interrupted = false) => {
|
|
12706
|
+
const diagnostic = interrupted ? {
|
|
12707
|
+
kind: "interrupted",
|
|
12708
|
+
message: "\u041F\u0440\u043E\u0446\u0435\u0441\u0441 Claude \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F \u043F\u043E\u0441\u0440\u0435\u0434\u0438 \u0432\u0445\u043E\u0434\u0430 \u2014 \u043D\u0430\u0447\u043D\u0438\u0442\u0435 \u0432\u0445\u043E\u0434 \u0437\u0430\u043D\u043E\u0432\u043E."
|
|
12709
|
+
} : await this.#diagnoseMcpAuth(run);
|
|
12710
|
+
this.#stopMcpAuth(sessionId, name);
|
|
12711
|
+
this.#broadcastMcpAuth(sessionId, {
|
|
12712
|
+
...this.#idleAuthState(name, run.accountId),
|
|
12713
|
+
error,
|
|
12714
|
+
diagnostic
|
|
12715
|
+
});
|
|
12396
12716
|
};
|
|
12397
12717
|
const timer = setInterval(() => {
|
|
12718
|
+
const run = this.#mcpAuthRuns.get(key);
|
|
12719
|
+
if (!run || run.timer !== timer) {
|
|
12720
|
+
clearInterval(timer);
|
|
12721
|
+
return;
|
|
12722
|
+
}
|
|
12723
|
+
if (busy)
|
|
12724
|
+
return;
|
|
12725
|
+
busy = true;
|
|
12398
12726
|
void (async () => {
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
return
|
|
12727
|
+
if (!this.#sessions.has(sessionId) || run.target.state === "closed") {
|
|
12728
|
+
this.#stopMcpAuth(sessionId, name);
|
|
12729
|
+
return;
|
|
12730
|
+
}
|
|
12731
|
+
if (generationOf(run.target) !== run.generation) {
|
|
12732
|
+
await fail(run, "\u0412\u0445\u043E\u0434 \u043F\u0440\u0435\u0440\u0432\u0430\u043D: \u043F\u0440\u043E\u0446\u0435\u0441\u0441 Claude \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F", true);
|
|
12733
|
+
return;
|
|
12734
|
+
}
|
|
12402
12735
|
if (Date.now() - startedAt > MCP_AUTH_TIMEOUT_MS) {
|
|
12403
|
-
|
|
12404
|
-
this.#broadcast({
|
|
12405
|
-
type: "mcp.auth",
|
|
12406
|
-
sessionId,
|
|
12407
|
-
state: {
|
|
12408
|
-
name,
|
|
12409
|
-
active: false,
|
|
12410
|
-
url: "",
|
|
12411
|
-
callbackExpected: false,
|
|
12412
|
-
done: false,
|
|
12413
|
-
error: "\u0412\u0445\u043E\u0434 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D \u2014 \u0438\u0441\u0442\u0435\u043A\u043B\u043E \u0432\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F"
|
|
12414
|
-
}
|
|
12415
|
-
});
|
|
12736
|
+
await fail(run, "\u0412\u0445\u043E\u0434 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D \u2014 \u0438\u0441\u0442\u0435\u043A\u043B\u043E \u0432\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F");
|
|
12416
12737
|
return;
|
|
12417
12738
|
}
|
|
12418
|
-
const status = (await
|
|
12739
|
+
const status = (await run.target.mcpServerStatus()).find((s) => s.name === name)?.status;
|
|
12419
12740
|
if (status === "needs-auth" || status === "pending")
|
|
12420
12741
|
return;
|
|
12421
|
-
finish();
|
|
12422
12742
|
const ok = status === "connected";
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
});
|
|
12743
|
+
if (!ok) {
|
|
12744
|
+
await fail(run, `\u0421\u0435\u0440\u0432\u0435\u0440 \xAB${name}\xBB \u043F\u043E\u0441\u043B\u0435 \u0432\u0445\u043E\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 ${status ?? "\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E"}`);
|
|
12745
|
+
} else {
|
|
12746
|
+
const otherAccounts = await this.#accountsMissingMcpToken(name, run.accountId);
|
|
12747
|
+
this.#stopMcpAuth(sessionId, name);
|
|
12748
|
+
this.#broadcastMcpAuth(sessionId, {
|
|
12749
|
+
...this.#idleAuthState(name, run.accountId),
|
|
12750
|
+
done: true,
|
|
12751
|
+
otherAccounts
|
|
12752
|
+
});
|
|
12753
|
+
}
|
|
12435
12754
|
this.#reportOperation(sessionId, "mcp", ok, ok ? `\u0421\u0435\u0440\u0432\u0435\u0440 \xAB${name}\xBB \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D \u0438 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0451\u043D` : `\u0421\u0435\u0440\u0432\u0435\u0440 \xAB${name}\xBB \u043D\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u043B\u0441\u044F \u043F\u043E\u0441\u043B\u0435 \u0432\u0445\u043E\u0434\u0430`);
|
|
12436
12755
|
await this.#sendMcpList(sessionId);
|
|
12437
|
-
})().catch(() =>
|
|
12756
|
+
})().catch(() => this.#stopMcpAuth(sessionId, name)).finally(() => {
|
|
12757
|
+
busy = false;
|
|
12758
|
+
});
|
|
12438
12759
|
}, MCP_AUTH_POLL_MS);
|
|
12439
|
-
this.#
|
|
12760
|
+
this.#mcpAuthRuns.set(key, { ...init, timer });
|
|
12761
|
+
this.#broadcastMcpAuth(sessionId, this.#runState(init, "waiting", null));
|
|
12440
12762
|
}
|
|
12441
12763
|
#reportOperation(sessionId, scope, ok, message) {
|
|
12442
12764
|
this.#broadcast({ type: "operation.result", sessionId, result: { scope, ok, message } });
|
|
@@ -12462,6 +12784,7 @@ var HostServer = class {
|
|
|
12462
12784
|
if (!session)
|
|
12463
12785
|
return false;
|
|
12464
12786
|
await this.#closeSide(sessionId);
|
|
12787
|
+
this.#stopMcpAuthFor(sessionId);
|
|
12465
12788
|
await session.close(reason);
|
|
12466
12789
|
this.#sessions.delete(sessionId);
|
|
12467
12790
|
this.#limitApproved.delete(sessionId);
|
|
@@ -12977,6 +13300,8 @@ var HostServer = class {
|
|
|
12977
13300
|
void this.#migratePin(from, to);
|
|
12978
13301
|
});
|
|
12979
13302
|
session.on("capabilities", () => {
|
|
13303
|
+
if (this.#sessions.has(session.id))
|
|
13304
|
+
void this.#sendMcpList(session.id).catch(() => void 0);
|
|
12980
13305
|
if (!session.capabilities)
|
|
12981
13306
|
return;
|
|
12982
13307
|
this.#broadcast({
|
|
@@ -13456,8 +13781,8 @@ var HostServer = class {
|
|
|
13456
13781
|
return;
|
|
13457
13782
|
}
|
|
13458
13783
|
const url2 = new URL(req.url ?? "/", "http://localhost");
|
|
13459
|
-
const requested =
|
|
13460
|
-
const target = requested.startsWith(webRoot) && existsSync7(requested) && statSync3(requested).isFile() ? requested :
|
|
13784
|
+
const requested = path34.join(webRoot, path34.normalize(url2.pathname));
|
|
13785
|
+
const target = requested.startsWith(webRoot) && existsSync7(requested) && statSync3(requested).isFile() ? requested : path34.join(webRoot, "index.html");
|
|
13461
13786
|
if (!existsSync7(target)) {
|
|
13462
13787
|
res.writeHead(404).end("not found");
|
|
13463
13788
|
return;
|
|
@@ -13483,7 +13808,7 @@ function contentType(file) {
|
|
|
13483
13808
|
".svg": "image/svg+xml",
|
|
13484
13809
|
".woff2": "font/woff2"
|
|
13485
13810
|
};
|
|
13486
|
-
return types[
|
|
13811
|
+
return types[path34.extname(file)] ?? "application/octet-stream";
|
|
13487
13812
|
}
|
|
13488
13813
|
var PROVIDER_LABEL = {
|
|
13489
13814
|
claude: "Claude",
|
|
@@ -13518,8 +13843,8 @@ function antigravitySummary(record, provider = "antigravity") {
|
|
|
13518
13843
|
}
|
|
13519
13844
|
|
|
13520
13845
|
// dist/ccv.js
|
|
13521
|
-
var HERE =
|
|
13522
|
-
var PACKAGE_ROOT =
|
|
13846
|
+
var HERE = path35.dirname(fileURLToPath(import.meta.url));
|
|
13847
|
+
var PACKAGE_ROOT = path35.resolve(HERE, "..");
|
|
13523
13848
|
var USAGE = `ccv \u2014 Claude Code Visual: \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0445\u043E\u0441\u0442 Claude Code \u0441 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043E\u043C \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.
|
|
13524
13849
|
|
|
13525
13850
|
\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
|
|
@@ -13586,7 +13911,7 @@ var server = new HostServer({
|
|
|
13586
13911
|
dataDir: defaults.dataDir,
|
|
13587
13912
|
// UI лежит в пакете рядом с бандлом — это и есть разница между установленной
|
|
13588
13913
|
// утилитой и запуском из репозитория, где сборка живёт в `apps/web/dist`.
|
|
13589
|
-
webRoot: process.env.CCV_WEB_ROOT ??
|
|
13914
|
+
webRoot: process.env.CCV_WEB_ROOT ?? path35.join(PACKAGE_ROOT, "web"),
|
|
13590
13915
|
version,
|
|
13591
13916
|
relayUrl: defaults.relayUrl
|
|
13592
13917
|
});
|
|
@@ -13615,7 +13940,7 @@ for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
|
13615
13940
|
}
|
|
13616
13941
|
async function packageVersion() {
|
|
13617
13942
|
try {
|
|
13618
|
-
const text = await
|
|
13943
|
+
const text = await readFile22(path35.join(PACKAGE_ROOT, "package.json"), "utf8");
|
|
13619
13944
|
return JSON.parse(text).version ?? "0.0.0";
|
|
13620
13945
|
} catch {
|
|
13621
13946
|
return "0.0.0";
|