@codesoul-co/hypha-memory / recovery
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/recovery.ts - Exports: 6
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
| Symbol | Kind | Signature | Description |
|---|---|---|---|
adviseMemoryRecovery | function | adviseMemoryRecovery(failure: RecoveryFailure): MemoryRecoveryAdvice | Advise Memory Recovery function with 1 public call signature; parameters and return types are listed below. |
classifyMemoryFailure | function | classifyMemoryFailure(error: unknown, context: MemoryFailureContext): RecoveryFailure | Classify Memory Failure function with 1 public call signature; parameters and return types are listed below. |
MemoryFailureContext | interface | interface MemoryFailureContext | Memory Failure Context interface with 13 public fields or methods. |
MemoryRecoveryAdvice | interface | interface MemoryRecoveryAdvice | Memory Recovery Advice interface with 3 public fields or methods. |
MemoryRecoveryScope | interface | interface MemoryRecoveryScope | Memory Recovery Scope interface with 4 public fields or methods. |
MemoryRecoveryOperation | type | type 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): MemoryRecoveryAdviceParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
failure | RecoveryFailure | Yes | Required 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): RecoveryFailureParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
error | unknown | Yes | Required parameter; accepted values are defined by the type column. |
context | MemoryFailureContext | Yes | Required 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
| Member | Kind | Signature | Description |
|---|---|---|---|
compensationAvailable | property | compensationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
occurredAt | property | occurredAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
operation | property | operation: MemoryRecoveryOperation | Public property; its type, readonly modifier and optionality are shown in the signature. |
policyRevision | property | policyRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerId | property | providerId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerRevision | property | providerRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
recordId | property | recordId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: MemoryRecoveryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
sideEffectState | property | sideEffectState?: RecoverySideEffectState | Public property; its type, readonly modifier and optionality are shown in the signature. |
specRevision | property | specRevision?: string | Public 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
| Member | Kind | Signature | Description |
|---|---|---|---|
allowBoundedEmptyResult | property | allowBoundedEmptyResult: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
strategy | property | strategy: "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
| Member | Kind | Signature | Description |
|---|---|---|---|
runId | property | runId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sessionId | property | sessionId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
workspaceId | property | workspaceId?: string | Public 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';