@infernetprotocol/cli 0.1.86 → 0.1.88
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 +11 -0
- package/commands/update.js +47 -9
- package/lib/version.js +5 -2
- package/package.json +9 -9
package/commands/start.js
CHANGED
|
@@ -227,6 +227,10 @@ async function runDaemon(args, ctx) {
|
|
|
227
227
|
const heartbeatMs = Number.parseInt(args.get('heartbeat-interval') ?? '', 10) || DEFAULT_HEARTBEAT_MS;
|
|
228
228
|
const pollMs = Number.parseInt(args.get('poll-interval') ?? '', 10) || DEFAULT_POLL_MS;
|
|
229
229
|
const once = args.has('once');
|
|
230
|
+
// Chat jobs run at once. Ollama on one GPU serves a single request at a
|
|
231
|
+
// time unless OLLAMA_NUM_PARALLEL is raised, so extra jobs only queue
|
|
232
|
+
// inside it; raise this together with that.
|
|
233
|
+
const maxConcurrentJobs = Number.parseInt(process.env.INFERNET_MAX_CONCURRENT_JOBS ?? '', 10) || 1;
|
|
230
234
|
|
|
231
235
|
const p2pDisabled = args.has('no-p2p');
|
|
232
236
|
const noAdvertise = args.has('no-advertise') || node.address === null;
|
|
@@ -618,6 +622,12 @@ async function runDaemon(args, ctx) {
|
|
|
618
622
|
return;
|
|
619
623
|
}
|
|
620
624
|
if (stats.draining) return;
|
|
625
|
+
// Polls fire every pollMs whether or not the last batch finished, so
|
|
626
|
+
// without a cap a node ran one job per tick at once. The extras sat
|
|
627
|
+
// in Ollama's queue until fetch gave up ("fetch failed" at ~300 s,
|
|
628
|
+
// cullen3 2026-11-02). Jobs stay assigned here and run when a slot
|
|
629
|
+
// frees up.
|
|
630
|
+
if (stats.activeJobIds.size >= maxConcurrentJobs) return;
|
|
621
631
|
const polledAt = Date.now();
|
|
622
632
|
try {
|
|
623
633
|
const result = await client.pollJobs({ limit: 5 });
|
|
@@ -635,6 +645,7 @@ async function runDaemon(args, ctx) {
|
|
|
635
645
|
// new ones" (bonita, 0.1.83 -> 0.1.84). They stay assigned
|
|
636
646
|
// and the restarted daemon picks them up.
|
|
637
647
|
if (stats.draining) break;
|
|
648
|
+
if (stats.activeJobIds.size >= maxConcurrentJobs) break;
|
|
638
649
|
await processJob(job);
|
|
639
650
|
}
|
|
640
651
|
} catch (err) {
|
package/commands/update.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
import { spawn } from 'node:child_process';
|
|
12
12
|
import { compareVersions } from '@profullstack/cli';
|
|
13
13
|
import setup from './setup.js';
|
|
14
|
-
import { CURRENT_VERSION, fetchLatestVersion } from '../lib/version.js';
|
|
15
|
-
import { pruneCliCopies, wrapperTarget } from '../lib/cli-copies.js';
|
|
14
|
+
import { CLI_DIR, CURRENT_VERSION, fetchLatestVersion } from '../lib/version.js';
|
|
15
|
+
import { pruneCliCopies, wrapperPath, wrapperTarget } from '../lib/cli-copies.js';
|
|
16
16
|
|
|
17
17
|
const HELP = `infernet update — pull latest CLI + autonomous post-upgrade setup
|
|
18
18
|
|
|
@@ -125,23 +125,61 @@ export default async function update(args, ctx) {
|
|
|
125
125
|
const ok = await pullLatestBinary({ quiet });
|
|
126
126
|
if (!ok) return 1;
|
|
127
127
|
|
|
128
|
-
// The installer already pruned other copies (install.sh); this catches an
|
|
129
|
-
// older installer and copies the installer could not see.
|
|
130
|
-
if (!args.has('keep-copies')) cleanCliCopies({ quiet, version: latest });
|
|
131
|
-
|
|
132
128
|
if (args.has('skip-setup')) {
|
|
129
|
+
if (!args.has('keep-copies')) cleanCliCopies({ quiet, version: latest });
|
|
133
130
|
process.stdout.write("\n✓ Binary updated (skipped setup).\n");
|
|
134
131
|
return 0;
|
|
135
132
|
}
|
|
136
133
|
|
|
137
134
|
process.stdout.write("\n→ Running post-upgrade setup (keys + register + daemon restart)\n");
|
|
138
135
|
|
|
139
|
-
const
|
|
136
|
+
const passthrough = [];
|
|
140
137
|
for (const k of ['port', 'address', 'no-advertise']) {
|
|
141
|
-
if (args.has(k))
|
|
138
|
+
if (!args.has(k)) continue;
|
|
139
|
+
const v = args.get(k);
|
|
140
|
+
passthrough.push(`--${k}`, ...(v === undefined ? [] : [String(v)]));
|
|
142
141
|
}
|
|
143
142
|
|
|
144
|
-
|
|
143
|
+
// Setup writes the daemon's unit from the CLI that runs it. If this
|
|
144
|
+
// process is not the CLI the installer just installed (a stale npm-global
|
|
145
|
+
// copy, or the npm copy of a node the installer kept on git), running
|
|
146
|
+
// setup here would point infernet.service at this copy, which the cleanup
|
|
147
|
+
// below then deletes: bonita's daemon crash-looped on exactly that during
|
|
148
|
+
// the 0.1.86 rollout. Hand setup to the installed CLI instead, and clean
|
|
149
|
+
// up copies only after it has rewritten the unit.
|
|
150
|
+
const installed = wrapperTarget();
|
|
151
|
+
let code;
|
|
152
|
+
if (setupRunsFrom(installed, CLI_DIR) === 'installed') {
|
|
153
|
+
process.stdout.write(` (running setup from the installed CLI at ${installed})\n`);
|
|
154
|
+
code = await runInstalledSetup(['setup', '--yes', '--confirm', '--skip-pull', ...passthrough]);
|
|
155
|
+
} else {
|
|
156
|
+
const setupArgs = new Map([['yes', true], ['confirm', true], ['skip-pull', true]]);
|
|
157
|
+
for (const k of ['port', 'address', 'no-advertise']) {
|
|
158
|
+
if (args.has(k)) setupArgs.set(k, args.get(k) ?? true);
|
|
159
|
+
}
|
|
160
|
+
code = await setup(setupArgs, ctx);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// The installer already pruned other copies (install.sh); this catches an
|
|
164
|
+
// older installer and copies it could not see. After setup, never before.
|
|
165
|
+
if (!args.has('keep-copies')) cleanCliCopies({ quiet, version: latest });
|
|
166
|
+
return code;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** 'installed' when the wrapper runs another CLI than this process. */
|
|
170
|
+
export function setupRunsFrom(installedDir, selfDir) {
|
|
171
|
+
return installedDir && installedDir !== selfDir ? 'installed' : 'self';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function runInstalledSetup(argv) {
|
|
175
|
+
return new Promise((resolve) => {
|
|
176
|
+
const child = spawn(wrapperPath(), argv, { stdio: 'inherit' });
|
|
177
|
+
child.on('exit', (c) => resolve(c ?? 1));
|
|
178
|
+
child.on('error', (err) => {
|
|
179
|
+
process.stderr.write(`error: could not run the installed CLI: ${err?.message ?? err}\n`);
|
|
180
|
+
resolve(1);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
145
183
|
}
|
|
146
184
|
|
|
147
185
|
export { HELP, INSTALLER_URL };
|
package/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
1
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
@@ -6,7 +6,10 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
const _dir = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
|
|
8
8
|
/** The CLI package directory this code is running from. */
|
|
9
|
-
export const CLI_DIR =
|
|
9
|
+
export const CLI_DIR = (() => {
|
|
10
|
+
const dir = join(_dir, '..');
|
|
11
|
+
try { return realpathSync(dir); } catch { return dir; }
|
|
12
|
+
})();
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* The version of the code that is actually running: the package.json next to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infernetprotocol/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.88",
|
|
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.
|
|
36
|
-
"@infernetprotocol/config": "0.1.
|
|
37
|
-
"@infernetprotocol/deploy-providers": "0.1.
|
|
38
|
-
"@infernetprotocol/engine": "0.1.
|
|
39
|
-
"@infernetprotocol/gpu": "0.1.
|
|
40
|
-
"@infernetprotocol/liquid-agent": "0.1.
|
|
41
|
-
"@infernetprotocol/rpc-adapter": "0.1.
|
|
42
|
-
"@infernetprotocol/training": "0.1.
|
|
35
|
+
"@infernetprotocol/auth": "0.1.88",
|
|
36
|
+
"@infernetprotocol/config": "0.1.88",
|
|
37
|
+
"@infernetprotocol/deploy-providers": "0.1.88",
|
|
38
|
+
"@infernetprotocol/engine": "0.1.88",
|
|
39
|
+
"@infernetprotocol/gpu": "0.1.88",
|
|
40
|
+
"@infernetprotocol/liquid-agent": "0.1.88",
|
|
41
|
+
"@infernetprotocol/rpc-adapter": "0.1.88",
|
|
42
|
+
"@infernetprotocol/training": "0.1.88"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|