c8ctl-plugin-nano 1.60.2 → 1.61.0

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/c8ctl-plugin.js +40 -9
  2. package/package.json +10 -9
package/c8ctl-plugin.js CHANGED
@@ -9310,6 +9310,7 @@ function formatSupervisorStatus(status) {
9310
9310
  const alive = d.pid ? isPidAlive(d.pid) : false;
9311
9311
  lines.push('Supervisor:');
9312
9312
  lines.push(` daemon pid: ${d.pid ?? '-'} ${alive ? '(alive)' : '(dead — stale state)'}`);
9313
+ if (d.version) lines.push(` version: ${d.version}`);
9313
9314
  if (d.startedAt) lines.push(` started: ${d.startedAt}`);
9314
9315
  if (d.socket) lines.push(` control: ${d.socket}`);
9315
9316
  const workers = Array.isArray(status.workers) ? status.workers : [];
@@ -9399,17 +9400,44 @@ function runningSupervisor() {
9399
9400
  return state && isPidAlive(state.pid) ? state : null;
9400
9401
  }
9401
9402
 
9403
+ /**
9404
+ * The canonical daemon-descriptor field set — the single source of truth for the
9405
+ * daemon object embedded in the persisted state (`persist()`), the socket
9406
+ * `status` frame (`statusFrame()`), and the socket-unreachable fallback
9407
+ * (`statusFromState()`). Routing all three through here guarantees no field
9408
+ * (e.g. `version`, `logFile`) can be added to one builder but silently dropped by
9409
+ * another, which is exactly how earlier rounds lost `version` and then `logFile`.
9410
+ */
9411
+ function supervisorDaemonDescriptor({ pid, startedAt, version, socket, logFile }) {
9412
+ return { pid, startedAt, version, socket, logFile };
9413
+ }
9414
+
9402
9415
  /** Synthesize a state-file-shaped object from a live `status` response. */
9403
9416
  function stateFromStatus(res, socketPath) {
9404
9417
  return {
9405
9418
  pid: res.daemon?.pid,
9406
9419
  startedAt: res.daemon?.startedAt,
9420
+ version: res.daemon?.version,
9407
9421
  socket: res.daemon?.socket || socketPath,
9408
9422
  logFile: res.daemon?.logFile,
9409
9423
  workers: res.workers || [],
9410
9424
  };
9411
9425
  }
9412
9426
 
9427
+ /**
9428
+ * Synthesize a `status`-shaped object from a persisted state file — the inverse
9429
+ * of `stateFromStatus`. Used by `supervisor status` when the daemon pid is alive
9430
+ * but its control socket is temporarily unreachable, so the fallback render must
9431
+ * carry every persisted daemon field (including `version`) to meet the feature's
9432
+ * visibility guarantee.
9433
+ */
9434
+ function statusFromState(running) {
9435
+ return {
9436
+ daemon: supervisorDaemonDescriptor(running),
9437
+ workers: (running.workers || []).map((w) => summarizeSupervisorWorker(w)),
9438
+ };
9439
+ }
9440
+
9413
9441
  /**
9414
9442
  * Resolve a live supervisor, healing a missing/stale state file. Returns the
9415
9443
  * running state (pid alive) if present; otherwise probes the deterministic
@@ -9524,6 +9552,11 @@ function installParentDeathWatchdog({ intervalMs = 2000, parentPid, onOrphan, re
9524
9552
  */
9525
9553
  async function runSupervisorDaemon() {
9526
9554
  const startedAt = new Date().toISOString();
9555
+ // The plugin version of THIS daemon process (read from its own pluginDir), so
9556
+ // `supervisor status` reports the version actually running — which may lag the
9557
+ // querying CLI after an upgrade-without-restart. Surfaced for version-based
9558
+ // debugging.
9559
+ const daemonVersion = pluginPackage().version;
9527
9560
  const { exec, entry } = c8ctlInvocation();
9528
9561
  const socketPath = getSupervisorSocketPath();
9529
9562
  const daemonLogFile = supervisorDaemonLogFile();
@@ -9570,10 +9603,9 @@ async function runSupervisorDaemon() {
9570
9603
  const persist = () => {
9571
9604
  try {
9572
9605
  writeSupervisorState({
9573
- pid: process.pid,
9574
- startedAt,
9575
- socket: socketPath,
9576
- logFile: daemonLogFile,
9606
+ ...supervisorDaemonDescriptor({
9607
+ pid: process.pid, startedAt, version: daemonVersion, socket: socketPath, logFile: daemonLogFile,
9608
+ }),
9577
9609
  workers: [...workers.values()].map((w) => ({
9578
9610
  id: w.id, profile: w.profile, args: w.args, pid: isPidAlive(w.pid) ? w.pid : null,
9579
9611
  startedAt: w.startedAt || null, restarts: w.restarts, lastExit: w.lastExit ?? null,
@@ -9815,7 +9847,7 @@ async function runSupervisorDaemon() {
9815
9847
  const statusFrame = (final, pub) => ({
9816
9848
  ok: true,
9817
9849
  type: 'status',
9818
- daemon: { pid: process.pid, startedAt, socket: socketPath, logFile: daemonLogFile },
9850
+ daemon: supervisorDaemonDescriptor({ pid: process.pid, startedAt, version: daemonVersion, socket: socketPath, logFile: daemonLogFile }),
9819
9851
  workers: pub || [...workers.values()].map(workerPublic),
9820
9852
  ...(final ? { final: true } : {}),
9821
9853
  });
@@ -10266,10 +10298,7 @@ async function supervisorStatusCmd() {
10266
10298
  if (res.ok) { printSupervisorStatus(logger, res); return; }
10267
10299
  } catch { /* fall back to state file below */ }
10268
10300
  // Socket unreachable but pid alive — render from the last persisted state.
10269
- printSupervisorStatus(logger, {
10270
- daemon: { pid: running.pid, startedAt: running.startedAt, socket: running.socket },
10271
- workers: (running.workers || []).map((w) => summarizeSupervisorWorker(w)),
10272
- });
10301
+ printSupervisorStatus(logger, statusFromState(running));
10273
10302
  }
10274
10303
 
10275
10304
  async function supervisorAddCmd(req, flags) {
@@ -13939,6 +13968,8 @@ export {
13939
13968
  formatDuration,
13940
13969
  summarizeSupervisorWorker,
13941
13970
  formatSupervisorStatus,
13971
+ statusFromState,
13972
+ supervisorDaemonDescriptor,
13942
13973
  formatSupervisorLogsLines,
13943
13974
  reageSupervisorStatus,
13944
13975
  clampToWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8ctl-plugin-nano",
3
- "version": "1.60.2",
3
+ "version": "1.61.0",
4
4
  "type": "module",
5
5
  "description": "c8ctl plugin to start, inspect, and stop a local Nano BPM (nanobpmn) cluster",
6
6
  "main": "c8ctl-plugin.js",
@@ -40,9 +40,10 @@
40
40
  "lint": "node --check c8ctl-plugin.js",
41
41
  "typecheck:supervisor": "tsc -p supervisor/tsconfig.json",
42
42
  "build:supervisor": "node supervisor/build.mjs",
43
+ "check:bundle": "node scripts/check-bundle.mjs",
43
44
  "vendor:effect": "node scripts/vendor-effect.mjs",
44
45
  "test:supervisor": "node --experimental-strip-types --test supervisor/test/*.test.ts",
45
- "test": "node --check c8ctl-plugin.js && npm run typecheck:supervisor && npm run build:supervisor && npm run test:supervisor && node --test --test-timeout=120000 --test-force-exit",
46
+ "test": "npm run check:bundle && node --check c8ctl-plugin.js && npm run typecheck:supervisor && npm run test:supervisor && node --test --test-timeout=120000 --test-force-exit",
46
47
  "prepublishOnly": "npm run typecheck:supervisor && npm run build:supervisor"
47
48
  },
48
49
  "license": "MIT",
@@ -73,12 +74,12 @@
73
74
  },
74
75
  "optionalDependencies": {
75
76
  "node-pty": "^1.0.0",
76
- "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.60.2",
77
- "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.60.2",
78
- "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.60.2",
79
- "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.60.2",
80
- "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.60.2",
81
- "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.60.2",
82
- "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.60.2"
77
+ "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.61.0",
78
+ "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.61.0",
79
+ "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.61.0",
80
+ "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.61.0",
81
+ "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.61.0",
82
+ "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.61.0",
83
+ "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.61.0"
83
84
  }
84
85
  }