@codesoul-co/hypha-harness / recovery-supervisor
- Package index:
@codesoul-co/hypha-harness - Source:
packages/harness/src/recovery-supervisor.ts - Exports: 8
Using this module
Use the Recovery supervisor module for handling bounded recovery, retry, or degradation. It exports 1 function, 6 interfaces, 1 type.
Import from the package entrypoint
import {
runRecoverySupervisor,
} from '@codesoul-co/hypha-harness';
import type {
RecoveryParticipant,
RecoveryParticipantContext,
RecoveryParticipantResult,
RecoverySupervisorOptions,
RecoverySupervisorResult,
RecoverySupervisorScheduler,
RecoveryParticipantAction,
} from '@codesoul-co/hypha-harness';Usage patterns
- Use the 7 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 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
runRecoverySupervisor | function | runRecoverySupervisor(options: RecoverySupervisorOptions): Promise<RecoverySupervisorResult> | Runs a dependency-ordered, FSM-governed recovery workflow. A participant is retried only while its evidence changes or the bounded strategy budget has not been exhausted. Completed upstream participants are not repeated. |
RecoveryParticipant | interface | interface RecoveryParticipant | Recovery Participant interface with 9 public fields or methods. |
RecoveryParticipantContext | interface | interface RecoveryParticipantContext | Recovery Participant Context interface with 10 public fields or methods. |
RecoveryParticipantResult | interface | interface RecoveryParticipantResult | Recovery Participant Result interface with 3 public fields or methods. |
RecoverySupervisorOptions | interface | interface RecoverySupervisorOptions | Recovery Supervisor Options interface with 18 public fields or methods. |
RecoverySupervisorResult | interface | interface RecoverySupervisorResult | Recovery Supervisor Result interface with 5 public fields or methods. |
RecoverySupervisorScheduler | interface | interface RecoverySupervisorScheduler | Recovery Supervisor Scheduler interface with 1 public fields or methods. |
RecoveryParticipantAction | type | type RecoveryParticipantAction = (context: RecoveryParticipantContext) => Promise<RecoveryParticipantResult<TOutput>> | Public type alias for Recovery Participant Action; the declaration contains its complete type expression. |
runRecoverySupervisor
Runs a dependency-ordered, FSM-governed recovery workflow. A participant is retried only while its evidence changes or the bounded strategy budget has not been exhausted. Completed upstream participants are not repeated.
- Kind: function
- Import:
import { runRecoverySupervisor } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export declare function runRecoverySupervisor(options: RecoverySupervisorOptions): Promise<RecoverySupervisorResult>;Call signature
runRecoverySupervisor(options: RecoverySupervisorOptions): Promise<RecoverySupervisorResult>Runs a dependency-ordered, FSM-governed recovery workflow. A participant is retried only while its evidence changes or the bounded strategy budget has not been exhausted. Completed upstream participants are not repeated.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options | RecoverySupervisorOptions | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
Promise<RecoverySupervisorResult> - Description: The return contract is defined by the type shown above.
RecoveryParticipant
Recovery Participant interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { RecoveryParticipant } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoveryParticipant<TOutput = unknown> {
id: string;
module: RecoveryModule;
dependsOn?: string[];
execute: RecoveryParticipantAction<TOutput>;
classify(error: unknown, context: RecoveryParticipantContext): RecoveryFailure | Promise<RecoveryFailure>;
reconcile?: RecoveryParticipantAction<TOutput>;
fallback?: RecoveryParticipantAction<TOutput>;
degrade?: RecoveryParticipantAction<TOutput>;
compensate?: RecoveryParticipantAction<TOutput>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
classify | method | classify(error: unknown, context: RecoveryParticipantContext): RecoveryFailure | Promise<RecoveryFailure> | Public method; parameters and return type are shown in the signature. |
compensate | method | compensate?(context: RecoveryParticipantContext): Promise<RecoveryParticipantResult<TOutput>> | Public method; parameters and return type are shown in the signature. |
degrade | method | degrade?(context: RecoveryParticipantContext): Promise<RecoveryParticipantResult<TOutput>> | Public method; parameters and return type are shown in the signature. |
dependsOn | property | dependsOn?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
execute | method | execute(context: RecoveryParticipantContext): Promise<RecoveryParticipantResult<TOutput>> | Public method; parameters and return type are shown in the signature. |
fallback | method | fallback?(context: RecoveryParticipantContext): Promise<RecoveryParticipantResult<TOutput>> | Public method; parameters and return type are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
module | property | module: "memory" | "domain" | "mcp" | "policy" | "workspace" | "tool" | "unknown" | "execution" | "fsm" | "inference" | "storage" | "message_bus" | "cache" | Public property; its type, readonly modifier and optionality are shown in the signature. |
reconcile | method | reconcile?(context: RecoveryParticipantContext): Promise<RecoveryParticipantResult<TOutput>> | Public method; parameters and return type are shown in the signature. |
RecoveryParticipantContext
Recovery Participant Context interface with 10 public fields or methods.
- Kind: interface
- Import:
import type { RecoveryParticipantContext } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoveryParticipantContext {
caseId: string;
runId: string;
scope: RecoveryKnowledgeScope;
participantId: string;
module: RecoveryModule;
cycle: number;
outputs: Readonly<Record<string, unknown>>;
snapshot?: Readonly<RecoveryCaseSnapshot>;
failure?: RecoveryFailure;
signal?: AbortSignal;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
caseId | property | caseId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
cycle | property | cycle: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
failure | property | failure?: RecoveryFailure | Public property; its type, readonly modifier and optionality are shown in the signature. |
module | property | module: "memory" | "domain" | "mcp" | "policy" | "workspace" | "tool" | "unknown" | "execution" | "fsm" | "inference" | "storage" | "message_bus" | "cache" | Public property; its type, readonly modifier and optionality are shown in the signature. |
outputs | property | outputs: Readonly<Record<string, unknown>> | Public property; its type, readonly modifier and optionality are shown in the signature. |
participantId | property | participantId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RecoveryKnowledgeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
signal | property | signal?: AbortSignal | Public property; its type, readonly modifier and optionality are shown in the signature. |
snapshot | property | snapshot?: Readonly<RecoveryCaseSnapshot> | Public property; its type, readonly modifier and optionality are shown in the signature. |
RecoveryParticipantResult
Recovery Participant Result interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RecoveryParticipantResult } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoveryParticipantResult<TOutput = unknown> {
output: TOutput;
evidence: RecoveryEvidence;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
evidence | property | evidence: RecoveryEvidence | 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. |
output | property | output: TOutput | Public property; its type, readonly modifier and optionality are shown in the signature. |
RecoverySupervisorOptions
Recovery Supervisor Options interface with 18 public fields or methods.
- Kind: interface
- Import:
import type { RecoverySupervisorOptions } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoverySupervisorOptions {
fsm: FSMRuntime;
caseId: string;
userId: string;
tenantId?: string;
participants: RecoveryParticipant[];
policy?: Partial<RecoveryConvergencePolicy>;
knowledge?: RecoveryKnowledgePort;
trace?: TraceRecorder;
sessionId?: string;
workspaceId?: string;
stepId?: string;
agentId?: string;
domainPackId?: string;
scheduler?: RecoverySupervisorScheduler;
maxInlineDelayMs?: number;
signal?: AbortSignal;
now?: () => string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
caseId | property | caseId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
domainPackId | property | domainPackId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
fsm | property | fsm: FSMRuntime | Public property; its type, readonly modifier and optionality are shown in the signature. |
knowledge | property | knowledge?: RecoveryKnowledgePort | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxInlineDelayMs | property | maxInlineDelayMs?: number | 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. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
participants | property | participants: RecoveryParticipant<unknown>[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
policy | property | policy?: Partial<RecoveryConvergencePolicy> | Public property; its type, readonly modifier and optionality are shown in the signature. |
scheduler | property | scheduler?: RecoverySupervisorScheduler | 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. |
signal | property | signal?: AbortSignal | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
trace | property | trace?: TraceRecorder | 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. |
RecoverySupervisorResult
Recovery Supervisor Result interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { RecoverySupervisorResult } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoverySupervisorResult {
status: 'succeeded' | 'degraded' | 'compensated' | 'suspended' | 'quarantined' | 'failed' | 'cancelled';
outputs: Record<string, unknown>;
snapshot?: RecoveryCaseSnapshot;
failure?: RecoveryFailure;
error?: unknown;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
error | property | error?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
failure | property | failure?: RecoveryFailure | Public property; its type, readonly modifier and optionality are shown in the signature. |
outputs | property | outputs: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
snapshot | property | snapshot?: RecoveryCaseSnapshot | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: "degraded" | "cancelled" | "failed" | "quarantined" | "succeeded" | "suspended" | "compensated" | Public property; its type, readonly modifier and optionality are shown in the signature. |
RecoverySupervisorScheduler
Recovery Supervisor Scheduler interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { RecoverySupervisorScheduler } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export interface RecoverySupervisorScheduler {
wait(delayMs: number, decision: FSMRecoveryDecision, signal?: AbortSignal): Promise<void>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
wait | method | wait(delayMs: number, decision: FSMRecoveryDecision, signal?: AbortSignal): Promise<void> | Public method; parameters and return type are shown in the signature. |
RecoveryParticipantAction
Public type alias for Recovery Participant Action; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RecoveryParticipantAction } from '@codesoul-co/hypha-harness'; - Source module:
recovery-supervisor
Declaration
export type RecoveryParticipantAction<TOutput = unknown> = (context: RecoveryParticipantContext) => Promise<RecoveryParticipantResult<TOutput>>;