@infernetprotocol/cli 0.1.98 → 0.1.99

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
@@ -622,12 +622,12 @@ async function runDaemon(args, ctx) {
622
622
  markFinished(job.id);
623
623
  const msg = err?.message ?? String(err);
624
624
  // Busy (engine queue full, Ollama restarting): hand the job back
625
- // to the front of the queue instead of failing it, and leave it
625
+ // to the queue (at the back) instead of failing it, and leave it
626
626
  // alone here for a moment (lib/turn-away.js).
627
627
  if (job.type === 'chat' && err?.turnedAway === true && await requeueTurnedAway(client, job.id, msg)) {
628
628
  stats.jobsFailed -= 1;
629
629
  turnedAwayUntil.set(job.id, Date.now() + TURN_AWAY_BACKOFF_MS);
630
- process.stdout.write(`[${new Date().toISOString()}] turned away job ${job.id} (${msg}); requeued at the front\n`);
630
+ process.stdout.write(`[${new Date().toISOString()}] turned away job ${job.id} (${msg}); back to the queue\n`);
631
631
  return;
632
632
  }
633
633
  process.stderr.write(`job ${job.id} failed: ${msg}\n`);
@@ -1850,8 +1850,8 @@ async function runDaemon(args, ctx) {
1850
1850
  // Release whatever is still running after the drain window.
1851
1851
  for (const jobId of stats.activeJobIds) {
1852
1852
  try {
1853
- // Not started yet: back to the front of the queue, for the
1854
- // restarted daemon or a free node (lib/turn-away.js).
1853
+ // Not started yet: back to the queue, for the restarted daemon
1854
+ // or another node (lib/turn-away.js).
1855
1855
  if (await requeueTurnedAway(client, jobId, 'daemon restarting for self-update')) continue;
1856
1856
  await client.failJob(jobId, 'daemon restarting for self-update');
1857
1857
  } catch { /* best-effort */ }
@@ -97,7 +97,7 @@ export function createNodeClient({ url, publicKey, privateKey, role, timeoutMs =
97
97
  });
98
98
  },
99
99
 
100
- // Busy: put the job back at the front of the queue (CLI 0.1.97).
100
+ // Busy: put the job back in the queue (CLI 0.1.97; at the back since 0.1.99).
101
101
  requeueJob(jobId, reason) {
102
102
  return signedFetch(`/api/v1/node/jobs/${encodeURIComponent(jobId)}/requeue`, {
103
103
  reason: typeof reason === 'string' ? reason.slice(0, 300) : String(reason ?? 'busy')
package/lib/turn-away.js CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Busy-type failures: the node turns a chat job away instead of failing it,
3
- * and the control plane puts it back at the front of the queue
3
+ * and the control plane puts it back in the queue, at the back
4
4
  * (POST /api/v1/node/jobs/<id>/requeue, apps/web/lib/routing/requeue.js,
5
5
  * which keeps the same pattern). Anthony, 2026-11-18: "if it turns away a job
6
- * send it back to the front of the queue".
6
+ * send it back to the front of the queue", then "just add it to the back of
7
+ * the queue ... otherwise we could get a recursive loop blocking if no nodes
8
+ * exist".
7
9
  */
8
10
 
9
11
  const TURN_AWAY_RE = /restarting for self-update|server busy|too many requests|HTTP 429|HTTP 503|queue (?:is )?full|no free slot|no inference engine reachable|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|timed? ?out/i;
@@ -16,17 +18,18 @@ export function isTurnAwayError(message) {
16
18
  export const TURN_AWAY_BACKOFF_MS = 15_000;
17
19
 
18
20
  /**
19
- * Ask the control plane to requeue `jobId`. Resolves true when it did (the
20
- * caller must then neither post an error nor fail the job), false when the
21
- * job must fail as before (answer already streaming, too many turn-aways, or
22
- * a control plane without the endpoint).
21
+ * Ask the control plane to requeue `jobId`. Resolves true when it handled
22
+ * the job: requeued, or ended it after the requeue cap with "Network is busy.
23
+ * Run a node or wait." (the caller must then neither post an error nor fail
24
+ * the job); false when the job must fail as before (answer already
25
+ * streaming, or a control plane without the endpoint).
23
26
  */
24
27
  export async function requeueTurnedAway(client, jobId, reason) {
25
28
  if (typeof client?.requeueJob !== 'function') return false;
26
29
  try {
27
30
  const res = await client.requeueJob(jobId, reason);
28
31
  const data = res?.data ?? res;
29
- return data?.requeued === true;
32
+ return data?.requeued === true || data?.ended === true;
30
33
  } catch {
31
34
  return false;
32
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.98",
3
+ "version": "0.1.99",
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.98",
36
- "@infernetprotocol/config": "0.1.98",
37
- "@infernetprotocol/deploy-providers": "0.1.98",
38
- "@infernetprotocol/engine": "0.1.98",
39
- "@infernetprotocol/gpu": "0.1.98",
40
- "@infernetprotocol/liquid-agent": "0.1.98",
41
- "@infernetprotocol/rpc-adapter": "0.1.98",
42
- "@infernetprotocol/training": "0.1.98"
35
+ "@infernetprotocol/auth": "0.1.99",
36
+ "@infernetprotocol/deploy-providers": "0.1.99",
37
+ "@infernetprotocol/config": "0.1.99",
38
+ "@infernetprotocol/engine": "0.1.99",
39
+ "@infernetprotocol/gpu": "0.1.99",
40
+ "@infernetprotocol/liquid-agent": "0.1.99",
41
+ "@infernetprotocol/rpc-adapter": "0.1.99",
42
+ "@infernetprotocol/training": "0.1.99"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",