@infernetprotocol/cli 0.1.84 → 0.1.85

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/commands/start.js CHANGED
@@ -551,6 +551,17 @@ async function runDaemon(args, ctx) {
551
551
  }
552
552
  }
553
553
 
554
+ // When each job finished here. Polls overlap (a batch is awaited job by
555
+ // job while the interval fires again), so a batch can still hold a job
556
+ // that another batch ran to completion meanwhile; bonita re-ran three
557
+ // completed chat jobs that way. Skip a job that finished after the poll
558
+ // that returned it was sent.
559
+ const finishedJobAt = new Map();
560
+ function markFinished(id) {
561
+ finishedJobAt.set(id, Date.now());
562
+ if (finishedJobAt.size > 1000) finishedJobAt.delete(finishedJobAt.keys().next().value);
563
+ }
564
+
554
565
  async function processJob(job) {
555
566
  const t0 = new Date().toISOString();
556
567
  stats.jobsPicked += 1;
@@ -581,10 +592,12 @@ async function runDaemon(args, ctx) {
581
592
  await client.completeJob(job.id, { status: 'completed', result: resultPayload });
582
593
  stats.jobsCompleted += 1;
583
594
  stats.activeJobIds.delete(job.id);
595
+ markFinished(job.id);
584
596
  process.stdout.write(`[${new Date().toISOString()}] completed job ${job.id} type=${job.type ?? 'inference'}\n`);
585
597
  } catch (err) {
586
598
  stats.jobsFailed += 1;
587
599
  stats.activeJobIds.delete(job.id);
600
+ markFinished(job.id);
588
601
  const msg = err?.message ?? String(err);
589
602
  process.stderr.write(`job ${job.id} failed: ${msg}\n`);
590
603
  if (job.type === 'chat') {
@@ -605,6 +618,7 @@ async function runDaemon(args, ctx) {
605
618
  return;
606
619
  }
607
620
  if (stats.draining) return;
621
+ const polledAt = Date.now();
608
622
  try {
609
623
  const result = await client.pollJobs({ limit: 5 });
610
624
  stats.pollsOk += 1;
@@ -614,6 +628,13 @@ async function runDaemon(args, ctx) {
614
628
  // complete, so without this guard the poll loop queues the
615
629
  // same job on every tick while it's in flight.
616
630
  if (stats.activeJobIds.has(job.id)) continue;
631
+ if ((finishedJobAt.get(job.id) ?? 0) >= polledAt) continue;
632
+ // A self-update can start draining while this batch runs
633
+ // (each job is awaited in turn). Stop picking the rest up, or
634
+ // a busy node keeps taking jobs for minutes after "taking no
635
+ // new ones" (bonita, 0.1.83 -> 0.1.84). They stay assigned
636
+ // and the restarted daemon picks them up.
637
+ if (stats.draining) break;
617
638
  await processJob(job);
618
639
  }
619
640
  } catch (err) {
package/lib/cli-copies.js CHANGED
@@ -51,8 +51,17 @@ export function globalModuleRoots({ env = process.env, home = os.homedir(), npmP
51
51
  const roots = [];
52
52
  const add = (prefix) => { if (prefix) roots.push(path.join(prefix, 'lib', 'node_modules')); };
53
53
 
54
- const miseData = env.MISE_DATA_DIR || path.join(env.XDG_DATA_HOME || path.join(home, '.local', 'share'), 'mise');
55
- for (const d of listDirs(path.join(miseData, 'installs', 'node'))) add(d);
54
+ // Both mise data dirs: the installer relocates mise to a big volume with
55
+ // MISE_DATA_DIR on some boxes, while the operator's own shell keeps the
56
+ // default one (vienna had a stale copy in the default dir only).
57
+ const miseDirs = new Set([
58
+ env.MISE_DATA_DIR,
59
+ path.join(env.XDG_DATA_HOME || path.join(home, '.local', 'share'), 'mise'),
60
+ path.join(home, '.local', 'share', 'mise')
61
+ ].filter(Boolean));
62
+ for (const miseData of miseDirs) {
63
+ for (const d of listDirs(path.join(miseData, 'installs', 'node'))) add(d);
64
+ }
56
65
  for (const d of listDirs(path.join(env.NVM_DIR || path.join(home, '.nvm'), 'versions', 'node'))) add(d);
57
66
  for (const d of listDirs(path.join(home, '.asdf', 'installs', 'nodejs'))) add(d);
58
67
  for (const d of listDirs(path.join(env.FNM_DIR || path.join(home, '.local', 'share', 'fnm'), 'node-versions'))) add(path.join(d, 'installation'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,14 +32,14 @@
32
32
  "ora": "^9.4.1",
33
33
  "react": "^17.0.2",
34
34
  "react-blessed": "^0.7.2",
35
- "@infernetprotocol/auth": "0.1.84",
36
- "@infernetprotocol/config": "0.1.84",
37
- "@infernetprotocol/deploy-providers": "0.1.84",
38
- "@infernetprotocol/engine": "0.1.84",
39
- "@infernetprotocol/gpu": "0.1.84",
40
- "@infernetprotocol/liquid-agent": "0.1.84",
41
- "@infernetprotocol/rpc-adapter": "0.1.84",
42
- "@infernetprotocol/training": "0.1.84"
35
+ "@infernetprotocol/auth": "0.1.85",
36
+ "@infernetprotocol/config": "0.1.85",
37
+ "@infernetprotocol/deploy-providers": "0.1.85",
38
+ "@infernetprotocol/engine": "0.1.85",
39
+ "@infernetprotocol/gpu": "0.1.85",
40
+ "@infernetprotocol/liquid-agent": "0.1.85",
41
+ "@infernetprotocol/rpc-adapter": "0.1.85",
42
+ "@infernetprotocol/training": "0.1.85"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",