Skip to content

@codesoul-co/hypha-inference / drivers

Using this module

Use the Drivers module for using the public contracts and operations for this capability boundary. It exports 3 classes, 7 interfaces, 4 types.

Import from the package entrypoint

ts
import {
  HttpLocalInferenceDriver,
  LocalInferenceDriverRegistry,
  NodeLocalInferenceProcessSupervisor,
} from '@codesoul-co/hypha-inference';

import type {
  LocalInferenceDriver,
  LocalInferenceDriverConfig,
  LocalInferenceDriverStatus,
  LocalInferenceHealthProbeRequest,
  LocalInferenceProcessHandle,
  LocalInferenceProcessSpec,
  LocalInferenceProcessSupervisor,
  LocalInferenceDriverMode,
} from '@codesoul-co/hypha-inference';

// The complete export list is documented below.

Usage patterns

  • Use the 11 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 3 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
HttpLocalInferenceDriverclassnew HttpLocalInferenceDriver(config: LocalInferenceDriverConfig, supervisor?: LocalInferenceProcessSupervisor, healthProbe?: LocalInferenceHealthProbe): HttpLocalInferenceDriverHttp Local Inference Driver class with 10 public constructor or member entries; its exact declarations are listed below.
LocalInferenceDriverRegistryclassnew LocalInferenceDriverRegistry(): LocalInferenceDriverRegistryLocal Inference Driver Registry class with 6 public constructor or member entries; its exact declarations are listed below.
NodeLocalInferenceProcessSupervisorclassnew NodeLocalInferenceProcessSupervisor(): NodeLocalInferenceProcessSupervisorNode Local Inference Process Supervisor class with 2 public constructor or member entries; its exact declarations are listed below.
LocalInferenceDriverinterfaceinterface LocalInferenceDriverLocal Inference Driver interface with 9 public fields or methods.
LocalInferenceDriverConfiginterfaceinterface LocalInferenceDriverConfigLocal Inference Driver Config interface with 17 public fields or methods.
LocalInferenceDriverStatusinterfaceinterface LocalInferenceDriverStatusLocal Inference Driver Status interface with 9 public fields or methods.
LocalInferenceHealthProbeRequestinterfaceinterface LocalInferenceHealthProbeRequestLocal Inference Health Probe Request interface with 3 public fields or methods.
LocalInferenceProcessHandleinterfaceinterface LocalInferenceProcessHandleLocal Inference Process Handle interface with 3 public fields or methods.
LocalInferenceProcessSpecinterfaceinterface LocalInferenceProcessSpecLocal Inference Process Spec interface with 4 public fields or methods.
LocalInferenceProcessSupervisorinterfaceinterface LocalInferenceProcessSupervisorLocal Inference Process Supervisor interface with 1 public fields or methods.
LocalInferenceDriverModetypetype LocalInferenceDriverMode = 'connect' | 'managed'Public type alias for Local Inference Driver Mode; the declaration contains its complete type expression.
LocalInferenceDriverStatetypetype LocalInferenceDriverState = 'idle' | 'starting' | 'ready' | 'stopping' | 'stopped' | 'failed'Public type alias for Local Inference Driver State; the declaration contains its complete type expression.
LocalInferenceEngineKindtypetype LocalInferenceEngineKind = 'ollama' | 'sglang' | 'vllm'Public type alias for Local Inference Engine Kind; the declaration contains its complete type expression.
LocalInferenceHealthProbetypetype LocalInferenceHealthProbe = (request: LocalInferenceHealthProbeRequest) => Promise<boolean>Public type alias for Local Inference Health Probe; the declaration contains its complete type expression.

HttpLocalInferenceDriver

Http Local Inference Driver class with 10 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { HttpLocalInferenceDriver } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export declare class HttpLocalInferenceDriver implements LocalInferenceDriver {
    readonly id: string;
    readonly kind: LocalInferenceEngineKind;
    constructor(config: LocalInferenceDriverConfig, supervisor?: LocalInferenceProcessSupervisor, healthProbe?: LocalInferenceHealthProbe);
    start(model?: string | undefined): Promise<LocalInferenceDriverStatus>;
    load(model: string): Promise<LocalInferenceDriverStatus>;
    unload(model?: string | undefined): Promise<LocalInferenceDriverStatus>;
    stop(): Promise<LocalInferenceDriverStatus>;
    health(): Promise<boolean>;
    status(): LocalInferenceDriverStatus;
    backend(): InferenceBackend;
}

