Skip to content

@codesoul-co/hypha-memory / provider-operational-health

Using this module

Use the Provider operational health module for binding external or local providers to Hypha ports. It exports 1 class, 4 interfaces, 2 types.

Import from the package entrypoint

ts
import {
  MemoryOperationalHealthService,
} from '@codesoul-co/hypha-memory';

import type {
  MemoryOperationalHealth,
  ProviderOperationalProbe,
  ProviderOperationalSnapshot,
  ProviderRuntimeMetrics,
  LivenessStatus,
  OperationalStatus,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 6 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 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
MemoryOperationalHealthServiceclassnew MemoryOperationalHealthService(probes: ProviderOperationalProbe[], now?: () => string): MemoryOperationalHealthServiceMemory Operational Health Service class with 2 public constructor or member entries; its exact declarations are listed below.
MemoryOperationalHealthinterfaceinterface MemoryOperationalHealthMemory Operational Health interface with 4 public fields or methods.
ProviderOperationalProbeinterfaceinterface ProviderOperationalProbeProvider Operational Probe interface with 4 public fields or methods.
ProviderOperationalSnapshotinterfaceinterface ProviderOperationalSnapshotProvider Operational Snapshot interface with 4 public fields or methods.
ProviderRuntimeMetricsinterfaceinterface ProviderRuntimeMetricsProvider Runtime Metrics interface with 11 public fields or methods.
LivenessStatustypetype LivenessStatus = 'alive' | 'stalled'Public type alias for Liveness Status; the declaration contains its complete type expression.
OperationalStatustypetype OperationalStatus = 'ready' | 'degraded' | 'not_ready'Public type alias for Operational Status; the declaration contains its complete type expression.

MemoryOperationalHealthService

Memory Operational Health Service class with 2 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MemoryOperationalHealthService } from '@codesoul-co/hypha-memory';
  • Source module: provider-operational-health

Declaration

text
export declare class MemoryOperationalHealthService {
    constructor(probes: ProviderOperationalProbe[], now?: () => string);
    snapshot(signal?: AbortSignal): Promise<MemoryOperationalHealth>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(probes: ProviderOperationalProbe[], now?: () => string): MemoryOperationalHealthServiceCreates an instance of this class.
snapshotmethodsnapshot(signal?: AbortSignal): Promise<MemoryOperationalHealth>Public method; parameters and return type are shown in the signature.

MemoryOperationalHealth

Memory Operational Health interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryOperationalHealth } from '@codesoul-co/hypha-memory';
  • Source module: provider-operational-health

Declaration

text
export interface MemoryOperationalHealth {
    readiness: {
        status: OperationalStatus;
        reasons: string[];
    };
    liveness: {
        status: LivenessStatus;
        reasons: string[];
    };
    providers: ProviderOperationalSnapshot[];
    checkedAt: string;
}

Contract members

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
livenesspropertyliveness: { status: LivenessStatus; reasons: string[]; }Public property; its type, readonly modifier and optionality are shown in the signature.
providerspropertyproviders: ProviderOperationalSnapshot[]Public property; its type, readonly modifier and optionality are shown in the signature.
readinesspropertyreadiness: { status: OperationalStatus; reasons: string[]; }Public property; its type, readonly modifier and optionality are shown in the signature.

ProviderOperationalProbe

Provider Operational Probe interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ProviderOperationalProbe } from '@codesoul-co/hypha-memory';
  • Source module: provider-operational-health

Declaration

text
export interface ProviderOperationalProbe {
    readonly providerId: string;
    readonly required: boolean;
    health(signal?: AbortSignal): Promise<ProviderHealth>;
    metrics(): Promise<ProviderRuntimeMetrics>;
}

Contract members

MemberKindSignatureDescription
healthmethodhealth(signal?: AbortSignal): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
metricsmethodmetrics(): Promise<ProviderRuntimeMetrics>Public method; parameters and return type are shown in the signature.
providerIdpropertyreadonly providerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requiredpropertyreadonly required: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ProviderOperationalSnapshot

Provider Operational Snapshot interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ProviderOperationalSnapshot } from '@codesoul-co/hypha-memory';
  • Source module: provider-operational-health

Declaration

text
export interface ProviderOperationalSnapshot {
    providerId: string;
    health: ProviderHealth;
    metrics: ProviderRuntimeMetrics;
    required: boolean;
}

Contract members

MemberKindSignatureDescription
healthpropertyhealth: ProviderHealthPublic property; its type, readonly modifier and optionality are shown in the signature.
metricspropertymetrics: ProviderRuntimeMetricsPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requiredpropertyrequired: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ProviderRuntimeMetrics

Provider Runtime Metrics interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ProviderRuntimeMetrics } from '@codesoul-co/hypha-memory';
  • Source module: provider-operational-health

Declaration

text
export interface ProviderRuntimeMetrics {
    poolActive?: number;
    poolIdle?: number;
    poolLimit?: number;
    queueDepth?: number;
    queueOldestAgeMs?: number;
    retryAttempts?: number;
    retryBudgetRemaining?: number;
    circuitState?: 'closed' | 'open' | 'half_open';
    rateLimitRemaining?: number;
    quarantinedOperations?: number;
    deadLetterCount?: number;
}

Contract members

MemberKindSignatureDescription
circuitStatepropertycircuitState?: "closed" | "open" | "half_open"Public property; its type, readonly modifier and optionality are shown in the signature.
deadLetterCountpropertydeadLetterCount?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
poolActivepropertypoolActive?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
poolIdlepropertypoolIdle?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
poolLimitpropertypoolLimit?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
quarantinedOperationspropertyquarantinedOperations?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
queueDepthpropertyqueueDepth?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
queueOldestAgeMspropertyqueueOldestAgeMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
rateLimitRemainingpropertyrateLimitRemaining?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
retryAttemptspropertyretryAttempts?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
retryBudgetRemainingpropertyretryBudgetRemaining?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

LivenessStatus

Public type alias for Liveness Status; the declaration contains its complete type expression.

Declaration

text
export type LivenessStatus = 'alive' | 'stalled';

OperationalStatus

Public type alias for Operational Status; the declaration contains its complete type expression.

Declaration

text
export type OperationalStatus = 'ready' | 'degraded' | 'not_ready';