@lob-ox/core-darwin-x64 0.0.26 → 0.0.27

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 +78 -10
  2. package/package.json +1 -1
package/core.cjs CHANGED
@@ -1642,7 +1642,7 @@ var require_version = __commonJS({
1642
1642
  var fs2 = require("node:fs");
1643
1643
  var path2 = require("node:path");
1644
1644
  function guardVersion() {
1645
- if (true) return String("0.0.26");
1645
+ if (true) return String("0.0.27");
1646
1646
  try {
1647
1647
  return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
1648
1648
  } catch {
@@ -2532,10 +2532,16 @@ var require_pm_client = __commonJS({
2532
2532
  return false;
2533
2533
  }
2534
2534
  }
2535
- function keepAlive(pid) {
2535
+ function keepAlive(pid, id) {
2536
2536
  const n = Number(pid);
2537
2537
  if (!Number.isInteger(n) || n <= 0) return false;
2538
- return post("/pm/keep-alive", { pid: n });
2538
+ const body = { pid: n };
2539
+ if (id !== void 0 && id !== null) {
2540
+ const s = String(id);
2541
+ if (!s) return false;
2542
+ body.id = s;
2543
+ }
2544
+ return post("/pm/keep-alive", body);
2539
2545
  }
2540
2546
  module2.exports = {
2541
2547
  FILE_NAME,
@@ -2580,6 +2586,8 @@ var require_desired = __commonJS({
2580
2586
  };
2581
2587
  const setManualRestart = typeof g.setManualRestart === "function" ? g.setManualRestart : () => {
2582
2588
  };
2589
+ const setShellHalted = typeof g.setShellHalted === "function" ? g.setShellHalted : null;
2590
+ const shellHalted = () => typeof g.getShellHalted === "function" ? g.getShellHalted() === true : false;
2583
2591
  const tick = () => {
2584
2592
  if (typeof g.tick === "function") g.tick();
2585
2593
  };
@@ -2600,7 +2608,19 @@ var require_desired = __commonJS({
2600
2608
  if (v === "stopped" && fields.observedOnly() && fields.accessors.adoptedPid.get() !== null) {
2601
2609
  stopProcess("desired_stopped");
2602
2610
  }
2603
- pmClient.setDesired("core", v);
2611
+ const reported = pmClient.setDesired("core", v) === true;
2612
+ if (reported && shellHalted() && setShellHalted) {
2613
+ setShellHalted(false);
2614
+ try {
2615
+ events().append("shell_halt_cleared", { reason: "shell_sync_ok", desired: v });
2616
+ } catch {
2617
+ }
2618
+ try {
2619
+ const l = logger();
2620
+ l && l.info && l.info("shellHalted \u5DF2\u6E05\uFF08\u58F3\u72B6\u6001\u540C\u6B65\u6210\u529F\u56DE\u6267\uFF09");
2621
+ } catch {
2622
+ }
2623
+ }
2604
2624
  if (fields.desired() !== v) {
2605
2625
  fields.setDesired(v);
2606
2626
  const ev = events();
@@ -2714,6 +2734,10 @@ var require_collaborator = __commonJS({
2714
2734
  getLogger: logger,
2715
2735
  setCrashHalted: g.setCrashHalted,
2716
2736
  setManualRestart: g.setManualRestart,
2737
+ // 壳状态同步成功回执 ⇒ 清「壳让停」旧标记。缺这两个 setter 时清除静默不执行
2738
+ // (desired.js 内部按 null 跳过)⇒ 那正是本次要修的静默失败,不能以同样形态引入。
2739
+ getShellHalted: g.getShellHalted,
2740
+ setShellHalted: g.setShellHalted,
2717
2741
  tick: g.tick,
2718
2742
  stopProcess: g.stopProcess
2719
2743
  });
@@ -5241,6 +5265,32 @@ var require_native = __commonJS({
5241
5265
  var require_changelog = __commonJS({
5242
5266
  "src/shared/changelog.json"(exports2, module2) {
5243
5267
  module2.exports = [
5268
+ {
5269
+ version: "0.0.27",
5270
+ date: "2026-10-19",
5271
+ sections: [
5272
+ {
5273
+ title: "\u4FEE\u590D",
5274
+ items: [
5275
+ "\u58F3\u7684\u8FDB\u7A0B\u8868\u8BB0\u7684\u5185\u6838 pid \u662F\u5165\u53E3\u8FDB\u7A0B\uFF08--run-guard\uFF09\u800C\u4E0D\u662F\u771F\u5185\u6838\uFF0C\u6052\u5DEE\u4E00\u4E2A\u8FDB\u7A0B\u4EE3 \u21D2 \u58F3\u505C\u5185\u6838\u65F6\u6740\u7684\u662F\u5165\u53E3\uFF0C\u771F\u5185\u6838\u53EA\u9760 JobObject \u8FDE\u5E26\u6740\u3002\u73B0\u7531\u5185\u6838\u5728\u542F\u52A8\u540E\u7ECF /pm/keep-alive \u81EA\u62A5\u81EA\u5DF1\u7684 pid\uFF0C\u58F3\u66F4\u65B0\u8FDB\u7A0B\u8868\uFF08update_pid \u7A84\u65B9\u6CD5\uFF0C\u53EA\u8BBE pid \u4E0D\u52A8\u5176\u4ED6\u5B57\u6BB5\uFF09",
5276
+ "\u8FDE\u5E26\u4FEE\u590D\u4E09\u5904\u56E0 pid \u6052\u7A7A\u800C\u6C38\u4E0D\u6210\u7ACB\u7684\u5224\u636E\uFF1Aalready\uFF08\u6BCF\u6B21\u542F\u52A8\u90FD\u8D70\u5B8C\u6574\u5E8F\u5217\uFF09\u3001serving\uFF08\u9762\u677F\u663E\u793A\u300C\u6CA1\u5728\u670D\u52A1\u300D\uFF09\u3001heal_candidates\uFF08core \u4ECE\u4E0D\u62A5\u76F8\u4F4D \u21D2 \u81EA\u6108\u51E0\u4E4E\u4E0D\u53EF\u89E6\u53D1\uFF09"
5277
+ ]
5278
+ },
5279
+ {
5280
+ title: "\u6539\u8FDB",
5281
+ items: [
5282
+ "\u58F3 API /pm/keep-alive \u7684 role \u6539\u4E3A\u53EF\u9009\u3001\u7F3A\u7701 managed\uFF1A\u5185\u6838\u4FA7\u53EA\u53D1 {pid}\uFF0C\u800C\u58F3\u4FA7 role \u8BCD\u8868\u53EA\u6709\u4E00\u4E2A\u503C \u21D2 \u4E0D\u8981\u6C42\u8C03\u7528\u65B9\u8BF4\u4E00\u53E5\u58F3\u5DF2\u7ECF\u77E5\u9053\u7684\u8BDD",
5283
+ "DSH \u4E3B\u5B9E\u4F8B\u7684 keep-alive \u6539\u62A5 id 'dsh-main' \u800C\u975E 'core'\uFF1A\u58F3\u7684 core \u884C\u4EE3\u8868\u5185\u6838\u8FDB\u7A0B\uFF08Priority::Core\uFF09\uFF0C\u4E0E DSH \u4E3B\u5B9E\u4F8B\u5171\u7528\u4E00\u4E2A id \u4F1A\u8BA9\u540E\u5199\u8986\u76D6\u524D\u5199"
5284
+ ]
5285
+ },
5286
+ {
5287
+ title: "\u6E05\u7406",
5288
+ items: [
5289
+ "\u5220 core/test/ 22 \u4E2A\u6D4B\u8BD5\u6587\u4EF6\uFF0821 \u4E2A *-test.js + README\uFF09\u2014\u2014\u5B83\u4EEC\u66FE\u670D\u52A1\u5DF2\u62C6\u9664\u7684 standards-check\uFF0C\u5168\u4ED3\u96F6 require\u3001CI \u96F6\u5F15\u7528\u3001package.json \u65E0 test \u811A\u672C"
5290
+ ]
5291
+ }
5292
+ ]
5293
+ },
5244
5294
  {
5245
5295
  version: "0.0.26",
5246
5296
  date: "2026-10-18",
@@ -7179,7 +7229,7 @@ var require_process = __commonJS({
7179
7229
  d.logger().info("spawn pid=" + child.pid + " cmd=" + d.spawnCommand().join(" "));
7180
7230
  if (child.pid) {
7181
7231
  try {
7182
- pmClient.keepAlive(child.pid);
7232
+ pmClient.keepAlive(child.pid, "dsh-main");
7183
7233
  } catch {
7184
7234
  }
7185
7235
  }
@@ -9255,7 +9305,8 @@ var require_portable = __commonJS({
9255
9305
  }
9256
9306
  if (opts.keepAlive) {
9257
9307
  try {
9258
- require_pm_client().keepAlive(child.pid);
9308
+ const ka = require_pm_client().keepAlive;
9309
+ ka(child.pid, opts.keepAliveId || void 0);
9259
9310
  } catch {
9260
9311
  }
9261
9312
  }
@@ -12947,7 +12998,7 @@ var require_process3 = __commonJS({
12947
12998
  this._writeIdentity(child.pid);
12948
12999
  if (child.pid) {
12949
13000
  try {
12950
- pmClient.keepAlive(child.pid);
13001
+ pmClient.keepAlive(child.pid, this.name);
12951
13002
  } catch {
12952
13003
  }
12953
13004
  }
@@ -23667,7 +23718,7 @@ var require_lifecycle3 = __commonJS({
23667
23718
  const ctx = sandbox.launchCtx(instancesRoot, deps.dshBin, inst);
23668
23719
  _cleanStaleUnit("dsh-web@" + inst.id, ctx);
23669
23720
  try {
23670
- service.startTransient({ unit: "dsh-web@" + inst.id, cmd: cmdArr, env, workingDir, port: ctx.port, pidFile: ctx.pidFile, anchors: ctx.anchors, keepAlive: true });
23721
+ service.startTransient({ unit: "dsh-web@" + inst.id, cmd: cmdArr, env, workingDir, port: ctx.port, pidFile: ctx.pidFile, anchors: ctx.anchors, keepAlive: true, keepAliveId: "sandbox" });
23671
23722
  } catch (e) {
23672
23723
  const msg = "systemd \u542F\u52A8\u5931\u8D25: " + (e.message || e);
23673
23724
  inst.state.lastError = msg;
@@ -28822,7 +28873,7 @@ var require_frp = __commonJS({
28822
28873
  this.child = child;
28823
28874
  if (child.pid) {
28824
28875
  try {
28825
- pmClient.keepAlive(child.pid);
28876
+ pmClient.keepAlive(child.pid, "frpc");
28826
28877
  } catch {
28827
28878
  }
28828
28879
  }
@@ -29776,7 +29827,24 @@ function cmdDaemon() {
29776
29827
  });
29777
29828
  sup.start();
29778
29829
  console.log("[supervisor] daemon started, pid=" + process.pid);
29779
- traceExit("started", { version: true ? "0.0.26" : null });
29830
+ traceExit("started", { version: true ? "0.0.27" : null });
29831
+ try {
29832
+ const pmc = require_pm_client();
29833
+ if (pmc.keepAlive(process.pid, "core")) {
29834
+ sup.events.append("core_pid_reported", { pid: process.pid, semantics: "request_sent" });
29835
+ } else {
29836
+ const ep = pmc.endpoint();
29837
+ sup.events.append("core_pid_not_reported", {
29838
+ pid: process.pid,
29839
+ reason: ep ? "post_failed" : "shell_absent"
29840
+ });
29841
+ }
29842
+ } catch (e) {
29843
+ try {
29844
+ sup.events.append("core_pid_report_failed", { pid: process.pid, error: e && e.message || String(e) });
29845
+ } catch {
29846
+ }
29847
+ }
29780
29848
  process.on("exit", (code) => {
29781
29849
  if (!_exiting) {
29782
29850
  traceExit("process_exit", { code });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lob-ox/core-darwin-x64",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "DSH lifecycle guard core (Node launcher) for darwin-x64 — requires Node >=22.12.0.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {