@dsh-sup/dsh-core-linux-x64 0.1.3-BETA.2 → 0.1.4-BETA.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.
Files changed (2) hide show
  1. package/core.cjs +63 -24
  2. package/package.json +1 -1
package/core.cjs CHANGED
@@ -68,13 +68,17 @@ var require_config = __commonJS({
68
68
  selfUpdateDir: null,
69
69
  pluginsProfileName: "web",
70
70
  packageName: "@deepseek-ai/dsh",
71
- // 默认候选镜像源 = 预设全集(npm官方/国内三大镜像)。自动模式按延迟测速选最快可达,
72
- // 与 UI 预设保持一致——系统任何 npm 拉包/更新都从这组候选选源。
71
+ // 默认候选镜像源。自动模式按延迟测速选最快可达,与 UI 预设/壳 mirror.rs 保持同一集合。
72
+ // ⚠ 每一项都经**真实 tarball 下载验证**(2026-09-11)——仅「元数据可读」不足以判定可用,
73
+ // 部分镜像只代理元数据、不代理 tarball。
74
+ // 已排除:mirrors.aliyun.com/npm、mirrors.tuna.tsinghua.edu.cn/npm(元数据不可用)。
73
75
  registries: [
74
76
  "https://registry.npmmirror.com",
75
77
  "https://registry.npmjs.org",
78
+ "https://repo.huaweicloud.com/repository/npm/",
76
79
  "https://mirrors.cloud.tencent.com/npm",
77
- "https://repo.huaweicloud.com/repository/npm/"
80
+ "https://npmreg.proxy.ustclug.org",
81
+ "https://r.cnpmjs.org"
78
82
  ],
79
83
  updateCheckEnabled: true,
80
84
  updateCheckIntervalMs: 36e5,
@@ -143,7 +147,7 @@ var require_version = __commonJS({
143
147
  var fs2 = require("node:fs");
144
148
  var path2 = require("node:path");
145
149
  function guardVersion() {
146
- if (true) return String("0.1.3-BETA.2");
150
+ if (true) return String("0.1.4-BETA.1");
147
151
  try {
148
152
  return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
149
153
  } catch {
@@ -1290,18 +1294,19 @@ var require_autostart = __commonJS({
1290
1294
  }
1291
1295
  function status() {
1292
1296
  if (isWindows) {
1293
- let on = false, watchdog = false;
1294
- try {
1295
- const out = execFileSync2("schtasks", ["/Query", "/TN", "DSH-Supervisor"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).toString();
1296
- on = out.includes("DSH-Supervisor");
1297
- } catch {
1298
- }
1299
- try {
1300
- const w = execFileSync2("schtasks", ["/Query", "/TN", "DSH-Supervisor-Watchdog"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).toString();
1301
- watchdog = w.includes("Watchdog");
1302
- } catch {
1303
- }
1304
- return { kind: "schtasks", on: on || watchdog, gui: on, watchdog };
1297
+ let guard = false, gui = false, watchdog = false;
1298
+ const has = (tn) => {
1299
+ try {
1300
+ const out = execFileSync2("schtasks", ["/Query", "/TN", tn], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).toString();
1301
+ return out.includes(tn);
1302
+ } catch {
1303
+ return false;
1304
+ }
1305
+ };
1306
+ guard = has("DSH-Supervisor");
1307
+ gui = has("DSH-Supervisor-GUI");
1308
+ watchdog = has("DSH-Supervisor-Watchdog");
1309
+ return { kind: "schtasks", on: guard || gui || watchdog, gui, watchdog, guard };
1305
1310
  }
1306
1311
  if (isMac) {
1307
1312
  const on = fs2.existsSync(laFile("com.dsh.supervisor"));
@@ -1343,9 +1348,13 @@ var require_autostart = __commonJS({
1343
1348
  fs2.writeFileSync(atmp, ps);
1344
1349
  fs2.renameSync(atmp, watchdogPs1);
1345
1350
  try {
1346
- execFileSync2("schtasks", ["/Create", "/TN", "DSH-Supervisor", "/SC", "ONLOGON", "/RL", "HIGHEST", "/F", "/TR", '"' + guiCommand() + '"']);
1351
+ execFileSync2("schtasks", ["/Create", "/TN", "DSH-Supervisor-GUI", "/SC", "ONLOGON", "/RL", "HIGHEST", "/F", "/TR", '"' + guiCommand() + '"']);
1347
1352
  } catch (e) {
1348
- errors.push("schtasks logon: " + e.message);
1353
+ errors.push("schtasks gui: " + e.message);
1354
+ }
1355
+ try {
1356
+ execFileSync2("schtasks", ["/Change", "/TN", "DSH-Supervisor", "/ENABLE"]);
1357
+ } catch {
1349
1358
  }
1350
1359
  try {
1351
1360
  execFileSync2("schtasks", ["/Create", "/TN", "DSH-Supervisor-Watchdog", "/SC", "MINUTE", "/MO", "5", "/RL", "HIGHEST", "/F", "/TR", 'powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "' + watchdogPs1 + '"']);
@@ -1358,7 +1367,11 @@ var require_autostart = __commonJS({
1358
1367
  } catch {
1359
1368
  }
1360
1369
  try {
1361
- execFileSync2("schtasks", ["/Delete", "/TN", "DSH-Supervisor", "/F"]);
1370
+ execFileSync2("schtasks", ["/Delete", "/TN", "DSH-Supervisor-GUI", "/F"]);
1371
+ } catch {
1372
+ }
1373
+ try {
1374
+ execFileSync2("schtasks", ["/Change", "/TN", "DSH-Supervisor", "/DISABLE"]);
1362
1375
  } catch {
1363
1376
  }
1364
1377
  try {
@@ -4281,8 +4294,10 @@ var require_dist = __commonJS({
4281
4294
  var REGISTRY_PRESETS = [
4282
4295
  { label: "npm \u5B98\u65B9", origin: "https://registry.npmjs.org" },
4283
4296
  { label: "npmmirror\uFF08\u56FD\u5185\xB7\u6DD8\u5B9D\uFF09", origin: "https://registry.npmmirror.com" },
4297
+ { label: "\u534E\u4E3A\u4E91\u955C\u50CF", origin: "https://repo.huaweicloud.com/repository/npm/" },
4284
4298
  { label: "\u817E\u8BAF\u4E91\u955C\u50CF", origin: "https://mirrors.cloud.tencent.com/npm" },
4285
- { label: "\u534E\u4E3A\u4E91\u955C\u50CF", origin: "https://repo.huaweicloud.com/repository/npm/" }
4299
+ { label: "\u4E2D\u79D1\u5927\u955C\u50CF", origin: "https://npmreg.proxy.ustclug.org" },
4300
+ { label: "cnpmjs \u955C\u50CF", origin: "https://r.cnpmjs.org" }
4286
4301
  ];
4287
4302
  var DistributionManager = class {
4288
4303
  constructor(opts) {
@@ -6813,7 +6828,13 @@ var require_frpmgr = __commonJS({
6813
6828
  } catch {
6814
6829
  return { ok: false, error: "no config generated yet" };
6815
6830
  }
6816
- const child = spawn(this.binPath, ["-c", this.configFile], { stdio: ["ignore", "pipe", "pipe"] });
6831
+ let child;
6832
+ try {
6833
+ child = spawn(this.binPath, ["-c", this.configFile], { stdio: ["ignore", "pipe", "pipe"] });
6834
+ } catch (e) {
6835
+ if (this._stableTimer) clearTimeout(this._stableTimer);
6836
+ return { ok: false, error: "frpc spawn failed: " + (e && e.message || e), needInstall: true };
6837
+ }
6817
6838
  this.child = child;
6818
6839
  const pushLog = (line) => {
6819
6840
  line = String(line).trim();
@@ -6821,6 +6842,11 @@ var require_frpmgr = __commonJS({
6821
6842
  this.logTail.push((/* @__PURE__ */ new Date()).toISOString().slice(11, 19) + " " + line);
6822
6843
  if (this.logTail.length > 200) this.logTail.splice(0, this.logTail.length - 200);
6823
6844
  };
6845
+ child.on("error", (e) => {
6846
+ pushLog("[spawn error] " + (e && e.message || e));
6847
+ if (this.child === child) this.child = null;
6848
+ if (!this._intentionalStop) this._scheduleRestart();
6849
+ });
6824
6850
  child.stdout.on("data", (c) => String(c).split("\n").forEach(pushLog));
6825
6851
  child.stderr.on("data", (c) => String(c).split("\n").forEach(pushLog));
6826
6852
  child.on("exit", (code) => {
@@ -18771,7 +18797,20 @@ var path = require("node:path");
18771
18797
  var os = require("node:os");
18772
18798
  var http = require("node:http");
18773
18799
  var { execFileSync } = require("node:child_process");
18774
- var ROOT = path.join(__dirname, "..");
18800
+ function findPackageRoot(start) {
18801
+ let d = start;
18802
+ for (let i = 0; i < 6; i += 1) {
18803
+ try {
18804
+ if (fs.existsSync(path.join(d, "package.json"))) return d;
18805
+ } catch {
18806
+ }
18807
+ const up = path.dirname(d);
18808
+ if (up === d) break;
18809
+ d = up;
18810
+ }
18811
+ return path.join(__dirname, "..");
18812
+ }
18813
+ var ROOT = findPackageRoot(__dirname);
18775
18814
  var SUPERVISOR_DIR = path.join(os.homedir(), ".dsh", "supervisor");
18776
18815
  var USER_CONFIG = path.join(SUPERVISOR_DIR, "config.json");
18777
18816
  var DEFAULT_CONFIG = Object.assign(
@@ -19036,12 +19075,12 @@ function cmdInstall() {
19036
19075
  } catch {
19037
19076
  }
19038
19077
  if (IS_WINDOWS) {
19039
- const target = path.join(__dirname, "dsh-supervisor");
19078
+ const target = path.join(ROOT, "bin", "dsh-supervisor");
19040
19079
  const shim = '@echo off\r\n"' + process.execPath + '" "' + target + '" %*\r\n';
19041
19080
  fs.writeFileSync(BIN_PATH, shim);
19042
19081
  console.log("[install] \u547D\u4EE4\u884C\u57AB\u7247: " + BIN_PATH + " \u2192 " + target);
19043
19082
  } else {
19044
- fs.symlinkSync(path.join(__dirname, "dsh-supervisor"), BIN_PATH);
19083
+ fs.symlinkSync(path.join(ROOT, "bin", "dsh-supervisor"), BIN_PATH);
19045
19084
  console.log("[install] \u547D\u4EE4\u884C\u94FE\u63A5: " + BIN_PATH + " \u2192 " + __dirname + "/dsh-supervisor");
19046
19085
  }
19047
19086
  if (!fs.existsSync(UNIT_TEMPLATE)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-sup/dsh-core-linux-x64",
3
- "version": "0.1.3-BETA.2",
3
+ "version": "0.1.4-BETA.1",
4
4
  "description": "DSH lifecycle guard core (Node launcher) for linux-x64 — requires Node >=18.",
5
5
  "license": "UNLICENSED",
6
6
  "os": [