@codesoul-co/hypha-fsm / recovery
- Package index:
@codesoul-co/hypha-fsm - Source:
packages/fsm/src/recovery.ts - Exports: 27
Using this module
Use the Recovery module for handling bounded recovery, retry, or degradation. It exports 7 constants, 5 functions, 10 interfaces, 5 types.
Import from the package entrypoint
import {
defaultFSMRecoveryPolicy,
FSM_ANOMALY_CATEGORIES,
FSM_ANOMALY_SOURCES,
FSM_RECOVERY_ACTIONS,
fsmAnomalySchema,
fsmRecoveryPolicySpecSchema,
fsmRecoverySnapshotSchema,
classifyFSMAnomaly,
} from '@codesoul-co/hypha-fsm';
import type {
FSMAnomaly,
FSMAnomalyClassificationInput,
FSMCircuitBreakerPolicy,
FSMCircuitSnapshot,
FSMRecoveryBackoffPolicy,
FSMRecoveryDecision,
FSMRecoveryPlan,
FSMRecoveryPolicySpec,
} from '@codesoul-co/hypha-fsm';
// The complete export list is documented below.Usage patterns
- Use the 15 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 5 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
- The 7 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.
Runtime validation example
import { fsmAnomalySchema } from '@codesoul-co/hypha-fsm';
declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = fsmAnomalySchema.parse(input);Parse untrusted configuration, network, or persisted input with the runtime schema before passing it to functions or classes that expect a validated contract.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
defaultFSMRecoveryPolicy | constant | const defaultFSMRecoveryPolicy: FSMRecoveryPolicySpec | Default FSM Recovery Policy constant exported by the recovery module. |
FSM_ANOMALY_CATEGORIES | constant | const FSM_ANOMALY_CATEGORIES: readonly ["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted", "tool_failure", "inference_failure", "memory_failure", "execution_failure", "storage_failure", "message_failure", "cache_failure", "invariant_violation", "cancellation", "unknown"] | FSM ANOMALY CATEGORIES constant exported by the recovery module. |
FSM_ANOMALY_SOURCES | constant | const FSM_ANOMALY_SOURCES: readonly ["fsm", "inference", "tool", "memory", "execution", "mcp", "workspace", "storage", "message_bus", "cache", "policy", "domain", "unknown"] | FSM ANOMALY SOURCES constant exported by the recovery module. |
FSM_RECOVERY_ACTIONS | constant | const FSM_RECOVERY_ACTIONS: readonly ["retry", "reconcile", "fallback", "degrade", "wait", "compensate", "human_review", "quarantine", "fail", "cancel"] | FSM RECOVERY ACTIONS constant exported by the recovery module. |
fsmAnomalySchema | constant | const fsmAnomalySchema: z.ZodObject<{ id: z.ZodString; source: z.ZodEnum<["fsm", "inference", "tool", "memory", "execution", "mcp", "workspace", "storage", "message_bus", "cache", "policy", "domain", "unknown"]>; category: z.ZodEnum<["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted"... | Runtime schema for FSM Anomaly. |
fsmRecoveryPolicySpecSchema | constant | const fsmRecoveryPolicySpecSchema: z.ZodObject<{ maxAttemptsPerState: z.ZodNumber; maxTotalAttempts: z.ZodNumber; maxElapsedMs: z.ZodNumber; retryableCategories: z.ZodArray<z.ZodEnum<["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted", "tool_failure", "inference_failure", "memory_fai... | Runtime schema for FSM Recovery Policy Spec. |
fsmRecoverySnapshotSchema | constant | const fsmRecoverySnapshotSchema: z.ZodObject<{ startedAt: z.ZodString; updatedAt: z.ZodString; totalAttempts: z.ZodNumber; attemptsByState: z.ZodRecord<z.ZodString, z.ZodNumber>; circuits: z.ZodRecord<z.ZodString, z.ZodObject<{ status: z.ZodEnum<["closed", "open", "half_open"]>; consecutiveFailures: z.ZodNumber; halfOpenAttempts: z.ZodNumber; openedAt: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { status... | Runtime schema for FSM Recovery Snapshot. |
classifyFSMAnomaly | function | classifyFSMAnomaly(error: unknown, input: FSMAnomalyClassificationInput): FSMAnomaly | Classify FSM Anomaly function with 1 public call signature; parameters and return types are listed below. |
computeFSMRecoveryDelay | function | computeFSMRecoveryDelay(policy: FSMRecoveryBackoffPolicy, attempt: number, seed: string): number | Compute FSM Recovery Delay function with 1 public call signature; parameters and return types are listed below. |
createInitialFSMRecoverySnapshot | function | createInitialFSMRecoverySnapshot(now?: string): FSMRecoverySnapshot | Create Initial FSM Recovery Snapshot function with 1 public call signature; parameters and return types are listed below. |
planFSMRecovery | function | planFSMRecovery(input: { anomaly: FSMAnomaly; stateId: string; policy?: FSMRecoveryPolicySpec; snapshot?: FSMRecoverySnapshot; now?: string; }): FSMRecoveryPlan | Plan FSM Recovery function with 1 public call signature; parameters and return types are listed below. |
registerFSMRecoverySuccess | function | registerFSMRecoverySuccess(snapshot: FSMRecoverySnapshot, circuitKey: string, now?: string): FSMRecoverySnapshot | Register FSM Recovery Success function with 1 public call signature; parameters and return types are listed below. |
FSMAnomaly | interface | interface FSMAnomaly | FSM Anomaly interface with 15 public fields or methods. |
FSMAnomalyClassificationInput | interface | interface FSMAnomalyClassificationInput | FSM Anomaly Classification Input interface with 12 public fields or methods. |
FSMCircuitBreakerPolicy | interface | interface FSMCircuitBreakerPolicy | FSM Circuit Breaker Policy interface with 3 public fields or methods. |
FSMCircuitSnapshot | interface | interface FSMCircuitSnapshot | FSM Circuit Snapshot interface with 4 public fields or methods. |
FSMRecoveryBackoffPolicy | interface | interface FSMRecoveryBackoffPolicy | FSM Recovery Backoff Policy interface with 4 public fields or methods. |
FSMRecoveryDecision | interface | interface FSMRecoveryDecision | FSM Recovery Decision interface with 16 public fields or methods. |
FSMRecoveryPlan | interface | interface FSMRecoveryPlan | FSM Recovery Plan interface with 2 public fields or methods. |
FSMRecoveryPolicySpec | interface | interface FSMRecoveryPolicySpec | FSM Recovery Policy Spec interface with 10 public fields or methods. |
FSMRecoverySnapshot | interface | interface FSMRecoverySnapshot | FSM Recovery Snapshot interface with 7 public fields or methods. |
FSMRecoveryStateTargets | interface | interface FSMRecoveryStateTargets | FSM Recovery State Targets interface with 6 public fields or methods. |
FSMAnomalyCategory | type | type FSMAnomalyCategory = RecoveryCategory | Public type alias for FSM Anomaly Category; the declaration contains its complete type expression. |
FSMAnomalySource | type | type FSMAnomalySource = RecoveryModule | Public type alias for FSM Anomaly Source; the declaration contains its complete type expression. |
FSMCircuitStatus | type | type FSMCircuitStatus = 'closed' | 'open' | 'half_open' | Public type alias for FSM Circuit Status; the declaration contains its complete type expression. |
FSMRecoveryAction | type | type FSMRecoveryAction = (typeof FSM_RECOVERY_ACTIONS)[number] | Public type alias for FSM Recovery Action; the declaration contains its complete type expression. |
FSMSideEffectState | type | type FSMSideEffectState = RecoverySideEffectState | Public type alias for FSM Side Effect State; the declaration contains its complete type expression. |
defaultFSMRecoveryPolicy
Default FSM Recovery Policy constant exported by the recovery module.
- Kind: constant
- Import:
import { defaultFSMRecoveryPolicy } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const defaultFSMRecoveryPolicy: FSMRecoveryPolicySpec;FSM_ANOMALY_CATEGORIES
FSM ANOMALY CATEGORIES constant exported by the recovery module.
- Kind: constant
- Import:
import { FSM_ANOMALY_CATEGORIES } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const FSM_ANOMALY_CATEGORIES: readonly ["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted", "tool_failure", "inference_failure", "memory_failure", "execution_failure", "storage_failure", "message_failure", "cache_failure", "invariant_violation", "cancellation", "unknown"];FSM_ANOMALY_SOURCES
FSM ANOMALY SOURCES constant exported by the recovery module.
- Kind: constant
- Import:
import { FSM_ANOMALY_SOURCES } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const FSM_ANOMALY_SOURCES: readonly ["fsm", "inference", "tool", "memory", "execution", "mcp", "workspace", "storage", "message_bus", "cache", "policy", "domain", "unknown"];FSM_RECOVERY_ACTIONS
FSM RECOVERY ACTIONS constant exported by the recovery module.
- Kind: constant
- Import:
import { FSM_RECOVERY_ACTIONS } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const FSM_RECOVERY_ACTIONS: readonly ["retry", "reconcile", "fallback", "degrade", "wait", "compensate", "human_review", "quarantine", "fail", "cancel"];fsmAnomalySchema
Runtime schema for FSM Anomaly.
- Kind: constant
- Import:
import { fsmAnomalySchema } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const fsmAnomalySchema: z.ZodObject<{ id: z.ZodString; source: z.ZodEnum<["fsm", "inference", "tool", "memory", "execution", "mcp", "workspace", "storage", "message_bus", "cache", "policy", "domain", "unknown"]>; category: z.ZodEnum<["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted", "tool_failure", "inference_failure", "memory_failure", "execution_failure", "storage_failure", "message_failure", "cache_failure", "invariant_violation", "cancellation", "unknown"]>; code: z.ZodString; message: z.ZodString; occurredAt: z.ZodString; retryable: z.ZodOptional<z.ZodBoolean>; retryAfterMs: z.ZodOptional<z.ZodNumber>; circuitKey: z.ZodOptional<z.ZodString>; sideEffectState: z.ZodOptional<z.ZodEnum<["none", "not_started", "committed", "unknown"]>>; compensationAvailable: z.ZodOptional<z.ZodBoolean>; reconciliationAvailable: z.ZodOptional<z.ZodBoolean>; fallbackAvailable: z.ZodOptional<z.ZodBoolean>; degradationAvailable: z.ZodOptional<z.ZodBoolean>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { id: string; source: "fsm" | "inference" | "tool" | "memory" | "execution" | "mcp" | "workspace" | "storage" | "message_bus" | "cache" | "policy" | "domain" | "unknown"; category: "unknown" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "timeout" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation" | "cancellation"; code: string; message: string; occurredAt: string; retryable?: boolean | undefined; retryAfterMs?: number | undefined; circuitKey?: string | undefined; sideEffectState?: "unknown" | "none" | "not_started" | "committed" | undefined; compensationAvailable?: boolean | undefined; reconciliationAvailable?: boolean | undefined; fallbackAvailable?: boolean | undefined; degradationAvailable?: boolean | undefined; metadata?: Record<string, unknown> | undefined; }, { id: string; source: "fsm" | "inference" | "tool" | "memory" | "execution" | "mcp" | "workspace" | "storage" | "message_bus" | "cache" | "policy" | "domain" | "unknown"; category: "unknown" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "timeout" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation" | "cancellation"; code: string; message: string; occurredAt: string; retryable?: boolean | undefined; retryAfterMs?: number | undefined; circuitKey?: string | undefined; sideEffectState?: "unknown" | "none" | "not_started" | "committed" | undefined; compensationAvailable?: boolean | undefined; reconciliationAvailable?: boolean | undefined; fallbackAvailable?: boolean | undefined; degradationAvailable?: boolean | undefined; metadata?: Record<string, unknown> | undefined; }>;fsmRecoveryPolicySpecSchema
Runtime schema for FSM Recovery Policy Spec.
- Kind: constant
- Import:
import { fsmRecoveryPolicySpecSchema } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const fsmRecoveryPolicySpecSchema: z.ZodObject<{ maxAttemptsPerState: z.ZodNumber; maxTotalAttempts: z.ZodNumber; maxElapsedMs: z.ZodNumber; retryableCategories: z.ZodArray<z.ZodEnum<["validation", "policy_denied", "authentication", "authorization", "rate_limit", "timeout", "transient_dependency", "permanent_dependency", "concurrency_conflict", "resource_exhausted", "tool_failure", "inference_failure", "memory_failure", "execution_failure", "storage_failure", "message_failure", "cache_failure", "invariant_violation", "cancellation", "unknown"]>, "many">; nonRetryableCodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; backoff: z.ZodObject<{ initialDelayMs: z.ZodNumber; maxDelayMs: z.ZodNumber; multiplier: z.ZodNumber; jitterRatio: z.ZodNumber; }, "strip", z.ZodTypeAny, { initialDelayMs: number; maxDelayMs: number; multiplier: number; jitterRatio: number; }, { initialDelayMs: number; maxDelayMs: number; multiplier: number; jitterRatio: number; }>; circuitBreaker: z.ZodObject<{ failureThreshold: z.ZodNumber; resetTimeoutMs: z.ZodNumber; halfOpenMaxAttempts: z.ZodNumber; }, "strip", z.ZodTypeAny, { failureThreshold: number; resetTimeoutMs: number; halfOpenMaxAttempts: number; }, { failureThreshold: number; resetTimeoutMs: number; halfOpenMaxAttempts: number; }>; stateTargets: z.ZodObject<{ recovering: z.ZodString; compensating: z.ZodString; humanReview: z.ZodString; quarantined: z.ZodString; failed: z.ZodString; cancelled: z.ZodString; }, "strip", z.ZodTypeAny, { recovering: string; compensating: string; humanReview: string; quarantined: string; failed: string; cancelled: string; }, { recovering: string; compensating: string; humanReview: string; quarantined: string; failed: string; cancelled: string; }>; onExhausted: z.ZodEnum<["human_review", "quarantine", "fail"]>; afterCompensation: z.ZodEnum<["human_review", "quarantine", "fail"]>; }, "strip", z.ZodTypeAny, { maxAttemptsPerState: number; maxTotalAttempts: number; maxElapsedMs: number; retryableCategories: ("unknown" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "timeout" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation" | "cancellation")[]; backoff: { initialDelayMs: number; maxDelayMs: number; multiplier: number; jitterRatio: number; }; circuitBreaker: { failureThreshold: number; resetTimeoutMs: number; halfOpenMaxAttempts: number; }; stateTargets: { recovering: string; compensating: string; humanReview: string; quarantined: string; failed: string; cancelled: string; }; onExhausted: "human_review" | "quarantine" | "fail"; afterCompensation: "human_review" | "quarantine" | "fail"; nonRetryableCodes?: string[] | undefined; }, { maxAttemptsPerState: number; maxTotalAttempts: number; maxElapsedMs: number; retryableCategories: ("unknown" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "timeout" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation" | "cancellation")[]; backoff: { initialDelayMs: number; maxDelayMs: number; multiplier: number; jitterRatio: number; }; circuitBreaker: { failureThreshold: number; resetTimeoutMs: number; halfOpenMaxAttempts: number; }; stateTargets: { recovering: string; compensating: string; humanReview: string; quarantined: string; failed: string; cancelled: string; }; onExhausted: "human_review" | "quarantine" | "fail"; afterCompensation: "human_review" | "quarantine" | "fail"; nonRetryableCodes?: string[] | undefined; }>;fsmRecoverySnapshotSchema
Runtime schema for FSM Recovery Snapshot.
- Kind: constant
- Import:
import { fsmRecoverySnapshotSchema } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare const fsmRecoverySnapshotSchema: z.ZodObject<{ startedAt: z.ZodString; updatedAt: z.ZodString; totalAttempts: z.ZodNumber; attemptsByState: z.ZodRecord<z.ZodString, z.ZodNumber>; circuits: z.ZodRecord<z.ZodString, z.ZodObject<{ status: z.ZodEnum<["closed", "open", "half_open"]>; consecutiveFailures: z.ZodNumber; halfOpenAttempts: z.ZodNumber; openedAt: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { status: "closed" | "open" | "half_open"; consecutiveFailures: number; halfOpenAttempts: number; openedAt?: string | undefined; }, { status: "closed" | "open" | "half_open"; consecutiveFailures: number; halfOpenAttempts: number; openedAt?: string | undefined; }>>; lastAnomalyId: z.ZodOptional<z.ZodString>; lastAction: z.ZodOptional<z.ZodEnum<["retry", "reconcile", "fallback", "degrade", "wait", "compensate", "human_review", "quarantine", "fail", "cancel"]>>; }, "strip", z.ZodTypeAny, { startedAt: string; updatedAt: string; totalAttempts: number; attemptsByState: Record<string, number>; circuits: Record<string, { status: "closed" | "open" | "half_open"; consecutiveFailures: number; halfOpenAttempts: number; openedAt?: string | undefined; }>; lastAnomalyId?: string | undefined; lastAction?: "retry" | "reconcile" | "fallback" | "degrade" | "wait" | "compensate" | "human_review" | "quarantine" | "fail" | "cancel" | undefined; }, { startedAt: string; updatedAt: string; totalAttempts: number; attemptsByState: Record<string, number>; circuits: Record<string, { status: "closed" | "open" | "half_open"; consecutiveFailures: number; halfOpenAttempts: number; openedAt?: string | undefined; }>; lastAnomalyId?: string | undefined; lastAction?: "retry" | "reconcile" | "fallback" | "degrade" | "wait" | "compensate" | "human_review" | "quarantine" | "fail" | "cancel" | undefined; }>;classifyFSMAnomaly
Classify FSM Anomaly function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { classifyFSMAnomaly } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare function classifyFSMAnomaly(error: unknown, input: FSMAnomalyClassificationInput): FSMAnomaly;Call signature
classifyFSMAnomaly(error: unknown, input: FSMAnomalyClassificationInput): FSMAnomalyParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
error | unknown | Yes | Required parameter; accepted values are defined by the type column. |
input | FSMAnomalyClassificationInput | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
FSMAnomaly - Description: The return contract is defined by the type shown above.
computeFSMRecoveryDelay
Compute FSM Recovery Delay function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { computeFSMRecoveryDelay } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare function computeFSMRecoveryDelay(policy: FSMRecoveryBackoffPolicy, attempt: number, seed: string): number;Call signature
computeFSMRecoveryDelay(policy: FSMRecoveryBackoffPolicy, attempt: number, seed: string): numberParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
policy | FSMRecoveryBackoffPolicy | Yes | Required parameter; accepted values are defined by the type column. |
attempt | number | Yes | Required parameter; accepted values are defined by the type column. |
seed | string | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
number - Description: The return contract is defined by the type shown above.
createInitialFSMRecoverySnapshot
Create Initial FSM Recovery Snapshot function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { createInitialFSMRecoverySnapshot } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare function createInitialFSMRecoverySnapshot(now?: string): FSMRecoverySnapshot;Call signature
createInitialFSMRecoverySnapshot(now?: string): FSMRecoverySnapshotParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
now | string | No | Optional parameter; accepted values are defined by the type column. |
Returns
- Type:
FSMRecoverySnapshot - Description: The return contract is defined by the type shown above.
planFSMRecovery
Plan FSM Recovery function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { planFSMRecovery } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare function planFSMRecovery(input: {
anomaly: FSMAnomaly;
stateId: string;
policy?: FSMRecoveryPolicySpec;
snapshot?: FSMRecoverySnapshot;
now?: string;
}): FSMRecoveryPlan;Call signature
planFSMRecovery(input: { anomaly: FSMAnomaly; stateId: string; policy?: FSMRecoveryPolicySpec; snapshot?: FSMRecoverySnapshot; now?: string; }): FSMRecoveryPlanParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | { anomaly: FSMAnomaly; stateId: string; policy?: FSMRecoveryPolicySpec; snapshot?: FSMRecoverySnapshot; now?: string; } | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
FSMRecoveryPlan - Description: The return contract is defined by the type shown above.
registerFSMRecoverySuccess
Register FSM Recovery Success function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { registerFSMRecoverySuccess } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export declare function registerFSMRecoverySuccess(snapshot: FSMRecoverySnapshot, circuitKey: string, now?: string): FSMRecoverySnapshot;Call signature
registerFSMRecoverySuccess(snapshot: FSMRecoverySnapshot, circuitKey: string, now?: string): FSMRecoverySnapshotParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
snapshot | FSMRecoverySnapshot | Yes | Required parameter; accepted values are defined by the type column. |
circuitKey | string | Yes | Required parameter; accepted values are defined by the type column. |
now | string | No | Optional parameter; accepted values are defined by the type column. |
Returns
- Type:
FSMRecoverySnapshot - Description: The return contract is defined by the type shown above.
FSMAnomaly
FSM Anomaly interface with 15 public fields or methods.
- Kind: interface
- Import:
import type { FSMAnomaly } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMAnomaly {
id: string;
source: FSMAnomalySource;
category: FSMAnomalyCategory;
code: string;
message: string;
occurredAt: string;
retryable?: boolean;
retryAfterMs?: number;
circuitKey?: string;
sideEffectState?: FSMSideEffectState;
compensationAvailable?: boolean;
reconciliationAvailable?: boolean;
fallbackAvailable?: boolean;
degradationAvailable?: boolean;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
category | property | category: "unknown" | "cancellation" | "timeout" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation" | Public property; its type, readonly modifier and optionality are shown in the signature. |
circuitKey | property | circuitKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
code | property | code: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
compensationAvailable | property | compensationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
degradationAvailable | property | degradationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
fallbackAvailable | property | fallbackAvailable?: 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. |
message | property | message: 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. |
reconciliationAvailable | property | reconciliationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryable | property | retryable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryAfterMs | property | retryAfterMs?: number | 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. |
source | property | source: "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. |
FSMAnomalyClassificationInput
FSM Anomaly Classification Input interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { FSMAnomalyClassificationInput } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMAnomalyClassificationInput {
id: string;
source?: FSMAnomalySource;
occurredAt?: string;
sideEffectState?: FSMSideEffectState;
compensationAvailable?: boolean;
reconciliationAvailable?: boolean;
fallbackAvailable?: boolean;
degradationAvailable?: boolean;
retryable?: boolean;
retryAfterMs?: number;
circuitKey?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
circuitKey | property | circuitKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
compensationAvailable | property | compensationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
degradationAvailable | property | degradationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
fallbackAvailable | property | fallbackAvailable?: 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. |
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. |
reconciliationAvailable | property | reconciliationAvailable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryable | property | retryable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryAfterMs | property | retryAfterMs?: number | 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. |
source | property | source?: "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. |
FSMCircuitBreakerPolicy
FSM Circuit Breaker Policy interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { FSMCircuitBreakerPolicy } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMCircuitBreakerPolicy {
failureThreshold: number;
resetTimeoutMs: number;
halfOpenMaxAttempts: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
failureThreshold | property | failureThreshold: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
halfOpenMaxAttempts | property | halfOpenMaxAttempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
resetTimeoutMs | property | resetTimeoutMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMCircuitSnapshot
FSM Circuit Snapshot interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { FSMCircuitSnapshot } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMCircuitSnapshot {
status: FSMCircuitStatus;
consecutiveFailures: number;
halfOpenAttempts: number;
openedAt?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
consecutiveFailures | property | consecutiveFailures: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
halfOpenAttempts | property | halfOpenAttempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
openedAt | property | openedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: FSMCircuitStatus | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoveryBackoffPolicy
FSM Recovery Backoff Policy interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoveryBackoffPolicy } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoveryBackoffPolicy {
initialDelayMs: number;
maxDelayMs: number;
multiplier: number;
jitterRatio: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
initialDelayMs | property | initialDelayMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
jitterRatio | property | jitterRatio: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxDelayMs | property | maxDelayMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
multiplier | property | multiplier: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoveryDecision
FSM Recovery Decision interface with 16 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoveryDecision } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoveryDecision {
anomaly: FSMAnomaly;
action: FSMRecoveryAction;
fromState: string;
transitionState: string;
resumeState?: string;
attempt: number;
totalAttempts: number;
delayMs: number;
decidedAt: string;
nextEligibleAt?: string;
circuitKey: string;
circuitStatus: FSMCircuitStatus;
reason: string;
quarantineState: string;
afterCompensationAction?: Extract<FSMRecoveryAction, 'human_review' | 'quarantine' | 'fail'>;
afterCompensationState?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
action | property | action: "fail" | "retry" | "human_review" | "reconcile" | "fallback" | "degrade" | "compensate" | "wait" | "quarantine" | "cancel" | Public property; its type, readonly modifier and optionality are shown in the signature. |
afterCompensationAction | property | afterCompensationAction?: "fail" | "human_review" | "quarantine" | Public property; its type, readonly modifier and optionality are shown in the signature. |
afterCompensationState | property | afterCompensationState?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
anomaly | property | anomaly: FSMAnomaly | Public property; its type, readonly modifier and optionality are shown in the signature. |
attempt | property | attempt: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
circuitKey | property | circuitKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
circuitStatus | property | circuitStatus: FSMCircuitStatus | Public property; its type, readonly modifier and optionality are shown in the signature. |
decidedAt | property | decidedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
delayMs | property | delayMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
fromState | property | fromState: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
nextEligibleAt | property | nextEligibleAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
quarantineState | property | quarantineState: string | 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. |
resumeState | property | resumeState?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalAttempts | property | totalAttempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
transitionState | property | transitionState: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoveryPlan
FSM Recovery Plan interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoveryPlan } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoveryPlan {
decision: FSMRecoveryDecision;
snapshot: FSMRecoverySnapshot;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
decision | property | decision: FSMRecoveryDecision | Public property; its type, readonly modifier and optionality are shown in the signature. |
snapshot | property | snapshot: FSMRecoverySnapshot | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoveryPolicySpec
FSM Recovery Policy Spec interface with 10 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoveryPolicySpec } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoveryPolicySpec {
maxAttemptsPerState: number;
maxTotalAttempts: number;
maxElapsedMs: number;
retryableCategories: FSMAnomalyCategory[];
nonRetryableCodes?: string[];
backoff: FSMRecoveryBackoffPolicy;
circuitBreaker: FSMCircuitBreakerPolicy;
stateTargets: FSMRecoveryStateTargets;
onExhausted: Extract<FSMRecoveryAction, 'human_review' | 'quarantine' | 'fail'>;
afterCompensation: Extract<FSMRecoveryAction, 'human_review' | 'quarantine' | 'fail'>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
afterCompensation | property | afterCompensation: "fail" | "human_review" | "quarantine" | Public property; its type, readonly modifier and optionality are shown in the signature. |
backoff | property | backoff: FSMRecoveryBackoffPolicy | Public property; its type, readonly modifier and optionality are shown in the signature. |
circuitBreaker | property | circuitBreaker: FSMCircuitBreakerPolicy | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxAttemptsPerState | property | maxAttemptsPerState: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxElapsedMs | property | maxElapsedMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxTotalAttempts | property | maxTotalAttempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
nonRetryableCodes | property | nonRetryableCodes?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
onExhausted | property | onExhausted: "fail" | "human_review" | "quarantine" | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryableCategories | property | retryableCategories: ("unknown" | "cancellation" | "timeout" | "validation" | "policy_denied" | "authentication" | "authorization" | "rate_limit" | "transient_dependency" | "permanent_dependency" | "concurrency_conflict" | "resource_exhausted" | "tool_failure" | "inference_failure" | "memory_failure" | "execution_failure" | "storage_failure" | "message_failure" | "cache_failure" | "invariant_violation")[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
stateTargets | property | stateTargets: FSMRecoveryStateTargets | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoverySnapshot
FSM Recovery Snapshot interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoverySnapshot } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoverySnapshot {
startedAt: string;
updatedAt: string;
totalAttempts: number;
attemptsByState: Record<string, number>;
circuits: Record<string, FSMCircuitSnapshot>;
lastAnomalyId?: string;
lastAction?: FSMRecoveryAction;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
attemptsByState | property | attemptsByState: Record<string, number> | Public property; its type, readonly modifier and optionality are shown in the signature. |
circuits | property | circuits: Record<string, FSMCircuitSnapshot> | Public property; its type, readonly modifier and optionality are shown in the signature. |
lastAction | property | lastAction?: "fail" | "retry" | "human_review" | "reconcile" | "fallback" | "degrade" | "compensate" | "wait" | "quarantine" | "cancel" | Public property; its type, readonly modifier and optionality are shown in the signature. |
lastAnomalyId | property | lastAnomalyId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
startedAt | property | startedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalAttempts | property | totalAttempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMRecoveryStateTargets
FSM Recovery State Targets interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { FSMRecoveryStateTargets } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export interface FSMRecoveryStateTargets {
recovering: string;
compensating: string;
humanReview: string;
quarantined: string;
failed: string;
cancelled: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancelled | property | cancelled: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
compensating | property | compensating: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
failed | property | failed: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
humanReview | property | humanReview: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
quarantined | property | quarantined: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
recovering | property | recovering: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
FSMAnomalyCategory
Public type alias for FSM Anomaly Category; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { FSMAnomalyCategory } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export type FSMAnomalyCategory = RecoveryCategory;FSMAnomalySource
Public type alias for FSM Anomaly Source; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { FSMAnomalySource } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export type FSMAnomalySource = RecoveryModule;FSMCircuitStatus
Public type alias for FSM Circuit Status; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { FSMCircuitStatus } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export type FSMCircuitStatus = 'closed' | 'open' | 'half_open';FSMRecoveryAction
Public type alias for FSM Recovery Action; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { FSMRecoveryAction } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export type FSMRecoveryAction = (typeof FSM_RECOVERY_ACTIONS)[number];FSMSideEffectState
Public type alias for FSM Side Effect State; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { FSMSideEffectState } from '@codesoul-co/hypha-fsm'; - Source module:
recovery
Declaration
export type FSMSideEffectState = RecoverySideEffectState;