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

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 +97 -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.28");
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,51 @@ 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.28",
5270
+ date: "2026-10-19",
5271
+ sections: [
5272
+ {
5273
+ title: "\u4FEE\u590D",
5274
+ items: [
5275
+ "\u58F3\u6536\u5230\u5185\u6838\u81EA\u62A5\u7684 pid \u65F6\u8FDB\u7A0B\u8868\u91CC\u8FD8\u6CA1\u6709 core \u884C\uFF08\u5185\u6838\u5728\u300C\u5C31\u7EEA\u90A3\u4E00\u523B\u300D\u81EA\u62A5\uFF0C\u800C\u58F3\u5728 await_daemon \u8FD4\u56DE\u4E4B\u540E\u624D\u5EFA\u884C\uFF09\u21D2 \u66F4\u65B0\u5FC5\u672A\u547D\u4E2D\u3002\u73B0\u6539\u4E3A\u5148\u5EFA\u884C\uFF08\u5165\u53E3 pid \u5360\u4F4D\uFF09\u518D\u7B49\u5C31\u7EEA\uFF0C\u81EA\u62A5\u7684 pid \u7531 update_pid \u6539\u5199\u90A3\u4E00\u884C",
5276
+ "\u58F3\u7684\u5951\u7EA6\u515C\u5E95\u4E0E\u8BA4\u9886\u767B\u8BB0\u4F1A\u62FF\u58F3\u81EA\u5DF1\u53BB\u6740/\u767B\u8BB0\uFF1Alive_contract_owner \u8BFB\u7684 guard-mgmt.json \u7684 pid \u662F\u58F3\u81EA\u5DF1\uFF08export_port \u5199 std::process::id\uFF09\uFF0C\u800C\u5B83\u6052\u771F \u21D2 shutdown_all \u7684\u515C\u5E95\u4F1A kill_tree_pid(\u58F3\u81EA\u5DF1) \u81EA\u6740\uFF0Cregister_core \u4F1A\u628A\u81EA\u5DF1 adopt_spawned \u8FDB core \u884C\u8BA9 already \u8BEF\u89E6\uFF08\u5185\u6838\u6C38\u8FDC\u8D77\u4E0D\u6765\uFF09\u3002\u4E24\u5904\u90FD\u52A0\u4E86 pid != \u81EA\u5DF1\u7684\u8FC7\u6EE4"
5277
+ ]
5278
+ },
5279
+ {
5280
+ title: "\u6E05\u7406",
5281
+ items: [
5282
+ "\u4E24\u5904 edit \u6B8B\u7559\uFF08\u4E24\u6761\u8BED\u53E5\u6324\u4E00\u884C\uFF09\uFF1Aguardctl.rs \u7684 })); \u4E0E let outcome\u3001bounded.rs \u7684\u4E24\u6761 extern \u58F0\u660E\u3002\u8BED\u6CD5\u5BF9\u6240\u4EE5 CI \u6293\u4E0D\u5230\uFF0C\u4F46\u4EBA\u8BFB\u96BE\u53D7"
5283
+ ]
5284
+ }
5285
+ ]
5286
+ },
5287
+ {
5288
+ version: "0.0.27",
5289
+ date: "2026-10-19",
5290
+ sections: [
5291
+ {
5292
+ title: "\u4FEE\u590D",
5293
+ items: [
5294
+ "\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",
5295
+ "\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"
5296
+ ]
5297
+ },
5298
+ {
5299
+ title: "\u6539\u8FDB",
5300
+ items: [
5301
+ "\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",
5302
+ "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"
5303
+ ]
5304
+ },
5305
+ {
5306
+ title: "\u6E05\u7406",
5307
+ items: [
5308
+ "\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"
5309
+ ]
5310
+ }
5311
+ ]
5312
+ },
5244
5313
  {
5245
5314
  version: "0.0.26",
5246
5315
  date: "2026-10-18",
@@ -7179,7 +7248,7 @@ var require_process = __commonJS({
7179
7248
  d.logger().info("spawn pid=" + child.pid + " cmd=" + d.spawnCommand().join(" "));
7180
7249
  if (child.pid) {
7181
7250
  try {
7182
- pmClient.keepAlive(child.pid);
7251
+ pmClient.keepAlive(child.pid, "dsh-main");
7183
7252
  } catch {
7184
7253
  }
7185
7254
  }
@@ -9255,7 +9324,8 @@ var require_portable = __commonJS({
9255
9324
  }
9256
9325
  if (opts.keepAlive) {
9257
9326
  try {
9258
- require_pm_client().keepAlive(child.pid);
9327
+ const ka = require_pm_client().keepAlive;
9328
+ ka(child.pid, opts.keepAliveId || void 0);
9259
9329
  } catch {
9260
9330
  }
9261
9331
  }
@@ -12947,7 +13017,7 @@ var require_process3 = __commonJS({
12947
13017
  this._writeIdentity(child.pid);
12948
13018
  if (child.pid) {
12949
13019
  try {
12950
- pmClient.keepAlive(child.pid);
13020
+ pmClient.keepAlive(child.pid, this.name);
12951
13021
  } catch {
12952
13022
  }
12953
13023
  }
@@ -23667,7 +23737,7 @@ var require_lifecycle3 = __commonJS({
23667
23737
  const ctx = sandbox.launchCtx(instancesRoot, deps.dshBin, inst);
23668
23738
  _cleanStaleUnit("dsh-web@" + inst.id, ctx);
23669
23739
  try {
23670
- service.startTransient({ unit: "dsh-web@" + inst.id, cmd: cmdArr, env, workingDir, port: ctx.port, pidFile: ctx.pidFile, anchors: ctx.anchors, keepAlive: true });
23740
+ 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
23741
  } catch (e) {
23672
23742
  const msg = "systemd \u542F\u52A8\u5931\u8D25: " + (e.message || e);
23673
23743
  inst.state.lastError = msg;
@@ -28822,7 +28892,7 @@ var require_frp = __commonJS({
28822
28892
  this.child = child;
28823
28893
  if (child.pid) {
28824
28894
  try {
28825
- pmClient.keepAlive(child.pid);
28895
+ pmClient.keepAlive(child.pid, "frpc");
28826
28896
  } catch {
28827
28897
  }
28828
28898
  }
@@ -29776,7 +29846,24 @@ function cmdDaemon() {
29776
29846
  });
29777
29847
  sup.start();
29778
29848
  console.log("[supervisor] daemon started, pid=" + process.pid);
29779
- traceExit("started", { version: true ? "0.0.26" : null });
29849
+ traceExit("started", { version: true ? "0.0.28" : null });
29850
+ try {
29851
+ const pmc = require_pm_client();
29852
+ if (pmc.keepAlive(process.pid, "core")) {
29853
+ sup.events.append("core_pid_reported", { pid: process.pid, semantics: "request_sent" });
29854
+ } else {
29855
+ const ep = pmc.endpoint();
29856
+ sup.events.append("core_pid_not_reported", {
29857
+ pid: process.pid,
29858
+ reason: ep ? "post_failed" : "shell_absent"
29859
+ });
29860
+ }
29861
+ } catch (e) {
29862
+ try {
29863
+ sup.events.append("core_pid_report_failed", { pid: process.pid, error: e && e.message || String(e) });
29864
+ } catch {
29865
+ }
29866
+ }
29780
29867
  process.on("exit", (code) => {
29781
29868
  if (!_exiting) {
29782
29869
  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.28",
4
4
  "description": "DSH lifecycle guard core (Node launcher) for darwin-x64 — requires Node >=22.12.0.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {