@i14ks/ccv 0.27.0 → 0.28.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/README.md +13 -2
- package/bundle/ccv.mjs +237 -87
- package/package.json +2 -2
- package/web/apple-touch-icon.png +0 -0
- package/web/assets/{codemirror-E1z6J01e.js → codemirror-Jn-nlEEo.js} +1 -1
- package/web/assets/{index-DzHtRLVh.js → index-BP4uDvBo.js} +1 -1
- package/web/assets/{index-CsM3FfDT.js → index-Bt0SR_BE.js} +1 -1
- package/web/assets/{index-Bz_OD4bi.js → index-C6yiLJP6.js} +1 -1
- package/web/assets/{index-BBZwZyBc.js → index-CB9Ecmwu.js} +1 -1
- package/web/assets/{index-Bz64IIeo.js → index-CaVGDL0G.js} +1 -1
- package/web/assets/{index-DAXylny5.js → index-CckLujnN.js} +1 -1
- package/web/assets/{index-DiTx3nWx.js → index-CfBtWXkv.js} +1 -1
- package/web/assets/index-Cjq5qPxL.css +1 -0
- package/web/assets/{index-CBwg0nNm.js → index-DIt15fZq.js} +1 -1
- package/web/assets/{index-7U1ohiLA.js → index-DP1WFH_k.js} +1 -1
- package/web/assets/{index-C9SmMjLJ.js → index-DdG4EILc.js} +1 -1
- package/web/assets/{index-BcerQq_T.js → index-DdTtoxsO.js} +1 -1
- package/web/assets/{index-B2AsV6mq.js → index-DkcdGFc4.js} +1 -1
- package/web/assets/{index-DkLckATt.js → index-OpaL2d_i.js} +1 -1
- package/web/assets/{index-BecRt4W_.js → index-P-Bcy60v.js} +1 -1
- package/web/assets/{index--avrDony.js → index-SnbL_sGM.js} +1 -1
- package/web/assets/{index-CAFnMkkM.js → index-aEpkBsNa.js} +1 -1
- package/web/assets/{index-wDZtpqBZ.js → index-aFwgvegU.js} +1 -1
- package/web/assets/{index-NY2_ZMtt.js → index-hFxJfMy0.js} +1 -1
- package/web/assets/{index-DKAqAv7f.js → index-n7R3xkAJ.js} +1 -1
- package/web/assets/index-rXb9w15o.js +143 -0
- package/web/favicon.ico +0 -0
- package/web/favicon.png +0 -0
- package/web/favicon.svg +4 -2
- package/web/index.html +9 -6
- package/web/assets/index-CcP9R_-q.js +0 -134
- package/web/assets/index-D-zxmJYV.css +0 -1
package/bundle/ccv.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// dist/ccv.js
|
|
4
4
|
import { spawn as spawn4 } from "node:child_process";
|
|
5
|
-
import { readFile as
|
|
6
|
-
import
|
|
5
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
6
|
+
import path27 from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
|
|
@@ -204,7 +204,7 @@ var CodexClient = class extends EventEmitter {
|
|
|
204
204
|
child.stdin.on("error", (error) => this.#fail(error));
|
|
205
205
|
child.on("error", (error) => this.#fail(error));
|
|
206
206
|
child.on("exit", (code, signal) => this.#fail(new Error(`Codex \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0441\u044F (${signal ?? code ?? "unknown"})`)));
|
|
207
|
-
await this.request("initialize", { clientInfo: { name: "ccv", title: "
|
|
207
|
+
await this.request("initialize", { clientInfo: { name: "ccv", title: "\u042D\u0444\u0438\u0440", version: "0.28.0" }, capabilities: { experimentalApi: true } });
|
|
208
208
|
this.notify("initialized", {});
|
|
209
209
|
}
|
|
210
210
|
request(method, params = {}) {
|
|
@@ -275,7 +275,7 @@ function envDefaults() {
|
|
|
275
275
|
// ../host/dist/server.js
|
|
276
276
|
import { createServer } from "node:http";
|
|
277
277
|
import { createReadStream, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
|
|
278
|
-
import
|
|
278
|
+
import path26 from "node:path";
|
|
279
279
|
import { homedir as homedir7 } from "node:os";
|
|
280
280
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
281
281
|
import { WebSocketServer } from "ws";
|
|
@@ -316,12 +316,12 @@ function hashText(text) {
|
|
|
316
316
|
// ../host/dist/workspace-ids.js
|
|
317
317
|
function workspaceIdRemap(paths, sessionsOf) {
|
|
318
318
|
const byLegacy = /* @__PURE__ */ new Map();
|
|
319
|
-
for (const
|
|
320
|
-
const id = workspaceIdFromPath(
|
|
321
|
-
for (const legacy of formerWorkspaceIdsFromPath(
|
|
319
|
+
for (const path28 of paths) {
|
|
320
|
+
const id = workspaceIdFromPath(path28);
|
|
321
|
+
for (const legacy of formerWorkspaceIdsFromPath(path28)) {
|
|
322
322
|
const group = byLegacy.get(legacy) ?? [];
|
|
323
323
|
if (!group.some((target) => target.id === id))
|
|
324
|
-
group.push({ id, path:
|
|
324
|
+
group.push({ id, path: path28 });
|
|
325
325
|
byLegacy.set(legacy, group);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
@@ -5800,9 +5800,9 @@ function parsePatch(raw) {
|
|
|
5800
5800
|
body = "";
|
|
5801
5801
|
}
|
|
5802
5802
|
total += body.length;
|
|
5803
|
-
const
|
|
5803
|
+
const path28 = status === "deleted" ? oldPath : newPath || oldPath;
|
|
5804
5804
|
files.push({
|
|
5805
|
-
path:
|
|
5805
|
+
path: path28,
|
|
5806
5806
|
oldPath: status === "renamed" ? oldPath : "",
|
|
5807
5807
|
status,
|
|
5808
5808
|
added: count(body, "+"),
|
|
@@ -5814,10 +5814,10 @@ function parsePatch(raw) {
|
|
|
5814
5814
|
return { files, truncated };
|
|
5815
5815
|
}
|
|
5816
5816
|
function stripPrefix(value) {
|
|
5817
|
-
const
|
|
5818
|
-
if (
|
|
5817
|
+
const path28 = unquote(value.trim());
|
|
5818
|
+
if (path28 === "/dev/null")
|
|
5819
5819
|
return "";
|
|
5820
|
-
return
|
|
5820
|
+
return path28.replace(/^[ab]\//, "");
|
|
5821
5821
|
}
|
|
5822
5822
|
function count(body, mark) {
|
|
5823
5823
|
let n = 0;
|
|
@@ -6877,18 +6877,107 @@ function isRecord2(value) {
|
|
|
6877
6877
|
return typeof value === "object" && value !== null && typeof value.workspaceId === "string" && typeof value.at === "number";
|
|
6878
6878
|
}
|
|
6879
6879
|
|
|
6880
|
-
// ../host/dist/
|
|
6881
|
-
import { mkdir as mkdir8, readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
|
|
6880
|
+
// ../host/dist/session-links.js
|
|
6881
|
+
import { mkdir as mkdir8, readFile as readFile10, rename, writeFile as writeFile9 } from "node:fs/promises";
|
|
6882
6882
|
import path17 from "node:path";
|
|
6883
|
+
var STAGES = /* @__PURE__ */ new Set(["research", "implementation", "review", "other"]);
|
|
6884
|
+
var validId = (id) => typeof id === "string" && id.length > 0 && id.length <= 512;
|
|
6885
|
+
var SessionLinks = class {
|
|
6886
|
+
#links = /* @__PURE__ */ new Map();
|
|
6887
|
+
#queue = Promise.resolve();
|
|
6888
|
+
#file;
|
|
6889
|
+
constructor(dataDir) {
|
|
6890
|
+
this.#file = path17.join(dataDir, "session-links.json");
|
|
6891
|
+
}
|
|
6892
|
+
async load() {
|
|
6893
|
+
try {
|
|
6894
|
+
const parsed = JSON.parse(await readFile10(this.#file, "utf8"));
|
|
6895
|
+
if (!Array.isArray(parsed))
|
|
6896
|
+
return;
|
|
6897
|
+
for (const value of parsed) {
|
|
6898
|
+
if (!value || typeof value !== "object")
|
|
6899
|
+
continue;
|
|
6900
|
+
const r = value;
|
|
6901
|
+
if (!validId(r.sessionId) || !validId(r.workspaceId) || !(r.parentId === null || validId(r.parentId)) || !STAGES.has(r.stage) || !["fork", "continuation", "linked"].includes(r.kind) || !Number.isFinite(r.createdAt))
|
|
6902
|
+
continue;
|
|
6903
|
+
this.#links.set(r.sessionId, { ...r });
|
|
6904
|
+
}
|
|
6905
|
+
} catch (error) {
|
|
6906
|
+
if (error.code !== "ENOENT")
|
|
6907
|
+
throw error;
|
|
6908
|
+
}
|
|
6909
|
+
}
|
|
6910
|
+
get all() {
|
|
6911
|
+
return [...this.#links.values()].map((r) => ({ ...r }));
|
|
6912
|
+
}
|
|
6913
|
+
set(link) {
|
|
6914
|
+
return this.#update(() => {
|
|
6915
|
+
if (!validId(link.sessionId) || !validId(link.workspaceId) || !STAGES.has(link.stage))
|
|
6916
|
+
throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0430\u044F \u0441\u0432\u044F\u0437\u044C \u0441\u0435\u0441\u0441\u0438\u0439");
|
|
6917
|
+
if (link.parentId !== null && !validId(link.parentId))
|
|
6918
|
+
throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0430\u044F \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F");
|
|
6919
|
+
const seen = /* @__PURE__ */ new Set([link.sessionId]);
|
|
6920
|
+
let parent = link.parentId;
|
|
6921
|
+
while (parent) {
|
|
6922
|
+
if (seen.has(parent))
|
|
6923
|
+
throw new Error("\u041D\u0435\u043B\u044C\u0437\u044F \u0437\u0430\u043C\u043A\u043D\u0443\u0442\u044C \u0446\u0435\u043F\u043E\u0447\u043A\u0443 \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 \u043A\u0440\u0443\u0433");
|
|
6924
|
+
seen.add(parent);
|
|
6925
|
+
const next = this.#links.get(parent);
|
|
6926
|
+
if (next && next.workspaceId !== link.workspaceId)
|
|
6927
|
+
throw new Error("\u042D\u0442\u0430\u043F\u044B \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043E\u043B\u0436\u043D\u044B \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0430\u0442\u044C \u043E\u0434\u043D\u043E\u043C\u0443 \u043F\u0440\u043E\u0435\u043A\u0442\u0443");
|
|
6928
|
+
parent = next?.parentId ?? null;
|
|
6929
|
+
}
|
|
6930
|
+
this.#links.set(link.sessionId, { ...link, createdAt: this.#links.get(link.sessionId)?.createdAt ?? link.createdAt });
|
|
6931
|
+
});
|
|
6932
|
+
}
|
|
6933
|
+
migrate(from, to) {
|
|
6934
|
+
return this.#update(() => {
|
|
6935
|
+
if (from === to)
|
|
6936
|
+
return;
|
|
6937
|
+
const link = this.#links.get(from);
|
|
6938
|
+
if (link) {
|
|
6939
|
+
this.#links.delete(from);
|
|
6940
|
+
this.#links.set(to, { ...link, sessionId: to, parentId: link.parentId === to ? null : link.parentId });
|
|
6941
|
+
}
|
|
6942
|
+
for (const [id, r] of this.#links) {
|
|
6943
|
+
if (r.parentId === from)
|
|
6944
|
+
this.#links.set(id, { ...r, parentId: id === to ? null : to });
|
|
6945
|
+
}
|
|
6946
|
+
});
|
|
6947
|
+
}
|
|
6948
|
+
#update(change) {
|
|
6949
|
+
const operation = this.#queue.then(async () => {
|
|
6950
|
+
const before = new Map(this.#links);
|
|
6951
|
+
try {
|
|
6952
|
+
change();
|
|
6953
|
+
const next = JSON.stringify(this.all, null, 2);
|
|
6954
|
+
if (next === JSON.stringify([...before.values()], null, 2))
|
|
6955
|
+
return;
|
|
6956
|
+
await mkdir8(path17.dirname(this.#file), { recursive: true });
|
|
6957
|
+
await writeFile9(this.#file + ".tmp", next, "utf8");
|
|
6958
|
+
await rename(this.#file + ".tmp", this.#file);
|
|
6959
|
+
} catch (error) {
|
|
6960
|
+
this.#links = before;
|
|
6961
|
+
throw error;
|
|
6962
|
+
}
|
|
6963
|
+
});
|
|
6964
|
+
this.#queue = operation.catch(() => void 0);
|
|
6965
|
+
return operation;
|
|
6966
|
+
}
|
|
6967
|
+
};
|
|
6968
|
+
|
|
6969
|
+
// ../host/dist/order.js
|
|
6970
|
+
import { mkdir as mkdir9, readFile as readFile11, writeFile as writeFile10 } from "node:fs/promises";
|
|
6971
|
+
import path18 from "node:path";
|
|
6883
6972
|
var ListOrderStore = class {
|
|
6884
6973
|
#order = emptyOrder();
|
|
6885
6974
|
#storePath;
|
|
6886
6975
|
constructor(dataDir) {
|
|
6887
|
-
this.#storePath =
|
|
6976
|
+
this.#storePath = path18.join(dataDir, "list-order.json");
|
|
6888
6977
|
}
|
|
6889
6978
|
async load() {
|
|
6890
6979
|
try {
|
|
6891
|
-
const raw = await
|
|
6980
|
+
const raw = await readFile11(this.#storePath, "utf8");
|
|
6892
6981
|
this.#order = sanitize(JSON.parse(raw));
|
|
6893
6982
|
} catch {
|
|
6894
6983
|
this.#order = emptyOrder();
|
|
@@ -6960,8 +7049,8 @@ var ListOrderStore = class {
|
|
|
6960
7049
|
return changed;
|
|
6961
7050
|
}
|
|
6962
7051
|
async #persist() {
|
|
6963
|
-
await
|
|
6964
|
-
await
|
|
7052
|
+
await mkdir9(path18.dirname(this.#storePath), { recursive: true });
|
|
7053
|
+
await writeFile10(this.#storePath, JSON.stringify(this.#order, null, 2), "utf8");
|
|
6965
7054
|
}
|
|
6966
7055
|
};
|
|
6967
7056
|
function emptyOrder() {
|
|
@@ -6990,8 +7079,8 @@ function sanitize(value) {
|
|
|
6990
7079
|
}
|
|
6991
7080
|
|
|
6992
7081
|
// ../host/dist/folders.js
|
|
6993
|
-
import { mkdir as
|
|
6994
|
-
import
|
|
7082
|
+
import { mkdir as mkdir10, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
|
|
7083
|
+
import path19 from "node:path";
|
|
6995
7084
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
6996
7085
|
var COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
|
|
6997
7086
|
var Folders = class {
|
|
@@ -7003,11 +7092,11 @@ var Folders = class {
|
|
|
7003
7092
|
#pinnedAssignments = /* @__PURE__ */ new Map();
|
|
7004
7093
|
#storePath;
|
|
7005
7094
|
constructor(dataDir) {
|
|
7006
|
-
this.#storePath =
|
|
7095
|
+
this.#storePath = path19.join(dataDir, "folders.json");
|
|
7007
7096
|
}
|
|
7008
7097
|
async load() {
|
|
7009
7098
|
try {
|
|
7010
|
-
const raw = await
|
|
7099
|
+
const raw = await readFile12(this.#storePath, "utf8");
|
|
7011
7100
|
const parsed = JSON.parse(raw);
|
|
7012
7101
|
this.#workspaceFolders = new Map(Object.entries(parsed.workspaceFolders ?? {}).filter(([, r]) => isWorkspaceFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
|
|
7013
7102
|
this.#sessionFolders = new Map(Object.entries(parsed.sessionFolders ?? {}).filter(([, r]) => isSessionFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
|
|
@@ -7284,8 +7373,8 @@ var Folders = class {
|
|
|
7284
7373
|
sessionAssignments: Object.fromEntries(this.#sessionAssignments),
|
|
7285
7374
|
pinnedAssignments: Object.fromEntries(this.#pinnedAssignments)
|
|
7286
7375
|
};
|
|
7287
|
-
await
|
|
7288
|
-
await
|
|
7376
|
+
await mkdir10(path19.dirname(this.#storePath), { recursive: true });
|
|
7377
|
+
await writeFile11(this.#storePath, JSON.stringify(file, null, 2), "utf8");
|
|
7289
7378
|
}
|
|
7290
7379
|
};
|
|
7291
7380
|
function withValidColor(record) {
|
|
@@ -7306,9 +7395,9 @@ function isPinnedFolder(value) {
|
|
|
7306
7395
|
}
|
|
7307
7396
|
|
|
7308
7397
|
// ../host/dist/app-settings.js
|
|
7309
|
-
import { mkdir as
|
|
7398
|
+
import { mkdir as mkdir11, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
|
|
7310
7399
|
import { homedir as homedir5 } from "node:os";
|
|
7311
|
-
import
|
|
7400
|
+
import path20 from "node:path";
|
|
7312
7401
|
var DEFAULT_AUTO_ARCHIVE_AFTER_MS = 2 * 24 * 60 * 60 * 1e3;
|
|
7313
7402
|
var MIN_AUTO_ARCHIVE_AFTER_MS = 60 * 60 * 1e3;
|
|
7314
7403
|
var DEFAULT_AUTO_STOP_AFTER_MS = 10 * 60 * 1e3;
|
|
@@ -7360,11 +7449,11 @@ var AppSettingsStore = class {
|
|
|
7360
7449
|
#settings = { ...DEFAULT_APP_SETTINGS };
|
|
7361
7450
|
#storePath;
|
|
7362
7451
|
constructor(dataDir) {
|
|
7363
|
-
this.#storePath =
|
|
7452
|
+
this.#storePath = path20.join(dataDir, "app-settings.json");
|
|
7364
7453
|
}
|
|
7365
7454
|
async load() {
|
|
7366
7455
|
try {
|
|
7367
|
-
const raw = await
|
|
7456
|
+
const raw = await readFile13(this.#storePath, "utf8");
|
|
7368
7457
|
this.#settings = sanitize2(JSON.parse(raw), DEFAULT_APP_SETTINGS);
|
|
7369
7458
|
} catch {
|
|
7370
7459
|
this.#settings = { ...DEFAULT_APP_SETTINGS };
|
|
@@ -7384,8 +7473,8 @@ var AppSettingsStore = class {
|
|
|
7384
7473
|
async update(patch) {
|
|
7385
7474
|
const next = sanitize2(patch, this.#settings);
|
|
7386
7475
|
this.#settings = next;
|
|
7387
|
-
await
|
|
7388
|
-
await
|
|
7476
|
+
await mkdir11(path20.dirname(this.#storePath), { recursive: true });
|
|
7477
|
+
await writeFile12(this.#storePath, JSON.stringify(next, null, 2), "utf8");
|
|
7389
7478
|
return this.current;
|
|
7390
7479
|
}
|
|
7391
7480
|
};
|
|
@@ -7451,7 +7540,7 @@ function sanitize2(value, fallback) {
|
|
|
7451
7540
|
return result;
|
|
7452
7541
|
}
|
|
7453
7542
|
function claudeHome() {
|
|
7454
|
-
return
|
|
7543
|
+
return path20.join(homedir5(), ".claude");
|
|
7455
7544
|
}
|
|
7456
7545
|
function writableRoots(mode, cwd, workspacePaths) {
|
|
7457
7546
|
if (mode === "all")
|
|
@@ -7461,7 +7550,7 @@ function writableRoots(mode, cwd, workspacePaths) {
|
|
|
7461
7550
|
return [...roots];
|
|
7462
7551
|
for (const workspace of [cwd, ...workspacePaths]) {
|
|
7463
7552
|
roots.add(workspace);
|
|
7464
|
-
const parent =
|
|
7553
|
+
const parent = path20.dirname(workspace);
|
|
7465
7554
|
if (parent !== workspace)
|
|
7466
7555
|
roots.add(parent);
|
|
7467
7556
|
}
|
|
@@ -7469,19 +7558,19 @@ function writableRoots(mode, cwd, workspacePaths) {
|
|
|
7469
7558
|
}
|
|
7470
7559
|
|
|
7471
7560
|
// ../host/dist/handoff-store.js
|
|
7472
|
-
import { mkdir as
|
|
7473
|
-
import
|
|
7561
|
+
import { mkdir as mkdir12, readFile as readFile14, readdir as readdir3, rm as rm4, writeFile as writeFile13 } from "node:fs/promises";
|
|
7562
|
+
import path21 from "node:path";
|
|
7474
7563
|
var HandoffStore = class {
|
|
7475
7564
|
#dir;
|
|
7476
7565
|
constructor(dataDir) {
|
|
7477
|
-
this.#dir =
|
|
7566
|
+
this.#dir = path21.join(dataDir, "handoffs");
|
|
7478
7567
|
}
|
|
7479
7568
|
async get(sessionId) {
|
|
7480
7569
|
const file = this.#file(sessionId);
|
|
7481
7570
|
if (!file)
|
|
7482
7571
|
return null;
|
|
7483
7572
|
try {
|
|
7484
|
-
const parsed = JSON.parse(await
|
|
7573
|
+
const parsed = JSON.parse(await readFile14(file, "utf8"));
|
|
7485
7574
|
return typeof parsed.text === "string" ? parsed : null;
|
|
7486
7575
|
} catch {
|
|
7487
7576
|
return null;
|
|
@@ -7491,8 +7580,8 @@ var HandoffStore = class {
|
|
|
7491
7580
|
const file = this.#file(handoff.sessionId);
|
|
7492
7581
|
if (!file)
|
|
7493
7582
|
return;
|
|
7494
|
-
await
|
|
7495
|
-
await
|
|
7583
|
+
await mkdir12(this.#dir, { recursive: true });
|
|
7584
|
+
await writeFile13(file, JSON.stringify(handoff, null, 2), "utf8");
|
|
7496
7585
|
}
|
|
7497
7586
|
async remove(sessionId) {
|
|
7498
7587
|
const file = this.#file(sessionId);
|
|
@@ -7511,7 +7600,7 @@ var HandoffStore = class {
|
|
|
7511
7600
|
#file(sessionId) {
|
|
7512
7601
|
if (!/^[\w-]{1,128}$/.test(sessionId))
|
|
7513
7602
|
return null;
|
|
7514
|
-
return
|
|
7603
|
+
return path21.join(this.#dir, `${sessionId}.json`);
|
|
7515
7604
|
}
|
|
7516
7605
|
};
|
|
7517
7606
|
var SAME_WINDOW_MS = 5 * 6e4;
|
|
@@ -7519,11 +7608,11 @@ var LimitStopState = class {
|
|
|
7519
7608
|
#fired = {};
|
|
7520
7609
|
#storePath;
|
|
7521
7610
|
constructor(dataDir) {
|
|
7522
|
-
this.#storePath =
|
|
7611
|
+
this.#storePath = path21.join(dataDir, "limit-stop.json");
|
|
7523
7612
|
}
|
|
7524
7613
|
async load() {
|
|
7525
7614
|
try {
|
|
7526
|
-
const parsed = JSON.parse(await
|
|
7615
|
+
const parsed = JSON.parse(await readFile14(this.#storePath, "utf8"));
|
|
7527
7616
|
this.#fired = {};
|
|
7528
7617
|
for (const key of ["fiveHour", "sevenDay"]) {
|
|
7529
7618
|
const until = parsed[key];
|
|
@@ -7555,8 +7644,8 @@ var LimitStopState = class {
|
|
|
7555
7644
|
/** Запомнить срабатывание до `until` (момент сброса окна). */
|
|
7556
7645
|
async mark(limit, until) {
|
|
7557
7646
|
this.#fired[limit] = until;
|
|
7558
|
-
await
|
|
7559
|
-
await
|
|
7647
|
+
await mkdir12(path21.dirname(this.#storePath), { recursive: true });
|
|
7648
|
+
await writeFile13(this.#storePath, JSON.stringify(this.#fired, null, 2), "utf8");
|
|
7560
7649
|
}
|
|
7561
7650
|
};
|
|
7562
7651
|
|
|
@@ -7660,9 +7749,9 @@ function capitalize(text) {
|
|
|
7660
7749
|
}
|
|
7661
7750
|
|
|
7662
7751
|
// ../host/dist/plugins.js
|
|
7663
|
-
import { readFile as
|
|
7752
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
7664
7753
|
import { homedir as homedir6 } from "node:os";
|
|
7665
|
-
import
|
|
7754
|
+
import path22 from "node:path";
|
|
7666
7755
|
var TIMEOUT_MS2 = 12e4;
|
|
7667
7756
|
var SAFE_ARG = /^[A-Za-z0-9][A-Za-z0-9._@/-]*$/;
|
|
7668
7757
|
var PluginCli = class {
|
|
@@ -7761,10 +7850,10 @@ async function readCatalog(markets, installed) {
|
|
|
7761
7850
|
return lists.flat().sort((a, b) => a.name.localeCompare(b.name));
|
|
7762
7851
|
}
|
|
7763
7852
|
async function readMarketplace(market, installed) {
|
|
7764
|
-
const root = market.installLocation ||
|
|
7853
|
+
const root = market.installLocation || path22.join(homedir6(), ".claude", "plugins", "marketplaces", market.name);
|
|
7765
7854
|
let manifest;
|
|
7766
7855
|
try {
|
|
7767
|
-
const text = await
|
|
7856
|
+
const text = await readFile15(path22.join(root, ".claude-plugin", "marketplace.json"), "utf8");
|
|
7768
7857
|
manifest = JSON.parse(text);
|
|
7769
7858
|
} catch {
|
|
7770
7859
|
return [];
|
|
@@ -8005,8 +8094,8 @@ function describe5(error) {
|
|
|
8005
8094
|
|
|
8006
8095
|
// ../host/dist/relay-link.js
|
|
8007
8096
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
8008
|
-
import { readFile as
|
|
8009
|
-
import
|
|
8097
|
+
import { readFile as readFile16, writeFile as writeFile14, rm as rm5, mkdir as mkdir13 } from "node:fs/promises";
|
|
8098
|
+
import path23 from "node:path";
|
|
8010
8099
|
import { hostname } from "node:os";
|
|
8011
8100
|
import WebSocket from "ws";
|
|
8012
8101
|
|
|
@@ -8061,7 +8150,7 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
8061
8150
|
#log;
|
|
8062
8151
|
constructor(options2) {
|
|
8063
8152
|
super();
|
|
8064
|
-
this.#file =
|
|
8153
|
+
this.#file = path23.join(options2.dataDir, "relay.json");
|
|
8065
8154
|
this.#defaultUrl = options2.defaultUrl.replace(/\/+$/, "");
|
|
8066
8155
|
this.#log = options2.log ?? ((msg) => console.log(`[relay] ${msg}`));
|
|
8067
8156
|
}
|
|
@@ -8142,7 +8231,7 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
8142
8231
|
}
|
|
8143
8232
|
async #read() {
|
|
8144
8233
|
try {
|
|
8145
|
-
const raw = await
|
|
8234
|
+
const raw = await readFile16(this.#file, "utf8");
|
|
8146
8235
|
const parsed = JSON.parse(raw);
|
|
8147
8236
|
if (typeof parsed !== "object" || parsed === null)
|
|
8148
8237
|
return null;
|
|
@@ -8155,8 +8244,8 @@ var RelayLink = class extends EventEmitter7 {
|
|
|
8155
8244
|
}
|
|
8156
8245
|
}
|
|
8157
8246
|
async #write(credentials) {
|
|
8158
|
-
await
|
|
8159
|
-
await
|
|
8247
|
+
await mkdir13(path23.dirname(this.#file), { recursive: true });
|
|
8248
|
+
await writeFile14(this.#file, `${JSON.stringify(credentials, null, 2)}
|
|
8160
8249
|
`, {
|
|
8161
8250
|
encoding: "utf8",
|
|
8162
8251
|
mode: 384
|
|
@@ -8413,7 +8502,7 @@ function humanize(error) {
|
|
|
8413
8502
|
// ../host/dist/terminal.js
|
|
8414
8503
|
import { EventEmitter as EventEmitter8 } from "node:events";
|
|
8415
8504
|
import { access as access2, constants as constants2 } from "node:fs/promises";
|
|
8416
|
-
import
|
|
8505
|
+
import path24 from "node:path";
|
|
8417
8506
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
8418
8507
|
var SCROLLBACK_BYTES = 256 * 1024;
|
|
8419
8508
|
var FLUSH_MS = 12;
|
|
@@ -8583,22 +8672,22 @@ async function defaultShell() {
|
|
|
8583
8672
|
if (pwsh)
|
|
8584
8673
|
return { file: pwsh, args: [], title: "pwsh" };
|
|
8585
8674
|
const system = process.env.SystemRoot ?? "C:\\Windows";
|
|
8586
|
-
const powershell =
|
|
8675
|
+
const powershell = path24.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
|
|
8587
8676
|
if (await exists2(powershell))
|
|
8588
8677
|
return { file: powershell, args: [], title: "powershell" };
|
|
8589
8678
|
return { file: process.env.COMSPEC ?? "cmd.exe", args: [], title: "cmd" };
|
|
8590
8679
|
}
|
|
8591
8680
|
const shell = process.env.SHELL;
|
|
8592
8681
|
if (shell && await exists2(shell))
|
|
8593
|
-
return { file: shell, args: [], title:
|
|
8682
|
+
return { file: shell, args: [], title: path24.basename(shell) };
|
|
8594
8683
|
if (await exists2("/bin/bash"))
|
|
8595
8684
|
return { file: "/bin/bash", args: [], title: "bash" };
|
|
8596
8685
|
return { file: "/bin/sh", args: [], title: "sh" };
|
|
8597
8686
|
}
|
|
8598
8687
|
async function findOnPath(name) {
|
|
8599
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
8688
|
+
const dirs = (process.env.PATH ?? "").split(path24.delimiter).filter(Boolean);
|
|
8600
8689
|
for (const dir of dirs) {
|
|
8601
|
-
const candidate =
|
|
8690
|
+
const candidate = path24.join(dir, name);
|
|
8602
8691
|
if (await exists2(candidate))
|
|
8603
8692
|
return candidate;
|
|
8604
8693
|
}
|
|
@@ -8609,10 +8698,10 @@ function exists2(file) {
|
|
|
8609
8698
|
}
|
|
8610
8699
|
|
|
8611
8700
|
// ../host/dist/mcp-config.js
|
|
8612
|
-
import { readFile as
|
|
8613
|
-
import
|
|
8701
|
+
import { readFile as readFile17, writeFile as writeFile15, mkdir as mkdir14 } from "node:fs/promises";
|
|
8702
|
+
import path25 from "node:path";
|
|
8614
8703
|
var MCP_FILE = ".mcp.json";
|
|
8615
|
-
var LOCAL_SETTINGS2 =
|
|
8704
|
+
var LOCAL_SETTINGS2 = path25.join(".claude", "settings.local.json");
|
|
8616
8705
|
var queues = /* @__PURE__ */ new Map();
|
|
8617
8706
|
function serialize(cwd, work) {
|
|
8618
8707
|
const previous = queues.get(cwd) ?? Promise.resolve();
|
|
@@ -8621,7 +8710,7 @@ function serialize(cwd, work) {
|
|
|
8621
8710
|
return next;
|
|
8622
8711
|
}
|
|
8623
8712
|
async function readProjectServers(cwd) {
|
|
8624
|
-
const file = await readJson(
|
|
8713
|
+
const file = await readJson(path25.join(cwd, MCP_FILE));
|
|
8625
8714
|
const servers = file?.mcpServers;
|
|
8626
8715
|
if (!servers || typeof servers !== "object")
|
|
8627
8716
|
return {};
|
|
@@ -8629,23 +8718,23 @@ async function readProjectServers(cwd) {
|
|
|
8629
8718
|
}
|
|
8630
8719
|
function addProjectServer(cwd, name, config) {
|
|
8631
8720
|
return serialize(cwd, async () => {
|
|
8632
|
-
const file = await readJson(
|
|
8721
|
+
const file = await readJson(path25.join(cwd, MCP_FILE)) ?? {};
|
|
8633
8722
|
const servers = file.mcpServers ?? {};
|
|
8634
8723
|
servers[name] = config;
|
|
8635
8724
|
file.mcpServers = servers;
|
|
8636
|
-
await writeJson(
|
|
8725
|
+
await writeJson(path25.join(cwd, MCP_FILE), file);
|
|
8637
8726
|
await approve(cwd, name);
|
|
8638
8727
|
});
|
|
8639
8728
|
}
|
|
8640
8729
|
function removeProjectServer(cwd, name) {
|
|
8641
8730
|
return serialize(cwd, async () => {
|
|
8642
|
-
const file = await readJson(
|
|
8731
|
+
const file = await readJson(path25.join(cwd, MCP_FILE));
|
|
8643
8732
|
const servers = file?.mcpServers;
|
|
8644
8733
|
if (!servers || !(name in servers))
|
|
8645
8734
|
return false;
|
|
8646
8735
|
delete servers[name];
|
|
8647
|
-
await writeJson(
|
|
8648
|
-
const settingsPath =
|
|
8736
|
+
await writeJson(path25.join(cwd, MCP_FILE), file);
|
|
8737
|
+
const settingsPath = path25.join(cwd, LOCAL_SETTINGS2);
|
|
8649
8738
|
const settings = await readJson(settingsPath);
|
|
8650
8739
|
const enabled = settings?.enabledMcpjsonServers;
|
|
8651
8740
|
if (settings && Array.isArray(enabled) && enabled.includes(name)) {
|
|
@@ -8656,7 +8745,7 @@ function removeProjectServer(cwd, name) {
|
|
|
8656
8745
|
});
|
|
8657
8746
|
}
|
|
8658
8747
|
async function approve(cwd, name) {
|
|
8659
|
-
const file =
|
|
8748
|
+
const file = path25.join(cwd, LOCAL_SETTINGS2);
|
|
8660
8749
|
const settings = await readJson(file) ?? {};
|
|
8661
8750
|
const enabled = Array.isArray(settings.enabledMcpjsonServers) ? settings.enabledMcpjsonServers : [];
|
|
8662
8751
|
if (!enabled.includes(name))
|
|
@@ -8695,21 +8784,21 @@ function describeConfig(config) {
|
|
|
8695
8784
|
}
|
|
8696
8785
|
async function readJson(file) {
|
|
8697
8786
|
try {
|
|
8698
|
-
const raw = await
|
|
8787
|
+
const raw = await readFile17(file, "utf8");
|
|
8699
8788
|
const parsed = JSON.parse(raw);
|
|
8700
8789
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
8701
8790
|
} catch (error) {
|
|
8702
8791
|
if (error.code === "ENOENT")
|
|
8703
8792
|
return null;
|
|
8704
8793
|
if (error instanceof SyntaxError) {
|
|
8705
|
-
throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${
|
|
8794
|
+
throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${path25.basename(file)}: ${error.message}`);
|
|
8706
8795
|
}
|
|
8707
8796
|
throw error;
|
|
8708
8797
|
}
|
|
8709
8798
|
}
|
|
8710
8799
|
async function writeJson(file, data) {
|
|
8711
|
-
await
|
|
8712
|
-
await
|
|
8800
|
+
await mkdir14(path25.dirname(file), { recursive: true });
|
|
8801
|
+
await writeFile15(file, `${JSON.stringify(data, null, 2)}
|
|
8713
8802
|
`, "utf8");
|
|
8714
8803
|
}
|
|
8715
8804
|
|
|
@@ -8731,6 +8820,7 @@ var HostServer = class {
|
|
|
8731
8820
|
#workspaces;
|
|
8732
8821
|
#archive;
|
|
8733
8822
|
#pins;
|
|
8823
|
+
#sessionLinks;
|
|
8734
8824
|
#order;
|
|
8735
8825
|
#folders;
|
|
8736
8826
|
#settings;
|
|
@@ -8807,6 +8897,7 @@ var HostServer = class {
|
|
|
8807
8897
|
this.#workspaces = new WorkspaceRegistry(options2.dataDir);
|
|
8808
8898
|
this.#archive = new SessionArchive(options2.dataDir);
|
|
8809
8899
|
this.#pins = new SessionPins(options2.dataDir);
|
|
8900
|
+
this.#sessionLinks = new SessionLinks(options2.dataDir);
|
|
8810
8901
|
this.#order = new ListOrderStore(options2.dataDir);
|
|
8811
8902
|
this.#folders = new Folders(options2.dataDir);
|
|
8812
8903
|
this.#settings = new AppSettingsStore(options2.dataDir);
|
|
@@ -8852,6 +8943,7 @@ var HostServer = class {
|
|
|
8852
8943
|
await this.#workspaces.load();
|
|
8853
8944
|
await this.#archive.load();
|
|
8854
8945
|
await this.#pins.load();
|
|
8946
|
+
await this.#sessionLinks.load();
|
|
8855
8947
|
await this.#order.load();
|
|
8856
8948
|
await this.#folders.load();
|
|
8857
8949
|
await this.#carryOverWorkspaceIds();
|
|
@@ -9020,7 +9112,8 @@ var HostServer = class {
|
|
|
9020
9112
|
client.send({
|
|
9021
9113
|
type: "error",
|
|
9022
9114
|
message: error instanceof Error ? error.message : String(error),
|
|
9023
|
-
context: frame.type
|
|
9115
|
+
context: frame.type,
|
|
9116
|
+
..."requestId" in frame && typeof frame.requestId === "string" ? { requestId: frame.requestId } : {}
|
|
9024
9117
|
});
|
|
9025
9118
|
});
|
|
9026
9119
|
}
|
|
@@ -9063,10 +9156,12 @@ var HostServer = class {
|
|
|
9063
9156
|
protocol: PROTOCOL_VERSION,
|
|
9064
9157
|
hostId: this.#hostId,
|
|
9065
9158
|
hostVersion: this.#options.version,
|
|
9066
|
-
platform: process.platform
|
|
9159
|
+
platform: process.platform,
|
|
9160
|
+
features: ["session-routing", "session-links"]
|
|
9067
9161
|
});
|
|
9068
9162
|
this.#send(socket, { type: "workspace.list", ...this.#workspaceLists() });
|
|
9069
9163
|
this.#sendFolders(socket);
|
|
9164
|
+
this.#send(socket, { type: "session.links", links: this.#sessionLinks.all });
|
|
9070
9165
|
this.#send(socket, { type: "order.state", order: this.#order.current });
|
|
9071
9166
|
this.#sendLive(socket);
|
|
9072
9167
|
this.#auth.status().then((status) => this.#send(socket, { type: "auth.status", status })).catch(() => void 0);
|
|
@@ -9143,6 +9238,27 @@ var HostServer = class {
|
|
|
9143
9238
|
case "session.start":
|
|
9144
9239
|
await this.#startSession(socket, frame);
|
|
9145
9240
|
return;
|
|
9241
|
+
case "session.links.get":
|
|
9242
|
+
this.#send(socket, { type: "session.links", links: this.#sessionLinks.all });
|
|
9243
|
+
return;
|
|
9244
|
+
case "session.link": {
|
|
9245
|
+
const { sessions, archived } = await this.#listSessions(frame.workspaceId);
|
|
9246
|
+
const find = (id) => [...sessions, ...archived].find((s) => s.id === id || s.claudeSessionId === id);
|
|
9247
|
+
const child = find(frame.sessionId);
|
|
9248
|
+
const parent = frame.parentId === null ? null : find(frame.parentId);
|
|
9249
|
+
if (!child || frame.parentId !== null && !parent)
|
|
9250
|
+
throw new Error("\u0421\u0435\u0441\u0441\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 \u044D\u0442\u043E\u043C \u043F\u0440\u043E\u0435\u043A\u0442\u0435");
|
|
9251
|
+
await this.#sessionLinks.set({
|
|
9252
|
+
workspaceId: frame.workspaceId,
|
|
9253
|
+
sessionId: child.claudeSessionId ?? child.id,
|
|
9254
|
+
parentId: parent ? parent.claudeSessionId ?? parent.id : null,
|
|
9255
|
+
stage: frame.stage,
|
|
9256
|
+
kind: "linked",
|
|
9257
|
+
createdAt: Date.now()
|
|
9258
|
+
});
|
|
9259
|
+
this.#broadcast({ type: "session.links", links: this.#sessionLinks.all });
|
|
9260
|
+
return;
|
|
9261
|
+
}
|
|
9146
9262
|
case "session.close":
|
|
9147
9263
|
await this.#dropSession(frame.sessionId, "closed by client");
|
|
9148
9264
|
return;
|
|
@@ -10014,6 +10130,8 @@ var HostServer = class {
|
|
|
10014
10130
|
return false;
|
|
10015
10131
|
await this.#closeSide(sessionId);
|
|
10016
10132
|
await session.close(reason);
|
|
10133
|
+
if (this.#sessions.get(sessionId) !== session)
|
|
10134
|
+
return true;
|
|
10017
10135
|
this.#sessions.delete(sessionId);
|
|
10018
10136
|
this.#limitApproved.delete(sessionId);
|
|
10019
10137
|
this.#broadcast({ type: "session.closed", sessionId, reason });
|
|
@@ -10312,6 +10430,11 @@ var HostServer = class {
|
|
|
10312
10430
|
const workspace = this.#workspaces.find(frame.workspaceId);
|
|
10313
10431
|
if (!workspace)
|
|
10314
10432
|
throw new Error(`\u0412\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.workspaceId}`);
|
|
10433
|
+
if (frame.taskParent) {
|
|
10434
|
+
const list = await this.#listSessions(workspace.id);
|
|
10435
|
+
if (![...list.sessions, ...list.archived].some((s) => s.id === frame.taskParent || s.claudeSessionId === frame.taskParent))
|
|
10436
|
+
throw new Error("\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 \u044D\u0442\u043E\u043C \u043F\u0440\u043E\u0435\u043A\u0442\u0435");
|
|
10437
|
+
}
|
|
10315
10438
|
const provider = frame.provider ?? "claude";
|
|
10316
10439
|
if (!frame.resume && !this.#settings.current.enabledProviders.includes(provider)) {
|
|
10317
10440
|
throw new Error(`${provider === "codex" ? "Codex" : provider === "antigravity" ? "Antigravity" : "Claude"} \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445`);
|
|
@@ -10324,7 +10447,7 @@ var HostServer = class {
|
|
|
10324
10447
|
throw new Error("\u0421\u0435\u0441\u0441\u0438\u044F \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0434\u0440\u0443\u0433\u043E\u043C\u0443 \u043F\u0440\u043E\u0435\u043A\u0442\u0443");
|
|
10325
10448
|
const existing = codexRecord && !frame.fork ? this.#sessions.get(codexRecord.id) : null;
|
|
10326
10449
|
if (existing && existing.state !== "closed" && existing.state !== "error") {
|
|
10327
|
-
this.#
|
|
10450
|
+
await this.#announceStarted(socket, frame, existing);
|
|
10328
10451
|
return;
|
|
10329
10452
|
}
|
|
10330
10453
|
if (existing)
|
|
@@ -10346,7 +10469,7 @@ var HostServer = class {
|
|
|
10346
10469
|
this.#sessions.set(session2.id, session2);
|
|
10347
10470
|
session2.start();
|
|
10348
10471
|
this.#sendLive();
|
|
10349
|
-
this.#
|
|
10472
|
+
await this.#announceStarted(socket, frame, session2);
|
|
10350
10473
|
return;
|
|
10351
10474
|
}
|
|
10352
10475
|
const agyRecord = frame.resume ? await this.#antigravity.find(frame.resume) : null;
|
|
@@ -10366,7 +10489,7 @@ var HostServer = class {
|
|
|
10366
10489
|
this.#sessions.set(session2.id, session2);
|
|
10367
10490
|
session2.start();
|
|
10368
10491
|
this.#sendLive();
|
|
10369
|
-
this.#
|
|
10492
|
+
await this.#announceStarted(socket, frame, session2);
|
|
10370
10493
|
return;
|
|
10371
10494
|
}
|
|
10372
10495
|
const resumed = frame.resume && !frame.fork ? (await this.#workspaces.sessionsOnDisk(workspace.id)).find((info) => info.sessionId === frame.resume) : void 0;
|
|
@@ -10391,13 +10514,31 @@ var HostServer = class {
|
|
|
10391
10514
|
this.#sessions.set(session.id, session);
|
|
10392
10515
|
session.start();
|
|
10393
10516
|
this.#sendLive();
|
|
10394
|
-
this.#
|
|
10517
|
+
await this.#announceStarted(socket, frame, session);
|
|
10395
10518
|
if (!frame.continuesFrom)
|
|
10396
10519
|
return;
|
|
10397
10520
|
await this.#carryPin(workspace.id, frame.continuesFrom, session.id);
|
|
10398
10521
|
if (frame.fromHandoff)
|
|
10399
10522
|
await this.#markHandoffContinued(frame.continuesFrom);
|
|
10400
10523
|
}
|
|
10524
|
+
async #announceStarted(socket, frame, session) {
|
|
10525
|
+
const summary = session.summary();
|
|
10526
|
+
const parent = frame.taskParent ?? (frame.fork ? frame.resume : frame.continuesFrom);
|
|
10527
|
+
if (parent && (!frame.resume || frame.fork)) {
|
|
10528
|
+
await this.#sessionLinks.set({
|
|
10529
|
+
workspaceId: frame.workspaceId,
|
|
10530
|
+
sessionId: summary.claudeSessionId ?? summary.id,
|
|
10531
|
+
parentId: parent,
|
|
10532
|
+
stage: frame.taskStage ?? "other",
|
|
10533
|
+
kind: frame.fork ? "fork" : "continuation",
|
|
10534
|
+
createdAt: Date.now()
|
|
10535
|
+
});
|
|
10536
|
+
this.#broadcast({ type: "session.links", links: this.#sessionLinks.all });
|
|
10537
|
+
}
|
|
10538
|
+
this.#send(socket, { type: "session.summary", session: summary });
|
|
10539
|
+
if (frame.requestId)
|
|
10540
|
+
this.#send(socket, { type: "session.started", requestId: frame.requestId, session: summary });
|
|
10541
|
+
}
|
|
10401
10542
|
/**
|
|
10402
10543
|
* Отметить хэндофф продолженным — и сказать об этом всем окнам. Он остаётся
|
|
10403
10544
|
* лежать у прежней сессии, пока его не скроют, и без отметки её баннер звал
|
|
@@ -10481,11 +10622,19 @@ var HostServer = class {
|
|
|
10481
10622
|
});
|
|
10482
10623
|
session.on("summary", (summary) => {
|
|
10483
10624
|
this.#broadcast({ type: "session.summary", session: summary });
|
|
10625
|
+
if (summary.claudeSessionId && summary.claudeSessionId !== summary.id && this.#sessionLinks.all.some((r) => r.sessionId === summary.id || r.parentId === summary.id)) {
|
|
10626
|
+
void this.#sessionLinks.migrate(summary.id, summary.claudeSessionId).then(() => {
|
|
10627
|
+
this.#broadcast({ type: "session.links", links: this.#sessionLinks.all });
|
|
10628
|
+
}).catch((error) => console.error("[session.links]", error));
|
|
10629
|
+
}
|
|
10484
10630
|
if (!summary.claudeSessionId || !this.#pins.has(summary.id))
|
|
10485
10631
|
return;
|
|
10486
10632
|
void this.#migratePin(summary.id, summary.claudeSessionId);
|
|
10487
10633
|
});
|
|
10488
10634
|
session.on("claudeSessionId", ({ from, to }) => {
|
|
10635
|
+
void this.#sessionLinks.migrate(from, to).then(() => {
|
|
10636
|
+
this.#broadcast({ type: "session.links", links: this.#sessionLinks.all });
|
|
10637
|
+
}).catch((error) => console.error("[session.links]", error));
|
|
10489
10638
|
if (!this.#pins.has(from))
|
|
10490
10639
|
return;
|
|
10491
10640
|
void this.#migratePin(from, to);
|
|
@@ -10900,11 +11049,12 @@ var HostServer = class {
|
|
|
10900
11049
|
const sessions = [];
|
|
10901
11050
|
const archived = [];
|
|
10902
11051
|
for (const base of [...live, ...historical].sort((a, b) => b.updatedAt - a.updatedAt)) {
|
|
11052
|
+
const current = this.#sessions.get(base.id)?.summary() ?? base;
|
|
10903
11053
|
const pin = this.#pins.find(base.claudeSessionId ?? base.id);
|
|
10904
11054
|
const folderId = this.#folders.folderIdForSession(base.claudeSessionId ?? base.id);
|
|
10905
11055
|
const pinnedFolderId = this.#folders.folderIdForPinnedSession(base.claudeSessionId ?? base.id);
|
|
10906
11056
|
const summary = {
|
|
10907
|
-
...
|
|
11057
|
+
...current,
|
|
10908
11058
|
...pin ? { pinned: true, pinnedAt: pin.at } : {},
|
|
10909
11059
|
...folderId ? { folderId } : {},
|
|
10910
11060
|
...pinnedFolderId ? { pinnedFolderId } : {}
|
|
@@ -10946,8 +11096,8 @@ var HostServer = class {
|
|
|
10946
11096
|
return;
|
|
10947
11097
|
}
|
|
10948
11098
|
const url2 = new URL(req.url ?? "/", "http://localhost");
|
|
10949
|
-
const requested =
|
|
10950
|
-
const target = requested.startsWith(webRoot) && existsSync5(requested) && statSync3(requested).isFile() ? requested :
|
|
11099
|
+
const requested = path26.join(webRoot, path26.normalize(url2.pathname));
|
|
11100
|
+
const target = requested.startsWith(webRoot) && existsSync5(requested) && statSync3(requested).isFile() ? requested : path26.join(webRoot, "index.html");
|
|
10951
11101
|
if (!existsSync5(target)) {
|
|
10952
11102
|
res.writeHead(404).end("not found");
|
|
10953
11103
|
return;
|
|
@@ -10973,7 +11123,7 @@ function contentType(file) {
|
|
|
10973
11123
|
".svg": "image/svg+xml",
|
|
10974
11124
|
".woff2": "font/woff2"
|
|
10975
11125
|
};
|
|
10976
|
-
return types[
|
|
11126
|
+
return types[path26.extname(file)] ?? "application/octet-stream";
|
|
10977
11127
|
}
|
|
10978
11128
|
function antigravitySummary(record) {
|
|
10979
11129
|
return {
|
|
@@ -11002,8 +11152,8 @@ function antigravitySummary(record) {
|
|
|
11002
11152
|
}
|
|
11003
11153
|
|
|
11004
11154
|
// dist/ccv.js
|
|
11005
|
-
var HERE =
|
|
11006
|
-
var PACKAGE_ROOT =
|
|
11155
|
+
var HERE = path27.dirname(fileURLToPath(import.meta.url));
|
|
11156
|
+
var PACKAGE_ROOT = path27.resolve(HERE, "..");
|
|
11007
11157
|
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.
|
|
11008
11158
|
|
|
11009
11159
|
\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
|
|
@@ -11077,7 +11227,7 @@ var server = new HostServer({
|
|
|
11077
11227
|
dataDir: defaults.dataDir,
|
|
11078
11228
|
// UI лежит в пакете рядом с бандлом — это и есть разница между установленной
|
|
11079
11229
|
// утилитой и запуском из репозитория, где сборка живёт в `apps/web/dist`.
|
|
11080
|
-
webRoot: process.env.CCV_WEB_ROOT ??
|
|
11230
|
+
webRoot: process.env.CCV_WEB_ROOT ?? path27.join(PACKAGE_ROOT, "web"),
|
|
11081
11231
|
version,
|
|
11082
11232
|
relayUrl: defaults.relayUrl
|
|
11083
11233
|
});
|
|
@@ -11106,7 +11256,7 @@ for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
|
11106
11256
|
}
|
|
11107
11257
|
async function packageVersion() {
|
|
11108
11258
|
try {
|
|
11109
|
-
const text = await
|
|
11259
|
+
const text = await readFile18(path27.join(PACKAGE_ROOT, "package.json"), "utf8");
|
|
11110
11260
|
return JSON.parse(text).version ?? "0.0.0";
|
|
11111
11261
|
} catch {
|
|
11112
11262
|
return "0.0.0";
|