c8ctl-plugin-nano 1.71.0 → 1.72.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.
package/README.md CHANGED
@@ -1363,7 +1363,10 @@ c8ctl nano supervisor reload # roll it into the running fleet, zero downtime
1363
1363
  since the daemon is a thin process manager. `supervisor status` shows an
1364
1364
  `on disk:` line flagging "update available" whenever the code on disk has
1365
1365
  advanced past the running daemon, so you know when a reload (or restart) is
1366
- worthwhile.
1366
+ worthwhile. While a reload is in progress, `supervisor status` also prints a
1367
+ `reload:` line (`rolling N/M adopted — draining <id> — do not restart the
1368
+ daemon`) so a detached operator can see the roll without staying attached to
1369
+ the streaming `reload` command.
1367
1370
 
1368
1371
  ### Surviving SSH logout: `supervisor install` / `uninstall`
1369
1372
 
package/c8ctl-plugin.js CHANGED
@@ -15130,6 +15130,24 @@ function formatSupervisorStatus(status) {
15130
15130
  if (onDiskVersion && d.version && onDiskVersion !== d.version) {
15131
15131
  lines.push(` on disk: ${onDiskVersion} (update available — run \`c8ctl nano supervisor reload\` to adopt new worker code; restart the daemon for new supervisor code)`);
15132
15132
  }
15133
+ // A rolling reload can run for a long time (each worker drains in-flight
15134
+ // work). Surface it on every `status` so a detached operator — or someone
15135
+ // who only ever polls status — can see the roll is live and must not
15136
+ // `restart` the daemon. `reload` is the progress object from the live
15137
+ // socket frame; absent on the socket-unreachable fallback.
15138
+ const roll = status.reload;
15139
+ if (roll && roll.inProgress) {
15140
+ const done = Array.isArray(roll.reloaded) ? roll.reloaded.length : 0;
15141
+ const total = Number(roll.total) || 0;
15142
+ const current = roll.current ? String(roll.current) : null;
15143
+ const parts = [`rolling ${done}/${total} adopted`];
15144
+ if (current) parts.push(`draining ${current}`);
15145
+ if (onDiskVersion && d.version && onDiskVersion !== d.version) {
15146
+ parts.push(`${d.version} → ${onDiskVersion}`);
15147
+ }
15148
+ parts.push('do not restart the daemon');
15149
+ lines.push(` reload: ${parts.join(' — ')}`);
15150
+ }
15133
15151
  if (d.startedAt) lines.push(` started: ${d.startedAt}`);
15134
15152
  if (d.socket) lines.push(` control: ${d.socket}`);
15135
15153
  const workers = Array.isArray(status.workers) ? status.workers : [];
@@ -15421,6 +15439,11 @@ async function runSupervisorDaemon() {
15421
15439
  // them one at a time (so the fleet keeps serving). This flag rejects a second
15422
15440
  // concurrent reload — a single rolling pass owns the fleet until it finishes.
15423
15441
  let reloading = false;
15442
+ // Progress for `status.reload` while `reloading` is true. Reset when the
15443
+ // roll starts; `reloadCurrent` is the id in `reloadWorker` right now.
15444
+ let reloadTargets = [];
15445
+ let reloadDone = [];
15446
+ let reloadCurrent = null;
15424
15447
  // Live-view monitor: tracks the last-broadcast fleet signature so we push a
15425
15448
  // refreshed status to attached consoles only on real change (see below).
15426
15449
  let monitorTimer = null;
@@ -15839,12 +15862,24 @@ async function runSupervisorDaemon() {
15839
15862
  // shutting down. Never clears `supervisor.json` — a reload is not a stop.
15840
15863
  const runReload = async (ids, sock) => {
15841
15864
  reloading = true;
15865
+ reloadTargets = [...ids];
15866
+ reloadDone = [];
15867
+ reloadCurrent = null;
15842
15868
  const reloaded = [];
15843
15869
  const skipped = [];
15844
15870
  let interrupted = false;
15845
15871
  try {
15846
15872
  for (let i = 0; i < ids.length; i++) {
15847
15873
  const id = ids[i];
15874
+ reloadCurrent = id;
15875
+ // Broadcast (not just to the initiating socket) on every target
15876
+ // transition so every attached console sees the drain progress and the
15877
+ // "do not restart the daemon" warning even with periodic monitoring
15878
+ // disabled (NANO_SUPERVISOR_MONITOR_MS=0). The initiator is itself an
15879
+ // attach client, so it is covered too.
15880
+ if (!shuttingDown) {
15881
+ try { broadcast(statusFrame(false)); } catch { /* best effort */ }
15882
+ }
15848
15883
  // If the daemon starts shutting down mid-roll, the remaining workers
15849
15884
  // never adopt the new code — record them as skipped (and flag the roll
15850
15885
  // interrupted) so the terminal frame can't report a clean success for a
@@ -15868,6 +15903,8 @@ async function runSupervisorDaemon() {
15868
15903
  const ok = await reloadWorker(id);
15869
15904
  if (ok) {
15870
15905
  reloaded.push(id);
15906
+ reloadDone.push(id);
15907
+ reloadCurrent = null;
15871
15908
  // Emit the per-worker "reloaded" progress signal ONLY after the final
15872
15909
  // success gate above confirmed a live, still-current replacement — not
15873
15910
  // at spawn time. A crash/spawn-fail makes `reloadWorker` return false
@@ -15888,13 +15925,24 @@ async function runSupervisorDaemon() {
15888
15925
  for (let j = i; j < ids.length; j++) skipped.push(ids[j]);
15889
15926
  break;
15890
15927
  }
15891
- try { sock.write(encodeFrame(statusFrame(false))); } catch { /* client gone */ }
15928
+ try { broadcast(statusFrame(false)); } catch { /* best effort */ }
15892
15929
  }
15893
15930
  } catch (err) {
15894
15931
  interrupted = true;
15895
15932
  dlog(`reload error: ${err?.message || err}`);
15896
15933
  } finally {
15897
15934
  reloading = false;
15935
+ reloadCurrent = null;
15936
+ reloadTargets = [];
15937
+ reloadDone = [];
15938
+ // Clearing the progress flags may not change the monitor signature (it may
15939
+ // already have sampled the final replacement mid-readiness-wait), and the
15940
+ // terminal `reloaded` frame goes only to the initiating socket — so push a
15941
+ // fresh status to every attached console now, or they could keep showing
15942
+ // the "rolling … do not restart the daemon" line after completion.
15943
+ if (!shuttingDown && attachClients.size > 0) {
15944
+ try { broadcast(statusFrame(false)); } catch { /* best effort */ }
15945
+ }
15898
15946
  // Terminal success requires BOTH a clean pass (not interrupted) AND nothing
15899
15947
  // skipped: a skipped worker (failed reload, or removed/absent mid-roll) is a
15900
15948
  // partial reload, so `ok: true` would let the streaming client exit zero and
@@ -15927,6 +15975,18 @@ async function runSupervisorDaemon() {
15927
15975
  // i.e. a `supervisor reload` would adopt new worker code (and a daemon
15928
15976
  // restart new supervisor code). Best-effort; falls back to the daemon's own.
15929
15977
  pluginVersion: (() => { try { return pluginPackage().version; } catch { return daemonVersion; } })(),
15978
+ // Live rolling-reload progress so `supervisor status` (and the attach
15979
+ // view) show a roll that was detached or started by someone else.
15980
+ // `inProgress` is the latch; `current` is the worker being drained
15981
+ // right now (null between respawn and the next drain); `reloaded` /
15982
+ // `targets` / `total` let the renderer print N/M.
15983
+ reload: {
15984
+ inProgress: reloading,
15985
+ current: reloadCurrent,
15986
+ targets: reloadTargets,
15987
+ reloaded: [...reloadDone],
15988
+ total: reloadTargets.length,
15989
+ },
15930
15990
  workers: pub || [...workers.values()].map(workerPublic),
15931
15991
  ...(final ? { final: true } : {}),
15932
15992
  });
@@ -16068,6 +16128,9 @@ async function runSupervisorDaemon() {
16068
16128
  // rolling pass over the same workers. The flag is reset in runReload's
16069
16129
  // `finally`.
16070
16130
  reloading = true;
16131
+ reloadTargets = [...ids];
16132
+ reloadDone = [];
16133
+ reloadCurrent = null;
16071
16134
  attachClients.add(sock);
16072
16135
  sock.write(encodeFrame({ ok: true, type: 'reloading', targets: ids }));
16073
16136
  sock.write(encodeFrame(statusFrame(false)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8ctl-plugin-nano",
3
- "version": "1.71.0",
3
+ "version": "1.72.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",
@@ -76,12 +76,12 @@
76
76
  },
77
77
  "optionalDependencies": {
78
78
  "node-pty": "^1.0.0",
79
- "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.71.0",
80
- "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.71.0",
81
- "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.71.0",
82
- "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.71.0",
83
- "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.71.0",
84
- "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.71.0",
85
- "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.71.0"
79
+ "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.72.0",
80
+ "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.72.0",
81
+ "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.72.0",
82
+ "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.72.0",
83
+ "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.72.0",
84
+ "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.72.0",
85
+ "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.72.0"
86
86
  }
87
87
  }