@i14ks/ccv 0.45.0 → 0.47.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/THIRD-PARTY-NOTICES.md +1688 -461
- package/bundle/ccv.mjs +1377 -216
- package/package.json +1 -1
- package/web/assets/MarkdownTextEditor-B3B8_rFw.js +60 -0
- package/web/assets/{abnfDiagram-S7VZAUFO-CNj02zRV.js → abnfDiagram-S7VZAUFO-DJLBYC4E.js} +1 -1
- package/web/assets/{architectureDiagram-YGSQEFNW-UnapXBnq.js → architectureDiagram-YGSQEFNW-CjOULv4y.js} +1 -1
- package/web/assets/{blockDiagram-APKKGZFW-By1mA1_j.js → blockDiagram-APKKGZFW-BxtAGaqL.js} +1 -1
- package/web/assets/{c4Diagram-KJ2TOQU5-DxR8Tp-K.js → c4Diagram-KJ2TOQU5-DixwjD35.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-CfcIu3Ah.js → chunk-2Q5K7J3B-D5RSYb7c.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-Ddk-Fv2Y.js → chunk-5VM5RSS4-Zw9KRmHP.js} +1 -1
- package/web/assets/{chunk-HFQBQIA3-DqPjzTQu.js → chunk-HFQBQIA3-Dz3Jqjvc.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-VUIzkY_4.js → chunk-JWPE2WC7-CYC8lXvq.js} +1 -1
- package/web/assets/{chunk-KQLB2F66-Bi85gKHH.js → chunk-KQLB2F66-BpsntY2B.js} +2 -2
- package/web/assets/{chunk-KS47KZWR-BZwBvPDM.js → chunk-KS47KZWR-CIw-CgK1.js} +1 -1
- package/web/assets/{chunk-OY52VR5R-B_DWv6kS.js → chunk-OY52VR5R-DyNxKUIK.js} +1 -1
- package/web/assets/{chunk-TU62E6Q5-BZ5M8LNU.js → chunk-TU62E6Q5-CHgxHE0R.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DcC5f1oO.js → chunk-XXDRQBXY-CQ0zLLMg.js} +1 -1
- package/web/assets/{classDiagram-v2-L25IHNXF-CiZfI5zH.js → classDiagram-v2-L25IHNXF-DyN77x6F.js} +1 -1
- package/web/assets/codemirror-Dh-4cMdO.js +1 -0
- package/web/assets/codemirrorImages-BHHbVBQN.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-OecldNrx.js → cose-bilkent-JH36ORCC-D1H3X9ot.js} +1 -1
- package/web/assets/{cynefin-EF2NZ3EQ-BHDQXZEc.js → cynefin-EF2NZ3EQ-B4SsJI8I.js} +1 -1
- package/web/assets/{cynefinDiagram-L36ESFBY-COnZzGKx.js → cynefinDiagram-L36ESFBY-D543PDJ4.js} +1 -1
- package/web/assets/{dagre-SPEB5RXH-XxNubJTv.js → dagre-SPEB5RXH-CksMpjx8.js} +1 -1
- package/web/assets/{diagram-3B7GL73J-BEpsszbY.js → diagram-3B7GL73J-DywKf_aW.js} +1 -1
- package/web/assets/{diagram-DNEMPZML-DAKChpAZ.js → diagram-DNEMPZML-QaEKUl5W.js} +1 -1
- package/web/assets/{diagram-L3MUGCDN-CvDcHjXy.js → diagram-L3MUGCDN-51y_ny8R.js} +1 -1
- package/web/assets/{diagram-LA4NIPWU-BO-n7J3S.js → diagram-LA4NIPWU-Cg_nbBL_.js} +1 -1
- package/web/assets/{diagram-MHCOC4E2-BW8MchVY.js → diagram-MHCOC4E2-DFHCPZYb.js} +1 -1
- package/web/assets/{diagram-XPFHEONP-DjiEBmkx.js → diagram-XPFHEONP-dBKRRNZa.js} +1 -1
- package/web/assets/{ebnfDiagram-UZSYDL2S-DKGunvzj.js → ebnfDiagram-UZSYDL2S-BwTgNIAm.js} +1 -1
- package/web/assets/{elk-XV6XMXQE-b9lmTG03.js → elk-XV6XMXQE-BR-xb3ob.js} +1 -1
- package/web/assets/{erDiagram-EYBAPDEH-DT_k1OGC.js → erDiagram-EYBAPDEH-BB1wg_fV.js} +1 -1
- package/web/assets/{flowDiagram-MALGAFMO-BUqGlWOn.js → flowDiagram-MALGAFMO-CRDw4nX3.js} +1 -1
- package/web/assets/{ganttDiagram-23REXITY-Cbr_kL7O.js → ganttDiagram-23REXITY-MYQEYJ-I.js} +1 -1
- package/web/assets/{gitGraphDiagram-STJD7YCW-Cw6S4Bcr.js → gitGraphDiagram-STJD7YCW-Dhn0_pRI.js} +1 -1
- package/web/assets/{index-Cl3pbMFT.js → index-7ivf0ID5.js} +1 -1
- package/web/assets/index-BJHr8-zK.js +1 -0
- package/web/assets/{index-BLmLDrEY.js → index-BJdwUs7I.js} +1 -1
- package/web/assets/index-BK9FAkRg.js +1 -0
- package/web/assets/index-BLLxsupM.js +13 -0
- package/web/assets/{index-DQnArn0a.js → index-Bod45-bM.js} +2 -2
- package/web/assets/index-C13EW7hw.js +3 -0
- package/web/assets/index-CE1Pd4z7.js +7 -0
- package/web/assets/{index-Du5Qar1T.js → index-CaL1Ugw4.js} +1 -1
- package/web/assets/index-Cbs1XkJa.js +1 -0
- package/web/assets/index-DIouQVG8.js +1 -0
- package/web/assets/index-DRJgyVu5.js +1 -0
- package/web/assets/index-DaBTH0ea.js +1 -0
- package/web/assets/{index-DvFMS_gT.js → index-DlMbLAnE.js} +4 -4
- package/web/assets/index-DqLAItfN.js +1 -0
- package/web/assets/index-DqxhStF7.js +1 -0
- package/web/assets/index-DtR2v4RD.js +1 -0
- package/web/assets/{index-dkD_YPIB.js → index-DtwnaAnT.js} +2 -2
- package/web/assets/index-PAORgBv5.js +7 -0
- package/web/assets/index-Vcq4gwWv.js +1 -0
- package/web/assets/index-eIS20v-m.css +1 -0
- package/web/assets/index-gy3hTMSD.js +167 -0
- package/web/assets/index-v-BrSiuM.js +1 -0
- package/web/assets/{infoDiagram-KBXO4MBG-CusT957H.js → infoDiagram-KBXO4MBG-By-j1Q2z.js} +1 -1
- package/web/assets/{ishikawaDiagram-M35NCXHK-DlxUISb3.js → ishikawaDiagram-M35NCXHK-Cj7pfKCW.js} +1 -1
- package/web/assets/{journeyDiagram-OPLOXDXO-B7X0y02x.js → journeyDiagram-OPLOXDXO-B7acuJLi.js} +1 -1
- package/web/assets/{kanban-definition-BZKZHSQY-DzEKGEDz.js → kanban-definition-BZKZHSQY-B0N1FM8N.js} +1 -1
- package/web/assets/{mermaid.core-BM9CG8VU.js → mermaid.core-Rt-JZroF.js} +5 -5
- package/web/assets/{mindmap-definition-I2QAS2VK-DgE3KgdI.js → mindmap-definition-I2QAS2VK-Du6Bq1D4.js} +1 -1
- package/web/assets/{pegDiagram-FD4XPPHP-2wTO2ZJT.js → pegDiagram-FD4XPPHP-Cx3y_VAW.js} +1 -1
- package/web/assets/{pieDiagram-J4AKIIQI-CKRDBux_.js → pieDiagram-J4AKIIQI-DrpfcCiI.js} +1 -1
- package/web/assets/{quadrantDiagram-XTYBLID2-Ceg_KG7b.js → quadrantDiagram-XTYBLID2-BbJ2d8x8.js} +1 -1
- package/web/assets/{railroadDiagram-MRQ6NCDL-DkyGV8eQ.js → railroadDiagram-MRQ6NCDL-C8B9eHMq.js} +1 -1
- package/web/assets/{requirementDiagram-Y7LWUY3S-DEpWnvQ5.js → requirementDiagram-Y7LWUY3S--8FcyGsP.js} +1 -1
- package/web/assets/{sankeyDiagram-WGJFYUXA-D06-ObVT.js → sankeyDiagram-WGJFYUXA-CYq-mQmD.js} +1 -1
- package/web/assets/{sequenceDiagram-5NDRBG5M-CNgwRsPl.js → sequenceDiagram-5NDRBG5M-C-Llg4wI.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-DLPIeXe1.js → sizeCapture-INFHLROL-80lnJyWe.js} +1 -1
- package/web/assets/{stateDiagram-v2-FJ4FJNEA-CjTQ5dpG.js → stateDiagram-v2-FJ4FJNEA-QZyfUycB.js} +1 -1
- package/web/assets/{swimlanes-UMQ2AFYF-eJkqG_t9.js → swimlanes-UMQ2AFYF-BxT8Ql8H.js} +1 -1
- package/web/assets/swimlanesDiagram-OMPLPG4O-BZDLC88s.js +8 -0
- package/web/assets/{timeline-definition-SEUHKTQE-CUTdCFpH.js → timeline-definition-SEUHKTQE-DWywP4r0.js} +4 -4
- package/web/assets/{usecaseDiagram-AFA6YXN4-BHojL49I.js → usecaseDiagram-AFA6YXN4-BgmSQD90.js} +1 -1
- package/web/assets/{vennDiagram-NNMJR3RB-Bk5isaer.js → vennDiagram-NNMJR3RB-B9ikZp8F.js} +1 -1
- package/web/assets/{wardleyDiagram-S7YFUSEH-DolRO_uR.js → wardleyDiagram-S7YFUSEH-CptNVfVi.js} +1 -1
- package/web/assets/{xychartDiagram-GGNKY7IX-V3IUgdp-.js → xychartDiagram-GGNKY7IX-DV4TDhUT.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/codemirror-B_zWrnLp.js +0 -1
- package/web/assets/index-B1IBfUz9.css +0 -1
- package/web/assets/index-B5vdEupB.js +0 -1
- package/web/assets/index-BO8effSp.js +0 -1
- package/web/assets/index-BYJrmc8N.js +0 -1
- package/web/assets/index-B_SP1UWv.js +0 -1
- package/web/assets/index-BdwT0-rx.js +0 -152
- package/web/assets/index-BoggcMUx.js +0 -7
- package/web/assets/index-COYbUhJ2.js +0 -7
- package/web/assets/index-CfWAy0wv.js +0 -1
- package/web/assets/index-Ch08lakn.js +0 -1
- package/web/assets/index-CnRY1mXR.js +0 -1
- package/web/assets/index-Ctc6whsQ.js +0 -1
- package/web/assets/index-D7DCXKEo.js +0 -13
- package/web/assets/index-DnFYUU1x.js +0 -3
- package/web/assets/index-HQJZpoPE.js +0 -1
- package/web/assets/index-qkpXZNl3.js +0 -1
- package/web/assets/swimlanesDiagram-OMPLPG4O-D-nejod0.js +0 -8
package/bundle/ccv.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// dist/ccv.js
|
|
4
|
-
import { spawn as
|
|
5
|
-
import { readFile as
|
|
6
|
-
import
|
|
4
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
5
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
6
|
+
import path36 from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
|
|
@@ -145,9 +145,9 @@ function envDefaults() {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// ../host/dist/server.js
|
|
148
|
-
import { createServer } from "node:http";
|
|
148
|
+
import { createServer as createServer3 } from "node:http";
|
|
149
149
|
import { createReadStream as createReadStream2, existsSync as existsSync7, statSync as statSync3 } from "node:fs";
|
|
150
|
-
import
|
|
150
|
+
import path35 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";
|
|
@@ -461,7 +461,7 @@ async function exists(file) {
|
|
|
461
461
|
return lstat(file).then(() => true, () => false);
|
|
462
462
|
}
|
|
463
463
|
async function isRealEntry(file) {
|
|
464
|
-
return lstat(file).then((
|
|
464
|
+
return lstat(file).then((stat7) => !stat7.isSymbolicLink(), () => false);
|
|
465
465
|
}
|
|
466
466
|
async function candidateConfigDirs() {
|
|
467
467
|
const home = homedir2();
|
|
@@ -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 path37 of paths) {
|
|
790
|
+
const id = workspaceIdFromPath(path37);
|
|
791
|
+
for (const legacy of formerWorkspaceIdsFromPath(path37)) {
|
|
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: path37 });
|
|
795
795
|
byLegacy.set(legacy, group);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
@@ -966,6 +966,7 @@ var MEDIA_MIME = {
|
|
|
966
966
|
".mov": "video/quicktime",
|
|
967
967
|
".m4v": "video/mp4"
|
|
968
968
|
};
|
|
969
|
+
var MAX_BINARY_WRITE = 20 * 1024 * 1024;
|
|
969
970
|
var SNIFF = 8192;
|
|
970
971
|
var HIDDEN = /* @__PURE__ */ new Set([".git"]);
|
|
971
972
|
var SEARCH_SKIP = /* @__PURE__ */ new Set([...HIDDEN, "node_modules"]);
|
|
@@ -1255,6 +1256,20 @@ var ProjectFiles = class {
|
|
|
1255
1256
|
const saved = await stat3(file);
|
|
1256
1257
|
return { mtime: Math.round(saved.mtimeMs), size: saved.size };
|
|
1257
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Записать новый двоичный файл — картинку, вставленную в .md из буфера.
|
|
1261
|
+
* Только создание: существующий файл не трогаем, имя выбирает окно с
|
|
1262
|
+
* отметкой времени, и совпадение значит ошибку, а не повод затереть.
|
|
1263
|
+
*/
|
|
1264
|
+
async writeBinary(relative, bytes) {
|
|
1265
|
+
if (bytes.length > MAX_BINARY_WRITE)
|
|
1266
|
+
throw new Error("\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0430\u044F (\u0431\u043E\u043B\u044C\u0448\u0435 20 \u041C\u0411)");
|
|
1267
|
+
const target = await this.#resolve(relative);
|
|
1268
|
+
await mkdir2(path7.dirname(target), { recursive: true });
|
|
1269
|
+
await writeFile2(target, bytes, { flag: "wx" });
|
|
1270
|
+
const saved = await stat3(target);
|
|
1271
|
+
return { mtime: Math.round(saved.mtimeMs), size: saved.size };
|
|
1272
|
+
}
|
|
1258
1273
|
async create(relative, kind) {
|
|
1259
1274
|
const target = await this.#resolve(relative);
|
|
1260
1275
|
if (await exists2(target))
|
|
@@ -1958,7 +1973,7 @@ function clipInput(input) {
|
|
|
1958
1973
|
|
|
1959
1974
|
// ../host/dist/session.js
|
|
1960
1975
|
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.";
|
|
1976
|
+
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
1977
|
if (!cwd)
|
|
1963
1978
|
return markdown;
|
|
1964
1979
|
return markdown + `
|
|
@@ -2071,6 +2086,12 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2071
2086
|
cwd;
|
|
2072
2087
|
journal = new Journal();
|
|
2073
2088
|
#query = null;
|
|
2089
|
+
/**
|
|
2090
|
+
* Сколько раз поднимали процесс CLI. Вход в MCP-сервер живёт внутри
|
|
2091
|
+
* процесса (локальный колбэк слушает он же), и по смене поколения хост
|
|
2092
|
+
* узнаёт, что вход оборвался вместе с процессом.
|
|
2093
|
+
*/
|
|
2094
|
+
#generation = 0;
|
|
2074
2095
|
/**
|
|
2075
2096
|
* Разговор, который был до нас, — прочитанный транскрипт продолженной сессии.
|
|
2076
2097
|
*
|
|
@@ -2297,10 +2318,18 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2297
2318
|
get claudeSessionId() {
|
|
2298
2319
|
return this.#claudeSessionId;
|
|
2299
2320
|
}
|
|
2321
|
+
/** `id` — временный UUID, а не дисковый id продолженного разговора. */
|
|
2322
|
+
get hasTemporaryId() {
|
|
2323
|
+
return !this.#options.resume || this.#options.fork === true;
|
|
2324
|
+
}
|
|
2300
2325
|
get accountId() {
|
|
2301
2326
|
return this.#options.accountId ?? MAIN_ACCOUNT_ID;
|
|
2302
2327
|
}
|
|
2303
2328
|
/** Каталог конфигурации аккаунта сессии; null — унаследованный хостом. */
|
|
2329
|
+
/** Номер текущего процесса CLI; растёт с каждым перезапуском. */
|
|
2330
|
+
get generation() {
|
|
2331
|
+
return this.#generation;
|
|
2332
|
+
}
|
|
2304
2333
|
get configDir() {
|
|
2305
2334
|
return this.#options.configDir ?? null;
|
|
2306
2335
|
}
|
|
@@ -2458,6 +2487,7 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
2458
2487
|
this.#resetTasks();
|
|
2459
2488
|
const q = query2({ prompt: this.#inbox, options: options2 });
|
|
2460
2489
|
this.#query = q;
|
|
2490
|
+
this.#generation += 1;
|
|
2461
2491
|
void this.#consume(q);
|
|
2462
2492
|
if (restarted)
|
|
2463
2493
|
void this.#resume(q);
|
|
@@ -3173,9 +3203,7 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
3173
3203
|
* локальный колбэк, единственный, что работает без своего домена.
|
|
3174
3204
|
*/
|
|
3175
3205
|
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;
|
|
3206
|
+
const q = await this.#ensureQuery();
|
|
3179
3207
|
if (typeof q.mcpAuthenticate !== "function") {
|
|
3180
3208
|
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
3209
|
}
|
|
@@ -3186,6 +3214,36 @@ var ClaudeSession = class extends EventEmitter2 {
|
|
|
3186
3214
|
callbackExpected: response.callbackExpected === true
|
|
3187
3215
|
};
|
|
3188
3216
|
}
|
|
3217
|
+
/**
|
|
3218
|
+
* Процесс CLI, готовый отвечать на управляющие вызовы.
|
|
3219
|
+
*
|
|
3220
|
+
* Если процесса нет (обрыв, VPN, кончились попытки переподключения), его
|
|
3221
|
+
* поднимают ради входа, а не отвечают «сессия ещё не запущена»: человеку
|
|
3222
|
+
* нужен вход, а не первый промпт ради него.
|
|
3223
|
+
*/
|
|
3224
|
+
async #ensureQuery() {
|
|
3225
|
+
if (this.#closing)
|
|
3226
|
+
throw new Error("\u0421\u0435\u0441\u0441\u0438\u044F \u0437\u0430\u043A\u0440\u044B\u0442\u0430");
|
|
3227
|
+
if (!this.#query) {
|
|
3228
|
+
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");
|
|
3229
|
+
if (!this.#query) {
|
|
3230
|
+
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");
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
const q = this.#query;
|
|
3234
|
+
let timer;
|
|
3235
|
+
const ready = await Promise.race([
|
|
3236
|
+
q.initializationResult().then(() => true, () => false),
|
|
3237
|
+
new Promise((resolve) => {
|
|
3238
|
+
timer = setTimeout(() => resolve(false), RESUME_TIMEOUT_MS);
|
|
3239
|
+
timer.unref?.();
|
|
3240
|
+
})
|
|
3241
|
+
]);
|
|
3242
|
+
clearTimeout(timer);
|
|
3243
|
+
if (!ready || q !== this.#query)
|
|
3244
|
+
throw new Error("\u041F\u0440\u043E\u0446\u0435\u0441\u0441 Claude \u043D\u0435 \u043E\u0442\u043E\u0437\u0432\u0430\u043B\u0441\u044F");
|
|
3245
|
+
return q;
|
|
3246
|
+
}
|
|
3189
3247
|
/**
|
|
3190
3248
|
* Отдать CLI адрес редиректа, вставленный руками, — когда браузер не на этой
|
|
3191
3249
|
* машине и до `localhost` хоста не достучался. Резолвится после входа.
|
|
@@ -7035,9 +7093,9 @@ function parsePatch(raw) {
|
|
|
7035
7093
|
body = "";
|
|
7036
7094
|
}
|
|
7037
7095
|
total += body.length;
|
|
7038
|
-
const
|
|
7096
|
+
const path37 = status === "deleted" ? oldPath : newPath || oldPath;
|
|
7039
7097
|
files.push({
|
|
7040
|
-
path:
|
|
7098
|
+
path: path37,
|
|
7041
7099
|
oldPath: status === "renamed" ? oldPath : "",
|
|
7042
7100
|
status,
|
|
7043
7101
|
added: count(body, "+"),
|
|
@@ -7049,10 +7107,10 @@ function parsePatch(raw) {
|
|
|
7049
7107
|
return { files, truncated };
|
|
7050
7108
|
}
|
|
7051
7109
|
function stripPrefix(value) {
|
|
7052
|
-
const
|
|
7053
|
-
if (
|
|
7110
|
+
const path37 = unquote(value.trim());
|
|
7111
|
+
if (path37 === "/dev/null")
|
|
7054
7112
|
return "";
|
|
7055
|
-
return
|
|
7113
|
+
return path37.replace(/^[ab]\//, "");
|
|
7056
7114
|
}
|
|
7057
7115
|
function count(body, mark) {
|
|
7058
7116
|
let n = 0;
|
|
@@ -7370,18 +7428,18 @@ var MemoryFiles = class {
|
|
|
7370
7428
|
const files = [];
|
|
7371
7429
|
for (const entry of await this.#entries()) {
|
|
7372
7430
|
const info = await stat4(entry.path).catch(() => null);
|
|
7373
|
-
const
|
|
7374
|
-
if (!
|
|
7431
|
+
const exists5 = Boolean(info?.isFile());
|
|
7432
|
+
if (!exists5 && !entry.creatable)
|
|
7375
7433
|
continue;
|
|
7376
7434
|
files.push({
|
|
7377
7435
|
id: entry.id,
|
|
7378
7436
|
scope: entry.scope,
|
|
7379
7437
|
label: entry.label,
|
|
7380
7438
|
path: entry.path,
|
|
7381
|
-
exists:
|
|
7382
|
-
size:
|
|
7383
|
-
mtime:
|
|
7384
|
-
deletable: entry.deletable &&
|
|
7439
|
+
exists: exists5,
|
|
7440
|
+
size: exists5 ? info.size : 0,
|
|
7441
|
+
mtime: exists5 ? Math.round(info.mtimeMs) : 0,
|
|
7442
|
+
deletable: entry.deletable && exists5
|
|
7385
7443
|
});
|
|
7386
7444
|
}
|
|
7387
7445
|
return files;
|
|
@@ -8197,19 +8255,761 @@ function isUnder(parent, child) {
|
|
|
8197
8255
|
return c === p || c.startsWith(`${p}${path20.sep}`.toLowerCase()) || c.startsWith(`${p}/`);
|
|
8198
8256
|
}
|
|
8199
8257
|
|
|
8200
|
-
// ../host/dist/
|
|
8201
|
-
import {
|
|
8258
|
+
// ../host/dist/site-proxy.js
|
|
8259
|
+
import { createServer, request as httpRequest } from "node:http";
|
|
8260
|
+
import { request as httpsRequest } from "node:https";
|
|
8261
|
+
import { connect as netConnect } from "node:net";
|
|
8262
|
+
import { connect as tlsConnect } from "node:tls";
|
|
8263
|
+
import { gunzipSync, brotliDecompressSync, inflateSync } from "node:zlib";
|
|
8264
|
+
|
|
8265
|
+
// ../host/dist/site-annotate-script.js
|
|
8266
|
+
var ANNOTATE_SCRIPT_PATH = "/__ccv/annotate.js";
|
|
8267
|
+
var ANNOTATE_SCRIPT = String.raw`(function () {
|
|
8268
|
+
if (window.__ccvAnnotate) return;
|
|
8269
|
+
window.__ccvAnnotate = true;
|
|
8270
|
+
var me = document.currentScript;
|
|
8271
|
+
var origin = (me && me.getAttribute('data-ccv-origin')) || '';
|
|
8272
|
+
var proxyOrigin = location.origin;
|
|
8273
|
+
var parentWin = window.parent;
|
|
8274
|
+
if (!parentWin || parentWin === window) return;
|
|
8275
|
+
|
|
8276
|
+
function realUrl() {
|
|
8277
|
+
var href = location.href;
|
|
8278
|
+
return origin && href.indexOf(proxyOrigin) === 0 ? origin + href.slice(proxyOrigin.length) : href;
|
|
8279
|
+
}
|
|
8280
|
+
function post(message) {
|
|
8281
|
+
message.source = 'ccv-site';
|
|
8282
|
+
try { parentWin.postMessage(message, '*'); } catch (e) {}
|
|
8283
|
+
}
|
|
8284
|
+
|
|
8285
|
+
var pick = false;
|
|
8286
|
+
var box = null;
|
|
8287
|
+
var label = null;
|
|
8288
|
+
var marksLayer = null;
|
|
8289
|
+
var marks = [];
|
|
8290
|
+
|
|
8291
|
+
function ensureUi() {
|
|
8292
|
+
if (box) return;
|
|
8293
|
+
box = document.createElement('div');
|
|
8294
|
+
box.setAttribute('data-ccv-ui', '');
|
|
8295
|
+
box.style.cssText = 'position:fixed;pointer-events:none;z-index:2147483646;border:2px solid #d97757;background:rgba(217,119,87,.12);border-radius:3px;display:none;transition:all .05s linear';
|
|
8296
|
+
label = document.createElement('div');
|
|
8297
|
+
label.setAttribute('data-ccv-ui', '');
|
|
8298
|
+
label.style.cssText = 'position:fixed;pointer-events:none;z-index:2147483647;background:#1f1e1d;color:#faf9f5;font:500 11px/1.4 ui-monospace,Menlo,Consolas,monospace;padding:2px 6px;border-radius:4px;display:none;max-width:60vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis';
|
|
8299
|
+
marksLayer = document.createElement('div');
|
|
8300
|
+
marksLayer.setAttribute('data-ccv-ui', '');
|
|
8301
|
+
marksLayer.style.cssText = 'position:fixed;inset:0;pointer-events:none;z-index:2147483645';
|
|
8302
|
+
(document.body || document.documentElement).appendChild(marksLayer);
|
|
8303
|
+
(document.body || document.documentElement).appendChild(box);
|
|
8304
|
+
(document.body || document.documentElement).appendChild(label);
|
|
8305
|
+
}
|
|
8306
|
+
|
|
8307
|
+
function isUi(el) {
|
|
8308
|
+
return !!(el && el.closest && el.closest('[data-ccv-ui]'));
|
|
8309
|
+
}
|
|
8310
|
+
|
|
8311
|
+
function cssEscape(value) {
|
|
8312
|
+
if (window.CSS && CSS.escape) return CSS.escape(value);
|
|
8313
|
+
return String(value).replace(/[^a-zA-Z0-9_-]/g, function (c) { return '\\' + c; });
|
|
8314
|
+
}
|
|
8315
|
+
|
|
8316
|
+
function selectorOf(el) {
|
|
8317
|
+
if (!(el instanceof Element)) return '';
|
|
8318
|
+
var parts = [];
|
|
8319
|
+
var node = el;
|
|
8320
|
+
while (node && node.nodeType === 1 && node !== document.documentElement && parts.length < 6) {
|
|
8321
|
+
if (node.id && !/\d{3,}/.test(node.id)) {
|
|
8322
|
+
parts.unshift('#' + cssEscape(node.id));
|
|
8323
|
+
break;
|
|
8324
|
+
}
|
|
8325
|
+
var part = node.tagName.toLowerCase();
|
|
8326
|
+
var classes = Array.prototype.filter.call(node.classList, function (c) {
|
|
8327
|
+
return c.length < 32 && !/^(css|sc|jsx|svelte)-|[0-9a-f]{6,}|:/.test(c);
|
|
8328
|
+
}).slice(0, 2);
|
|
8329
|
+
if (classes.length) part += '.' + classes.map(cssEscape).join('.');
|
|
8330
|
+
var parent = node.parentElement;
|
|
8331
|
+
if (parent) {
|
|
8332
|
+
var same = Array.prototype.filter.call(parent.children, function (c) {
|
|
8333
|
+
return c.tagName === node.tagName;
|
|
8334
|
+
});
|
|
8335
|
+
if (same.length > 1) part += ':nth-of-type(' + (same.indexOf(node) + 1) + ')';
|
|
8336
|
+
}
|
|
8337
|
+
parts.unshift(part);
|
|
8338
|
+
node = parent;
|
|
8339
|
+
}
|
|
8340
|
+
return parts.join(' > ');
|
|
8341
|
+
}
|
|
8342
|
+
|
|
8343
|
+
/** Где элемент в исходниках: dev-сборка React кладёт это в fiber, плагины-инспекторы — в атрибуты. */
|
|
8344
|
+
function sourceOf(el) {
|
|
8345
|
+
var node = el;
|
|
8346
|
+
for (var depth = 0; node && depth < 8; depth++, node = node.parentElement) {
|
|
8347
|
+
var attr = node.getAttribute && (node.getAttribute('data-source') || node.getAttribute('data-inspector-relative-path') || node.getAttribute('data-locatorjs-id'));
|
|
8348
|
+
if (attr) {
|
|
8349
|
+
var line = node.getAttribute('data-inspector-line');
|
|
8350
|
+
return { file: attr + (line ? ':' + line : '') };
|
|
8351
|
+
}
|
|
8352
|
+
for (var key in node) {
|
|
8353
|
+
if (key.indexOf('__reactFiber$') !== 0 && key.indexOf('__reactInternalInstance$') !== 0) continue;
|
|
8354
|
+
var fiber = node[key];
|
|
8355
|
+
for (var hop = 0; fiber && hop < 12; hop++, fiber = fiber.return) {
|
|
8356
|
+
var src = fiber._debugSource;
|
|
8357
|
+
if (src && src.fileName) {
|
|
8358
|
+
var type = fiber.type;
|
|
8359
|
+
var name = type && (type.displayName || type.name);
|
|
8360
|
+
return { file: src.fileName + ':' + src.lineNumber, component: typeof name === 'string' ? name : undefined };
|
|
8361
|
+
}
|
|
8362
|
+
}
|
|
8363
|
+
break;
|
|
8364
|
+
}
|
|
8365
|
+
}
|
|
8366
|
+
return null;
|
|
8367
|
+
}
|
|
8368
|
+
|
|
8369
|
+
function describe(el) {
|
|
8370
|
+
var rect = el.getBoundingClientRect();
|
|
8371
|
+
var text = (el.innerText || el.textContent || '').replace(/\s+/g, ' ').trim();
|
|
8372
|
+
var html = el.outerHTML || '';
|
|
8373
|
+
var style = getComputedStyle(el);
|
|
8374
|
+
return {
|
|
8375
|
+
selector: selectorOf(el),
|
|
8376
|
+
tag: el.tagName.toLowerCase(),
|
|
8377
|
+
id: el.id || undefined,
|
|
8378
|
+
classes: Array.prototype.slice.call(el.classList, 0, 8),
|
|
8379
|
+
text: text.length > 160 ? text.slice(0, 157) + '…' : text,
|
|
8380
|
+
html: html.length > 500 ? html.slice(0, 497) + '…' : html,
|
|
8381
|
+
rect: { x: Math.round(rect.left), y: Math.round(rect.top), width: Math.round(rect.width), height: Math.round(rect.height) },
|
|
8382
|
+
viewport: { width: window.innerWidth, height: window.innerHeight },
|
|
8383
|
+
styles: { color: style.color, background: style.backgroundColor, font: style.fontSize + ' ' + style.fontWeight + ' ' + style.fontFamily.split(',')[0] },
|
|
8384
|
+
source: sourceOf(el) || undefined,
|
|
8385
|
+
url: realUrl()
|
|
8386
|
+
};
|
|
8387
|
+
}
|
|
8388
|
+
|
|
8389
|
+
function show(el) {
|
|
8390
|
+
ensureUi();
|
|
8391
|
+
if (!el || isUi(el)) { box.style.display = 'none'; label.style.display = 'none'; return; }
|
|
8392
|
+
var r = el.getBoundingClientRect();
|
|
8393
|
+
box.style.display = 'block';
|
|
8394
|
+
box.style.left = r.left + 'px'; box.style.top = r.top + 'px';
|
|
8395
|
+
box.style.width = r.width + 'px'; box.style.height = r.height + 'px';
|
|
8396
|
+
var name = el.tagName.toLowerCase() + (el.id ? '#' + el.id : '') + (el.classList.length ? '.' + Array.prototype.slice.call(el.classList, 0, 2).join('.') : '');
|
|
8397
|
+
label.textContent = name + ' ' + Math.round(r.width) + '×' + Math.round(r.height);
|
|
8398
|
+
label.style.display = 'block';
|
|
8399
|
+
label.style.left = Math.max(4, r.left) + 'px';
|
|
8400
|
+
label.style.top = (r.top > 24 ? r.top - 22 : r.bottom + 4) + 'px';
|
|
8401
|
+
}
|
|
8402
|
+
|
|
8403
|
+
function drawMarks() {
|
|
8404
|
+
ensureUi();
|
|
8405
|
+
marksLayer.innerHTML = '';
|
|
8406
|
+
marks.forEach(function (mark) {
|
|
8407
|
+
var el;
|
|
8408
|
+
try { el = document.querySelector(mark.selector); } catch (e) { el = null; }
|
|
8409
|
+
if (!el) return;
|
|
8410
|
+
var r = el.getBoundingClientRect();
|
|
8411
|
+
if (r.bottom < 0 || r.top > innerHeight) return;
|
|
8412
|
+
var dot = document.createElement('div');
|
|
8413
|
+
dot.textContent = String(mark.n);
|
|
8414
|
+
dot.style.cssText = 'position:fixed;min-width:20px;height:20px;padding:0 5px;box-sizing:border-box;border-radius:10px;background:#d97757;color:#fff;font:600 11px/20px system-ui,sans-serif;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.35);left:' + Math.max(2, r.left - 8) + 'px;top:' + Math.max(2, r.top - 8) + 'px';
|
|
8415
|
+
var outline = document.createElement('div');
|
|
8416
|
+
outline.style.cssText = 'position:fixed;border:1.5px dashed rgba(217,119,87,.8);border-radius:3px;left:' + r.left + 'px;top:' + r.top + 'px;width:' + r.width + 'px;height:' + r.height + 'px';
|
|
8417
|
+
marksLayer.appendChild(outline);
|
|
8418
|
+
marksLayer.appendChild(dot);
|
|
8419
|
+
});
|
|
8420
|
+
}
|
|
8421
|
+
|
|
8422
|
+
var raf = 0;
|
|
8423
|
+
function redrawSoon() {
|
|
8424
|
+
if (raf) return;
|
|
8425
|
+
raf = requestAnimationFrame(function () { raf = 0; drawMarks(); });
|
|
8426
|
+
}
|
|
8427
|
+
addEventListener('scroll', redrawSoon, true);
|
|
8428
|
+
addEventListener('resize', redrawSoon);
|
|
8429
|
+
|
|
8430
|
+
document.addEventListener('mousemove', function (e) {
|
|
8431
|
+
if (!pick) return;
|
|
8432
|
+
show(document.elementFromPoint(e.clientX, e.clientY));
|
|
8433
|
+
}, true);
|
|
8434
|
+
|
|
8435
|
+
function swallow(e) {
|
|
8436
|
+
if (!pick || isUi(e.target)) return;
|
|
8437
|
+
e.preventDefault();
|
|
8438
|
+
e.stopPropagation();
|
|
8439
|
+
e.stopImmediatePropagation();
|
|
8440
|
+
}
|
|
8441
|
+
['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'dblclick', 'contextmenu', 'submit'].forEach(function (type) {
|
|
8442
|
+
document.addEventListener(type, swallow, true);
|
|
8443
|
+
});
|
|
8444
|
+
document.addEventListener('click', function (e) {
|
|
8445
|
+
if (!pick || isUi(e.target)) return;
|
|
8446
|
+
swallow(e);
|
|
8447
|
+
var el = document.elementFromPoint(e.clientX, e.clientY);
|
|
8448
|
+
if (!el || isUi(el)) return;
|
|
8449
|
+
post({ type: 'picked', element: describe(el) });
|
|
8450
|
+
}, true);
|
|
8451
|
+
document.addEventListener('keydown', function (e) {
|
|
8452
|
+
if (pick && e.key === 'Escape') { e.preventDefault(); post({ type: 'cancel' }); }
|
|
8453
|
+
}, true);
|
|
8454
|
+
|
|
8455
|
+
addEventListener('message', function (e) {
|
|
8456
|
+
var data = e.data;
|
|
8457
|
+
if (!data || data.source !== 'ccv-app') return;
|
|
8458
|
+
if (data.type === 'mode') {
|
|
8459
|
+
pick = !!data.pick;
|
|
8460
|
+
document.documentElement.style.cursor = pick ? 'crosshair' : '';
|
|
8461
|
+
if (!pick) show(null);
|
|
8462
|
+
} else if (data.type === 'marks') {
|
|
8463
|
+
marks = Array.isArray(data.marks) ? data.marks : [];
|
|
8464
|
+
drawMarks();
|
|
8465
|
+
} else if (data.type === 'flash') {
|
|
8466
|
+
var el;
|
|
8467
|
+
try { el = document.querySelector(data.selector); } catch (err) { el = null; }
|
|
8468
|
+
if (el) { el.scrollIntoView({ block: 'center', behavior: 'smooth' }); setTimeout(function () { show(el); setTimeout(function () { if (!pick) show(null); }, 1200); }, 350); }
|
|
8469
|
+
}
|
|
8470
|
+
});
|
|
8471
|
+
|
|
8472
|
+
var lastUrl = '';
|
|
8473
|
+
function report(type) {
|
|
8474
|
+
var url = realUrl();
|
|
8475
|
+
if (type === 'location' && url === lastUrl) return;
|
|
8476
|
+
lastUrl = url;
|
|
8477
|
+
post({ type: type, url: url, title: document.title });
|
|
8478
|
+
}
|
|
8479
|
+
var push = history.pushState, replace = history.replaceState;
|
|
8480
|
+
history.pushState = function () { var r = push.apply(this, arguments); report('location'); redrawSoon(); return r; };
|
|
8481
|
+
history.replaceState = function () { var r = replace.apply(this, arguments); report('location'); return r; };
|
|
8482
|
+
addEventListener('popstate', function () { report('location'); redrawSoon(); });
|
|
8483
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', function () { report('ready'); });
|
|
8484
|
+
else report('ready');
|
|
8485
|
+
new MutationObserver(function (records) {
|
|
8486
|
+
for (var i = 0; i < records.length; i++) if (!isUi(records[i].target) && records[i].target !== marksLayer) { redrawSoon(); return; }
|
|
8487
|
+
}).observe(document.documentElement, { childList: true, subtree: true });
|
|
8488
|
+
})();`;
|
|
8489
|
+
|
|
8490
|
+
// ../host/dist/site-proxy.js
|
|
8491
|
+
var DROP_RESPONSE = /* @__PURE__ */ new Set([
|
|
8492
|
+
"content-security-policy",
|
|
8493
|
+
"content-security-policy-report-only",
|
|
8494
|
+
"x-frame-options",
|
|
8495
|
+
"cross-origin-opener-policy",
|
|
8496
|
+
"cross-origin-embedder-policy",
|
|
8497
|
+
"cross-origin-resource-policy",
|
|
8498
|
+
"strict-transport-security",
|
|
8499
|
+
"alt-svc"
|
|
8500
|
+
]);
|
|
8501
|
+
var MAX_HTML = 16 * 1024 * 1024;
|
|
8502
|
+
var OriginProxy = class {
|
|
8503
|
+
origin;
|
|
8504
|
+
#target;
|
|
8505
|
+
#server;
|
|
8506
|
+
#proxyOrigin = "";
|
|
8507
|
+
#lastUsed = Date.now();
|
|
8508
|
+
constructor(origin) {
|
|
8509
|
+
this.origin = origin;
|
|
8510
|
+
this.#target = new URL(origin);
|
|
8511
|
+
this.#server = createServer((req, res) => this.#handle(req, res));
|
|
8512
|
+
this.#server.on("upgrade", (req, socket, head) => this.#upgrade(req, socket, head));
|
|
8513
|
+
this.#server.on("clientError", (_error, socket) => socket.destroy());
|
|
8514
|
+
}
|
|
8515
|
+
get proxyOrigin() {
|
|
8516
|
+
return this.#proxyOrigin;
|
|
8517
|
+
}
|
|
8518
|
+
get lastUsed() {
|
|
8519
|
+
return this.#lastUsed;
|
|
8520
|
+
}
|
|
8521
|
+
listen() {
|
|
8522
|
+
return new Promise((resolve, reject) => {
|
|
8523
|
+
this.#server.once("error", reject);
|
|
8524
|
+
this.#server.listen(0, "127.0.0.1", () => {
|
|
8525
|
+
const address = this.#server.address();
|
|
8526
|
+
this.#proxyOrigin = `http://127.0.0.1:${address.port}`;
|
|
8527
|
+
resolve();
|
|
8528
|
+
});
|
|
8529
|
+
});
|
|
8530
|
+
}
|
|
8531
|
+
close() {
|
|
8532
|
+
this.#server.close();
|
|
8533
|
+
this.#server.closeAllConnections?.();
|
|
8534
|
+
}
|
|
8535
|
+
#upstreamHeaders(headers) {
|
|
8536
|
+
const out = { ...headers };
|
|
8537
|
+
out.host = this.#target.host;
|
|
8538
|
+
out["accept-encoding"] = "gzip, deflate, br";
|
|
8539
|
+
for (const key of ["origin", "referer"]) {
|
|
8540
|
+
const value = out[key];
|
|
8541
|
+
if (typeof value === "string")
|
|
8542
|
+
out[key] = value.split(this.#proxyOrigin).join(this.origin);
|
|
8543
|
+
}
|
|
8544
|
+
return out;
|
|
8545
|
+
}
|
|
8546
|
+
#handle(req, res) {
|
|
8547
|
+
this.#lastUsed = Date.now();
|
|
8548
|
+
const url2 = req.url ?? "/";
|
|
8549
|
+
if (url2 === ANNOTATE_SCRIPT_PATH) {
|
|
8550
|
+
res.writeHead(200, {
|
|
8551
|
+
"content-type": "application/javascript; charset=utf-8",
|
|
8552
|
+
"cache-control": "no-store"
|
|
8553
|
+
});
|
|
8554
|
+
res.end(ANNOTATE_SCRIPT);
|
|
8555
|
+
return;
|
|
8556
|
+
}
|
|
8557
|
+
const send = this.#target.protocol === "https:" ? httpsRequest : httpRequest;
|
|
8558
|
+
const upstream = send({
|
|
8559
|
+
protocol: this.#target.protocol,
|
|
8560
|
+
hostname: this.#target.hostname,
|
|
8561
|
+
port: this.#target.port || void 0,
|
|
8562
|
+
method: req.method,
|
|
8563
|
+
path: url2,
|
|
8564
|
+
headers: this.#upstreamHeaders(req.headers)
|
|
8565
|
+
}, (response) => this.#respond(response, res));
|
|
8566
|
+
upstream.on("error", (error) => {
|
|
8567
|
+
if (res.headersSent) {
|
|
8568
|
+
res.destroy();
|
|
8569
|
+
return;
|
|
8570
|
+
}
|
|
8571
|
+
res.writeHead(502, { "content-type": "text/plain; charset=utf-8" });
|
|
8572
|
+
res.end(`Claude Code Visual: \u0441\u0430\u0439\u0442 ${this.origin} \u043D\u0435 \u043E\u0442\u0432\u0435\u0442\u0438\u043B \u2014 ${error.message}`);
|
|
8573
|
+
});
|
|
8574
|
+
req.pipe(upstream);
|
|
8575
|
+
}
|
|
8576
|
+
#respond(response, res) {
|
|
8577
|
+
const headers = {};
|
|
8578
|
+
for (const [key, value] of Object.entries(response.headers)) {
|
|
8579
|
+
if (value === void 0 || DROP_RESPONSE.has(key))
|
|
8580
|
+
continue;
|
|
8581
|
+
headers[key] = value;
|
|
8582
|
+
}
|
|
8583
|
+
const location = response.headers.location;
|
|
8584
|
+
if (location)
|
|
8585
|
+
headers.location = this.#rewriteUrl(location);
|
|
8586
|
+
const cookies = response.headers["set-cookie"];
|
|
8587
|
+
if (cookies)
|
|
8588
|
+
headers["set-cookie"] = cookies.map(relaxCookie);
|
|
8589
|
+
const type = String(response.headers["content-type"] ?? "");
|
|
8590
|
+
const status = response.statusCode ?? 502;
|
|
8591
|
+
if (!type.includes("text/html") || status === 204 || status === 304) {
|
|
8592
|
+
res.writeHead(status, response.statusMessage, headers);
|
|
8593
|
+
response.pipe(res);
|
|
8594
|
+
return;
|
|
8595
|
+
}
|
|
8596
|
+
const chunks = [];
|
|
8597
|
+
let size = 0;
|
|
8598
|
+
let overflow = false;
|
|
8599
|
+
response.on("data", (chunk) => {
|
|
8600
|
+
size += chunk.length;
|
|
8601
|
+
if (size > MAX_HTML)
|
|
8602
|
+
overflow = true;
|
|
8603
|
+
if (!overflow)
|
|
8604
|
+
chunks.push(chunk);
|
|
8605
|
+
});
|
|
8606
|
+
response.on("end", () => {
|
|
8607
|
+
if (overflow) {
|
|
8608
|
+
res.writeHead(502, { "content-type": "text/plain; charset=utf-8" });
|
|
8609
|
+
res.end("Claude Code Visual: \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0430\u044F \u0434\u043B\u044F \u0440\u0435\u0436\u0438\u043C\u0430 \u043F\u0440\u0430\u0432\u043E\u043A");
|
|
8610
|
+
return;
|
|
8611
|
+
}
|
|
8612
|
+
let html;
|
|
8613
|
+
try {
|
|
8614
|
+
html = decode2(Buffer.concat(chunks), String(response.headers["content-encoding"] ?? ""));
|
|
8615
|
+
} catch {
|
|
8616
|
+
res.writeHead(status, response.statusMessage, headers);
|
|
8617
|
+
res.end(Buffer.concat(chunks));
|
|
8618
|
+
return;
|
|
8619
|
+
}
|
|
8620
|
+
const body = Buffer.from(this.#inject(html), "utf8");
|
|
8621
|
+
delete headers["content-encoding"];
|
|
8622
|
+
delete headers["content-length"];
|
|
8623
|
+
delete headers["transfer-encoding"];
|
|
8624
|
+
delete headers.etag;
|
|
8625
|
+
headers["content-length"] = body.length;
|
|
8626
|
+
headers["cache-control"] = "no-store";
|
|
8627
|
+
res.writeHead(status, response.statusMessage, headers);
|
|
8628
|
+
res.end(body);
|
|
8629
|
+
});
|
|
8630
|
+
response.on("error", () => res.destroy());
|
|
8631
|
+
}
|
|
8632
|
+
/**
|
|
8633
|
+
* Скрипт выбора элементов — первым в `<head>`, и абсолютные ссылки страницы
|
|
8634
|
+
* на свой же origin — на прокси: иначе переход по такой ссылке увёл бы
|
|
8635
|
+
* iframe на настоящий сайт, где скрипта нет.
|
|
8636
|
+
*/
|
|
8637
|
+
#inject(html) {
|
|
8638
|
+
const rewritten = html.split(this.origin + "/").join(this.#proxyOrigin + "/").split(this.origin.replace(/^https?:/, "") + "/").join(this.#proxyOrigin.replace(/^http:/, "") + "/");
|
|
8639
|
+
const tag = `<script src="${ANNOTATE_SCRIPT_PATH}" data-ccv-origin="${this.origin}"></script>`;
|
|
8640
|
+
const head = /<head[^>]*>/i.exec(rewritten);
|
|
8641
|
+
if (head) {
|
|
8642
|
+
const at = head.index + head[0].length;
|
|
8643
|
+
return rewritten.slice(0, at) + tag + rewritten.slice(at);
|
|
8644
|
+
}
|
|
8645
|
+
const htmlTag = /<html[^>]*>/i.exec(rewritten);
|
|
8646
|
+
if (htmlTag) {
|
|
8647
|
+
const at = htmlTag.index + htmlTag[0].length;
|
|
8648
|
+
return rewritten.slice(0, at) + tag + rewritten.slice(at);
|
|
8649
|
+
}
|
|
8650
|
+
return tag + rewritten;
|
|
8651
|
+
}
|
|
8652
|
+
#rewriteUrl(value) {
|
|
8653
|
+
if (value.startsWith(this.origin))
|
|
8654
|
+
return this.#proxyOrigin + value.slice(this.origin.length);
|
|
8655
|
+
return value;
|
|
8656
|
+
}
|
|
8657
|
+
/** Вебсокеты (горячая перезагрузка dev-сервера) — сырым туннелем до сайта. */
|
|
8658
|
+
#upgrade(req, socket, head) {
|
|
8659
|
+
this.#lastUsed = Date.now();
|
|
8660
|
+
const secure = this.#target.protocol === "https:";
|
|
8661
|
+
const port2 = Number(this.#target.port || (secure ? 443 : 80));
|
|
8662
|
+
const upstream = secure ? tlsConnect({ host: this.#target.hostname, port: port2, servername: this.#target.hostname }) : netConnect({ host: this.#target.hostname, port: port2 });
|
|
8663
|
+
upstream.once(secure ? "secureConnect" : "connect", () => {
|
|
8664
|
+
const headers = this.#upstreamHeaders(req.headers);
|
|
8665
|
+
const lines = [`${req.method ?? "GET"} ${req.url ?? "/"} HTTP/1.1`];
|
|
8666
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
8667
|
+
if (value === void 0)
|
|
8668
|
+
continue;
|
|
8669
|
+
for (const item of Array.isArray(value) ? value : [value])
|
|
8670
|
+
lines.push(`${key}: ${item}`);
|
|
8671
|
+
}
|
|
8672
|
+
upstream.write(lines.join("\r\n") + "\r\n\r\n");
|
|
8673
|
+
if (head.length > 0)
|
|
8674
|
+
upstream.write(head);
|
|
8675
|
+
upstream.pipe(socket);
|
|
8676
|
+
socket.pipe(upstream);
|
|
8677
|
+
});
|
|
8678
|
+
const drop = () => {
|
|
8679
|
+
upstream.destroy();
|
|
8680
|
+
socket.destroy();
|
|
8681
|
+
};
|
|
8682
|
+
upstream.on("error", drop);
|
|
8683
|
+
socket.on("error", drop);
|
|
8684
|
+
}
|
|
8685
|
+
};
|
|
8686
|
+
function decode2(body, encoding) {
|
|
8687
|
+
const kind = encoding.trim().toLowerCase();
|
|
8688
|
+
if (kind === "gzip" || kind === "x-gzip")
|
|
8689
|
+
return gunzipSync(body).toString("utf8");
|
|
8690
|
+
if (kind === "br")
|
|
8691
|
+
return brotliDecompressSync(body).toString("utf8");
|
|
8692
|
+
if (kind === "deflate")
|
|
8693
|
+
return inflateSync(body).toString("utf8");
|
|
8694
|
+
return body.toString("utf8");
|
|
8695
|
+
}
|
|
8696
|
+
function relaxCookie(cookie) {
|
|
8697
|
+
return cookie.split(";").map((part) => part.trim()).filter((part) => !/^(domain|secure|partitioned)(=|$)/i.test(part)).map((part) => /^samesite=none$/i.test(part) ? "SameSite=Lax" : part).join("; ");
|
|
8698
|
+
}
|
|
8699
|
+
function normalizeSiteUrl(raw) {
|
|
8700
|
+
const text = raw.trim();
|
|
8701
|
+
if (!text)
|
|
8702
|
+
throw new Error("\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u0441\u0430\u0439\u0442\u0430");
|
|
8703
|
+
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(text) ? text : /^(localhost|127\.|0\.0\.0\.0|\[::1\]|\d+\.\d+\.\d+\.\d+)/i.test(text) ? `http://${text}` : `https://${text}`;
|
|
8704
|
+
const url2 = new URL(withScheme);
|
|
8705
|
+
if (url2.protocol !== "http:" && url2.protocol !== "https:") {
|
|
8706
|
+
throw new Error("\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0436\u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u0440\u0435\u0441 http:// \u0438\u043B\u0438 https://");
|
|
8707
|
+
}
|
|
8708
|
+
return url2;
|
|
8709
|
+
}
|
|
8710
|
+
var SiteProxies = class {
|
|
8711
|
+
#byOrigin = /* @__PURE__ */ new Map();
|
|
8712
|
+
#idleMs;
|
|
8713
|
+
#sweep = null;
|
|
8714
|
+
constructor(idleMs = 30 * 60 * 1e3) {
|
|
8715
|
+
this.#idleMs = idleMs;
|
|
8716
|
+
}
|
|
8717
|
+
/** Поднять (или взять готовый) прокси и вернуть адрес страницы через него. */
|
|
8718
|
+
async open(raw) {
|
|
8719
|
+
const url2 = normalizeSiteUrl(raw);
|
|
8720
|
+
let proxy = this.#byOrigin.get(url2.origin);
|
|
8721
|
+
if (!proxy) {
|
|
8722
|
+
proxy = new OriginProxy(url2.origin);
|
|
8723
|
+
await proxy.listen();
|
|
8724
|
+
this.#byOrigin.set(url2.origin, proxy);
|
|
8725
|
+
this.#startSweep();
|
|
8726
|
+
}
|
|
8727
|
+
return {
|
|
8728
|
+
url: url2.href,
|
|
8729
|
+
origin: url2.origin,
|
|
8730
|
+
proxyOrigin: proxy.proxyOrigin,
|
|
8731
|
+
proxyUrl: proxy.proxyOrigin + url2.pathname + url2.search + url2.hash
|
|
8732
|
+
};
|
|
8733
|
+
}
|
|
8734
|
+
closeAll() {
|
|
8735
|
+
for (const proxy of this.#byOrigin.values())
|
|
8736
|
+
proxy.close();
|
|
8737
|
+
this.#byOrigin.clear();
|
|
8738
|
+
if (this.#sweep)
|
|
8739
|
+
clearInterval(this.#sweep);
|
|
8740
|
+
this.#sweep = null;
|
|
8741
|
+
}
|
|
8742
|
+
#startSweep() {
|
|
8743
|
+
if (this.#sweep)
|
|
8744
|
+
return;
|
|
8745
|
+
this.#sweep = setInterval(() => {
|
|
8746
|
+
const now = Date.now();
|
|
8747
|
+
for (const [origin, proxy] of this.#byOrigin) {
|
|
8748
|
+
if (now - proxy.lastUsed < this.#idleMs)
|
|
8749
|
+
continue;
|
|
8750
|
+
proxy.close();
|
|
8751
|
+
this.#byOrigin.delete(origin);
|
|
8752
|
+
}
|
|
8753
|
+
if (this.#byOrigin.size === 0 && this.#sweep) {
|
|
8754
|
+
clearInterval(this.#sweep);
|
|
8755
|
+
this.#sweep = null;
|
|
8756
|
+
}
|
|
8757
|
+
}, 60 * 1e3);
|
|
8758
|
+
this.#sweep.unref();
|
|
8759
|
+
}
|
|
8760
|
+
};
|
|
8761
|
+
|
|
8762
|
+
// ../host/dist/video-studio.js
|
|
8763
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
8764
|
+
import { readdir as readdir6, readFile as readFile11, stat as stat5 } from "node:fs/promises";
|
|
8765
|
+
import { createServer as createServer2 } from "node:net";
|
|
8202
8766
|
import path21 from "node:path";
|
|
8767
|
+
var VIDEO_EXT = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov", ".m4v", ".mkv", ".ogv", ".gif"]);
|
|
8768
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", "_deps", "vendor", "third_party", ".git", ".next", ".nuxt", ".cache", ".turbo", ".venv", "__pycache__"]);
|
|
8769
|
+
var MAX_DEPTH = 8;
|
|
8770
|
+
var MAX_ENTRIES = 2e4;
|
|
8771
|
+
var MAX_ANIMATION_BYTES = 512 * 1024;
|
|
8772
|
+
var ANIMATION_HINT = /@keyframes|\bgsap\b|anime\(|\.animate\(|<canvas|lottie|three(\.module)?\.js|animation\s*:/i;
|
|
8773
|
+
var REMOTION_DEPS = ["remotion", "@remotion/cli"];
|
|
8774
|
+
var ENTRY_CANDIDATES = [
|
|
8775
|
+
"src/index.ts",
|
|
8776
|
+
"src/index.tsx",
|
|
8777
|
+
"src/index.js",
|
|
8778
|
+
"src/remotion/index.ts",
|
|
8779
|
+
"src/remotion/index.tsx",
|
|
8780
|
+
"remotion/index.ts",
|
|
8781
|
+
"remotion/index.tsx"
|
|
8782
|
+
];
|
|
8783
|
+
function toRelative(root, file) {
|
|
8784
|
+
return path21.relative(root, file).split(path21.sep).join("/");
|
|
8785
|
+
}
|
|
8786
|
+
async function exists3(file) {
|
|
8787
|
+
return stat5(file).then(() => true, () => false);
|
|
8788
|
+
}
|
|
8789
|
+
async function remotionEntry(dir, pkg) {
|
|
8790
|
+
for (const script of Object.values(pkg.scripts ?? {})) {
|
|
8791
|
+
const match = /remotion\s+(?:studio|preview|render)\s+([^\s]+\.(?:tsx?|jsx?))/.exec(script);
|
|
8792
|
+
if (match?.[1] && await exists3(path21.join(dir, match[1])))
|
|
8793
|
+
return match[1].replace(/\\/g, "/");
|
|
8794
|
+
}
|
|
8795
|
+
for (const candidate of ENTRY_CANDIDATES) {
|
|
8796
|
+
if (await exists3(path21.join(dir, candidate)))
|
|
8797
|
+
return candidate;
|
|
8798
|
+
}
|
|
8799
|
+
return null;
|
|
8800
|
+
}
|
|
8801
|
+
async function scanVideoCatalog(root) {
|
|
8802
|
+
const videos = [];
|
|
8803
|
+
const animations = [];
|
|
8804
|
+
const remotion = [];
|
|
8805
|
+
let seen = 0;
|
|
8806
|
+
let truncated = false;
|
|
8807
|
+
async function walk(dir, depth) {
|
|
8808
|
+
if (depth > MAX_DEPTH || truncated)
|
|
8809
|
+
return;
|
|
8810
|
+
let entries;
|
|
8811
|
+
try {
|
|
8812
|
+
entries = await readdir6(dir, { withFileTypes: true });
|
|
8813
|
+
} catch {
|
|
8814
|
+
return;
|
|
8815
|
+
}
|
|
8816
|
+
for (const entry of entries) {
|
|
8817
|
+
if (++seen > MAX_ENTRIES) {
|
|
8818
|
+
truncated = true;
|
|
8819
|
+
return;
|
|
8820
|
+
}
|
|
8821
|
+
const full = path21.join(dir, entry.name);
|
|
8822
|
+
if (entry.isDirectory()) {
|
|
8823
|
+
if (SKIP_DIRS.has(entry.name) || entry.name.startsWith("."))
|
|
8824
|
+
continue;
|
|
8825
|
+
await walk(full, depth + 1);
|
|
8826
|
+
continue;
|
|
8827
|
+
}
|
|
8828
|
+
if (!entry.isFile())
|
|
8829
|
+
continue;
|
|
8830
|
+
const ext = path21.extname(entry.name).toLowerCase();
|
|
8831
|
+
if (VIDEO_EXT.has(ext)) {
|
|
8832
|
+
const info = await stat5(full).catch(() => null);
|
|
8833
|
+
if (info)
|
|
8834
|
+
videos.push({ path: toRelative(root, full), size: info.size, mtime: Math.round(info.mtimeMs) });
|
|
8835
|
+
} else if (ext === ".html" || ext === ".htm") {
|
|
8836
|
+
const info = await stat5(full).catch(() => null);
|
|
8837
|
+
if (!info || info.size > MAX_ANIMATION_BYTES)
|
|
8838
|
+
continue;
|
|
8839
|
+
const text = await readFile11(full, "utf8").catch(() => "");
|
|
8840
|
+
if (ANIMATION_HINT.test(text)) {
|
|
8841
|
+
animations.push({ path: toRelative(root, full), size: info.size, mtime: Math.round(info.mtimeMs) });
|
|
8842
|
+
}
|
|
8843
|
+
} else if (entry.name === "package.json") {
|
|
8844
|
+
try {
|
|
8845
|
+
const pkg = JSON.parse(await readFile11(full, "utf8"));
|
|
8846
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
8847
|
+
if (!REMOTION_DEPS.some((name) => name in deps))
|
|
8848
|
+
continue;
|
|
8849
|
+
const entryFile = await remotionEntry(dir, pkg);
|
|
8850
|
+
remotion.push({
|
|
8851
|
+
root: toRelative(root, dir) || ".",
|
|
8852
|
+
name: pkg.name ?? path21.basename(dir),
|
|
8853
|
+
entry: entryFile,
|
|
8854
|
+
installed: await exists3(path21.join(dir, "node_modules", "remotion"))
|
|
8855
|
+
});
|
|
8856
|
+
} catch {
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8859
|
+
}
|
|
8860
|
+
}
|
|
8861
|
+
await walk(root, 0);
|
|
8862
|
+
videos.sort((a, b) => b.mtime - a.mtime);
|
|
8863
|
+
animations.sort((a, b) => b.mtime - a.mtime);
|
|
8864
|
+
return { videos, animations, remotion, truncated };
|
|
8865
|
+
}
|
|
8866
|
+
function freePort() {
|
|
8867
|
+
return new Promise((resolve, reject) => {
|
|
8868
|
+
const server2 = createServer2();
|
|
8869
|
+
server2.once("error", reject);
|
|
8870
|
+
server2.listen(0, "127.0.0.1", () => {
|
|
8871
|
+
const { port: port2 } = server2.address();
|
|
8872
|
+
server2.close(() => resolve(port2));
|
|
8873
|
+
});
|
|
8874
|
+
});
|
|
8875
|
+
}
|
|
8876
|
+
var READY_TIMEOUT_MS = 3 * 60 * 1e3;
|
|
8877
|
+
var LOG_LINES = 40;
|
|
8878
|
+
var RemotionStudios = class {
|
|
8879
|
+
#studios = /* @__PURE__ */ new Map();
|
|
8880
|
+
#emit;
|
|
8881
|
+
constructor(emit) {
|
|
8882
|
+
this.#emit = emit;
|
|
8883
|
+
}
|
|
8884
|
+
states(workspaceId) {
|
|
8885
|
+
return [...this.#studios.values()].filter((s) => s.workspaceId === workspaceId).map((s) => s.state);
|
|
8886
|
+
}
|
|
8887
|
+
async start(workspaceId, workspacePath, root, entry) {
|
|
8888
|
+
const key = `${workspaceId}\0${root}`;
|
|
8889
|
+
const running2 = this.#studios.get(key);
|
|
8890
|
+
if (running2 && (running2.state.status === "starting" || running2.state.status === "ready")) {
|
|
8891
|
+
this.#emit(running2.state);
|
|
8892
|
+
return;
|
|
8893
|
+
}
|
|
8894
|
+
const dir = path21.resolve(workspacePath, root);
|
|
8895
|
+
const relative = path21.relative(workspacePath, dir);
|
|
8896
|
+
if (relative.startsWith("..") || path21.isAbsolute(relative))
|
|
8897
|
+
throw new Error("\u041F\u0440\u043E\u0435\u043A\u0442 Remotion \u0432\u043D\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430");
|
|
8898
|
+
const port2 = await freePort();
|
|
8899
|
+
const args = ["remotion", "studio", ...entry ? [entry] : [], "--port", String(port2)];
|
|
8900
|
+
const studio = {
|
|
8901
|
+
key,
|
|
8902
|
+
workspaceId,
|
|
8903
|
+
root,
|
|
8904
|
+
child: null,
|
|
8905
|
+
log: [],
|
|
8906
|
+
state: { workspaceId, root, status: "starting", url: `http://localhost:${port2}` }
|
|
8907
|
+
};
|
|
8908
|
+
this.#studios.set(key, studio);
|
|
8909
|
+
this.#emit(studio.state);
|
|
8910
|
+
const child = spawn4("npx", args, {
|
|
8911
|
+
cwd: dir,
|
|
8912
|
+
// `BROWSER=none` — Studio не открывает вкладку сама: её покажет окно.
|
|
8913
|
+
env: { ...process.env, BROWSER: "none", FORCE_COLOR: "0" },
|
|
8914
|
+
shell: process.platform === "win32",
|
|
8915
|
+
windowsHide: true
|
|
8916
|
+
});
|
|
8917
|
+
studio.child = child;
|
|
8918
|
+
const onData = (chunk) => {
|
|
8919
|
+
for (const line of chunk.toString("utf8").split(/\r?\n/)) {
|
|
8920
|
+
const clean = line.replace(/\u001b\[[0-9;]*[A-Za-z]/g, "").trimEnd();
|
|
8921
|
+
if (!clean)
|
|
8922
|
+
continue;
|
|
8923
|
+
studio.log.push(clean);
|
|
8924
|
+
if (studio.log.length > LOG_LINES)
|
|
8925
|
+
studio.log.shift();
|
|
8926
|
+
}
|
|
8927
|
+
};
|
|
8928
|
+
child.stdout?.on("data", onData);
|
|
8929
|
+
child.stderr?.on("data", onData);
|
|
8930
|
+
child.on("error", (error) => this.#fail(studio, error.message));
|
|
8931
|
+
child.on("exit", (code) => {
|
|
8932
|
+
studio.child = null;
|
|
8933
|
+
if (studio.state.status === "stopped")
|
|
8934
|
+
return;
|
|
8935
|
+
this.#fail(studio, `Remotion Studio \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C (\u043A\u043E\u0434 ${code ?? "\u2014"})`);
|
|
8936
|
+
});
|
|
8937
|
+
void this.#waitReady(studio, port2);
|
|
8938
|
+
}
|
|
8939
|
+
stop(workspaceId, root) {
|
|
8940
|
+
const studio = this.#studios.get(`${workspaceId}\0${root}`);
|
|
8941
|
+
if (!studio)
|
|
8942
|
+
return;
|
|
8943
|
+
studio.state = { workspaceId, root, status: "stopped" };
|
|
8944
|
+
this.#kill(studio);
|
|
8945
|
+
this.#studios.delete(studio.key);
|
|
8946
|
+
this.#emit(studio.state);
|
|
8947
|
+
}
|
|
8948
|
+
stopAll() {
|
|
8949
|
+
for (const studio of this.#studios.values()) {
|
|
8950
|
+
studio.state = { ...studio.state, status: "stopped" };
|
|
8951
|
+
this.#kill(studio);
|
|
8952
|
+
}
|
|
8953
|
+
this.#studios.clear();
|
|
8954
|
+
}
|
|
8955
|
+
#kill(studio) {
|
|
8956
|
+
const child = studio.child;
|
|
8957
|
+
if (!child?.pid)
|
|
8958
|
+
return;
|
|
8959
|
+
studio.child = null;
|
|
8960
|
+
if (process.platform === "win32") {
|
|
8961
|
+
spawn4("taskkill", ["/pid", String(child.pid), "/T", "/F"], { windowsHide: true }).on("error", () => {
|
|
8962
|
+
});
|
|
8963
|
+
} else {
|
|
8964
|
+
child.kill("SIGTERM");
|
|
8965
|
+
}
|
|
8966
|
+
}
|
|
8967
|
+
#fail(studio, message) {
|
|
8968
|
+
if (studio.state.status === "failed" || studio.state.status === "stopped")
|
|
8969
|
+
return;
|
|
8970
|
+
studio.state = {
|
|
8971
|
+
workspaceId: studio.workspaceId,
|
|
8972
|
+
root: studio.root,
|
|
8973
|
+
status: "failed",
|
|
8974
|
+
message,
|
|
8975
|
+
log: studio.log.slice(-12)
|
|
8976
|
+
};
|
|
8977
|
+
this.#kill(studio);
|
|
8978
|
+
this.#emit(studio.state);
|
|
8979
|
+
}
|
|
8980
|
+
async #waitReady(studio, port2) {
|
|
8981
|
+
const started = Date.now();
|
|
8982
|
+
while (Date.now() - started < READY_TIMEOUT_MS) {
|
|
8983
|
+
if (studio.state.status !== "starting")
|
|
8984
|
+
return;
|
|
8985
|
+
try {
|
|
8986
|
+
const response = await fetch(`http://127.0.0.1:${port2}/`, { signal: AbortSignal.timeout(2e3) });
|
|
8987
|
+
if (response.ok || response.status < 500) {
|
|
8988
|
+
studio.state = { ...studio.state, status: "ready" };
|
|
8989
|
+
this.#emit(studio.state);
|
|
8990
|
+
return;
|
|
8991
|
+
}
|
|
8992
|
+
} catch {
|
|
8993
|
+
}
|
|
8994
|
+
await new Promise((resolve) => setTimeout(resolve, 700));
|
|
8995
|
+
}
|
|
8996
|
+
this.#fail(studio, "Remotion Studio \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0430\u0441\u044C \u0437\u0430 3 \u043C\u0438\u043D\u0443\u0442\u044B");
|
|
8997
|
+
}
|
|
8998
|
+
};
|
|
8999
|
+
|
|
9000
|
+
// ../host/dist/archive.js
|
|
9001
|
+
import { mkdir as mkdir10, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
|
|
9002
|
+
import path22 from "node:path";
|
|
8203
9003
|
var SessionArchive = class {
|
|
8204
9004
|
#archived = /* @__PURE__ */ new Map();
|
|
8205
9005
|
#restored = /* @__PURE__ */ new Map();
|
|
8206
9006
|
#storePath;
|
|
8207
9007
|
constructor(dataDir) {
|
|
8208
|
-
this.#storePath =
|
|
9008
|
+
this.#storePath = path22.join(dataDir, "session-archive.json");
|
|
8209
9009
|
}
|
|
8210
9010
|
async load() {
|
|
8211
9011
|
try {
|
|
8212
|
-
const raw = await
|
|
9012
|
+
const raw = await readFile12(this.#storePath, "utf8");
|
|
8213
9013
|
const parsed = JSON.parse(raw);
|
|
8214
9014
|
this.#archived = new Map(Object.entries(parsed.archived ?? {}).filter(([, r]) => isRecord2(r)));
|
|
8215
9015
|
this.#restored = new Map(Object.entries(parsed.restored ?? {}).filter((entry) => typeof entry[1] === "number"));
|
|
@@ -8317,7 +9117,7 @@ var SessionArchive = class {
|
|
|
8317
9117
|
archived: Object.fromEntries(this.#archived),
|
|
8318
9118
|
restored: Object.fromEntries(this.#restored)
|
|
8319
9119
|
};
|
|
8320
|
-
await mkdir10(
|
|
9120
|
+
await mkdir10(path22.dirname(this.#storePath), { recursive: true });
|
|
8321
9121
|
await writeFile11(this.#storePath, JSON.stringify(file, null, 2), "utf8");
|
|
8322
9122
|
}
|
|
8323
9123
|
};
|
|
@@ -8326,8 +9126,8 @@ function isRecord2(value) {
|
|
|
8326
9126
|
}
|
|
8327
9127
|
|
|
8328
9128
|
// ../host/dist/pins.js
|
|
8329
|
-
import { mkdir as mkdir11, readFile as
|
|
8330
|
-
import
|
|
9129
|
+
import { mkdir as mkdir11, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
|
|
9130
|
+
import path23 from "node:path";
|
|
8331
9131
|
var SessionPins = class {
|
|
8332
9132
|
#pinned = /* @__PURE__ */ new Map();
|
|
8333
9133
|
/**
|
|
@@ -8342,11 +9142,11 @@ var SessionPins = class {
|
|
|
8342
9142
|
#moved = /* @__PURE__ */ new Map();
|
|
8343
9143
|
#storePath;
|
|
8344
9144
|
constructor(dataDir) {
|
|
8345
|
-
this.#storePath =
|
|
9145
|
+
this.#storePath = path23.join(dataDir, "session-pins.json");
|
|
8346
9146
|
}
|
|
8347
9147
|
async load() {
|
|
8348
9148
|
try {
|
|
8349
|
-
const raw = await
|
|
9149
|
+
const raw = await readFile13(this.#storePath, "utf8");
|
|
8350
9150
|
const parsed = JSON.parse(raw);
|
|
8351
9151
|
this.#pinned = new Map(Object.entries(parsed.pinned ?? {}).filter(([, r]) => isRecord3(r)));
|
|
8352
9152
|
this.#moved = new Map(Object.entries(parsed.moved ?? {}).filter(([, to]) => typeof to === "string"));
|
|
@@ -8499,7 +9299,7 @@ var SessionPins = class {
|
|
|
8499
9299
|
pinned: Object.fromEntries(this.#pinned),
|
|
8500
9300
|
...this.#moved.size > 0 ? { moved: Object.fromEntries(this.#moved) } : {}
|
|
8501
9301
|
};
|
|
8502
|
-
await mkdir11(
|
|
9302
|
+
await mkdir11(path23.dirname(this.#storePath), { recursive: true });
|
|
8503
9303
|
await writeFile12(this.#storePath, JSON.stringify(file, null, 2), "utf8");
|
|
8504
9304
|
}
|
|
8505
9305
|
};
|
|
@@ -8508,17 +9308,17 @@ function isRecord3(value) {
|
|
|
8508
9308
|
}
|
|
8509
9309
|
|
|
8510
9310
|
// ../host/dist/order.js
|
|
8511
|
-
import { mkdir as mkdir12, readFile as
|
|
8512
|
-
import
|
|
9311
|
+
import { mkdir as mkdir12, readFile as readFile14, writeFile as writeFile13 } from "node:fs/promises";
|
|
9312
|
+
import path24 from "node:path";
|
|
8513
9313
|
var ListOrderStore = class {
|
|
8514
9314
|
#order = emptyOrder();
|
|
8515
9315
|
#storePath;
|
|
8516
9316
|
constructor(dataDir) {
|
|
8517
|
-
this.#storePath =
|
|
9317
|
+
this.#storePath = path24.join(dataDir, "list-order.json");
|
|
8518
9318
|
}
|
|
8519
9319
|
async load() {
|
|
8520
9320
|
try {
|
|
8521
|
-
const raw = await
|
|
9321
|
+
const raw = await readFile14(this.#storePath, "utf8");
|
|
8522
9322
|
this.#order = sanitize(JSON.parse(raw));
|
|
8523
9323
|
} catch {
|
|
8524
9324
|
this.#order = emptyOrder();
|
|
@@ -8590,7 +9390,7 @@ var ListOrderStore = class {
|
|
|
8590
9390
|
return changed;
|
|
8591
9391
|
}
|
|
8592
9392
|
async #persist() {
|
|
8593
|
-
await mkdir12(
|
|
9393
|
+
await mkdir12(path24.dirname(this.#storePath), { recursive: true });
|
|
8594
9394
|
await writeFile13(this.#storePath, JSON.stringify(this.#order, null, 2), "utf8");
|
|
8595
9395
|
}
|
|
8596
9396
|
};
|
|
@@ -8620,8 +9420,8 @@ function sanitize(value) {
|
|
|
8620
9420
|
}
|
|
8621
9421
|
|
|
8622
9422
|
// ../host/dist/folders.js
|
|
8623
|
-
import { mkdir as mkdir13, readFile as
|
|
8624
|
-
import
|
|
9423
|
+
import { mkdir as mkdir13, readFile as readFile15, writeFile as writeFile14 } from "node:fs/promises";
|
|
9424
|
+
import path25 from "node:path";
|
|
8625
9425
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
8626
9426
|
var COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
|
|
8627
9427
|
var Folders = class {
|
|
@@ -8633,11 +9433,11 @@ var Folders = class {
|
|
|
8633
9433
|
#pinnedAssignments = /* @__PURE__ */ new Map();
|
|
8634
9434
|
#storePath;
|
|
8635
9435
|
constructor(dataDir) {
|
|
8636
|
-
this.#storePath =
|
|
9436
|
+
this.#storePath = path25.join(dataDir, "folders.json");
|
|
8637
9437
|
}
|
|
8638
9438
|
async load() {
|
|
8639
9439
|
try {
|
|
8640
|
-
const raw = await
|
|
9440
|
+
const raw = await readFile15(this.#storePath, "utf8");
|
|
8641
9441
|
const parsed = JSON.parse(raw);
|
|
8642
9442
|
this.#workspaceFolders = new Map(Object.entries(parsed.workspaceFolders ?? {}).filter(([, r]) => isWorkspaceFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
|
|
8643
9443
|
this.#sessionFolders = new Map(Object.entries(parsed.sessionFolders ?? {}).filter(([, r]) => isSessionFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
|
|
@@ -8955,7 +9755,7 @@ var Folders = class {
|
|
|
8955
9755
|
sessionAssignments: Object.fromEntries(this.#sessionAssignments),
|
|
8956
9756
|
pinnedAssignments: Object.fromEntries(this.#pinnedAssignments)
|
|
8957
9757
|
};
|
|
8958
|
-
await mkdir13(
|
|
9758
|
+
await mkdir13(path25.dirname(this.#storePath), { recursive: true });
|
|
8959
9759
|
await writeFile14(this.#storePath, JSON.stringify(file, null, 2), "utf8");
|
|
8960
9760
|
}
|
|
8961
9761
|
};
|
|
@@ -8978,29 +9778,29 @@ function isPinnedFolder(value) {
|
|
|
8978
9778
|
|
|
8979
9779
|
// ../host/dist/project-folders.js
|
|
8980
9780
|
import { existsSync as existsSync6, watch } from "node:fs";
|
|
8981
|
-
import { mkdir as mkdir14, readdir as
|
|
8982
|
-
import
|
|
9781
|
+
import { mkdir as mkdir14, readdir as readdir8, rmdir } from "node:fs/promises";
|
|
9782
|
+
import path27 from "node:path";
|
|
8983
9783
|
|
|
8984
9784
|
// ../host/dist/project-move.js
|
|
8985
9785
|
import { existsSync as existsSync5 } from "node:fs";
|
|
8986
|
-
import { readFile as
|
|
9786
|
+
import { readFile as readFile16, readdir as readdir7, rename as rename2, stat as stat6 } from "node:fs/promises";
|
|
8987
9787
|
import { homedir as homedir6 } from "node:os";
|
|
8988
|
-
import
|
|
9788
|
+
import path26 from "node:path";
|
|
8989
9789
|
var ACTIVE_WINDOW_MS = 2 * 6e4;
|
|
8990
9790
|
function transcriptDirName(cwd) {
|
|
8991
9791
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
8992
9792
|
}
|
|
8993
9793
|
function isInside(parent, child) {
|
|
8994
|
-
const norm = (value) =>
|
|
9794
|
+
const norm = (value) => path26.resolve(value).replace(/[\\/]+$/, "").toLowerCase();
|
|
8995
9795
|
const p = norm(parent);
|
|
8996
9796
|
const c = norm(child);
|
|
8997
|
-
return c === p || c.startsWith(p +
|
|
9797
|
+
return c === p || c.startsWith(p + path26.sep.toLowerCase()) || c.startsWith(`${p}/`);
|
|
8998
9798
|
}
|
|
8999
9799
|
async function externalAgentActivity(dirs, configDirs, now = Date.now()) {
|
|
9000
9800
|
for (const dir of dirs) {
|
|
9001
9801
|
const name = transcriptDirName(dir);
|
|
9002
9802
|
for (const config of configDirs) {
|
|
9003
|
-
const t = await newestMtime(
|
|
9803
|
+
const t = await newestMtime(path26.join(config, "projects", name), 1);
|
|
9004
9804
|
if (t !== null && now - t < ACTIVE_WINDOW_MS)
|
|
9005
9805
|
return "Claude Code";
|
|
9006
9806
|
}
|
|
@@ -9013,13 +9813,13 @@ async function newestMtime(dir, depth) {
|
|
|
9013
9813
|
let newest = null;
|
|
9014
9814
|
let entries;
|
|
9015
9815
|
try {
|
|
9016
|
-
entries = await
|
|
9816
|
+
entries = await readdir7(dir);
|
|
9017
9817
|
} catch {
|
|
9018
9818
|
return null;
|
|
9019
9819
|
}
|
|
9020
9820
|
for (const entry of entries) {
|
|
9021
|
-
const file =
|
|
9022
|
-
const info = await
|
|
9821
|
+
const file = path26.join(dir, entry);
|
|
9822
|
+
const info = await stat6(file).catch(() => null);
|
|
9023
9823
|
if (!info)
|
|
9024
9824
|
continue;
|
|
9025
9825
|
if (info.isDirectory()) {
|
|
@@ -9036,22 +9836,22 @@ async function newestMtime(dir, depth) {
|
|
|
9036
9836
|
return newest;
|
|
9037
9837
|
}
|
|
9038
9838
|
async function codexActive(dirs, now) {
|
|
9039
|
-
const root =
|
|
9839
|
+
const root = path26.join(process.env.CODEX_HOME?.trim() || path26.join(homedir6(), ".codex"), "sessions");
|
|
9040
9840
|
const days = /* @__PURE__ */ new Set();
|
|
9041
9841
|
for (const offset of [0, 1]) {
|
|
9042
9842
|
const d = new Date(now - offset * 864e5);
|
|
9043
|
-
days.add(
|
|
9843
|
+
days.add(path26.join(root, String(d.getFullYear()), String(d.getMonth() + 1).padStart(2, "0"), String(d.getDate()).padStart(2, "0")));
|
|
9044
9844
|
}
|
|
9045
9845
|
for (const day of days) {
|
|
9046
|
-
const files = await
|
|
9846
|
+
const files = await readdir7(day).catch(() => []);
|
|
9047
9847
|
for (const name of files) {
|
|
9048
9848
|
if (!name.endsWith(".jsonl"))
|
|
9049
9849
|
continue;
|
|
9050
|
-
const file =
|
|
9051
|
-
const info = await
|
|
9850
|
+
const file = path26.join(day, name);
|
|
9851
|
+
const info = await stat6(file).catch(() => null);
|
|
9052
9852
|
if (!info || now - info.mtimeMs >= ACTIVE_WINDOW_MS)
|
|
9053
9853
|
continue;
|
|
9054
|
-
const head = (await
|
|
9854
|
+
const head = (await readFile16(file, "utf8").catch(() => "")).slice(0, 4e3);
|
|
9055
9855
|
const text = head.replace(/\\\\/g, "\\").toLowerCase();
|
|
9056
9856
|
if (dirs.some((dir) => text.includes(dir.toLowerCase()) || head.includes(dir.replace(/\\/g, "\\\\")))) {
|
|
9057
9857
|
return true;
|
|
@@ -9074,10 +9874,10 @@ async function moveDirectory(from, to, projects, configDirs) {
|
|
|
9074
9874
|
throw new Error("\u041D\u0435\u043B\u044C\u0437\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043A\u0430\u0442\u0430\u043B\u043E\u0433 \u0432\u043D\u0443\u0442\u0440\u044C \u0441\u0430\u043C\u043E\u0433\u043E \u0441\u0435\u0431\u044F");
|
|
9075
9875
|
const transcripts = [];
|
|
9076
9876
|
for (const project of projects) {
|
|
9077
|
-
const next =
|
|
9877
|
+
const next = path26.join(to, path26.relative(from, project));
|
|
9078
9878
|
for (const config of configDirs) {
|
|
9079
|
-
const source =
|
|
9080
|
-
const target =
|
|
9879
|
+
const source = path26.join(config, "projects", transcriptDirName(project));
|
|
9880
|
+
const target = path26.join(config, "projects", transcriptDirName(next));
|
|
9081
9881
|
if (!existsSync5(source))
|
|
9082
9882
|
continue;
|
|
9083
9883
|
if (existsSync5(target)) {
|
|
@@ -9128,45 +9928,45 @@ function cleanFolderName(raw) {
|
|
|
9128
9928
|
return name;
|
|
9129
9929
|
}
|
|
9130
9930
|
async function listDiskFolders(root, projectPaths) {
|
|
9131
|
-
const projects = new Set(projectPaths.map((p) =>
|
|
9132
|
-
const entries = await
|
|
9931
|
+
const projects = new Set(projectPaths.map((p) => path27.resolve(p).toLowerCase()));
|
|
9932
|
+
const entries = await readdir8(root, { withFileTypes: true }).catch(() => []);
|
|
9133
9933
|
const names2 = [];
|
|
9134
9934
|
for (const entry of entries) {
|
|
9135
9935
|
if (!entry.isDirectory() || entry.name.startsWith(".") || SKIP.has(entry.name.toLowerCase()))
|
|
9136
9936
|
continue;
|
|
9137
|
-
const dir =
|
|
9138
|
-
if (projects.has(
|
|
9937
|
+
const dir = path27.join(root, entry.name);
|
|
9938
|
+
if (projects.has(path27.resolve(dir).toLowerCase()))
|
|
9139
9939
|
continue;
|
|
9140
|
-
if (existsSync6(
|
|
9940
|
+
if (existsSync6(path27.join(dir, ".git")))
|
|
9141
9941
|
continue;
|
|
9142
9942
|
names2.push(entry.name);
|
|
9143
9943
|
}
|
|
9144
9944
|
return names2.sort((a, b) => a.localeCompare(b));
|
|
9145
9945
|
}
|
|
9146
9946
|
async function listUnopened(dir, projectPaths, limit = 200) {
|
|
9147
|
-
const projects = new Set(projectPaths.map((p) =>
|
|
9148
|
-
const entries = await
|
|
9149
|
-
return entries.filter((e) => e.isDirectory() && !e.name.startsWith(".") && !SKIP.has(e.name.toLowerCase())).map((e) => ({ name: e.name, path:
|
|
9947
|
+
const projects = new Set(projectPaths.map((p) => path27.resolve(p).toLowerCase()));
|
|
9948
|
+
const entries = await readdir8(dir, { withFileTypes: true }).catch(() => []);
|
|
9949
|
+
return entries.filter((e) => e.isDirectory() && !e.name.startsWith(".") && !SKIP.has(e.name.toLowerCase())).map((e) => ({ name: e.name, path: path27.join(dir, e.name) })).filter((e) => !projects.has(path27.resolve(e.path).toLowerCase())).sort((a, b) => a.name.localeCompare(b.name)).slice(0, limit);
|
|
9150
9950
|
}
|
|
9151
9951
|
function folderOfProject(root, projectPath, folders) {
|
|
9152
|
-
const parent =
|
|
9153
|
-
if (
|
|
9952
|
+
const parent = path27.dirname(path27.resolve(projectPath));
|
|
9953
|
+
if (path27.resolve(path27.dirname(parent)).toLowerCase() !== path27.resolve(root).toLowerCase())
|
|
9154
9954
|
return null;
|
|
9155
|
-
const name =
|
|
9955
|
+
const name = path27.basename(parent);
|
|
9156
9956
|
return folders.has(name) ? folderIdFor(name) : null;
|
|
9157
9957
|
}
|
|
9158
9958
|
async function createDiskFolder(root, rawName) {
|
|
9159
9959
|
const name = cleanFolderName(rawName);
|
|
9160
|
-
const dir =
|
|
9960
|
+
const dir = path27.join(root, name);
|
|
9161
9961
|
if (existsSync6(dir))
|
|
9162
9962
|
throw new Error(`\u0423\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442: ${dir}`);
|
|
9163
9963
|
await mkdir14(dir, { recursive: true });
|
|
9164
9964
|
return name;
|
|
9165
9965
|
}
|
|
9166
9966
|
async function foreignContent(dir, projectPaths) {
|
|
9167
|
-
const projects = new Set(projectPaths.map((p) =>
|
|
9168
|
-
for (const entry of await
|
|
9169
|
-
if (!projects.has(
|
|
9967
|
+
const projects = new Set(projectPaths.map((p) => path27.resolve(p).toLowerCase()));
|
|
9968
|
+
for (const entry of await readdir8(dir).catch(() => [])) {
|
|
9969
|
+
if (!projects.has(path27.resolve(path27.join(dir, entry)).toLowerCase()))
|
|
9170
9970
|
return entry;
|
|
9171
9971
|
}
|
|
9172
9972
|
return null;
|
|
@@ -9192,9 +9992,9 @@ function watchRoot(root, onChange) {
|
|
|
9192
9992
|
}
|
|
9193
9993
|
|
|
9194
9994
|
// ../host/dist/app-settings.js
|
|
9195
|
-
import { mkdir as mkdir15, readFile as
|
|
9995
|
+
import { mkdir as mkdir15, readFile as readFile17, writeFile as writeFile15 } from "node:fs/promises";
|
|
9196
9996
|
import { homedir as homedir7 } from "node:os";
|
|
9197
|
-
import
|
|
9997
|
+
import path28 from "node:path";
|
|
9198
9998
|
var DEFAULT_AUTO_ARCHIVE_AFTER_MS = 2 * 24 * 60 * 60 * 1e3;
|
|
9199
9999
|
var MIN_AUTO_ARCHIVE_AFTER_MS = 60 * 60 * 1e3;
|
|
9200
10000
|
var DEFAULT_AUTO_STOP_AFTER_MS = 10 * 60 * 1e3;
|
|
@@ -9251,11 +10051,11 @@ var AppSettingsStore = class {
|
|
|
9251
10051
|
#settings = { ...DEFAULT_APP_SETTINGS };
|
|
9252
10052
|
#storePath;
|
|
9253
10053
|
constructor(dataDir) {
|
|
9254
|
-
this.#storePath =
|
|
10054
|
+
this.#storePath = path28.join(dataDir, "app-settings.json");
|
|
9255
10055
|
}
|
|
9256
10056
|
async load() {
|
|
9257
10057
|
try {
|
|
9258
|
-
const raw = await
|
|
10058
|
+
const raw = await readFile17(this.#storePath, "utf8");
|
|
9259
10059
|
this.#settings = sanitize2(JSON.parse(raw), DEFAULT_APP_SETTINGS);
|
|
9260
10060
|
} catch {
|
|
9261
10061
|
this.#settings = { ...DEFAULT_APP_SETTINGS };
|
|
@@ -9275,7 +10075,7 @@ var AppSettingsStore = class {
|
|
|
9275
10075
|
async update(patch) {
|
|
9276
10076
|
const next = sanitize2(patch, this.#settings);
|
|
9277
10077
|
this.#settings = next;
|
|
9278
|
-
await mkdir15(
|
|
10078
|
+
await mkdir15(path28.dirname(this.#storePath), { recursive: true });
|
|
9279
10079
|
await writeFile15(this.#storePath, JSON.stringify(next, null, 2), "utf8");
|
|
9280
10080
|
return this.current;
|
|
9281
10081
|
}
|
|
@@ -9351,7 +10151,7 @@ function sanitize2(value, fallback) {
|
|
|
9351
10151
|
return result;
|
|
9352
10152
|
}
|
|
9353
10153
|
function claudeHome() {
|
|
9354
|
-
return
|
|
10154
|
+
return path28.join(homedir7(), ".claude");
|
|
9355
10155
|
}
|
|
9356
10156
|
function writableRoots(mode, cwd, workspacePaths) {
|
|
9357
10157
|
if (mode === "all")
|
|
@@ -9361,7 +10161,7 @@ function writableRoots(mode, cwd, workspacePaths) {
|
|
|
9361
10161
|
return [...roots];
|
|
9362
10162
|
for (const workspace of [cwd, ...workspacePaths]) {
|
|
9363
10163
|
roots.add(workspace);
|
|
9364
|
-
const parent =
|
|
10164
|
+
const parent = path28.dirname(workspace);
|
|
9365
10165
|
if (parent !== workspace)
|
|
9366
10166
|
roots.add(parent);
|
|
9367
10167
|
}
|
|
@@ -9369,19 +10169,19 @@ function writableRoots(mode, cwd, workspacePaths) {
|
|
|
9369
10169
|
}
|
|
9370
10170
|
|
|
9371
10171
|
// ../host/dist/handoff-store.js
|
|
9372
|
-
import { mkdir as mkdir16, readFile as
|
|
9373
|
-
import
|
|
10172
|
+
import { mkdir as mkdir16, readFile as readFile18, readdir as readdir9, rm as rm5, writeFile as writeFile16 } from "node:fs/promises";
|
|
10173
|
+
import path29 from "node:path";
|
|
9374
10174
|
var HandoffStore = class {
|
|
9375
10175
|
#dir;
|
|
9376
10176
|
constructor(dataDir) {
|
|
9377
|
-
this.#dir =
|
|
10177
|
+
this.#dir = path29.join(dataDir, "handoffs");
|
|
9378
10178
|
}
|
|
9379
10179
|
async get(sessionId) {
|
|
9380
10180
|
const file = this.#file(sessionId);
|
|
9381
10181
|
if (!file)
|
|
9382
10182
|
return null;
|
|
9383
10183
|
try {
|
|
9384
|
-
const parsed = JSON.parse(await
|
|
10184
|
+
const parsed = JSON.parse(await readFile18(file, "utf8"));
|
|
9385
10185
|
return typeof parsed.text === "string" ? parsed : null;
|
|
9386
10186
|
} catch {
|
|
9387
10187
|
return null;
|
|
@@ -9402,7 +10202,7 @@ var HandoffStore = class {
|
|
|
9402
10202
|
/** id всех сохранённых хэндоффов. */
|
|
9403
10203
|
async list() {
|
|
9404
10204
|
try {
|
|
9405
|
-
return (await
|
|
10205
|
+
return (await readdir9(this.#dir)).filter((name) => name.endsWith(".json")).map((name) => name.slice(0, -".json".length));
|
|
9406
10206
|
} catch {
|
|
9407
10207
|
return [];
|
|
9408
10208
|
}
|
|
@@ -9411,7 +10211,7 @@ var HandoffStore = class {
|
|
|
9411
10211
|
#file(sessionId) {
|
|
9412
10212
|
if (!/^[\w-]{1,128}$/.test(sessionId))
|
|
9413
10213
|
return null;
|
|
9414
|
-
return
|
|
10214
|
+
return path29.join(this.#dir, `${sessionId}.json`);
|
|
9415
10215
|
}
|
|
9416
10216
|
};
|
|
9417
10217
|
var SAME_WINDOW_MS = 5 * 6e4;
|
|
@@ -9420,11 +10220,11 @@ var LimitStopState = class {
|
|
|
9420
10220
|
#fired = {};
|
|
9421
10221
|
#storePath;
|
|
9422
10222
|
constructor(dataDir) {
|
|
9423
|
-
this.#storePath =
|
|
10223
|
+
this.#storePath = path29.join(dataDir, "limit-stop.json");
|
|
9424
10224
|
}
|
|
9425
10225
|
async load() {
|
|
9426
10226
|
try {
|
|
9427
|
-
const parsed = JSON.parse(await
|
|
10227
|
+
const parsed = JSON.parse(await readFile18(this.#storePath, "utf8"));
|
|
9428
10228
|
this.#fired = {};
|
|
9429
10229
|
const read = (source) => {
|
|
9430
10230
|
const out = {};
|
|
@@ -9468,7 +10268,7 @@ var LimitStopState = class {
|
|
|
9468
10268
|
}
|
|
9469
10269
|
async #mark(account, limit, until) {
|
|
9470
10270
|
this.#fired[account] = { ...this.#fired[account], [limit]: until };
|
|
9471
|
-
await mkdir16(
|
|
10271
|
+
await mkdir16(path29.dirname(this.#storePath), { recursive: true });
|
|
9472
10272
|
const { [MAIN_ACCOUNT_ID]: main = {}, ...others } = this.#fired;
|
|
9473
10273
|
await writeFile16(this.#storePath, JSON.stringify({ ...main, ...others }, null, 2), "utf8");
|
|
9474
10274
|
}
|
|
@@ -9574,9 +10374,9 @@ function capitalize(text) {
|
|
|
9574
10374
|
}
|
|
9575
10375
|
|
|
9576
10376
|
// ../host/dist/plugins.js
|
|
9577
|
-
import { readFile as
|
|
10377
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
9578
10378
|
import { homedir as homedir8 } from "node:os";
|
|
9579
|
-
import
|
|
10379
|
+
import path30 from "node:path";
|
|
9580
10380
|
var TIMEOUT_MS2 = 12e4;
|
|
9581
10381
|
var SAFE_ARG = /^[A-Za-z0-9][A-Za-z0-9._@/-]*$/;
|
|
9582
10382
|
var PluginCli = class {
|
|
@@ -9675,10 +10475,10 @@ async function readCatalog(markets, installed) {
|
|
|
9675
10475
|
return lists.flat().sort((a, b) => a.name.localeCompare(b.name));
|
|
9676
10476
|
}
|
|
9677
10477
|
async function readMarketplace(market, installed) {
|
|
9678
|
-
const root = market.installLocation ||
|
|
10478
|
+
const root = market.installLocation || path30.join(homedir8(), ".claude", "plugins", "marketplaces", market.name);
|
|
9679
10479
|
let manifest;
|
|
9680
10480
|
try {
|
|
9681
|
-
const text = await
|
|
10481
|
+
const text = await readFile19(path30.join(root, ".claude-plugin", "marketplace.json"), "utf8");
|
|
9682
10482
|
manifest = JSON.parse(text);
|
|
9683
10483
|
} catch {
|
|
9684
10484
|
return [];
|
|
@@ -9930,8 +10730,8 @@ function describe6(error) {
|
|
|
9930
10730
|
|
|
9931
10731
|
// ../host/dist/relay-link.js
|
|
9932
10732
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
9933
|
-
import { readFile as
|
|
9934
|
-
import
|
|
10733
|
+
import { readFile as readFile20, writeFile as writeFile17, rm as rm6, mkdir as mkdir17 } from "node:fs/promises";
|
|
10734
|
+
import path31 from "node:path";
|
|
9935
10735
|
import { hostname } from "node:os";
|
|
9936
10736
|
import WebSocket from "ws";
|
|
9937
10737
|
|
|
@@ -9986,7 +10786,7 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
9986
10786
|
#log;
|
|
9987
10787
|
constructor(options2) {
|
|
9988
10788
|
super();
|
|
9989
|
-
this.#file =
|
|
10789
|
+
this.#file = path31.join(options2.dataDir, "relay.json");
|
|
9990
10790
|
this.#defaultUrl = options2.defaultUrl.replace(/\/+$/, "");
|
|
9991
10791
|
this.#log = options2.log ?? ((msg) => console.log(`[relay] ${msg}`));
|
|
9992
10792
|
}
|
|
@@ -10067,7 +10867,7 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
10067
10867
|
}
|
|
10068
10868
|
async #read() {
|
|
10069
10869
|
try {
|
|
10070
|
-
const raw = await
|
|
10870
|
+
const raw = await readFile20(this.#file, "utf8");
|
|
10071
10871
|
const parsed = JSON.parse(raw);
|
|
10072
10872
|
if (typeof parsed !== "object" || parsed === null)
|
|
10073
10873
|
return null;
|
|
@@ -10080,7 +10880,7 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
10080
10880
|
}
|
|
10081
10881
|
}
|
|
10082
10882
|
async #write(credentials) {
|
|
10083
|
-
await mkdir17(
|
|
10883
|
+
await mkdir17(path31.dirname(this.#file), { recursive: true });
|
|
10084
10884
|
await writeFile17(this.#file, `${JSON.stringify(credentials, null, 2)}
|
|
10085
10885
|
`, {
|
|
10086
10886
|
encoding: "utf8",
|
|
@@ -10338,7 +11138,7 @@ function humanize(error) {
|
|
|
10338
11138
|
// ../host/dist/terminal.js
|
|
10339
11139
|
import { EventEmitter as EventEmitter8 } from "node:events";
|
|
10340
11140
|
import { access as access2, constants as constants2 } from "node:fs/promises";
|
|
10341
|
-
import
|
|
11141
|
+
import path32 from "node:path";
|
|
10342
11142
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
10343
11143
|
var SCROLLBACK_BYTES = 256 * 1024;
|
|
10344
11144
|
var FLUSH_MS = 12;
|
|
@@ -10508,36 +11308,167 @@ async function defaultShell() {
|
|
|
10508
11308
|
if (pwsh)
|
|
10509
11309
|
return { file: pwsh, args: [], title: "pwsh" };
|
|
10510
11310
|
const system = process.env.SystemRoot ?? "C:\\Windows";
|
|
10511
|
-
const powershell =
|
|
10512
|
-
if (await
|
|
11311
|
+
const powershell = path32.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
|
|
11312
|
+
if (await exists4(powershell))
|
|
10513
11313
|
return { file: powershell, args: [], title: "powershell" };
|
|
10514
11314
|
return { file: process.env.COMSPEC ?? "cmd.exe", args: [], title: "cmd" };
|
|
10515
11315
|
}
|
|
10516
11316
|
const shell = process.env.SHELL;
|
|
10517
|
-
if (shell && await
|
|
10518
|
-
return { file: shell, args: [], title:
|
|
10519
|
-
if (await
|
|
11317
|
+
if (shell && await exists4(shell))
|
|
11318
|
+
return { file: shell, args: [], title: path32.basename(shell) };
|
|
11319
|
+
if (await exists4("/bin/bash"))
|
|
10520
11320
|
return { file: "/bin/bash", args: [], title: "bash" };
|
|
10521
11321
|
return { file: "/bin/sh", args: [], title: "sh" };
|
|
10522
11322
|
}
|
|
10523
11323
|
async function findOnPath(name) {
|
|
10524
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
11324
|
+
const dirs = (process.env.PATH ?? "").split(path32.delimiter).filter(Boolean);
|
|
10525
11325
|
for (const dir of dirs) {
|
|
10526
|
-
const candidate =
|
|
10527
|
-
if (await
|
|
11326
|
+
const candidate = path32.join(dir, name);
|
|
11327
|
+
if (await exists4(candidate))
|
|
10528
11328
|
return candidate;
|
|
10529
11329
|
}
|
|
10530
11330
|
return null;
|
|
10531
11331
|
}
|
|
10532
|
-
function
|
|
11332
|
+
function exists4(file) {
|
|
10533
11333
|
return access2(file, constants2.X_OK).then(() => true, () => false);
|
|
10534
11334
|
}
|
|
10535
11335
|
|
|
11336
|
+
// ../host/dist/mcp-credentials.js
|
|
11337
|
+
import { createHash } from "node:crypto";
|
|
11338
|
+
import { readFile as readFile21, rename as rename3, writeFile as writeFile18 } from "node:fs/promises";
|
|
11339
|
+
import path33 from "node:path";
|
|
11340
|
+
function mcpOAuthKey(name, config) {
|
|
11341
|
+
if (!config || typeof config !== "object")
|
|
11342
|
+
return null;
|
|
11343
|
+
const c = config;
|
|
11344
|
+
if (typeof c.url !== "string")
|
|
11345
|
+
return null;
|
|
11346
|
+
const shape = JSON.stringify({ type: c.type, url: c.url, headers: c.headers || {} });
|
|
11347
|
+
const hash = createHash("sha256").update(shape).digest("hex").substring(0, 16);
|
|
11348
|
+
return `${name}|${hash}`;
|
|
11349
|
+
}
|
|
11350
|
+
async function readMcpCredentialRecords(configDir, name) {
|
|
11351
|
+
let parsed;
|
|
11352
|
+
try {
|
|
11353
|
+
parsed = JSON.parse(await readFile21(path33.join(configDir, ".credentials.json"), "utf8"));
|
|
11354
|
+
} catch {
|
|
11355
|
+
return null;
|
|
11356
|
+
}
|
|
11357
|
+
if (!parsed || typeof parsed !== "object")
|
|
11358
|
+
return null;
|
|
11359
|
+
const store = parsed.mcpOAuth;
|
|
11360
|
+
if (store === void 0)
|
|
11361
|
+
return [];
|
|
11362
|
+
if (!store || typeof store !== "object")
|
|
11363
|
+
return null;
|
|
11364
|
+
const records = [];
|
|
11365
|
+
for (const [key, value] of Object.entries(store)) {
|
|
11366
|
+
if (!key.startsWith(`${name}|`) || !value || typeof value !== "object")
|
|
11367
|
+
continue;
|
|
11368
|
+
const v = value;
|
|
11369
|
+
const filled = (field) => typeof v[field] === "string" && v[field].length > 0;
|
|
11370
|
+
records.push({
|
|
11371
|
+
key,
|
|
11372
|
+
hasClient: filled("clientId"),
|
|
11373
|
+
hasAccessToken: filled("accessToken"),
|
|
11374
|
+
hasRefreshToken: filled("refreshToken"),
|
|
11375
|
+
expiresAt: typeof v.expiresAt === "number" ? v.expiresAt : null
|
|
11376
|
+
});
|
|
11377
|
+
}
|
|
11378
|
+
return records;
|
|
11379
|
+
}
|
|
11380
|
+
function usableToken(record, now = Date.now()) {
|
|
11381
|
+
if (!record.hasAccessToken)
|
|
11382
|
+
return false;
|
|
11383
|
+
if (record.hasRefreshToken)
|
|
11384
|
+
return true;
|
|
11385
|
+
return record.expiresAt === null || record.expiresAt > now;
|
|
11386
|
+
}
|
|
11387
|
+
function diagnoseSignIn(records, expectedKey) {
|
|
11388
|
+
if (records === null)
|
|
11389
|
+
return null;
|
|
11390
|
+
const own = expectedKey ? records.filter((r) => r.key === expectedKey) : records;
|
|
11391
|
+
const others = expectedKey ? records.filter((r) => r.key !== expectedKey) : [];
|
|
11392
|
+
const mine = own[0];
|
|
11393
|
+
if (mine && usableToken(mine)) {
|
|
11394
|
+
return null;
|
|
11395
|
+
}
|
|
11396
|
+
if (others.some((r) => usableToken(r))) {
|
|
11397
|
+
return {
|
|
11398
|
+
kind: "token-under-other-key",
|
|
11399
|
+
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."
|
|
11400
|
+
};
|
|
11401
|
+
}
|
|
11402
|
+
if (mine?.hasAccessToken) {
|
|
11403
|
+
return {
|
|
11404
|
+
kind: "token-expired",
|
|
11405
|
+
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."
|
|
11406
|
+
};
|
|
11407
|
+
}
|
|
11408
|
+
if (mine?.hasClient) {
|
|
11409
|
+
return {
|
|
11410
|
+
kind: "client-without-token",
|
|
11411
|
+
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."
|
|
11412
|
+
};
|
|
11413
|
+
}
|
|
11414
|
+
return {
|
|
11415
|
+
kind: "no-record",
|
|
11416
|
+
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."
|
|
11417
|
+
};
|
|
11418
|
+
}
|
|
11419
|
+
function registryPath(configDir) {
|
|
11420
|
+
return path33.join(configDir, "plugins", "installed_plugins.json");
|
|
11421
|
+
}
|
|
11422
|
+
async function readRegistry(configDir) {
|
|
11423
|
+
try {
|
|
11424
|
+
const raw = JSON.parse(await readFile21(registryPath(configDir), "utf8"));
|
|
11425
|
+
const plugins = raw.plugins;
|
|
11426
|
+
if (!plugins || typeof plugins !== "object")
|
|
11427
|
+
return null;
|
|
11428
|
+
for (const value of Object.values(plugins))
|
|
11429
|
+
if (!Array.isArray(value))
|
|
11430
|
+
return null;
|
|
11431
|
+
return { raw, plugins };
|
|
11432
|
+
} catch {
|
|
11433
|
+
return null;
|
|
11434
|
+
}
|
|
11435
|
+
}
|
|
11436
|
+
async function findDuplicatePlugins(configDir) {
|
|
11437
|
+
const registry = await readRegistry(configDir);
|
|
11438
|
+
if (!registry)
|
|
11439
|
+
return [];
|
|
11440
|
+
const str4 = (v) => typeof v === "string" ? v : "";
|
|
11441
|
+
return Object.entries(registry.plugins).filter(([, records]) => records.length > 1).map(([id, records]) => ({
|
|
11442
|
+
id,
|
|
11443
|
+
records: records.map((r) => ({
|
|
11444
|
+
scope: str4(r.scope),
|
|
11445
|
+
version: str4(r.version),
|
|
11446
|
+
installPath: str4(r.installPath)
|
|
11447
|
+
}))
|
|
11448
|
+
}));
|
|
11449
|
+
}
|
|
11450
|
+
async function keepSinglePluginRecord(configDir, id) {
|
|
11451
|
+
const registry = await readRegistry(configDir);
|
|
11452
|
+
if (!registry)
|
|
11453
|
+
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");
|
|
11454
|
+
const records = registry.plugins[id];
|
|
11455
|
+
if (!records || records.length < 2)
|
|
11456
|
+
return;
|
|
11457
|
+
const stamp = (r) => typeof r.lastUpdated === "string" ? Date.parse(r.lastUpdated) || 0 : 0;
|
|
11458
|
+
const pool = records.some((r) => r.scope === "user") ? records.filter((r) => r.scope === "user") : records;
|
|
11459
|
+
const keep = [...pool].sort((a, b) => stamp(b) - stamp(a))[0];
|
|
11460
|
+
registry.plugins[id] = [keep];
|
|
11461
|
+
const file = registryPath(configDir);
|
|
11462
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
11463
|
+
await writeFile18(tmp, JSON.stringify({ ...registry.raw, plugins: registry.plugins }, null, 2), "utf8");
|
|
11464
|
+
await rename3(tmp, file);
|
|
11465
|
+
}
|
|
11466
|
+
|
|
10536
11467
|
// ../host/dist/mcp-config.js
|
|
10537
|
-
import { readFile as
|
|
10538
|
-
import
|
|
11468
|
+
import { readFile as readFile22, writeFile as writeFile19, mkdir as mkdir18 } from "node:fs/promises";
|
|
11469
|
+
import path34 from "node:path";
|
|
10539
11470
|
var MCP_FILE = ".mcp.json";
|
|
10540
|
-
var LOCAL_SETTINGS2 =
|
|
11471
|
+
var LOCAL_SETTINGS2 = path34.join(".claude", "settings.local.json");
|
|
10541
11472
|
var queues = /* @__PURE__ */ new Map();
|
|
10542
11473
|
function serialize(cwd, work) {
|
|
10543
11474
|
const previous = queues.get(cwd) ?? Promise.resolve();
|
|
@@ -10546,7 +11477,7 @@ function serialize(cwd, work) {
|
|
|
10546
11477
|
return next;
|
|
10547
11478
|
}
|
|
10548
11479
|
async function readProjectServers(cwd) {
|
|
10549
|
-
const file = await readJson(
|
|
11480
|
+
const file = await readJson(path34.join(cwd, MCP_FILE));
|
|
10550
11481
|
const servers = file?.mcpServers;
|
|
10551
11482
|
if (!servers || typeof servers !== "object")
|
|
10552
11483
|
return {};
|
|
@@ -10554,23 +11485,23 @@ async function readProjectServers(cwd) {
|
|
|
10554
11485
|
}
|
|
10555
11486
|
function addProjectServer(cwd, name, config) {
|
|
10556
11487
|
return serialize(cwd, async () => {
|
|
10557
|
-
const file = await readJson(
|
|
11488
|
+
const file = await readJson(path34.join(cwd, MCP_FILE)) ?? {};
|
|
10558
11489
|
const servers = file.mcpServers ?? {};
|
|
10559
11490
|
servers[name] = config;
|
|
10560
11491
|
file.mcpServers = servers;
|
|
10561
|
-
await writeJson(
|
|
11492
|
+
await writeJson(path34.join(cwd, MCP_FILE), file);
|
|
10562
11493
|
await approve(cwd, name);
|
|
10563
11494
|
});
|
|
10564
11495
|
}
|
|
10565
11496
|
function removeProjectServer(cwd, name) {
|
|
10566
11497
|
return serialize(cwd, async () => {
|
|
10567
|
-
const file = await readJson(
|
|
11498
|
+
const file = await readJson(path34.join(cwd, MCP_FILE));
|
|
10568
11499
|
const servers = file?.mcpServers;
|
|
10569
11500
|
if (!servers || !(name in servers))
|
|
10570
11501
|
return false;
|
|
10571
11502
|
delete servers[name];
|
|
10572
|
-
await writeJson(
|
|
10573
|
-
const settingsPath =
|
|
11503
|
+
await writeJson(path34.join(cwd, MCP_FILE), file);
|
|
11504
|
+
const settingsPath = path34.join(cwd, LOCAL_SETTINGS2);
|
|
10574
11505
|
const settings = await readJson(settingsPath);
|
|
10575
11506
|
const enabled = settings?.enabledMcpjsonServers;
|
|
10576
11507
|
if (settings && Array.isArray(enabled) && enabled.includes(name)) {
|
|
@@ -10581,7 +11512,7 @@ function removeProjectServer(cwd, name) {
|
|
|
10581
11512
|
});
|
|
10582
11513
|
}
|
|
10583
11514
|
async function approve(cwd, name) {
|
|
10584
|
-
const file =
|
|
11515
|
+
const file = path34.join(cwd, LOCAL_SETTINGS2);
|
|
10585
11516
|
const settings = await readJson(file) ?? {};
|
|
10586
11517
|
const enabled = Array.isArray(settings.enabledMcpjsonServers) ? settings.enabledMcpjsonServers : [];
|
|
10587
11518
|
if (!enabled.includes(name))
|
|
@@ -10620,25 +11551,31 @@ function describeConfig(config) {
|
|
|
10620
11551
|
}
|
|
10621
11552
|
async function readJson(file) {
|
|
10622
11553
|
try {
|
|
10623
|
-
const raw = await
|
|
11554
|
+
const raw = await readFile22(file, "utf8");
|
|
10624
11555
|
const parsed = JSON.parse(raw);
|
|
10625
11556
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
10626
11557
|
} catch (error) {
|
|
10627
11558
|
if (error.code === "ENOENT")
|
|
10628
11559
|
return null;
|
|
10629
11560
|
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 ${
|
|
11561
|
+
throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${path34.basename(file)}: ${error.message}`);
|
|
10631
11562
|
}
|
|
10632
11563
|
throw error;
|
|
10633
11564
|
}
|
|
10634
11565
|
}
|
|
10635
11566
|
async function writeJson(file, data) {
|
|
10636
|
-
await mkdir18(
|
|
10637
|
-
await
|
|
11567
|
+
await mkdir18(path34.dirname(file), { recursive: true });
|
|
11568
|
+
await writeFile19(file, `${JSON.stringify(data, null, 2)}
|
|
10638
11569
|
`, "utf8");
|
|
10639
11570
|
}
|
|
10640
11571
|
|
|
10641
11572
|
// ../host/dist/server.js
|
|
11573
|
+
function accountOf(session) {
|
|
11574
|
+
return session instanceof ClaudeSession ? session.accountId : MAIN_ACCOUNT_ID;
|
|
11575
|
+
}
|
|
11576
|
+
function generationOf(session) {
|
|
11577
|
+
return session instanceof ClaudeSession ? session.generation : 0;
|
|
11578
|
+
}
|
|
10642
11579
|
var SIDE_TITLE = "\xB7 \u0432\u043E\u043F\u0440\u043E\u0441 \u043D\u0430 \u043F\u043E\u043B\u044F\u0445";
|
|
10643
11580
|
var FINDER_TITLE = "\xB7 \u043F\u043E\u0438\u0441\u043A \u043F\u0440\u043E\u0435\u043A\u0442\u0430";
|
|
10644
11581
|
var HISTORY_PAGE = 250;
|
|
@@ -10660,9 +11597,13 @@ var HostServer = class {
|
|
|
10660
11597
|
#folders;
|
|
10661
11598
|
#settings;
|
|
10662
11599
|
#finder;
|
|
11600
|
+
/** Прокси сайтов для правок комментариями — по одному на origin (`site-proxy.ts`). */
|
|
11601
|
+
#siteProxies = new SiteProxies();
|
|
11602
|
+
/** Remotion Studio проектов для раздела «Видео» (`video-studio.ts`). */
|
|
11603
|
+
#studios = new RemotionStudios((state) => this.#broadcast({ type: "video.studio", state }));
|
|
10663
11604
|
#sessions = /* @__PURE__ */ new Map();
|
|
10664
|
-
/**
|
|
10665
|
-
#
|
|
11605
|
+
/** Идущие OAuth-входы MCP, ключ — сессия и сервер. */
|
|
11606
|
+
#mcpAuthRuns = /* @__PURE__ */ new Map();
|
|
10666
11607
|
#antigravity;
|
|
10667
11608
|
#codex;
|
|
10668
11609
|
/** Боковые сессии («вопрос на полях») по id родителя — не больше одной на разговор. */
|
|
@@ -10716,6 +11657,13 @@ var HostServer = class {
|
|
|
10716
11657
|
* не останавливает. В памяти: живые сессии рестарт хоста не переживают.
|
|
10717
11658
|
*/
|
|
10718
11659
|
#limitApproved = /* @__PURE__ */ new Map();
|
|
11660
|
+
/**
|
|
11661
|
+
* Закрытые в этом запуске Claude-сессии: временный id живой сессии →
|
|
11662
|
+
* дисковый id её разговора (`null` — разговор так и не начался). Окно
|
|
11663
|
+
* старого клиента может попросить продолжить по временному id, а CLI знает
|
|
11664
|
+
* только дисковый.
|
|
11665
|
+
*/
|
|
11666
|
+
#closedDiskIds = /* @__PURE__ */ new Map();
|
|
10719
11667
|
/** Живые id сессий, у которых сейчас пишется хэндофф у лимита. */
|
|
10720
11668
|
#limitHandoffBusy = /* @__PURE__ */ new Set();
|
|
10721
11669
|
/** Живые id сессий, у которых сейчас пишется ручной хэндофф. */
|
|
@@ -10842,7 +11790,7 @@ var HostServer = class {
|
|
|
10842
11790
|
const status = await new AuthCli(configDir).status().catch(() => null);
|
|
10843
11791
|
if (!status?.loggedIn)
|
|
10844
11792
|
return null;
|
|
10845
|
-
const used = this.#accounts.all.find((a) =>
|
|
11793
|
+
const used = this.#accounts.all.find((a) => path35.resolve(this.#accounts.effectiveDir(a.id)).toLowerCase() === configDir.toLowerCase());
|
|
10846
11794
|
return {
|
|
10847
11795
|
configDir,
|
|
10848
11796
|
email: status.email,
|
|
@@ -10923,7 +11871,7 @@ var HostServer = class {
|
|
|
10923
11871
|
await this.#github.load();
|
|
10924
11872
|
await warmClaudeLauncher();
|
|
10925
11873
|
void this.#finder.warm();
|
|
10926
|
-
const httpServer =
|
|
11874
|
+
const httpServer = createServer3((req, res) => this.#serveHttp(req, res));
|
|
10927
11875
|
const wss = new WebSocketServer({ server: httpServer, path: "/ws" });
|
|
10928
11876
|
wss.on("connection", (socket) => this.#onConnection(socket));
|
|
10929
11877
|
let listening = false;
|
|
@@ -10976,6 +11924,8 @@ var HostServer = class {
|
|
|
10976
11924
|
for (const auth of this.#auths.values())
|
|
10977
11925
|
auth.cancel();
|
|
10978
11926
|
this.#terminals.closeAll();
|
|
11927
|
+
this.#siteProxies.closeAll();
|
|
11928
|
+
this.#studios.stopAll();
|
|
10979
11929
|
this.#rootWatcher?.close();
|
|
10980
11930
|
await this.#relay.close();
|
|
10981
11931
|
await Promise.all([...this.#sessions.values()].map((s) => s.close("host shutdown")));
|
|
@@ -11148,13 +12098,13 @@ var HostServer = class {
|
|
|
11148
12098
|
workspaceFolders: await Promise.all(this.#diskFolders.map(async (name) => {
|
|
11149
12099
|
const id = folderIdFor(name);
|
|
11150
12100
|
const color = this.#folders.diskFolderColor(id);
|
|
11151
|
-
const unopened = await listUnopened(
|
|
12101
|
+
const unopened = await listUnopened(path35.join(this.#projectsRoot(), name), this.#workspaces.allPaths());
|
|
11152
12102
|
return {
|
|
11153
12103
|
id,
|
|
11154
12104
|
name,
|
|
11155
12105
|
...color ? { color } : {},
|
|
11156
12106
|
unopened,
|
|
11157
|
-
path:
|
|
12107
|
+
path: path35.join(this.#projectsRoot(), name)
|
|
11158
12108
|
};
|
|
11159
12109
|
}))
|
|
11160
12110
|
};
|
|
@@ -11223,10 +12173,10 @@ var HostServer = class {
|
|
|
11223
12173
|
const name = folderNameOf(folderId);
|
|
11224
12174
|
if (!name || !this.#diskFolders.includes(name))
|
|
11225
12175
|
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 =
|
|
12176
|
+
parent = path35.join(root, name);
|
|
11227
12177
|
}
|
|
11228
|
-
const to =
|
|
11229
|
-
if (
|
|
12178
|
+
const to = path35.join(parent, path35.basename(workspace.path));
|
|
12179
|
+
if (path35.resolve(to).toLowerCase() === path35.resolve(workspace.path).toLowerCase())
|
|
11230
12180
|
return;
|
|
11231
12181
|
await this.#relocate(workspace.path, to);
|
|
11232
12182
|
}
|
|
@@ -11238,7 +12188,7 @@ var HostServer = class {
|
|
|
11238
12188
|
if (name === old)
|
|
11239
12189
|
return;
|
|
11240
12190
|
const root = this.#projectsRoot();
|
|
11241
|
-
await this.#relocate(
|
|
12191
|
+
await this.#relocate(path35.join(root, old), path35.join(root, name));
|
|
11242
12192
|
await this.#folders.renameDiskFolder(folderId, folderIdFor(name), name);
|
|
11243
12193
|
this.#sendFolders();
|
|
11244
12194
|
}
|
|
@@ -11246,13 +12196,13 @@ var HostServer = class {
|
|
|
11246
12196
|
const name = folderNameOf(folderId);
|
|
11247
12197
|
if (!name)
|
|
11248
12198
|
return;
|
|
11249
|
-
const dir =
|
|
12199
|
+
const dir = path35.join(this.#projectsRoot(), name);
|
|
11250
12200
|
const foreign = await foreignContent(dir, this.#workspaces.allPaths());
|
|
11251
12201
|
if (foreign) {
|
|
11252
12202
|
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
12203
|
}
|
|
11254
12204
|
for (const project of this.#workspaces.allPaths().filter((p) => isInside(dir, p))) {
|
|
11255
|
-
await this.#relocate(project,
|
|
12205
|
+
await this.#relocate(project, path35.join(this.#projectsRoot(), path35.basename(project)));
|
|
11256
12206
|
}
|
|
11257
12207
|
await removeEmptyDir(dir);
|
|
11258
12208
|
await this.#folders.forgetDiskFolder(folderId);
|
|
@@ -11358,7 +12308,7 @@ var HostServer = class {
|
|
|
11358
12308
|
await this.#refreshDiskFolders();
|
|
11359
12309
|
if (!name || !this.#diskFolders.includes(name))
|
|
11360
12310
|
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 =
|
|
12311
|
+
parent = path35.join(this.#projectsRoot(), name);
|
|
11362
12312
|
}
|
|
11363
12313
|
const { workspace, warnings } = await this.#workspaces.create(parent, frame.name, frame.init);
|
|
11364
12314
|
await this.#refreshDiskFolders();
|
|
@@ -11410,6 +12360,8 @@ var HostServer = class {
|
|
|
11410
12360
|
return;
|
|
11411
12361
|
}
|
|
11412
12362
|
case "session.reconnect":
|
|
12363
|
+
if (!frame.force)
|
|
12364
|
+
this.#refuseDuringMcpAuth(frame.sessionId);
|
|
11413
12365
|
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
12366
|
return;
|
|
11415
12367
|
case "session.archive": {
|
|
@@ -11594,6 +12546,8 @@ var HostServer = class {
|
|
|
11594
12546
|
this.#requireSession(frame.sessionId).sendPrompt(frame.text, frame.images, false, frame.attachments);
|
|
11595
12547
|
return;
|
|
11596
12548
|
case "prompt.edit":
|
|
12549
|
+
if (!frame.force)
|
|
12550
|
+
this.#refuseDuringMcpAuth(frame.sessionId);
|
|
11597
12551
|
await networkGuard.ensureFresh();
|
|
11598
12552
|
this.#approveAfterLimit(frame.sessionId);
|
|
11599
12553
|
await this.#requireSession(frame.sessionId).editPrompt(frame.userIndex, frame.text, frame.images, frame.attachments, frame.rewindFiles === true);
|
|
@@ -11711,27 +12665,30 @@ var HostServer = class {
|
|
|
11711
12665
|
case "mcp.auth": {
|
|
11712
12666
|
const session = this.#requireSession(frame.sessionId);
|
|
11713
12667
|
const { name } = frame;
|
|
11714
|
-
const
|
|
12668
|
+
const accountId = frame.accountId ?? accountOf(session);
|
|
12669
|
+
this.#stopMcpAuth(frame.sessionId, name);
|
|
12670
|
+
let helper = null;
|
|
11715
12671
|
try {
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
12672
|
+
if (accountId !== accountOf(session))
|
|
12673
|
+
helper = this.#mcpAuthHelper(session, accountId);
|
|
12674
|
+
const target = helper ?? session;
|
|
12675
|
+
const start = await target.authenticateMcpServer(name);
|
|
12676
|
+
this.#watchMcpAuth({
|
|
11719
12677
|
sessionId: frame.sessionId,
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
12678
|
+
name,
|
|
12679
|
+
accountId,
|
|
12680
|
+
target,
|
|
12681
|
+
helper,
|
|
12682
|
+
generation: generationOf(target),
|
|
12683
|
+
url: start.requiresUserAction ? start.url : "",
|
|
12684
|
+
callbackExpected: start.callbackExpected
|
|
11727
12685
|
});
|
|
11728
|
-
this.#watchMcpAuth(frame.sessionId, name);
|
|
11729
12686
|
} catch (error) {
|
|
12687
|
+
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
12688
|
const message = error instanceof Error ? error.message : String(error);
|
|
11731
|
-
this.#
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
state: { ...base, active: false, error: message }
|
|
12689
|
+
this.#broadcastMcpAuth(frame.sessionId, {
|
|
12690
|
+
...this.#idleAuthState(name, accountId),
|
|
12691
|
+
error: message
|
|
11735
12692
|
});
|
|
11736
12693
|
this.#reportOperation(frame.sessionId, "mcp", false, message);
|
|
11737
12694
|
}
|
|
@@ -11739,25 +12696,40 @@ var HostServer = class {
|
|
|
11739
12696
|
}
|
|
11740
12697
|
case "mcp.auth_callback": {
|
|
11741
12698
|
const session = this.#requireSession(frame.sessionId);
|
|
12699
|
+
const run = this.#mcpAuthRuns.get(`${frame.sessionId}/${frame.name}`);
|
|
12700
|
+
const target = run?.target ?? session;
|
|
12701
|
+
if (run)
|
|
12702
|
+
this.#broadcastMcpAuth(frame.sessionId, this.#runState(run, "exchanging", null));
|
|
11742
12703
|
try {
|
|
11743
|
-
await
|
|
12704
|
+
await target.submitMcpOAuthCallback(frame.name, frame.callbackUrl.trim());
|
|
11744
12705
|
} catch (error) {
|
|
11745
12706
|
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
|
-
}
|
|
12707
|
+
this.#broadcastMcpAuth(frame.sessionId, run ? this.#runState(run, "waiting", message) : {
|
|
12708
|
+
...this.#idleAuthState(frame.name, accountOf(session)),
|
|
12709
|
+
active: true,
|
|
12710
|
+
stage: "waiting",
|
|
12711
|
+
callbackExpected: true,
|
|
12712
|
+
error: message
|
|
11757
12713
|
});
|
|
11758
12714
|
}
|
|
11759
12715
|
return;
|
|
11760
12716
|
}
|
|
12717
|
+
case "plugin.dedupe": {
|
|
12718
|
+
const session = this.#requireSession(frame.sessionId);
|
|
12719
|
+
let ok = true;
|
|
12720
|
+
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`;
|
|
12721
|
+
try {
|
|
12722
|
+
await keepSinglePluginRecord(this.#accounts.effectiveDir(accountOf(session)), frame.id);
|
|
12723
|
+
await session.reloadPlugins().catch(() => void 0);
|
|
12724
|
+
} catch (error) {
|
|
12725
|
+
ok = false;
|
|
12726
|
+
message = error instanceof Error ? error.message : String(error);
|
|
12727
|
+
}
|
|
12728
|
+
this.#reportOperation(frame.sessionId, "plugin", ok, message);
|
|
12729
|
+
await this.#sendPluginList(frame.sessionId);
|
|
12730
|
+
await this.#sendMcpList(frame.sessionId).catch(() => void 0);
|
|
12731
|
+
return;
|
|
12732
|
+
}
|
|
11761
12733
|
case "plugin.list":
|
|
11762
12734
|
await this.#sendPluginList(frame.sessionId);
|
|
11763
12735
|
return;
|
|
@@ -11980,6 +12952,61 @@ var HostServer = class {
|
|
|
11980
12952
|
await this.#sendDir(frame.workspaceId, parentOf(frame.path));
|
|
11981
12953
|
return;
|
|
11982
12954
|
}
|
|
12955
|
+
case "site.open": {
|
|
12956
|
+
try {
|
|
12957
|
+
const opened = await this.#siteProxies.open(frame.url);
|
|
12958
|
+
this.#send(socket, { type: "site.opened", ...opened });
|
|
12959
|
+
} catch (error) {
|
|
12960
|
+
this.#send(socket, {
|
|
12961
|
+
type: "site.failed",
|
|
12962
|
+
url: frame.url,
|
|
12963
|
+
message: error instanceof Error ? error.message : String(error)
|
|
12964
|
+
});
|
|
12965
|
+
}
|
|
12966
|
+
return;
|
|
12967
|
+
}
|
|
12968
|
+
case "video.scan": {
|
|
12969
|
+
const workspace = this.#workspaces.find(frame.workspaceId);
|
|
12970
|
+
if (!workspace)
|
|
12971
|
+
throw new Error(`\u0412\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.workspaceId}`);
|
|
12972
|
+
const catalog = await scanVideoCatalog(workspace.path);
|
|
12973
|
+
this.#send(socket, { type: "video.catalog", workspaceId: workspace.id, ...catalog });
|
|
12974
|
+
for (const state of this.#studios.states(workspace.id)) {
|
|
12975
|
+
this.#send(socket, { type: "video.studio", state });
|
|
12976
|
+
}
|
|
12977
|
+
return;
|
|
12978
|
+
}
|
|
12979
|
+
case "video.studio.start": {
|
|
12980
|
+
const workspace = this.#workspaces.find(frame.workspaceId);
|
|
12981
|
+
if (!workspace)
|
|
12982
|
+
throw new Error(`\u0412\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.workspaceId}`);
|
|
12983
|
+
const project = (await scanVideoCatalog(workspace.path)).remotion.find((r) => r.root === frame.root);
|
|
12984
|
+
if (!project)
|
|
12985
|
+
throw new Error(`\u041F\u0440\u043E\u0435\u043A\u0442 Remotion \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.root}`);
|
|
12986
|
+
await this.#studios.start(workspace.id, workspace.path, project.root, project.entry);
|
|
12987
|
+
return;
|
|
12988
|
+
}
|
|
12989
|
+
case "video.studio.stop":
|
|
12990
|
+
this.#studios.stop(frame.workspaceId, frame.root);
|
|
12991
|
+
return;
|
|
12992
|
+
case "fs.writeBinary": {
|
|
12993
|
+
let saved;
|
|
12994
|
+
try {
|
|
12995
|
+
saved = await this.#files(frame.workspaceId).writeBinary(frame.path, Buffer.from(frame.base64, "base64"));
|
|
12996
|
+
} catch (error) {
|
|
12997
|
+
this.#fsFailed(frame.workspaceId, frame.path, error);
|
|
12998
|
+
return;
|
|
12999
|
+
}
|
|
13000
|
+
this.#broadcast({
|
|
13001
|
+
type: "fs.saved",
|
|
13002
|
+
workspaceId: frame.workspaceId,
|
|
13003
|
+
path: normalize(frame.path),
|
|
13004
|
+
mtime: saved.mtime,
|
|
13005
|
+
size: saved.size
|
|
13006
|
+
});
|
|
13007
|
+
await this.#sendDir(frame.workspaceId, parentOf(frame.path));
|
|
13008
|
+
return;
|
|
13009
|
+
}
|
|
11983
13010
|
case "fs.create":
|
|
11984
13011
|
case "fs.delete":
|
|
11985
13012
|
case "fs.rename": {
|
|
@@ -12353,7 +13380,9 @@ var HostServer = class {
|
|
|
12353
13380
|
}
|
|
12354
13381
|
async #sendPluginList(sessionId) {
|
|
12355
13382
|
const { plugins, marketplaces, catalog } = await this.#plugins.list();
|
|
12356
|
-
this.#
|
|
13383
|
+
const session = this.#sessions.get(sessionId);
|
|
13384
|
+
const duplicates = await findDuplicatePlugins(this.#accounts.effectiveDir(session ? accountOf(session) : MAIN_ACCOUNT_ID));
|
|
13385
|
+
this.#broadcast({ type: "plugin.list", sessionId, plugins, marketplaces, duplicates, catalog });
|
|
12357
13386
|
}
|
|
12358
13387
|
/**
|
|
12359
13388
|
* Общий хвост для всех команд `claude plugin`.
|
|
@@ -12378,65 +13407,187 @@ var HostServer = class {
|
|
|
12378
13407
|
this.#reportOperation(sessionId, "plugin", ok, message);
|
|
12379
13408
|
await this.#sendPluginList(sessionId);
|
|
12380
13409
|
}
|
|
13410
|
+
/** Состояние входа, которого нет или который закончился. */
|
|
13411
|
+
#idleAuthState(name, accountId) {
|
|
13412
|
+
return {
|
|
13413
|
+
name,
|
|
13414
|
+
accountId,
|
|
13415
|
+
active: false,
|
|
13416
|
+
stage: "finished",
|
|
13417
|
+
url: "",
|
|
13418
|
+
callbackExpected: false,
|
|
13419
|
+
done: false,
|
|
13420
|
+
error: null,
|
|
13421
|
+
diagnostic: null,
|
|
13422
|
+
otherAccounts: []
|
|
13423
|
+
};
|
|
13424
|
+
}
|
|
13425
|
+
#runState(run, stage, error) {
|
|
13426
|
+
return {
|
|
13427
|
+
...this.#idleAuthState(run.name, run.accountId),
|
|
13428
|
+
active: true,
|
|
13429
|
+
stage,
|
|
13430
|
+
url: run.url,
|
|
13431
|
+
callbackExpected: run.callbackExpected,
|
|
13432
|
+
error
|
|
13433
|
+
};
|
|
13434
|
+
}
|
|
13435
|
+
#broadcastMcpAuth(sessionId, state) {
|
|
13436
|
+
this.#broadcast({ type: "mcp.auth", sessionId, state });
|
|
13437
|
+
}
|
|
13438
|
+
/**
|
|
13439
|
+
* Отказать в перезапуске процесса CLI, пока в нём идёт вход: локальный
|
|
13440
|
+
* колбэк слушает именно этот процесс, и с ним умрёт и вход. Клиент
|
|
13441
|
+
* спрашивает человека и повторяет кадр с `force`.
|
|
13442
|
+
*/
|
|
13443
|
+
#refuseDuringMcpAuth(sessionId) {
|
|
13444
|
+
for (const run of this.#mcpAuthRuns.values()) {
|
|
13445
|
+
if (run.sessionId === sessionId && run.helper === null) {
|
|
13446
|
+
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`);
|
|
13447
|
+
}
|
|
13448
|
+
}
|
|
13449
|
+
}
|
|
13450
|
+
/**
|
|
13451
|
+
* Вспомогательная сессия под другим аккаунтом — ради одного входа.
|
|
13452
|
+
*
|
|
13453
|
+
* MCP-токен ложится в `.credentials.json` того аккаунта, под которым идёт
|
|
13454
|
+
* процесс CLI, а копировать этот файл между аккаунтами нельзя: там же вход в
|
|
13455
|
+
* claude.ai. Поэтому вход для второго аккаунта — это его собственный процесс
|
|
13456
|
+
* в том же каталоге (те же плагины и `.mcp.json`), без промптов. В список
|
|
13457
|
+
* сессий он не попадает и закрывается, как только вход кончился.
|
|
13458
|
+
*/
|
|
13459
|
+
#mcpAuthHelper(parent, accountId) {
|
|
13460
|
+
if (!(parent instanceof ClaudeSession)) {
|
|
13461
|
+
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");
|
|
13462
|
+
}
|
|
13463
|
+
const account = this.#accounts.find(accountId);
|
|
13464
|
+
if (!account)
|
|
13465
|
+
throw new Error("\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D");
|
|
13466
|
+
const helper = new ClaudeSession({
|
|
13467
|
+
workspaceId: "",
|
|
13468
|
+
accountId: account.id,
|
|
13469
|
+
configDir: account.configDir,
|
|
13470
|
+
cwd: parent.cwd
|
|
13471
|
+
});
|
|
13472
|
+
helper.start();
|
|
13473
|
+
return helper;
|
|
13474
|
+
}
|
|
13475
|
+
#stopMcpAuth(sessionId, name) {
|
|
13476
|
+
const key = `${sessionId}/${name}`;
|
|
13477
|
+
const run = this.#mcpAuthRuns.get(key);
|
|
13478
|
+
if (!run)
|
|
13479
|
+
return;
|
|
13480
|
+
clearInterval(run.timer);
|
|
13481
|
+
this.#mcpAuthRuns.delete(key);
|
|
13482
|
+
void run.helper?.close("\u0432\u0445\u043E\u0434 \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043A\u043E\u043D\u0447\u0435\u043D");
|
|
13483
|
+
}
|
|
13484
|
+
/** Погасить все входы сессии — она закрывается. */
|
|
13485
|
+
#stopMcpAuthFor(sessionId) {
|
|
13486
|
+
for (const run of [...this.#mcpAuthRuns.values()]) {
|
|
13487
|
+
if (run.sessionId === sessionId)
|
|
13488
|
+
this.#stopMcpAuth(sessionId, run.name);
|
|
13489
|
+
}
|
|
13490
|
+
}
|
|
13491
|
+
/**
|
|
13492
|
+
* Объяснить незавершённый вход по записи в хранилище токенов аккаунта.
|
|
13493
|
+
* Только наличие полей; при незнакомом формате — `null`.
|
|
13494
|
+
*/
|
|
13495
|
+
async #diagnoseMcpAuth(run) {
|
|
13496
|
+
try {
|
|
13497
|
+
const status = (await run.target.mcpServerStatus()).find((s) => s.name === run.name);
|
|
13498
|
+
const expected = mcpOAuthKey(run.name, status?.config);
|
|
13499
|
+
const records = await readMcpCredentialRecords(this.#accounts.effectiveDir(run.accountId), run.name);
|
|
13500
|
+
return diagnoseSignIn(records, expected);
|
|
13501
|
+
} catch {
|
|
13502
|
+
return null;
|
|
13503
|
+
}
|
|
13504
|
+
}
|
|
13505
|
+
/**
|
|
13506
|
+
* Другие аккаунты, у которых у сервера нет пригодного токена. Аккаунт, чьё
|
|
13507
|
+
* хранилище не прочитать (macOS держит его в связке ключей), не предлагаем:
|
|
13508
|
+
* о нём ничего не известно.
|
|
13509
|
+
*/
|
|
13510
|
+
async #accountsMissingMcpToken(name, except) {
|
|
13511
|
+
const missing = [];
|
|
13512
|
+
for (const account of this.#accounts.all) {
|
|
13513
|
+
if (account.id === except)
|
|
13514
|
+
continue;
|
|
13515
|
+
const records = await readMcpCredentialRecords(this.#accounts.effectiveDir(account.id), name);
|
|
13516
|
+
if (records !== null && !records.some((r) => usableToken(r)))
|
|
13517
|
+
missing.push(account.id);
|
|
13518
|
+
}
|
|
13519
|
+
return missing;
|
|
13520
|
+
}
|
|
12381
13521
|
/**
|
|
12382
13522
|
* Дождаться, пока сервер выйдет из `needs-auth`.
|
|
12383
13523
|
*
|
|
12384
13524
|
* О конце входа CLI не сообщает ничем: после колбэка он молча меняет токены
|
|
12385
13525
|
* и переподключает сервер у себя. Остаётся спрашивать статус, пока не
|
|
12386
13526
|
* изменится, — недолго, потому что вход человек либо проходит за минуты,
|
|
12387
|
-
* либо бросает.
|
|
13527
|
+
* либо бросает. Заодно следим, не сменился ли процесс CLI: вход живёт в нём.
|
|
12388
13528
|
*/
|
|
12389
|
-
#watchMcpAuth(
|
|
13529
|
+
#watchMcpAuth(init) {
|
|
13530
|
+
const { sessionId, name } = init;
|
|
12390
13531
|
const key = `${sessionId}/${name}`;
|
|
12391
|
-
clearInterval(this.#mcpAuthWatch.get(key));
|
|
12392
13532
|
const startedAt = Date.now();
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
13533
|
+
let busy = false;
|
|
13534
|
+
const fail = async (run, error, interrupted = false) => {
|
|
13535
|
+
const diagnostic = interrupted ? {
|
|
13536
|
+
kind: "interrupted",
|
|
13537
|
+
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."
|
|
13538
|
+
} : await this.#diagnoseMcpAuth(run);
|
|
13539
|
+
this.#stopMcpAuth(sessionId, name);
|
|
13540
|
+
this.#broadcastMcpAuth(sessionId, {
|
|
13541
|
+
...this.#idleAuthState(name, run.accountId),
|
|
13542
|
+
error,
|
|
13543
|
+
diagnostic
|
|
13544
|
+
});
|
|
12396
13545
|
};
|
|
12397
13546
|
const timer = setInterval(() => {
|
|
13547
|
+
const run = this.#mcpAuthRuns.get(key);
|
|
13548
|
+
if (!run || run.timer !== timer) {
|
|
13549
|
+
clearInterval(timer);
|
|
13550
|
+
return;
|
|
13551
|
+
}
|
|
13552
|
+
if (busy)
|
|
13553
|
+
return;
|
|
13554
|
+
busy = true;
|
|
12398
13555
|
void (async () => {
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
return
|
|
13556
|
+
if (!this.#sessions.has(sessionId) || run.target.state === "closed") {
|
|
13557
|
+
this.#stopMcpAuth(sessionId, name);
|
|
13558
|
+
return;
|
|
13559
|
+
}
|
|
13560
|
+
if (generationOf(run.target) !== run.generation) {
|
|
13561
|
+
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);
|
|
13562
|
+
return;
|
|
13563
|
+
}
|
|
12402
13564
|
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
|
-
});
|
|
13565
|
+
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
13566
|
return;
|
|
12417
13567
|
}
|
|
12418
|
-
const status = (await
|
|
13568
|
+
const status = (await run.target.mcpServerStatus()).find((s) => s.name === name)?.status;
|
|
12419
13569
|
if (status === "needs-auth" || status === "pending")
|
|
12420
13570
|
return;
|
|
12421
|
-
finish();
|
|
12422
13571
|
const ok = status === "connected";
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
});
|
|
13572
|
+
if (!ok) {
|
|
13573
|
+
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"}`);
|
|
13574
|
+
} else {
|
|
13575
|
+
const otherAccounts = await this.#accountsMissingMcpToken(name, run.accountId);
|
|
13576
|
+
this.#stopMcpAuth(sessionId, name);
|
|
13577
|
+
this.#broadcastMcpAuth(sessionId, {
|
|
13578
|
+
...this.#idleAuthState(name, run.accountId),
|
|
13579
|
+
done: true,
|
|
13580
|
+
otherAccounts
|
|
13581
|
+
});
|
|
13582
|
+
}
|
|
12435
13583
|
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
13584
|
await this.#sendMcpList(sessionId);
|
|
12437
|
-
})().catch(() =>
|
|
13585
|
+
})().catch(() => this.#stopMcpAuth(sessionId, name)).finally(() => {
|
|
13586
|
+
busy = false;
|
|
13587
|
+
});
|
|
12438
13588
|
}, MCP_AUTH_POLL_MS);
|
|
12439
|
-
this.#
|
|
13589
|
+
this.#mcpAuthRuns.set(key, { ...init, timer });
|
|
13590
|
+
this.#broadcastMcpAuth(sessionId, this.#runState(init, "waiting", null));
|
|
12440
13591
|
}
|
|
12441
13592
|
#reportOperation(sessionId, scope, ok, message) {
|
|
12442
13593
|
this.#broadcast({ type: "operation.result", sessionId, result: { scope, ok, message } });
|
|
@@ -12462,6 +13613,10 @@ var HostServer = class {
|
|
|
12462
13613
|
if (!session)
|
|
12463
13614
|
return false;
|
|
12464
13615
|
await this.#closeSide(sessionId);
|
|
13616
|
+
this.#stopMcpAuthFor(sessionId);
|
|
13617
|
+
if (session instanceof ClaudeSession && session.hasTemporaryId) {
|
|
13618
|
+
this.#closedDiskIds.set(sessionId, session.claudeSessionId);
|
|
13619
|
+
}
|
|
12465
13620
|
await session.close(reason);
|
|
12466
13621
|
this.#sessions.delete(sessionId);
|
|
12467
13622
|
this.#limitApproved.delete(sessionId);
|
|
@@ -12804,6 +13959,10 @@ var HostServer = class {
|
|
|
12804
13959
|
const workspace = this.#workspaces.find(frame.workspaceId);
|
|
12805
13960
|
if (!workspace)
|
|
12806
13961
|
throw new Error(`\u0412\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.workspaceId}`);
|
|
13962
|
+
if (frame.resume && this.#closedDiskIds.has(frame.resume)) {
|
|
13963
|
+
const diskId = this.#closedDiskIds.get(frame.resume) ?? void 0;
|
|
13964
|
+
frame = { ...frame, resume: diskId };
|
|
13965
|
+
}
|
|
12807
13966
|
const provider = frame.provider ?? "claude";
|
|
12808
13967
|
if (!frame.resume && !this.#settings.current.enabledProviders.includes(provider)) {
|
|
12809
13968
|
throw new Error(`${PROVIDER_LABEL[provider]} \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445`);
|
|
@@ -12977,6 +14136,8 @@ var HostServer = class {
|
|
|
12977
14136
|
void this.#migratePin(from, to);
|
|
12978
14137
|
});
|
|
12979
14138
|
session.on("capabilities", () => {
|
|
14139
|
+
if (this.#sessions.has(session.id))
|
|
14140
|
+
void this.#sendMcpList(session.id).catch(() => void 0);
|
|
12980
14141
|
if (!session.capabilities)
|
|
12981
14142
|
return;
|
|
12982
14143
|
this.#broadcast({
|
|
@@ -13456,8 +14617,8 @@ var HostServer = class {
|
|
|
13456
14617
|
return;
|
|
13457
14618
|
}
|
|
13458
14619
|
const url2 = new URL(req.url ?? "/", "http://localhost");
|
|
13459
|
-
const requested =
|
|
13460
|
-
const target = requested.startsWith(webRoot) && existsSync7(requested) && statSync3(requested).isFile() ? requested :
|
|
14620
|
+
const requested = path35.join(webRoot, path35.normalize(url2.pathname));
|
|
14621
|
+
const target = requested.startsWith(webRoot) && existsSync7(requested) && statSync3(requested).isFile() ? requested : path35.join(webRoot, "index.html");
|
|
13461
14622
|
if (!existsSync7(target)) {
|
|
13462
14623
|
res.writeHead(404).end("not found");
|
|
13463
14624
|
return;
|
|
@@ -13483,7 +14644,7 @@ function contentType(file) {
|
|
|
13483
14644
|
".svg": "image/svg+xml",
|
|
13484
14645
|
".woff2": "font/woff2"
|
|
13485
14646
|
};
|
|
13486
|
-
return types[
|
|
14647
|
+
return types[path35.extname(file)] ?? "application/octet-stream";
|
|
13487
14648
|
}
|
|
13488
14649
|
var PROVIDER_LABEL = {
|
|
13489
14650
|
claude: "Claude",
|
|
@@ -13518,8 +14679,8 @@ function antigravitySummary(record, provider = "antigravity") {
|
|
|
13518
14679
|
}
|
|
13519
14680
|
|
|
13520
14681
|
// dist/ccv.js
|
|
13521
|
-
var HERE =
|
|
13522
|
-
var PACKAGE_ROOT =
|
|
14682
|
+
var HERE = path36.dirname(fileURLToPath(import.meta.url));
|
|
14683
|
+
var PACKAGE_ROOT = path36.resolve(HERE, "..");
|
|
13523
14684
|
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
14685
|
|
|
13525
14686
|
\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
|
|
@@ -13586,7 +14747,7 @@ var server = new HostServer({
|
|
|
13586
14747
|
dataDir: defaults.dataDir,
|
|
13587
14748
|
// UI лежит в пакете рядом с бандлом — это и есть разница между установленной
|
|
13588
14749
|
// утилитой и запуском из репозитория, где сборка живёт в `apps/web/dist`.
|
|
13589
|
-
webRoot: process.env.CCV_WEB_ROOT ??
|
|
14750
|
+
webRoot: process.env.CCV_WEB_ROOT ?? path36.join(PACKAGE_ROOT, "web"),
|
|
13590
14751
|
version,
|
|
13591
14752
|
relayUrl: defaults.relayUrl
|
|
13592
14753
|
});
|
|
@@ -13615,7 +14776,7 @@ for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
|
13615
14776
|
}
|
|
13616
14777
|
async function packageVersion() {
|
|
13617
14778
|
try {
|
|
13618
|
-
const text = await
|
|
14779
|
+
const text = await readFile23(path36.join(PACKAGE_ROOT, "package.json"), "utf8");
|
|
13619
14780
|
return JSON.parse(text).version ?? "0.0.0";
|
|
13620
14781
|
} catch {
|
|
13621
14782
|
return "0.0.0";
|
|
@@ -13659,7 +14820,7 @@ function openBrowser(target) {
|
|
|
13659
14820
|
return;
|
|
13660
14821
|
}
|
|
13661
14822
|
const command = process.platform === "win32" ? { file: "cmd", args: ["/c", "start", "", target] } : process.platform === "darwin" ? { file: "open", args: [target] } : { file: "xdg-open", args: [target] };
|
|
13662
|
-
const child =
|
|
14823
|
+
const child = spawn5(command.file, command.args, {
|
|
13663
14824
|
stdio: "ignore",
|
|
13664
14825
|
detached: true,
|
|
13665
14826
|
windowsHide: true
|