Public members

MemberKindSignatureDescription
backendmethodbackend(): InferenceBackendPublic method; parameters and return type are shown in the signature.
constructorconstructor(config: LocalInferenceDriverConfig, supervisor?: LocalInferenceProcessSupervisor, healthProbe?: LocalInferenceHealthProbe): HttpLocalInferenceDriverCreates an instance of this class.
healthmethodhealth(): Promise<boolean>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertyreadonly kind: LocalInferenceEngineKindPublic property; its type, readonly modifier and optionality are shown in the signature.
loadmethodload(model: string): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
startmethodstart(model?: string | undefined): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
statusmethodstatus(): LocalInferenceDriverStatusPublic method; parameters and return type are shown in the signature.
stopmethodstop(): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
unloadmethodunload(model?: string | undefined): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.

LocalInferenceDriverRegistry

Local Inference Driver Registry class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { LocalInferenceDriverRegistry } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export declare class LocalInferenceDriverRegistry {
    register(driver: LocalInferenceDriver): void;
    get(id: string): LocalInferenceDriver | null;
    require(id: string): LocalInferenceDriver;
    list(): LocalInferenceDriver[];
    stopAll(): Promise<void>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): LocalInferenceDriverRegistryCreates an instance of this class.
getmethodget(id: string): LocalInferenceDriver | nullPublic method; parameters and return type are shown in the signature.
listmethodlist(): LocalInferenceDriver[]Public method; parameters and return type are shown in the signature.
registermethodregister(driver: LocalInferenceDriver): voidPublic method; parameters and return type are shown in the signature.
requiremethodrequire(id: string): LocalInferenceDriverPublic method; parameters and return type are shown in the signature.
stopAllmethodstopAll(): Promise<void>Public method; parameters and return type are shown in the signature.

NodeLocalInferenceProcessSupervisor

Node Local Inference Process Supervisor class with 2 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { NodeLocalInferenceProcessSupervisor } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export declare class NodeLocalInferenceProcessSupervisor implements LocalInferenceProcessSupervisor {
    start(spec: LocalInferenceProcessSpec): Promise<LocalInferenceProcessHandle>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): NodeLocalInferenceProcessSupervisorCreates an instance of this class.
startmethodstart(spec: LocalInferenceProcessSpec): Promise<LocalInferenceProcessHandle>Public method; parameters and return type are shown in the signature.

LocalInferenceDriver

Local Inference Driver interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceDriver } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceDriver {
    readonly id: string;
    readonly kind: LocalInferenceEngineKind;
    start(model?: string): Promise<LocalInferenceDriverStatus>;
    load(model: string): Promise<LocalInferenceDriverStatus>;
    unload(model?: string): Promise<LocalInferenceDriverStatus>;
    stop(): Promise<LocalInferenceDriverStatus>;
    health(): Promise<boolean>;
    status(): LocalInferenceDriverStatus;
    backend(): InferenceBackend;
}

Contract members

MemberKindSignatureDescription
backendmethodbackend(): InferenceBackendPublic method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<boolean>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertyreadonly kind: LocalInferenceEngineKindPublic property; its type, readonly modifier and optionality are shown in the signature.
loadmethodload(model: string): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
startmethodstart(model?: string): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
statusmethodstatus(): LocalInferenceDriverStatusPublic method; parameters and return type are shown in the signature.
stopmethodstop(): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.
unloadmethodunload(model?: string): Promise<LocalInferenceDriverStatus>Public method; parameters and return type are shown in the signature.

LocalInferenceDriverConfig

Local Inference Driver Config interface with 17 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceDriverConfig } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceDriverConfig {
    id?: string;
    kind: LocalInferenceEngineKind;
    mode?: LocalInferenceDriverMode;
    baseUrl?: string;
    endpoint?: string;
    model?: string;
    host?: string;
    port?: number;
    command?: string;
    args?: string[];
    cwd?: string;
    env?: Record<string, string>;
    startupTimeoutMs?: number;
    healthPollMs?: number;
    requestTimeoutMs?: number;
    apiKey?: string;
    apiKeyEnv?: string;
}

Contract members

