Skip to content

@codesoul-co/hypha-memory / recovery

Using this module

Use the Recovery module for handling bounded recovery, retry, or degradation. It exports 2 functions, 3 interfaces, 1 type.

Import from the package entrypoint

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

import type {
  MemoryFailureContext,
  MemoryRecoveryAdvice,
  MemoryRecoveryScope,
  MemoryRecoveryOperation,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 4 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 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
adviseMemoryRecoveryfunctionadviseMemoryRecovery(failure: RecoveryFailure): MemoryRecoveryAdviceAdvise Memory Recovery function with 1 public call signature; parameters and return types are listed below.
classifyMemoryFailurefunctionclassifyMemoryFailure(error: unknown, context: MemoryFailureContext): RecoveryFailureClassify Memory Failure function with 1 public call signature; parameters and return types are listed below.
MemoryFailureContextinterfaceinterface MemoryFailureContextMemory Failure Context interface with 13 public fields or methods.
MemoryRecoveryAdviceinterfaceinterface MemoryRecoveryAdviceMemory Recovery Advice interface with 3 public fields or methods.
MemoryRecoveryScopeinterfaceinterface MemoryRecoveryScopeMemory Recovery Scope interface with 4 public fields or methods.
MemoryRecoveryOperationtypetype MemoryRecoveryOperation = 'read' | 'search' | 'write' | 'update' | 'invalidate' | 'summarize' | 'audit'Public type alias for Memory Recovery Operation; the declaration contains its complete type expression.

adviseMemoryRecovery

Advise Memory Recovery function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { adviseMemoryRecovery } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export declare function adviseMemoryRecovery(failure: RecoveryFailure): MemoryRecoveryAdvice;

Call signature

text
adviseMemoryRecovery(failure: RecoveryFailure): MemoryRecoveryAdvice

Parameters

ParameterTypeRequiredDescription
failureRecoveryFailureYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: MemoryRecoveryAdvice
  • Description: The return contract is defined by the type shown above.

classifyMemoryFailure

Classify Memory Failure function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { classifyMemoryFailure } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export declare function classifyMemoryFailure(error: unknown, context: MemoryFailureContext): RecoveryFailure;

Call signature

text
classifyMemoryFailure(error: unknown, context: MemoryFailureContext): RecoveryFailure

Parameters

ParameterTypeRequiredDescription
errorunknownYesRequired parameter; accepted values are defined by the type column.
contextMemoryFailureContextYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: RecoveryFailure
  • Description: The return contract is defined by the type shown above.

MemoryFailureContext

Memory Failure Context interface with 13 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryFailureContext } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export interface MemoryFailureContext {
    id: string;
    operation: MemoryRecoveryOperation;
    scope: MemoryRecoveryScope;
    occurredAt?: string;
    providerId?: string;
    providerRevision?: string;
    specRevision?: string;
    policyRevision?: string;
    recordId?: string;
    idempotencyKey?: string;
    sideEffectState?: RecoverySideEffectState;
    compensationAvailable?: boolean;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
compensationAvailablepropertycompensationAvailable?: 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.
idempotencyKeypropertyidempotencyKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
occurredAtpropertyoccurredAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationpropertyoperation: MemoryRecoveryOperationPublic property; its type, readonly modifier and optionality are shown in the signature.
policyRevisionpropertypolicyRevision?: stringPublic 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.
providerRevisionpropertyproviderRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recordIdpropertyrecordId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: MemoryRecoveryScopePublic property; its type, readonly modifier and optionality are shown in the signature.
sideEffectStatepropertysideEffectState?: RecoverySideEffectStatePublic property; its type, readonly modifier and optionality are shown in the signature.
specRevisionpropertyspecRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRecoveryAdvice

Memory Recovery Advice interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryRecoveryAdvice } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export interface MemoryRecoveryAdvice {
    strategy: RecoveryStrategy;
    reason: string;
    allowBoundedEmptyResult: boolean;
}

Contract members

MemberKindSignatureDescription
allowBoundedEmptyResultpropertyallowBoundedEmptyResult: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
strategypropertystrategy: "fail" | "retry" | "human_review" | "reconcile" | "fallback" | "degrade" | "compensate" | "wait" | "quarantine" | "cancel"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryRecoveryScope

Memory Recovery Scope interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryRecoveryScope } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export interface MemoryRecoveryScope {
    workspaceId?: string;
    sessionId?: string;
    runId?: string;
    userId?: string;
}

Contract members

MemberKindSignatureDescription
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRecoveryOperation

Public type alias for Memory Recovery Operation; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemoryRecoveryOperation } from '@codesoul-co/hypha-memory';
  • Source module: recovery

Declaration

text
export type MemoryRecoveryOperation = 'read' | 'search' | 'write' | 'update' | 'invalidate' | 'summarize' | 'audit';