@infernetprotocol/cli 0.1.93 → 0.1.94

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.
@@ -133,6 +133,18 @@ function buildEngine(cacheKey, opts) {
133
133
  return engineCache.get(cacheKey);
134
134
  }
135
135
 
136
+ /**
137
+ * The stub backend answers with canned text. That is fine when an operator
138
+ * asked for it (`--backend stub`, INFERNET_ENGINE_BACKEND=stub) and wrong
139
+ * everywhere else: auto-select falls back to it whenever no engine answers
140
+ * its probe, e.g. Ollama busy for a moment, and the daemon then served
141
+ * "This is a stub response ..." to real chat users for the rest of its life
142
+ * (seen on c0mpute.com chat 2026-11-11). Exported for tests.
143
+ */
144
+ export function stubExplicitlyChosen(config = {}, env = process.env) {
145
+ return env.INFERNET_ENGINE_BACKEND === 'stub' || config?.engine?.backend === 'stub';
146
+ }
147
+
136
148
  async function defaultEngine() {
137
149
  const config = (await loadConfig()) ?? {};
138
150
  const eng = config.engine ?? {};
@@ -145,7 +157,15 @@ async function defaultEngine() {
145
157
  if (Number.isFinite(eng.ollama_num_thread) && eng.ollama_num_thread > 0) {
146
158
  opts.numThread = eng.ollama_num_thread;
147
159
  }
148
- return buildEngine(`default:${eng.backend ?? 'auto'}`, opts);
160
+ const cacheKey = `default:${eng.backend ?? 'auto'}`;
161
+ const engine = await buildEngine(cacheKey, opts);
162
+ if (engine.kind === 'stub' && !stubExplicitlyChosen(config)) {
163
+ // Do not keep it: the next job probes the real engines again.
164
+ engineCache.delete(cacheKey);
165
+ try { engine.shutdown?.(); } catch { /* best-effort */ }
166
+ throw new Error('no inference engine reachable on this node (Ollama/vLLM/llama.cpp did not answer); refusing to serve stub output');
167
+ }
168
+ return engine;
149
169
  }
150
170
 
151
171
  /** Best-effort: does Ollama (at host) currently serve this exact tag? */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.93",
3
+ "version": "0.1.94",
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.93",
36
- "@infernetprotocol/config": "0.1.93",
37
- "@infernetprotocol/deploy-providers": "0.1.93",
38
- "@infernetprotocol/engine": "0.1.93",
39
- "@infernetprotocol/gpu": "0.1.93",
40
- "@infernetprotocol/liquid-agent": "0.1.93",
41
- "@infernetprotocol/rpc-adapter": "0.1.93",
42
- "@infernetprotocol/training": "0.1.93"
35
+ "@infernetprotocol/auth": "0.1.94",
36
+ "@infernetprotocol/config": "0.1.94",
37
+ "@infernetprotocol/engine": "0.1.94",
38
+ "@infernetprotocol/deploy-providers": "0.1.94",
39
+ "@infernetprotocol/gpu": "0.1.94",
40
+ "@infernetprotocol/liquid-agent": "0.1.94",
41
+ "@infernetprotocol/rpc-adapter": "0.1.94",
42
+ "@infernetprotocol/training": "0.1.94"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",