MemberKindSignatureDescription
apiKeypropertyapiKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
apiKeyEnvpropertyapiKeyEnv?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
argspropertyargs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
baseUrlpropertybaseUrl?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandpropertycommand?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cwdpropertycwd?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
endpointpropertyendpoint?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
envpropertyenv?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
healthPollMspropertyhealthPollMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
hostpropertyhost?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: LocalInferenceEngineKindPublic property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode?: LocalInferenceDriverModePublic property; its type, readonly modifier and optionality are shown in the signature.
modelpropertymodel?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
portpropertyport?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
requestTimeoutMspropertyrequestTimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
startupTimeoutMspropertystartupTimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

LocalInferenceDriverStatus

Local Inference Driver Status interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceDriverStatus } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceDriverStatus {
    id: string;
    kind: LocalInferenceEngineKind;
    mode: LocalInferenceDriverMode;
    state: LocalInferenceDriverState;
    baseUrl: string;
    model?: string;
    pid?: number;
    healthy: boolean;
    error?: string;
}

Contract members

MemberKindSignatureDescription
baseUrlpropertybaseUrl: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
healthypropertyhealthy: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: LocalInferenceEngineKindPublic property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: LocalInferenceDriverModePublic property; its type, readonly modifier and optionality are shown in the signature.
modelpropertymodel?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pidpropertypid?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
statepropertystate: LocalInferenceDriverStatePublic property; its type, readonly modifier and optionality are shown in the signature.

LocalInferenceHealthProbeRequest

Local Inference Health Probe Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceHealthProbeRequest } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceHealthProbeRequest {
    url: string;
    headers: Record<string, string>;
    timeoutMs: number;
}

Contract members

MemberKindSignatureDescription
headerspropertyheaders: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
timeoutMspropertytimeoutMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
urlpropertyurl: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

LocalInferenceProcessHandle

Local Inference Process Handle interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceProcessHandle } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceProcessHandle {
    readonly pid?: number;
    readonly exited: Promise<{
        code: number | null;
        signal: NodeJS.Signals | null;
    }>;
    stop(graceMs?: number): Promise<void>;
}

Contract members

MemberKindSignatureDescription
exitedpropertyreadonly exited: Promise<{ code: number | null; signal: NodeJS.Signals | null; }>Public property; its type, readonly modifier and optionality are shown in the signature.
pidpropertyreadonly pid?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stopmethodstop(graceMs?: number): Promise<void>Public method; parameters and return type are shown in the signature.

LocalInferenceProcessSpec

Local Inference Process Spec interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceProcessSpec } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceProcessSpec {
    command: string;
    args: string[];
    cwd?: string;
    env?: Record<string, string>;
}

Contract members

MemberKindSignatureDescription
argspropertyargs: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
commandpropertycommand: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cwdpropertycwd?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
envpropertyenv?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.

LocalInferenceProcessSupervisor

Local Inference Process Supervisor interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { LocalInferenceProcessSupervisor } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export interface LocalInferenceProcessSupervisor {
    start(spec: LocalInferenceProcessSpec): Promise<LocalInferenceProcessHandle>;
}

Contract members

MemberKindSignatureDescription
startmethodstart(spec: LocalInferenceProcessSpec): Promise<LocalInferenceProcessHandle>Public method; parameters and return type are shown in the signature.

LocalInferenceDriverMode

Public type alias for Local Inference Driver Mode; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { LocalInferenceDriverMode } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export type LocalInferenceDriverMode = 'connect' | 'managed';

LocalInferenceDriverState

Public type alias for Local Inference Driver State; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { LocalInferenceDriverState } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export type LocalInferenceDriverState = 'idle' | 'starting' | 'ready' | 'stopping' | 'stopped' | 'failed';

LocalInferenceEngineKind

Public type alias for Local Inference Engine Kind; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { LocalInferenceEngineKind } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export type LocalInferenceEngineKind = 'ollama' | 'sglang' | 'vllm';

LocalInferenceHealthProbe

Public type alias for Local Inference Health Probe; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { LocalInferenceHealthProbe } from '@codesoul-co/hypha-inference';
  • Source module: drivers

Declaration

text
export type LocalInferenceHealthProbe = (request: LocalInferenceHealthProbeRequest) => Promise<boolean>;