@infernetprotocol/cli 0.1.57 → 0.1.58
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/model.js +22 -0
- package/lib/node-models.js +31 -0
- package/package.json +7 -7
package/commands/model.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* the engine uses by default.
|
|
8
8
|
*
|
|
9
9
|
* infernet model list
|
|
10
|
+
* infernet model list --node <id> a remote node's advertised models
|
|
10
11
|
* infernet model pull <name> Ollama name or hf:org/repo
|
|
11
12
|
* infernet model remove <name>
|
|
12
13
|
* infernet model use <name>
|
|
@@ -26,11 +27,16 @@ import {
|
|
|
26
27
|
downloadHfModel,
|
|
27
28
|
} from "../lib/hf-model.js";
|
|
28
29
|
import { recommendModels } from "../lib/recommender.js";
|
|
30
|
+
import { resolveClientOptions } from "../lib/reservations-client.js";
|
|
31
|
+
import { fetchNodeModels, formatNodeModels } from "../lib/node-models.js";
|
|
29
32
|
|
|
30
33
|
const HELP = `infernet model — manage models served by this node
|
|
31
34
|
|
|
32
35
|
Usage:
|
|
33
36
|
infernet model list List models pulled locally.
|
|
37
|
+
infernet model list --node <id> List the models a remote node advertises
|
|
38
|
+
(node id or row id, public nodes only).
|
|
39
|
+
--url <control-plane> default infernetprotocol.com
|
|
34
40
|
infernet model recommend [flags] Recommend models for your hardware.
|
|
35
41
|
--use-case <chat|coding|study|agents|uncensored|vision>
|
|
36
42
|
--uncensored
|
|
@@ -158,6 +164,21 @@ async function cmdList(host) {
|
|
|
158
164
|
return 0;
|
|
159
165
|
}
|
|
160
166
|
|
|
167
|
+
async function cmdListNode(nodeId, args) {
|
|
168
|
+
if (!nodeId || nodeId === true) {
|
|
169
|
+
process.stderr.write("error: --node needs a node id\n");
|
|
170
|
+
return 2;
|
|
171
|
+
}
|
|
172
|
+
const { baseUrl } = await resolveClientOptions({ url: args.get("url") });
|
|
173
|
+
const node = await fetchNodeModels({ baseUrl, nodeId: String(nodeId) });
|
|
174
|
+
if (args.has("json")) {
|
|
175
|
+
process.stdout.write(JSON.stringify(node, null, 2) + "\n");
|
|
176
|
+
} else {
|
|
177
|
+
process.stdout.write(formatNodeModels(node));
|
|
178
|
+
}
|
|
179
|
+
return 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
161
182
|
async function cmdRecommend(args) {
|
|
162
183
|
const useCase = args.get("use-case") ?? args.get("for") ?? null;
|
|
163
184
|
const uncensoredOnly = args.has("uncensored");
|
|
@@ -562,6 +583,7 @@ export default async function model(args) {
|
|
|
562
583
|
switch (sub) {
|
|
563
584
|
case "list":
|
|
564
585
|
case "ls":
|
|
586
|
+
if (args.has("node")) return await cmdListNode(args.get("node"), args);
|
|
565
587
|
return await cmdList(host);
|
|
566
588
|
case "info":
|
|
567
589
|
case "inspect":
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a remote node's advertised models from the control plane
|
|
3
|
+
* (GET /api/nodes/:id/models). Backs `infernet model list --node <id>`.
|
|
4
|
+
*/
|
|
5
|
+
export async function fetchNodeModels({ baseUrl, nodeId, fetchImpl = fetch }) {
|
|
6
|
+
const url = `${baseUrl}/api/nodes/${encodeURIComponent(nodeId)}/models`;
|
|
7
|
+
const res = await fetchImpl(url, { headers: { accept: "application/json" } });
|
|
8
|
+
const text = await res.text();
|
|
9
|
+
let json = null;
|
|
10
|
+
try { json = text ? JSON.parse(text) : null; } catch { /* non-JSON */ }
|
|
11
|
+
if (res.status === 404) {
|
|
12
|
+
throw new Error(`node ${nodeId} not found (or not public)`);
|
|
13
|
+
}
|
|
14
|
+
if (!res.ok) {
|
|
15
|
+
throw new Error(`GET ${url} -> HTTP ${res.status} ${json?.error ?? text.slice(0, 200)}`);
|
|
16
|
+
}
|
|
17
|
+
return json?.data ?? json;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function formatNodeModels(node) {
|
|
21
|
+
const label = node.name ?? node.node_id ?? node.id;
|
|
22
|
+
const lines = [`node: ${label}${node.status ? ` (${node.status})` : ""}`];
|
|
23
|
+
if (node.last_seen) lines.push(`seen: ${node.last_seen}`);
|
|
24
|
+
const models = node.served_models ?? [];
|
|
25
|
+
if (models.length === 0) {
|
|
26
|
+
lines.push("", "(this node advertises no models)");
|
|
27
|
+
} else {
|
|
28
|
+
lines.push("", "MODEL", ...models);
|
|
29
|
+
}
|
|
30
|
+
return lines.join("\n") + "\n";
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infernetprotocol/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58",
|
|
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",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"ora": "^9.4.0",
|
|
31
31
|
"react": "^17.0.2",
|
|
32
32
|
"react-blessed": "^0.7.2",
|
|
33
|
-
"@infernetprotocol/
|
|
34
|
-
"@infernetprotocol/
|
|
35
|
-
"@infernetprotocol/engine": "0.1.
|
|
36
|
-
"@infernetprotocol/
|
|
37
|
-
"@infernetprotocol/
|
|
38
|
-
"@infernetprotocol/
|
|
33
|
+
"@infernetprotocol/auth": "0.1.58",
|
|
34
|
+
"@infernetprotocol/config": "0.1.58",
|
|
35
|
+
"@infernetprotocol/engine": "0.1.58",
|
|
36
|
+
"@infernetprotocol/deploy-providers": "0.1.58",
|
|
37
|
+
"@infernetprotocol/gpu": "0.1.58",
|
|
38
|
+
"@infernetprotocol/rpc-adapter": "0.1.58"
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|