@wrongstack/desktop 0.289.0 → 0.291.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main/main.js
CHANGED
|
@@ -803,8 +803,8 @@ async function writeUiLocale(code) {
|
|
|
803
803
|
import { spawn } from "node:child_process";
|
|
804
804
|
import { randomBytes } from "node:crypto";
|
|
805
805
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
806
|
-
import * as fs2 from "node:fs/promises";
|
|
807
806
|
import { existsSync } from "node:fs";
|
|
807
|
+
import * as fs2 from "node:fs/promises";
|
|
808
808
|
import * as http from "node:http";
|
|
809
809
|
import { createRequire } from "node:module";
|
|
810
810
|
import * as net from "node:net";
|
|
@@ -1233,30 +1233,42 @@ var DesktopRuntimeManager = class extends EventEmitter2 {
|
|
|
1233
1233
|
}, 250);
|
|
1234
1234
|
}
|
|
1235
1235
|
};
|
|
1236
|
+
function hasChildExited(child) {
|
|
1237
|
+
return child.exitCode !== null || child.signalCode !== null;
|
|
1238
|
+
}
|
|
1239
|
+
function waitForChildExit(child, timeoutMs) {
|
|
1240
|
+
if (hasChildExited(child)) return Promise.resolve(true);
|
|
1241
|
+
return new Promise((resolve2) => {
|
|
1242
|
+
let settled = false;
|
|
1243
|
+
const finish = (exited) => {
|
|
1244
|
+
if (settled) return;
|
|
1245
|
+
settled = true;
|
|
1246
|
+
clearTimeout(timer);
|
|
1247
|
+
child.off("exit", onExit);
|
|
1248
|
+
resolve2(exited);
|
|
1249
|
+
};
|
|
1250
|
+
const onExit = () => finish(true);
|
|
1251
|
+
const timer = setTimeout(() => finish(hasChildExited(child)), timeoutMs);
|
|
1252
|
+
timer.unref?.();
|
|
1253
|
+
child.once("exit", onExit);
|
|
1254
|
+
if (hasChildExited(child)) finish(true);
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1236
1257
|
async function terminateProcessTree(child) {
|
|
1237
|
-
if (!child || child
|
|
1258
|
+
if (!child?.pid || hasChildExited(child)) return;
|
|
1238
1259
|
if (process.platform !== "win32") {
|
|
1260
|
+
const pid = child.pid;
|
|
1261
|
+
const exited = waitForChildExit(child, 5e3);
|
|
1239
1262
|
child.kill("SIGTERM");
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
process.kill(-child.pid, "SIGKILL");
|
|
1250
|
-
} catch {
|
|
1251
|
-
child.kill("SIGKILL");
|
|
1252
|
-
}
|
|
1253
|
-
resolve2();
|
|
1254
|
-
return;
|
|
1255
|
-
}
|
|
1256
|
-
setTimeout(check, 100);
|
|
1257
|
-
};
|
|
1258
|
-
check();
|
|
1259
|
-
});
|
|
1263
|
+
if (await exited) return;
|
|
1264
|
+
if (!hasChildExited(child)) {
|
|
1265
|
+
try {
|
|
1266
|
+
process.kill(-pid, "SIGKILL");
|
|
1267
|
+
} catch {
|
|
1268
|
+
child.kill("SIGKILL");
|
|
1269
|
+
}
|
|
1270
|
+
await waitForChildExit(child, 1e3);
|
|
1271
|
+
}
|
|
1260
1272
|
return;
|
|
1261
1273
|
}
|
|
1262
1274
|
await new Promise((resolve2) => {
|
|
@@ -1541,10 +1553,14 @@ async function touchGlobalProjectManifest(entry) {
|
|
|
1541
1553
|
} else {
|
|
1542
1554
|
projects.push({ ...entry, createdAt: entry.lastSeen });
|
|
1543
1555
|
}
|
|
1544
|
-
const sorted = projects.sort(
|
|
1556
|
+
const sorted = projects.sort(
|
|
1557
|
+
(a, b) => (b.lastSeen ?? b.createdAt ?? "").localeCompare(a.lastSeen ?? a.createdAt ?? "")
|
|
1558
|
+
).slice(0, 80);
|
|
1545
1559
|
await fs2.mkdir(path2.dirname(manifestFile), { recursive: true });
|
|
1546
1560
|
await atomicWrite2(manifestFile, `${JSON.stringify({ projects: sorted }, null, 2)}
|
|
1547
|
-
`, {
|
|
1561
|
+
`, {
|
|
1562
|
+
mode: 384
|
|
1563
|
+
});
|
|
1548
1564
|
return sorted;
|
|
1549
1565
|
}
|
|
1550
1566
|
async function removeGlobalProjectManifest(projectRoot) {
|
|
@@ -1597,9 +1613,7 @@ var DESKTOP_WEBUI_VIEWS = /* @__PURE__ */ new Set([
|
|
|
1597
1613
|
"chat",
|
|
1598
1614
|
"settings",
|
|
1599
1615
|
"goal",
|
|
1600
|
-
"
|
|
1601
|
-
"sddboard",
|
|
1602
|
-
"sddwizard",
|
|
1616
|
+
"sddhub",
|
|
1603
1617
|
"files",
|
|
1604
1618
|
"changes",
|
|
1605
1619
|
"sessions",
|
|
@@ -2143,7 +2157,6 @@ import { z } from "zod";
|
|
|
2143
2157
|
var RUNTIME_ID_PATTERN = /^[a-zA-Z0-9._:-]{3,120}$/;
|
|
2144
2158
|
var runtimeIdSchema = z.string().regex(RUNTIME_ID_PATTERN, "Invalid runtime ID format");
|
|
2145
2159
|
var pathSchema = z.string().min(1).max(1e4);
|
|
2146
|
-
var nonEmptyStringSchema = z.string().min(1);
|
|
2147
2160
|
var booleanSchema = z.boolean();
|
|
2148
2161
|
var numberSchema = z.number().int().finite();
|
|
2149
2162
|
var openProjectSchema = z.object({
|