@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
45 lines (44 loc) • 1.53 kB
TypeScript
import { type SpawnSyncReturns, type SpawnSyncOptions } from "child_process";
import type { AllowedCommand } from "../../types/index.js";
/**
* Shared Ollama utilities for CLI commands
*/
export declare class OllamaUtils {
/**
* Secure wrapper around spawnSync to prevent command injection.
*/
static safeSpawn(command: AllowedCommand, args: string[], options?: SpawnSyncOptions): SpawnSyncReturns<string>;
/**
* Whether a `safeSpawn` call actually succeeded.
*
* `spawnSync` reports failure by RETURNING — `error` set (ENOENT, ETIMEDOUT)
* or a non-zero `status` — never by throwing. Every `try/catch` around one of
* these calls was therefore dead code, which is why several fallbacks in this
* file had never run.
*/
private static spawnSucceeded;
/**
* Check if Ollama command line is available
*/
private static isOllamaCommandReady;
/**
* Validate HTTP API response from Ollama
*/
private static validateApiResponse;
/**
* Check if Ollama HTTP API is ready
*/
private static isOllamaApiReady;
/**
* Wait for Ollama service to become ready with exponential backoff
*/
static waitForOllamaReady(maxAttempts?: number, initialDelay?: number): Promise<boolean>;
/**
* Check if Ollama service is already running
*/
static isOllamaRunning(): boolean;
/**
* Unified Ollama start logic that works across platforms
*/
static startOllamaService(): Promise<void>;
}