/** * Runner Manager * Manages spawning and lifecycle of llama.cpp runner processes */ import { type ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; import { RunnerClient } from './client.js'; import type { RunnerConfig, SystemInfo } from '../types/index.js'; export type RunnerInstanceStatus = 'starting' | 'loading' | 'ready' | 'busy' | 'error' | 'stopped'; export interface RunnerInstance { id: string; pid: number; port: number; status: RunnerInstanceStatus; modelPath: string; client: RunnerClient; process: ChildProcess; startedAt: Date; lastUsedAt: Date; } export interface SpawnOptions { modelPath: string; ollamaEngine?: boolean; gpuLibPaths?: string[]; env?: Record; } export declare class RunnerManager extends EventEmitter { private config; private runners; private runnerPath; constructor(config?: Partial); /** * Find the runner executable */ findRunner(): Promise; /** * Find the ollama executable in system PATH */ private findOllama; /** * Spawn a new runner process */ spawn(options: SpawnOptions): Promise; /** * Get the library path environment variable name for the current platform */ private getLibraryPathEnv; /** * Load a model on a runner */ load(instance: RunnerInstance, options?: { parallel?: number; batchSize?: number; numCtx?: number; numThreads?: number; flashAttention?: boolean; kvCacheType?: string; }): Promise; /** * Get a runner instance by ID */ get(id: string): RunnerInstance | undefined; /** * Get all runner instances */ getAll(): RunnerInstance[]; /** * Find a runner by model path */ findByModel(modelPath: string): RunnerInstance | undefined; /** * Update last used timestamp */ touch(id: string): void; /** * Kill a runner process */ kill(id: string): Promise; /** * Kill all runners */ killAll(): Promise; /** * Get system info */ getSystemInfo(): SystemInfo; /** * Check if any runners are running */ hasRunningRunners(): boolean; /** * Get count of running runners */ get runnerCount(): number; } //# sourceMappingURL=manager.d.ts.map