@lob-ox/core-darwin-x64 0.0.11 → 0.0.12

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 +42 -20
  2. package/package.json +1 -1
package/core.cjs CHANGED
@@ -1471,7 +1471,7 @@ var require_version = __commonJS({
1471
1471
  var fs2 = require("node:fs");
1472
1472
  var path2 = require("node:path");
1473
1473
  function guardVersion() {
1474
- if (true) return String("0.0.11");
1474
+ if (true) return String("0.0.12");
1475
1475
  try {
1476
1476
  return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
1477
1477
  } catch {
@@ -1824,10 +1824,7 @@ var require_phase = __commonJS({
1824
1824
  STARTING: "starting",
1825
1825
  RUNNING: "running",
1826
1826
  STOPPING: "draining",
1827
- FAILED: "failed",
1828
- OBSERVED: "stopped",
1829
- RESTARTING: "starting",
1830
- BACKOFF: "failed"
1827
+ FAILED: "failed"
1831
1828
  };
1832
1829
  function entryToLegacyPhase(ph) {
1833
1830
  return ENTRY_TO_LEGACY[ph] || "STOPPED";
@@ -1865,10 +1862,7 @@ var require_fields = __commonJS({
1865
1862
  }
1866
1863
  function phase() {
1867
1864
  const e = record.storeOf();
1868
- const p = e.process || null;
1869
- const upper = entryToLegacyPhase(e.phase || "stopped");
1870
- if (upper === "STOPPED" && p && p.observedOnly && p.adopted) return "OBSERVED";
1871
- return upper;
1865
+ return entryToLegacyPhase(e.phase || "stopped");
1872
1866
  }
1873
1867
  function setPhase(upper) {
1874
1868
  const e = record.storeOf();
@@ -2126,11 +2120,11 @@ var require_desired = __commonJS({
2126
2120
  if (it) it.register("start");
2127
2121
  setCrashHalted(false);
2128
2122
  }
2129
- if (v === "running" && fields.phase() === "OBSERVED") {
2123
+ if (v === "running" && fields.observedOnly() && fields.accessors.adoptedPid.get() !== null) {
2130
2124
  fields.setObservedOnly(false);
2131
2125
  fields.setPhase("STOPPED");
2132
2126
  }
2133
- if (v === "stopped" && fields.phase() === "OBSERVED" && fields.observedOnly()) {
2127
+ if (v === "stopped" && fields.observedOnly() && fields.accessors.adoptedPid.get() !== null) {
2134
2128
  stopProcess("desired_stopped");
2135
2129
  }
2136
2130
  if (fields.desired() !== v) {
@@ -4830,7 +4824,10 @@ var require_collaborators = __commonJS({
4830
4824
  crashHalted: () => host._crashHalted
4831
4825
  });
4832
4826
  host.session = session;
4833
- host.sessionState = () => session.state();
4827
+ host.sessionState = () => {
4828
+ const p = String(host._mPhase ? host._mPhase() : "").toUpperCase();
4829
+ return p === "STARTING" || p === "RUNNING" ? "running" : "stopped";
4830
+ };
4834
4831
  host._setSessionState = (s) => {
4835
4832
  session.setState(s);
4836
4833
  };
@@ -10422,7 +10419,8 @@ var require_controller = __commonJS({
10422
10419
  host._crashHalted = v;
10423
10420
  },
10424
10421
  sessionState() {
10425
- return host._sessionState;
10422
+ const p = String(host._mPhase() || "").toUpperCase();
10423
+ return p === "STARTING" || p === "RUNNING" ? "running" : "stopped";
10426
10424
  },
10427
10425
  mChild() {
10428
10426
  return host._mChild();
@@ -10497,8 +10495,8 @@ var require_controller = __commonJS({
10497
10495
  if (managedAlive) {
10498
10496
  d.main().stopProcess("desired_stopped");
10499
10497
  } else if (adoptedAlive && d.mObservedOnly()) {
10500
- if (d.state().phase() !== "OBSERVED") {
10501
- d.state().setPhase("OBSERVED");
10498
+ d.state().setObservedOnly(true);
10499
+ if (d.state().phase() !== "STOPPED") {
10502
10500
  d.state().write();
10503
10501
  }
10504
10502
  } else if (portUp) {
@@ -10543,6 +10541,16 @@ var require_controller = __commonJS({
10543
10541
  d.intents().consume("start");
10544
10542
  }
10545
10543
  }
10544
+ {
10545
+ const nst = host.nativeManager ? host.nativeManager.status() : null;
10546
+ if (nst && nst.installed === false) {
10547
+ const ph0 = String(d.state().phase() || "").toUpperCase();
10548
+ if (ph0 === "STARTING" || ph0 === "RUNNING") {
10549
+ d.events().append("state_corrected", { from: ph0, to: "STOPPED", reason: "harness_not_installed" });
10550
+ d.state().setPhase("STOPPED");
10551
+ }
10552
+ }
10553
+ }
10546
10554
  switch (d.state().phase()) {
10547
10555
  case "STOPPED": {
10548
10556
  if (portUp) {
@@ -10623,7 +10631,7 @@ var require_controller = __commonJS({
10623
10631
  d.logger().error("tick error: " + (e && e.stack || e));
10624
10632
  } finally {
10625
10633
  d.writeTicking(false);
10626
- if (d.sessionState() === "starting") d.session().setState("running");
10634
+ if (d.sessionState() === "running") d.session().setState("running");
10627
10635
  try {
10628
10636
  d.control().syncDshView();
10629
10637
  } catch (e) {
@@ -11072,7 +11080,8 @@ var require_process2 = __commonJS({
11072
11080
  },
11073
11081
  _adoptObserved() {
11074
11082
  const d = depsOf(this);
11075
- d.state().setPhase("OBSERVED");
11083
+ d.state().setObservedOnly(true);
11084
+ d.state().setPhase("STOPPED");
11076
11085
  d.mSetAdopted(true);
11077
11086
  d.mSetObservedOnly(true);
11078
11087
  d.mSetChild(null);
@@ -12780,12 +12789,26 @@ var require_status = __commonJS({
12780
12789
  "src/app/facade/status.js"(exports2, module2) {
12781
12790
  "use strict";
12782
12791
  var { installId } = require_install_id();
12792
+ function deriveState(host) {
12793
+ const nat = host.nativeManager ? host.nativeManager.status() : null;
12794
+ if (nat && nat.installed === false) return "uninstalled";
12795
+ if (host._mMissingNotified && host._mMissingNotified()) return "command_missing";
12796
+ const ph = String(host._mPhase() || "").toUpperCase();
12797
+ if (ph === "RUNNING") return "running";
12798
+ if (ph === "STARTING") return "starting";
12799
+ if (ph === "FAILED") return "failed";
12800
+ return "stopped";
12801
+ }
12783
12802
  function statusSummary(host) {
12784
12803
  const dshPidNow = host._mChild() ? host._mChild().pid : host._mAdoptPid();
12785
12804
  return {
12786
12805
  desired: host._mDesired(),
12787
12806
  phase: host._mPhase(),
12788
- sessionState: host._sessionState,
12807
+ state: deriveState(host),
12808
+ sessionState: (function() {
12809
+ const p = String(host._mPhase() || "").toUpperCase();
12810
+ return p === "STARTING" || p === "RUNNING" ? "running" : "stopped";
12811
+ })(),
12789
12812
  dataDirProtected: Array.isArray(host._fileProtectStatus) ? host._fileProtectStatus.length > 0 && host._fileProtectStatus.every((r) => r.ok) : null,
12790
12813
  guardVersion: host.guardVersion,
12791
12814
  installId: installId(),
@@ -12800,7 +12823,7 @@ var require_status = __commonJS({
12800
12823
  lastRestartAt: host._mLastRestartAt(),
12801
12824
  upgradeHold: host._upgradeHold,
12802
12825
  shellHalted: host._shellHalted === true,
12803
- commandMissing: !!(host._mSpawnBlockedUntil() && Date.now() < host._mSpawnBlockedUntil()),
12826
+ commandMissing: !!(host._mMissingNotified && host._mMissingNotified()),
12804
12827
  dshTokenCaptured: !!(host.tokenService && host.tokenService.get("main")),
12805
12828
  tasks: host.tasks ? host.tasks.running().map((t) => ({ id: t.id, kind: t.kind, action: t.action, target: t.target, state: t.state })) : [],
12806
12829
  native: host.nativeManager ? host.nativeManager.status() : null,
@@ -15663,7 +15686,6 @@ var require_core5 = __commonJS({
15663
15686
  host._ticking = false;
15664
15687
  host.intents = new IntentLedger();
15665
15688
  host._stopping = false;
15666
- host._sessionState = "starting";
15667
15689
  host._crashHalted = false;
15668
15690
  host._shellHalted = false;
15669
15691
  host._upgradeHold = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lob-ox/core-darwin-x64",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "DSH lifecycle guard core (Node launcher) for darwin-x64 — requires Node >=18.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {