@wrongstack/desktop 0.295.0 → 0.296.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/main.js +96 -90
- package/dist/main/main.js.map +4 -4
- package/dist/renderer/assets/{index-Bih3lXdg.js → index-DS-X1ScP.js} +215 -243
- package/dist/renderer/assets/index-DS-X1ScP.js.map +1 -0
- package/dist/renderer/index.html +1 -1
- package/package.json +5 -5
- package/dist/renderer/assets/index-Bih3lXdg.js.map +0 -1
package/dist/main/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/main/main.ts
|
|
2
|
-
import * as
|
|
3
|
-
import { resolveWstackPaths as
|
|
2
|
+
import * as path5 from "node:path";
|
|
3
|
+
import { resolveWstackPaths as resolveWstackPaths3 } from "@wrongstack/core/utils";
|
|
4
4
|
import {
|
|
5
5
|
app as app2,
|
|
6
6
|
BaseWindow,
|
|
@@ -40,9 +40,9 @@ function handleFileOpen(filePath) {
|
|
|
40
40
|
}
|
|
41
41
|
var pendingOpenFilePath = null;
|
|
42
42
|
function drainPendingOpenFilePath() {
|
|
43
|
-
const
|
|
43
|
+
const path6 = pendingOpenFilePath;
|
|
44
44
|
pendingOpenFilePath = null;
|
|
45
|
-
return
|
|
45
|
+
return path6;
|
|
46
46
|
}
|
|
47
47
|
function firstOpenFileArg(argv) {
|
|
48
48
|
if (process.platform !== "darwin") return null;
|
|
@@ -145,7 +145,7 @@ var DesktopAgentBridge = class extends EventEmitter {
|
|
|
145
145
|
conversation.error = void 0;
|
|
146
146
|
this.emitChanged(conversation);
|
|
147
147
|
this.emitReconnectEvent(conversation, "connecting");
|
|
148
|
-
return new Promise((
|
|
148
|
+
return new Promise((resolve3, reject) => {
|
|
149
149
|
const ws = new WebSocket(wsUrl);
|
|
150
150
|
conversation.ws = ws;
|
|
151
151
|
const timeout = setTimeout(() => {
|
|
@@ -163,7 +163,7 @@ var DesktopAgentBridge = class extends EventEmitter {
|
|
|
163
163
|
conversation.connectionState = markConnectionOpen(conversation.connectionState);
|
|
164
164
|
this.emitChanged(conversation);
|
|
165
165
|
this.emitReconnectEvent(conversation, "connected");
|
|
166
|
-
|
|
166
|
+
resolve3();
|
|
167
167
|
});
|
|
168
168
|
ws.on("message", (data) => {
|
|
169
169
|
this.handleServerMessage(conversation, data.toString());
|
|
@@ -910,22 +910,66 @@ async function writeUiLocale(code) {
|
|
|
910
910
|
import { spawn } from "node:child_process";
|
|
911
911
|
import { randomBytes } from "node:crypto";
|
|
912
912
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
913
|
-
import { existsSync } from "node:fs";
|
|
914
913
|
import * as fs2 from "node:fs/promises";
|
|
915
914
|
import * as http from "node:http";
|
|
916
|
-
import { createRequire } from "node:module";
|
|
917
915
|
import * as net from "node:net";
|
|
918
916
|
import * as os from "node:os";
|
|
919
|
-
import * as
|
|
920
|
-
import { fileURLToPath } from "node:url";
|
|
917
|
+
import * as path3 from "node:path";
|
|
921
918
|
import {
|
|
922
919
|
atomicWrite as atomicWrite2,
|
|
923
920
|
buildChildEnv,
|
|
924
921
|
projectSlug,
|
|
925
|
-
resolveWstackPaths,
|
|
922
|
+
resolveWstackPaths as resolveWstackPaths2,
|
|
926
923
|
toErrorMessage,
|
|
927
924
|
wstackGlobalRoot as wstackGlobalRoot2
|
|
928
925
|
} from "@wrongstack/core/utils";
|
|
926
|
+
|
|
927
|
+
// src/main/runtime-manager-paths.ts
|
|
928
|
+
import { existsSync } from "node:fs";
|
|
929
|
+
import { createRequire } from "node:module";
|
|
930
|
+
import * as path2 from "node:path";
|
|
931
|
+
import { fileURLToPath } from "node:url";
|
|
932
|
+
import { resolveWstackPaths } from "@wrongstack/core/utils";
|
|
933
|
+
function resolveWebUiEntry() {
|
|
934
|
+
if (process.env["WRONGSTACK_WEBUI_ENTRY"]) {
|
|
935
|
+
return path2.resolve(process.env["WRONGSTACK_WEBUI_ENTRY"]);
|
|
936
|
+
}
|
|
937
|
+
const require2 = createRequire(import.meta.url);
|
|
938
|
+
try {
|
|
939
|
+
const serverPkgPath = require2.resolve("@wrongstack/webui-server/package.json");
|
|
940
|
+
const candidate = path2.join(path2.dirname(serverPkgPath), "dist", "server", "entry.js");
|
|
941
|
+
if (existsSync(candidate)) return candidate;
|
|
942
|
+
} catch {
|
|
943
|
+
}
|
|
944
|
+
const serverIndex = require2.resolve("@wrongstack/webui-server");
|
|
945
|
+
return path2.join(path2.dirname(serverIndex), "server", "entry.js");
|
|
946
|
+
}
|
|
947
|
+
function resolveWebUiDistDir() {
|
|
948
|
+
if (process.env["WRONGSTACK_WEBUI_DIST"]) {
|
|
949
|
+
return path2.resolve(process.env["WRONGSTACK_WEBUI_DIST"]);
|
|
950
|
+
}
|
|
951
|
+
const require2 = createRequire(import.meta.url);
|
|
952
|
+
const serverEntry = require2.resolve("@wrongstack/webui");
|
|
953
|
+
const candidate = path2.dirname(serverEntry);
|
|
954
|
+
if (existsSync(candidate)) return candidate;
|
|
955
|
+
throw new Error(
|
|
956
|
+
`WebUI frontend assets not found at ${candidate}. Build @wrongstack/webui or set WRONGSTACK_WEBUI_DIST.`
|
|
957
|
+
);
|
|
958
|
+
}
|
|
959
|
+
function rendererIndexPath() {
|
|
960
|
+
return new URL("../renderer/index.html", import.meta.url).href;
|
|
961
|
+
}
|
|
962
|
+
function preloadPath() {
|
|
963
|
+
return fileURLToPath(new URL("../preload/preload.cjs", import.meta.url));
|
|
964
|
+
}
|
|
965
|
+
function webuiPreloadPath() {
|
|
966
|
+
return fileURLToPath(new URL("../preload/webui-preload.cjs", import.meta.url));
|
|
967
|
+
}
|
|
968
|
+
function desktopSettingsWorkspaceRoot() {
|
|
969
|
+
return path2.join(resolveWstackPaths({ projectRoot: process.cwd() }).configDir, "settings");
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// src/main/runtime-manager.ts
|
|
929
973
|
var HTTP_PORT_START = 34560;
|
|
930
974
|
var WS_PORT_START = 34660;
|
|
931
975
|
var START_TIMEOUT_MS = 3e4;
|
|
@@ -938,8 +982,8 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
938
982
|
}
|
|
939
983
|
trustBoundary;
|
|
940
984
|
runtimes = /* @__PURE__ */ new Map();
|
|
941
|
-
stateFile =
|
|
942
|
-
|
|
985
|
+
stateFile = path3.join(
|
|
986
|
+
resolveWstackPaths2({ projectRoot: process.cwd() }).configDir,
|
|
943
987
|
"desktop.json"
|
|
944
988
|
);
|
|
945
989
|
recentProjects = [];
|
|
@@ -1046,7 +1090,7 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1046
1090
|
return url.toString();
|
|
1047
1091
|
}
|
|
1048
1092
|
async openProject(projectRoot, options = {}) {
|
|
1049
|
-
const resolved =
|
|
1093
|
+
const resolved = path3.resolve(projectRoot);
|
|
1050
1094
|
const stat3 = await fs2.stat(resolved).catch(() => null);
|
|
1051
1095
|
if (!stat3?.isDirectory()) throw new Error(`Not a directory: ${resolved}`);
|
|
1052
1096
|
const kind = options.kind ?? "project";
|
|
@@ -1232,12 +1276,12 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1232
1276
|
);
|
|
1233
1277
|
}
|
|
1234
1278
|
async registerProject(projectRoot) {
|
|
1235
|
-
const resolved =
|
|
1279
|
+
const resolved = path3.resolve(projectRoot);
|
|
1236
1280
|
const stat3 = await fs2.stat(resolved).catch(() => null);
|
|
1237
1281
|
if (!stat3?.isDirectory()) throw new Error(`Not a directory: ${resolved}`);
|
|
1238
1282
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1239
1283
|
const entry = {
|
|
1240
|
-
name:
|
|
1284
|
+
name: path3.basename(resolved) || resolved,
|
|
1241
1285
|
root: resolved,
|
|
1242
1286
|
slug: projectSlug(resolved),
|
|
1243
1287
|
lastSeen: now,
|
|
@@ -1247,7 +1291,7 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1247
1291
|
this.emitChanged();
|
|
1248
1292
|
}
|
|
1249
1293
|
async unregisterProject(projectRoot) {
|
|
1250
|
-
const resolved =
|
|
1294
|
+
const resolved = path3.resolve(projectRoot);
|
|
1251
1295
|
this.registeredProjects = await removeGlobalProjectManifest(resolved);
|
|
1252
1296
|
await this.saveDesktopState();
|
|
1253
1297
|
this.emitChanged();
|
|
@@ -1274,10 +1318,10 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1274
1318
|
this.emitChanged();
|
|
1275
1319
|
}
|
|
1276
1320
|
async touchProject(projectRoot) {
|
|
1277
|
-
const resolved =
|
|
1321
|
+
const resolved = path3.resolve(projectRoot);
|
|
1278
1322
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1279
1323
|
const entry = {
|
|
1280
|
-
name:
|
|
1324
|
+
name: path3.basename(resolved) || resolved,
|
|
1281
1325
|
root: resolved,
|
|
1282
1326
|
slug: projectSlug(resolved),
|
|
1283
1327
|
lastSeen: now,
|
|
@@ -1310,7 +1354,7 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1310
1354
|
openProjects,
|
|
1311
1355
|
openProjectSessions,
|
|
1312
1356
|
activeRuntimeId: normalizeRuntimeId(parsed.activeRuntimeId) ?? null,
|
|
1313
|
-
activeProjectRoot: typeof parsed.activeProjectRoot === "string" && parsed.activeProjectRoot.trim() ?
|
|
1357
|
+
activeProjectRoot: typeof parsed.activeProjectRoot === "string" && parsed.activeProjectRoot.trim() ? path3.resolve(parsed.activeProjectRoot) : null,
|
|
1314
1358
|
window: normalizeWindowState(parsed.window)
|
|
1315
1359
|
};
|
|
1316
1360
|
} catch {
|
|
@@ -1325,7 +1369,7 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1325
1369
|
}
|
|
1326
1370
|
}
|
|
1327
1371
|
async saveDesktopState() {
|
|
1328
|
-
await fs2.mkdir(
|
|
1372
|
+
await fs2.mkdir(path3.dirname(this.stateFile), { recursive: true });
|
|
1329
1373
|
const liveProjectSessions = Array.from(this.runtimes.values()).filter((runtime) => runtime.status !== "stopped" && runtime.kind === "project").map((runtime) => runtimeToSessionState(runtime));
|
|
1330
1374
|
const openProjectSessions = liveProjectSessions.length === 0 && !this.workspaceRestoreCompleted ? [...this.restoreProjectSessions] : liveProjectSessions;
|
|
1331
1375
|
const openProjects = openProjectSessions.map((session) => session.root);
|
|
@@ -1371,14 +1415,14 @@ function hasChildExited(child) {
|
|
|
1371
1415
|
}
|
|
1372
1416
|
function waitForChildExit(child, timeoutMs) {
|
|
1373
1417
|
if (hasChildExited(child)) return Promise.resolve(true);
|
|
1374
|
-
return new Promise((
|
|
1418
|
+
return new Promise((resolve3) => {
|
|
1375
1419
|
let settled = false;
|
|
1376
1420
|
const finish = (exited) => {
|
|
1377
1421
|
if (settled) return;
|
|
1378
1422
|
settled = true;
|
|
1379
1423
|
clearTimeout(timer);
|
|
1380
1424
|
child.off("exit", onExit);
|
|
1381
|
-
|
|
1425
|
+
resolve3(exited);
|
|
1382
1426
|
};
|
|
1383
1427
|
const onExit = () => finish(true);
|
|
1384
1428
|
const timer = setTimeout(() => finish(hasChildExited(child)), timeoutMs);
|
|
@@ -1404,12 +1448,12 @@ async function terminateProcessTree(child) {
|
|
|
1404
1448
|
}
|
|
1405
1449
|
return;
|
|
1406
1450
|
}
|
|
1407
|
-
await new Promise((
|
|
1451
|
+
await new Promise((resolve3) => {
|
|
1408
1452
|
let settled = false;
|
|
1409
1453
|
const finish = () => {
|
|
1410
1454
|
if (settled) return;
|
|
1411
1455
|
settled = true;
|
|
1412
|
-
|
|
1456
|
+
resolve3();
|
|
1413
1457
|
};
|
|
1414
1458
|
const timer = setTimeout(finish, 3e3);
|
|
1415
1459
|
timer.unref?.();
|
|
@@ -1467,7 +1511,7 @@ function normalizePathList(value) {
|
|
|
1467
1511
|
const roots = [];
|
|
1468
1512
|
for (const item of value) {
|
|
1469
1513
|
if (typeof item !== "string" || !item.trim()) continue;
|
|
1470
|
-
const resolved =
|
|
1514
|
+
const resolved = path3.resolve(item);
|
|
1471
1515
|
roots.push(resolved);
|
|
1472
1516
|
}
|
|
1473
1517
|
return roots.slice(0, 12);
|
|
@@ -1482,7 +1526,7 @@ function normalizeSessionStateList(value, fallbackRoots) {
|
|
|
1482
1526
|
const candidate = item;
|
|
1483
1527
|
if (typeof candidate.root !== "string" || !candidate.root.trim()) continue;
|
|
1484
1528
|
const session = {
|
|
1485
|
-
root:
|
|
1529
|
+
root: path3.resolve(candidate.root)
|
|
1486
1530
|
};
|
|
1487
1531
|
const runtimeId = normalizeRuntimeId(candidate.runtimeId);
|
|
1488
1532
|
if (runtimeId) session.runtimeId = runtimeId;
|
|
@@ -1535,7 +1579,7 @@ function usedPorts(runtimes) {
|
|
|
1535
1579
|
return ports;
|
|
1536
1580
|
}
|
|
1537
1581
|
function nextRuntimeName(runtimes, root, kind) {
|
|
1538
|
-
const baseName =
|
|
1582
|
+
const baseName = path3.basename(root) || root;
|
|
1539
1583
|
if (kind !== "project") return baseName;
|
|
1540
1584
|
const liveSameRoot = Array.from(runtimes.values()).filter(
|
|
1541
1585
|
(runtime) => runtime.kind === "project" && samePath(runtime.root, root) && runtime.status !== "stopped"
|
|
@@ -1543,7 +1587,7 @@ function nextRuntimeName(runtimes, root, kind) {
|
|
|
1543
1587
|
return liveSameRoot === 0 ? baseName : `${baseName} #${liveSameRoot + 1}`;
|
|
1544
1588
|
}
|
|
1545
1589
|
function pathKey(value) {
|
|
1546
|
-
const resolved =
|
|
1590
|
+
const resolved = path3.resolve(value);
|
|
1547
1591
|
return os.platform() === "win32" ? resolved.toLowerCase() : resolved;
|
|
1548
1592
|
}
|
|
1549
1593
|
async function findFreePort(startPort, exclude) {
|
|
@@ -1554,11 +1598,11 @@ async function findFreePort(startPort, exclude) {
|
|
|
1554
1598
|
throw new Error(`No free local port found near ${startPort}`);
|
|
1555
1599
|
}
|
|
1556
1600
|
function isPortFree(port) {
|
|
1557
|
-
return new Promise((
|
|
1601
|
+
return new Promise((resolve3) => {
|
|
1558
1602
|
const server = net.createServer();
|
|
1559
|
-
server.once("error", () =>
|
|
1603
|
+
server.once("error", () => resolve3(false));
|
|
1560
1604
|
server.once("listening", () => {
|
|
1561
|
-
server.close(() =>
|
|
1605
|
+
server.close(() => resolve3(true));
|
|
1562
1606
|
});
|
|
1563
1607
|
server.listen(port, "127.0.0.1");
|
|
1564
1608
|
});
|
|
@@ -1568,12 +1612,12 @@ function waitForHttpReady(baseUrl, token, timeoutMs) {
|
|
|
1568
1612
|
const url = new URL(baseUrl);
|
|
1569
1613
|
url.searchParams.set("token", token);
|
|
1570
1614
|
url.searchParams.set("shell", "desktop");
|
|
1571
|
-
return new Promise((
|
|
1615
|
+
return new Promise((resolve3, reject) => {
|
|
1572
1616
|
const probe = () => {
|
|
1573
1617
|
const req = http.get(url, (res) => {
|
|
1574
1618
|
res.resume();
|
|
1575
1619
|
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 500) {
|
|
1576
|
-
|
|
1620
|
+
resolve3();
|
|
1577
1621
|
return;
|
|
1578
1622
|
}
|
|
1579
1623
|
retry();
|
|
@@ -1594,34 +1638,8 @@ function waitForHttpReady(baseUrl, token, timeoutMs) {
|
|
|
1594
1638
|
probe();
|
|
1595
1639
|
});
|
|
1596
1640
|
}
|
|
1597
|
-
function resolveWebUiEntry() {
|
|
1598
|
-
if (process.env["WRONGSTACK_WEBUI_ENTRY"]) {
|
|
1599
|
-
return path2.resolve(process.env["WRONGSTACK_WEBUI_ENTRY"]);
|
|
1600
|
-
}
|
|
1601
|
-
const require2 = createRequire(import.meta.url);
|
|
1602
|
-
try {
|
|
1603
|
-
const serverPkgPath = require2.resolve("@wrongstack/webui-server/package.json");
|
|
1604
|
-
const candidate = path2.join(path2.dirname(serverPkgPath), "dist", "server", "entry.js");
|
|
1605
|
-
if (existsSync(candidate)) return candidate;
|
|
1606
|
-
} catch {
|
|
1607
|
-
}
|
|
1608
|
-
const serverIndex = require2.resolve("@wrongstack/webui-server");
|
|
1609
|
-
return path2.join(path2.dirname(serverIndex), "server", "entry.js");
|
|
1610
|
-
}
|
|
1611
|
-
function resolveWebUiDistDir() {
|
|
1612
|
-
if (process.env["WRONGSTACK_WEBUI_DIST"]) {
|
|
1613
|
-
return path2.resolve(process.env["WRONGSTACK_WEBUI_DIST"]);
|
|
1614
|
-
}
|
|
1615
|
-
const require2 = createRequire(import.meta.url);
|
|
1616
|
-
const serverEntry = require2.resolve("@wrongstack/webui");
|
|
1617
|
-
const candidate = path2.dirname(serverEntry);
|
|
1618
|
-
if (existsSync(candidate)) return candidate;
|
|
1619
|
-
throw new Error(
|
|
1620
|
-
`WebUI frontend assets not found at ${candidate}. Build @wrongstack/webui or set WRONGSTACK_WEBUI_DIST.`
|
|
1621
|
-
);
|
|
1622
|
-
}
|
|
1623
1641
|
async function readGlobalProjectManifest() {
|
|
1624
|
-
const manifestFile =
|
|
1642
|
+
const manifestFile = path3.join(wstackGlobalRoot2(), "projects.json");
|
|
1625
1643
|
try {
|
|
1626
1644
|
const raw = await fs2.readFile(manifestFile, "utf8");
|
|
1627
1645
|
return normalizeProjectManifest(JSON.parse(raw));
|
|
@@ -1656,8 +1674,8 @@ function normalizeProjectEntry(value) {
|
|
|
1656
1674
|
if (!value || typeof value !== "object") return null;
|
|
1657
1675
|
const candidate = value;
|
|
1658
1676
|
if (typeof candidate.root !== "string" || !candidate.root.trim()) return null;
|
|
1659
|
-
const root =
|
|
1660
|
-
const name = typeof candidate.name === "string" && candidate.name.trim() ? candidate.name.trim() :
|
|
1677
|
+
const root = path3.resolve(candidate.root);
|
|
1678
|
+
const name = typeof candidate.name === "string" && candidate.name.trim() ? candidate.name.trim() : path3.basename(root) || root;
|
|
1661
1679
|
const entry = {
|
|
1662
1680
|
name,
|
|
1663
1681
|
root,
|
|
@@ -1670,12 +1688,12 @@ function normalizeProjectEntry(value) {
|
|
|
1670
1688
|
entry.createdAt = candidate.createdAt.trim();
|
|
1671
1689
|
}
|
|
1672
1690
|
if (typeof candidate.lastWorkingDir === "string" && candidate.lastWorkingDir.trim()) {
|
|
1673
|
-
entry.lastWorkingDir =
|
|
1691
|
+
entry.lastWorkingDir = path3.resolve(candidate.lastWorkingDir);
|
|
1674
1692
|
}
|
|
1675
1693
|
return entry;
|
|
1676
1694
|
}
|
|
1677
1695
|
async function touchGlobalProjectManifest(entry) {
|
|
1678
|
-
const manifestFile =
|
|
1696
|
+
const manifestFile = path3.join(wstackGlobalRoot2(), "projects.json");
|
|
1679
1697
|
const projects = await readGlobalProjectManifest();
|
|
1680
1698
|
const existing = projects.find((p) => samePath(p.root, entry.root));
|
|
1681
1699
|
if (existing) {
|
|
@@ -1689,7 +1707,7 @@ async function touchGlobalProjectManifest(entry) {
|
|
|
1689
1707
|
const sorted = projects.sort(
|
|
1690
1708
|
(a, b) => (b.lastSeen ?? b.createdAt ?? "").localeCompare(a.lastSeen ?? a.createdAt ?? "")
|
|
1691
1709
|
).slice(0, 80);
|
|
1692
|
-
await fs2.mkdir(
|
|
1710
|
+
await fs2.mkdir(path3.dirname(manifestFile), { recursive: true });
|
|
1693
1711
|
await atomicWrite2(manifestFile, `${JSON.stringify({ projects: sorted }, null, 2)}
|
|
1694
1712
|
`, {
|
|
1695
1713
|
mode: 384
|
|
@@ -1697,33 +1715,21 @@ async function touchGlobalProjectManifest(entry) {
|
|
|
1697
1715
|
return sorted;
|
|
1698
1716
|
}
|
|
1699
1717
|
async function removeGlobalProjectManifest(projectRoot) {
|
|
1700
|
-
const manifestFile =
|
|
1701
|
-
const resolved =
|
|
1718
|
+
const manifestFile = path3.join(wstackGlobalRoot2(), "projects.json");
|
|
1719
|
+
const resolved = path3.resolve(projectRoot);
|
|
1702
1720
|
const projects = (await readGlobalProjectManifest()).filter(
|
|
1703
1721
|
(project) => !samePath(project.root, resolved)
|
|
1704
1722
|
);
|
|
1705
|
-
await fs2.mkdir(
|
|
1723
|
+
await fs2.mkdir(path3.dirname(manifestFile), { recursive: true });
|
|
1706
1724
|
await atomicWrite2(manifestFile, `${JSON.stringify({ projects }, null, 2)}
|
|
1707
1725
|
`, { mode: 384 });
|
|
1708
1726
|
return projects;
|
|
1709
1727
|
}
|
|
1710
1728
|
function samePath(left, right) {
|
|
1711
|
-
const a =
|
|
1712
|
-
const b =
|
|
1729
|
+
const a = path3.resolve(left);
|
|
1730
|
+
const b = path3.resolve(right);
|
|
1713
1731
|
return os.platform() === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
1714
1732
|
}
|
|
1715
|
-
function rendererIndexPath() {
|
|
1716
|
-
return fileURLToPath(new URL("../renderer/index.html", import.meta.url));
|
|
1717
|
-
}
|
|
1718
|
-
function preloadPath() {
|
|
1719
|
-
return fileURLToPath(new URL("../preload/preload.cjs", import.meta.url));
|
|
1720
|
-
}
|
|
1721
|
-
function webuiPreloadPath() {
|
|
1722
|
-
return fileURLToPath(new URL("../preload/webui-preload.cjs", import.meta.url));
|
|
1723
|
-
}
|
|
1724
|
-
function desktopSettingsWorkspaceRoot() {
|
|
1725
|
-
return path2.join(resolveWstackPaths({ projectRoot: process.cwd() }).configDir, "settings");
|
|
1726
|
-
}
|
|
1727
1733
|
|
|
1728
1734
|
// src/main/main.ts
|
|
1729
1735
|
import { watchProviderConfig } from "@wrongstack/core/storage";
|
|
@@ -2127,14 +2133,14 @@ var DesktopWebuiController = class {
|
|
|
2127
2133
|
if (this.views.get(entry.runtimeId) !== entry || !entry.url) return Promise.resolve(false);
|
|
2128
2134
|
const requestId = `${entry.runtimeId}:${Date.now()}:${++this.commandSequence}`;
|
|
2129
2135
|
const outbound = { ...command, requestId };
|
|
2130
|
-
return new Promise((
|
|
2136
|
+
return new Promise((resolve3) => {
|
|
2131
2137
|
const fallbackTimer = setTimeout(() => {
|
|
2132
2138
|
if (!this.pendingAcks.has(requestId)) return;
|
|
2133
2139
|
if (this.views.get(entry.runtimeId) !== entry || entry.view.webContents.isDestroyed()) return;
|
|
2134
2140
|
void entry.view.webContents.executeJavaScript(buildWebuiCommandFallbackScript(outbound), true).catch(() => void 0);
|
|
2135
2141
|
}, WEBUI_COMMAND_FALLBACK_MS);
|
|
2136
2142
|
const timer = setTimeout(() => this.settleAck(requestId, false), WEBUI_COMMAND_ACK_TIMEOUT_MS);
|
|
2137
|
-
this.pendingAcks.set(requestId, { runtimeId: entry.runtimeId, timer, fallbackTimer, resolve:
|
|
2143
|
+
this.pendingAcks.set(requestId, { runtimeId: entry.runtimeId, timer, fallbackTimer, resolve: resolve3 });
|
|
2138
2144
|
try {
|
|
2139
2145
|
entry.view.webContents.send(IPC.webuiCommand, outbound);
|
|
2140
2146
|
if (this.activeRuntimeId === entry.runtimeId) entry.view.webContents.focus();
|
|
@@ -2332,7 +2338,7 @@ function getSidebarWidth(windowWidth, collapsed) {
|
|
|
2332
2338
|
import { Menu as Menu2 } from "electron";
|
|
2333
2339
|
|
|
2334
2340
|
// src/main/menu/projects-menu.ts
|
|
2335
|
-
import
|
|
2341
|
+
import path4 from "node:path";
|
|
2336
2342
|
function buildProjectsMenu(runtimes, actions, t) {
|
|
2337
2343
|
const projectGroups = groupProjectRuntimesForMenu(runtimes);
|
|
2338
2344
|
const menu = [
|
|
@@ -2466,7 +2472,7 @@ function groupProjectRuntimesForMenu(runtimes) {
|
|
|
2466
2472
|
}
|
|
2467
2473
|
groups.set(key, {
|
|
2468
2474
|
key,
|
|
2469
|
-
name:
|
|
2475
|
+
name: path4.basename(runtime.root) || runtime.name,
|
|
2470
2476
|
root: runtime.root,
|
|
2471
2477
|
sessions: [runtime]
|
|
2472
2478
|
});
|
|
@@ -2957,8 +2963,8 @@ if (process.platform === "win32") {
|
|
|
2957
2963
|
}
|
|
2958
2964
|
app2.setPath(
|
|
2959
2965
|
"userData",
|
|
2960
|
-
|
|
2961
|
-
|
|
2966
|
+
path5.join(
|
|
2967
|
+
resolveWstackPaths3({ projectRoot: process.cwd() }).configDir,
|
|
2962
2968
|
"desktop",
|
|
2963
2969
|
"electron-profile"
|
|
2964
2970
|
)
|
|
@@ -3011,7 +3017,7 @@ function revealInExplorer(root) {
|
|
|
3011
3017
|
if (!authorization.allowed) return;
|
|
3012
3018
|
return shell2.openPath(root).catch((err) => {
|
|
3013
3019
|
if (process.platform === "darwin") {
|
|
3014
|
-
void shell2.openPath(
|
|
3020
|
+
void shell2.openPath(path5.dirname(root)).catch(() => void 0);
|
|
3015
3021
|
}
|
|
3016
3022
|
console.error(
|
|
3017
3023
|
JSON.stringify({
|