@infernetprotocol/cli 0.1.93 → 0.1.95

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/setup.js CHANGED
@@ -218,7 +218,12 @@ async function startOllama({ yes }) {
218
218
  // --user service or simply lack passwordless sudo.
219
219
  const uid = process.getuid?.() ?? null;
220
220
  const userBus = uid != null && fsSync.existsSync(`/run/user/${uid}/bus`);
221
- const NOHUP = "(nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &)";
221
+ // Flash attention + q8_0 KV cache unless the operator set them: halves
222
+ // the KV cache, so long-context models fit the GPU (see install.sh
223
+ // ensure_ollama_memory_env, which does the same for ollama.service).
224
+ const NOHUP = "(OLLAMA_FLASH_ATTENTION=${OLLAMA_FLASH_ATTENTION:-1}"
225
+ + " OLLAMA_KV_CACHE_TYPE=${OLLAMA_KV_CACHE_TYPE:-q8_0}"
226
+ + " nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &)";
222
227
  let cmd;
223
228
  if (isMac) {
224
229
  cmd = `open -a Ollama || ${NOHUP}`;
@@ -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,20 @@ 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
+ // Optional override for the per-request context cap (default 32768,
161
+ // INFERNET_OLLAMA_MAX_CTX; 0 = no cap). See DEFAULT_MAX_CTX in the engine.
162
+ if (Number.isFinite(eng.ollama_max_ctx) && eng.ollama_max_ctx >= 0) {
163
+ opts.maxCtx = eng.ollama_max_ctx;
164
+ }
165
+ const cacheKey = `default:${eng.backend ?? 'auto'}`;
166
+ const engine = await buildEngine(cacheKey, opts);
167
+ if (engine.kind === 'stub' && !stubExplicitlyChosen(config)) {
168
+ // Do not keep it: the next job probes the real engines again.
169
+ engineCache.delete(cacheKey);
170
+ try { engine.shutdown?.(); } catch { /* best-effort */ }
171
+ throw new Error('no inference engine reachable on this node (Ollama/vLLM/llama.cpp did not answer); refusing to serve stub output');
172
+ }
173
+ return engine;
149
174
  }
150
175
 
151
176
  /** 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.95",
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.95",
36
+ "@infernetprotocol/config": "0.1.95",
37
+ "@infernetprotocol/deploy-providers": "0.1.95",
38
+ "@infernetprotocol/engine": "0.1.95",
39
+ "@infernetprotocol/gpu": "0.1.95",
40
+ "@infernetprotocol/liquid-agent": "0.1.95",
41
+ "@infernetprotocol/rpc-adapter": "0.1.95",
42
+ "@infernetprotocol/training": "0.1.95"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",