Skip to content

@codesoul-co/hypha-core / modules/execution/recovery

Using this module

Use the Recovery module for executing runtime behavior at this boundary. It exports 2 functions, 2 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  adviseExecutionRecovery,
  classifyExecutionFailure,
} from '@codesoul-co/hypha-core';

import type {
  ExecutionFailureContext,
  ExecutionRecoveryAdvice,
  ExecutionRecoveryOperation,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 3 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
adviseExecutionRecoveryfunctionadviseExecutionRecovery(failure: RecoveryFailure): ExecutionRecoveryAdviceAdvise Execution Recovery function with 1 public call signature; parameters and return types are listed below.
classifyExecutionFailurefunctionclassifyExecutionFailure(error: unknown, context: ExecutionFailureContext): RecoveryFailureClassify Execution Failure function with 1 public call signature; parameters and return types are listed below.
ExecutionFailureContextinterfaceinterface ExecutionFailureContextExecution Failure Context interface with 14 public fields or methods.
ExecutionRecoveryAdviceinterfaceinterface ExecutionRecoveryAdviceExecution Recovery Advice interface with 4 public fields or methods.
ExecutionRecoveryOperationtypetype ExecutionRecoveryOperation = 'validate' | 'queue' | 'start' | 'poll' | 'cancel' | 'persist' | 'cleanup'Public type alias for Execution Recovery Operation; the declaration contains its complete type expression.

adviseExecutionRecovery

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

Declaration

text
export declare function adviseExecutionRecovery(failure: RecoveryFailure): ExecutionRecoveryAdvice;

Call signature

text
adviseExecutionRecovery(failure: RecoveryFailure): ExecutionRecoveryAdvice

Parameters

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

Returns

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

classifyExecutionFailure

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

  • Kind: function
  • Import: import { classifyExecutionFailure } from '@codesoul-co/hypha-core';
  • Source module: modules/execution/recovery

Declaration

text
export declare function classifyExecutionFailure(error: unknown, context: ExecutionFailureContext): RecoveryFailure;

Call signature

text
classifyExecutionFailure(error: unknown, context: ExecutionFailureContext): RecoveryFailure

Parameters

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

Returns

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

ExecutionFailureContext

Execution Failure Context interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { ExecutionFailureContext } from '@codesoul-co/hypha-core';
  • Source module: modules/execution/recovery

Declaration

text
export interface ExecutionFailureContext {
    id: string;
    operation: ExecutionRecoveryOperation;
    occurredAt?: string;
    request?: CommandExecutionRequest;
    record?: ExecutionRecord;
    result?: CommandExecutionResult;
    assessment?: ExecutionRecoveryAssessment;
    providerId?: string;
    providerRevision?: string;
    policyRevision?: string;
    specRevision?: string;
    sideEffectState?: RecoverySideEffectState;
    compensationAvailable?: boolean;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
assessmentpropertyassessment?: ExecutionRecoveryAssessmentPublic property; its type, readonly modifier and optionality are shown in the signature.
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.
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: ExecutionRecoveryOperationPublic 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.
recordpropertyrecord?: ExecutionRecordPublic property; its type, readonly modifier and optionality are shown in the signature.
requestpropertyrequest?: CommandExecutionRequestPublic property; its type, readonly modifier and optionality are shown in the signature.
resultpropertyresult?: CommandExecutionResultPublic 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.

ExecutionRecoveryAdvice

Execution Recovery Advice interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ExecutionRecoveryAdvice } from '@codesoul-co/hypha-core';
  • Source module: modules/execution/recovery

Declaration

text
export interface ExecutionRecoveryAdvice {
    strategy: RecoveryStrategy;
    reason: string;
    refreshRecordBeforeRetry: boolean;
    requireReceiptReconciliation: boolean;
}

Contract members

MemberKindSignatureDescription
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
refreshRecordBeforeRetrypropertyrefreshRecordBeforeRetry: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
requireReceiptReconciliationpropertyrequireReceiptReconciliation: booleanPublic 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.

ExecutionRecoveryOperation

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

  • Kind: type
  • Import: import type { ExecutionRecoveryOperation } from '@codesoul-co/hypha-core';
  • Source module: modules/execution/recovery

Declaration

text
export type ExecutionRecoveryOperation = 'validate' | 'queue' | 'start' | 'poll' | 'cancel' | 'persist' | 'cleanup';