@gorlitzer-labs/seldon 0.1.21 → 0.1.22

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/bin/seldon.js +35 -8
  2. package/package.json +1 -1
package/bin/seldon.js CHANGED
@@ -328,6 +328,7 @@ const RUN_DIR = path.join(SELDON_HOME, "run");
328
328
  const pidFile = (name) => path.join(RUN_DIR, name + ".pid");
329
329
  const readPid = (name) => { try { return parseInt(fs.readFileSync(pidFile(name), "utf8").trim(), 10) || 0; } catch { return 0; } };
330
330
  const isAlive = (pid) => { try { process.kill(pid, 0); return true; } catch { return false; } };
331
+ const portListening = (port) => { try { return !!execSync(`lsof -nP -iTCP:${port} -sTCP:LISTEN -t`, { stdio: ["ignore", "pipe", "ignore"] }).toString().trim(); } catch { return false; } };
331
332
  const daemonUp = (name) => { const p = readPid(name); return p && isAlive(p) ? p : 0; };
332
333
 
333
334
  function startDaemon(name, cmd, args, opts = {}) {
@@ -684,9 +685,17 @@ function moduleInstalled(m) {
684
685
 
685
686
  function statusCmd() {
686
687
  console.log(C.bold("\n seldon — stack status\n"));
688
+ // The dot answers "is it working?". For a CLI tool that is "installed"; for a
689
+ // SERVICE it is "running" — a green dot next to "voice down" read as up, and
690
+ // `seldon down` saying "nothing was running" then looked like a lie.
691
+ const up = [], starting = [], stopped = [];
692
+ const svcState = (label, pid, upText) => {
693
+ (pid ? up : stopped).push(label);
694
+ return pid ? " " + C.green(upText) : " " + C.gold(label + " down");
695
+ };
696
+ const brain = demerzelInstalled() ? (savedBrain() || "qwen") : null;
687
697
  for (const m of MODULES) {
688
698
  const inst = moduleInstalled(m);
689
- const dot = inst ? C.green("●") : C.dim("○");
690
699
  let detail;
691
700
  if (!inst) detail = platformOk(m) ? C.dim(`not installed ${C.dim("· seldon install " + m.id)}`) : C.dim("not supported on this machine");
692
701
  else if (m.method === "npm") detail = C.dim("v" + (npmGlobalVersion(m.pkg) || "?"));
@@ -695,21 +704,39 @@ function statusCmd() {
695
704
  else detail = C.dim("installed");
696
705
 
697
706
  // service state for the two daemons
698
- let svc = "";
699
- if (m.id === "factory") { const p = daemonUp("factory-watch"); svc = p ? " " + C.green("supervisor up") + C.dim(` (pid ${p})`) : " " + C.dim("supervisor down"); }
700
- if (m.id === "demerzel" && inst) { const p = daemonUp("demerzel"); svc = p ? " " + C.green("voice up") + " " + C.cyan("http://localhost:8770") : " " + C.dim("voice down"); }
701
-
707
+ let svc = "", running = true;
708
+ if (m.id === "factory" && inst) {
709
+ const p = daemonUp("factory-watch"); running = !!p;
710
+ svc = svcState("supervisor", p, "supervisor up") + (p ? C.dim(` (pid ${p})`) : "");
711
+ }
712
+ if (m.id === "demerzel" && inst) {
713
+ const p = daemonUp("demerzel"), b = brain !== "bonsai" || daemonUp("bonsai") || bonsaiHealthy();
714
+ // A live pid is not a working voice: models load for ~30-90s before :8770
715
+ // listens, and "voice up" there sent you to a page that would not open.
716
+ const serving = p && portListening(8770);
717
+ running = !!serving && !!b; // the voice without its brain server cannot answer
718
+ if (p && !serving) { starting.push("voice"); svc = " " + C.gold("voice starting") + C.dim(" — models loading, give it a minute"); }
719
+ else svc = svcState("voice", p, "voice up") + (p ? " " + C.cyan("http://localhost:8770") : "");
720
+ }
721
+ const dot = !inst ? C.dim("○") : running ? C.green("●") : C.gold("●");
702
722
  console.log(` ${dot} ${C.bold(m.id.padEnd(11))} ${detail}${svc}`);
703
723
  }
704
- if (demerzelInstalled()) {
705
- const brain = savedBrain() || "qwen";
724
+ if (brain) {
706
725
  const bstate = brain === "bonsai"
707
- ? (daemonUp("bonsai") || bonsaiHealthy() ? C.green("server up") : C.dim("server down"))
726
+ ? ((daemonUp("bonsai") || bonsaiHealthy()) ? (up.push("brain"), C.green("server up")) : (stopped.push("brain"), C.gold("server down")))
708
727
  : C.dim("in-process");
709
728
  console.log(C.dim(`\n voice brain: `) + C.bold(brain) + " " + bstate + C.dim(" · switch: seldon up --brain=qwen|bonsai"));
710
729
  const phone = tailscaleServeUrl();
711
730
  if (phone) console.log(C.dim(" phone (HTTPS): ") + C.cyan(phone));
712
731
  }
732
+ if (up.length || starting.length || stopped.length) {
733
+ const parts = [];
734
+ if (up.length) parts.push(C.green("● running: " + up.join(", ")));
735
+ if (starting.length) parts.push(C.gold("● starting: " + starting.join(", ")));
736
+ if (stopped.length) parts.push(C.gold("● stopped: " + stopped.join(", ")) + C.dim(" — start: ") + C.cyan("seldon up"));
737
+ if (!up.length && !starting.length) parts[0] = C.gold("● nothing is running") + C.dim(" — start: ") + C.cyan("seldon up");
738
+ console.log("\n " + parts.join(" "));
739
+ }
713
740
  const dk = dockerState();
714
741
  if (dk === "down") console.log(C.gold("\n ⚠ docker: installed but the daemon is not running") + C.dim(" — factory box and containerised gates need it (open Docker Desktop)"));
715
742
  else if (dk === "up") console.log(C.dim("\n docker: ") + C.green("up"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gorlitzer-labs/seldon",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Install the Seldon stack — pick your tools from a checklist; each installs via its native method.",
5
5
  "type": "module",
6
6
  "bin": {