Skip to content

@codesoul-co/hypha-fsm / index ​

Using this module ​

Aggregates the public entrypoint exports for @codesoul-co/hypha-fsm; applications import these symbols from the package entrypoint instead of internal file paths.

Import from the package entrypoint ​

ts
import {
  FSMRuntime,
  defaultReActFSMProcessSpec,
  fsmProcessSpecDefinition,
  fsmProcessSpecExample,
  fsmProcessSpecJsonSchema,
  fsmProcessSpecSchema,
  fsmSpecDefinitions,
  fsmSpecJsonSchemas,
} from '@codesoul-co/hypha-fsm';

import type {
  FSMGuardContext,
  FSMProcessSpec,
  FSMRecoveryDecisionRecord,
  FSMRuntimeCancelOptions,
  FSMRuntimeOptions,
  FSMRuntimeTransitionOptions,
  FSMSnapshot,
  FSMStateEnteredRecord,
} from '@codesoul-co/hypha-fsm';

// The complete export list is documented below.

Usage patterns ​

  • Use the 19 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 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 17 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 13 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Runtime validation example ​

ts
import { fsmProcessSpecSchema } from '@codesoul-co/hypha-fsm';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = fsmProcessSpecSchema.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 ​

SymbolKindSignatureDescription
FSMRuntimeclassnew FSMRuntime(spec: FSMProcessSpec, runId: string, options?: FSMRuntimeOptions, snapshot?: FSMSnapshot): FSMRuntimeFSM Runtime class with 8 public constructor or member entries; its exact declarations are listed below.
defaultReActFSMProcessSpecconstantconst defaultReActFSMProcessSpec: FSMProcessSpecDefault ReAct FSM Process Spec constant exported by the index module.
fsmProcessSpecDefinitionconstantconst fsmProcessSpecDefinition: SpecSchemaDefinition<FSMProcessSpec>Runtime validation entrypoint for the FSM Process spec, combining its parser, example and JSON Schema.
fsmProcessSpecExampleconstantconst fsmProcessSpecExample: FSMProcessSpecValid example value for FSM Process Spec.
fsmProcessSpecJsonSchemaconstantconst fsmProcessSpecJsonSchema: JsonSchemaJSON Schema for FSM Process Spec.
fsmProcessSpecSchemaconstantconst fsmProcessSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { initialState: z.ZodString; states: z.ZodArray<z.ZodObject<{ name: z.ZodOptional<z....Runtime schema for FSM Process Spec.
fsmSpecDefinitionsconstantconst fsmSpecDefinitions: readonly [SpecSchemaDefinition<FSMProcessSpec>]FSM Spec Definitions constant exported by the index module.
fsmSpecJsonSchemasconstantconst fsmSpecJsonSchemas: Record<string, JsonSchema>FSM Spec JSON Schemas constant exported by the index module.
fsmStateSpecSchemaconstantconst fsmStateSpecSchema: z.ZodObject<{ name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { id: z.ZodString; kind: z.ZodOptional<z.ZodEnum<["idle", "run_initialized", "context_built", "reasoning", "action_selected", "poli...Runtime schema for FSM State Spec.
fsmTransitionSpecSchemaconstantconst fsmTransitionSpecSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; guard: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; traceEvent: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { from: string; to: string; description?: string | undefined; guard?: string | undefined; traceEvent?: string | undefined; }, { from: string; to: string; description?: string | undefined; guard?...Runtime schema for FSM Transition Spec.
HARNESS_FSM_STATE_IDSconstantconst HARNESS_FSM_STATE_IDS: readonly ["Idle", "RunInitialized", "ContextBuilt", "Reasoning", "ActionSelected", "PolicyChecked", "Acting", "ObservationRecorded", "Verifying", "MemorySync", "Recovering", "Compensating", "Quarantined", "HumanReview", "Completed", "Failed", "Cancelled"]Stable Harness states owned by the framework runtime. Domain Packs may bind capabilities and policy to these phases, but must not add, remove, rename, or reconnect them.
HARNESS_STATE_CAPABILITY_AREAconstantconst HARNESS_STATE_CAPABILITY_AREA: Readonly<Record<"Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled", HarnessCapabilityArea>>activity is the governed side-effect phase shared by Tool, MCP, Execution, file, Memory-write, and external-write adapters. The concrete activity type remains Event evidence; it never becomes a Domain-defined FSM state.
REACT_FSM_STATE_PATHconstantconst REACT_FSM_STATE_PATH: readonly ["Idle", "RunInitialized", "ContextBuilt", "Reasoning", "ActionSelected", "PolicyChecked", "Acting", "ObservationRecorded", "Verifying", "MemorySync", "Completed"]REACT FSM STATE PATH constant exported by the index module.
REACT_PHASE_TO_HARNESS_STATEconstantconst REACT_PHASE_TO_HARNESS_STATE: Readonly<{ reason: "Reasoning"; select_action: "ActionSelected"; policy_check: "PolicyChecked"; act: "Acting"; observe_result: "ObservationRecorded"; verify: "Verifying"; memory_sync: "MemorySync"; complete: "Completed"; fail: "Failed"; human_review: "HumanReview"; cancel: "Cancelled"; }>REACT PHASE TO HARNESS STATE constant exported by the index module.
analyzeFSMTopologyfunctionanalyzeFSMTopology(spec: FSMProcessSpec): FSMTopologyAnalysisDescribes graph properties without imposing product-specific topology rules. Callers can decide whether unreachable states, non-terminal dead ends, or cycles are valid for their Domain workflow.
applyTransitionfunctionapplyTransition(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, nowOrOptions?: string | FSMTransitionOptions): FSMSnapshotApply Transition function with 1 public call signature; parameters and return types are listed below.
applyTransitionWithRuntimePolicyfunctionapplyTransitionWithRuntimePolicy(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, options?: FSMRuntimeTransitionOptions): Promise<FSMSnapshot>Apply Transition With Runtime Policy function with 1 public call signature; parameters and return types are listed below.
assertHarnessFSMProcessSpecfunctionassertHarnessFSMProcessSpec(spec: FSMProcessSpec): voidFails closed when an application or Domain Pack attempts to replace the Harness capability topology with a product workflow.
canRetryStatefunctioncanRetryState(spec: FSMProcessSpec, stateId: string, attemptedCount: number): booleanCan Retry State function with 1 public call signature; parameters and return types are listed below.
createHarnessFSMProcessSpecfunctioncreateHarnessFSMProcessSpec(): FSMProcessSpecReturns an isolated copy so composition code cannot mutate the shared contract.
createInitialSnapshotfunctioncreateInitialSnapshot(spec: FSMProcessSpec, runId: string, now?: string): FSMSnapshotCreate Initial Snapshot function with 1 public call signature; parameters and return types are listed below.
evaluateGuardExpressionfunctionevaluateGuardExpression(guard: string, context?: FSMGuardContext): booleanEvaluate Guard Expression function with 1 public call signature; parameters and return types are listed below.
evaluateStateTimeoutfunctionevaluateStateTimeout(spec: FSMProcessSpec, snapshot: FSMSnapshot, now?: string): FSMTimeoutEvaluation | nullEvaluate State Timeout function with 1 public call signature; parameters and return types are listed below.
getAllowedTransitionsfunctiongetAllowedTransitions(spec: FSMProcessSpec, stateId: string): FSMTransitionSpec[]Get Allowed Transitions function with 1 public call signature; parameters and return types are listed below.
harnessStateForReActPhasefunctionharnessStateForReActPhase(phase: string): HarnessFSMStateId | undefinedHarness State For ReAct Phase function with 1 public call signature; parameters and return types are listed below.
isHarnessFSMProcessSpecfunctionisHarnessFSMProcessSpec(spec: FSMProcessSpec): booleanReturns false for either an invalid process or a valid non-Harness topology.
isHarnessFSMStateIdfunctionisHarnessFSMStateId(value: string): value is HarnessFSMStateIdIs Harness FSM State ID function with 1 public call signature; parameters and return types are listed below.
parseFSMProcessSpecfunctionparseFSMProcessSpec(input: unknown): FSMProcessSpecParse FSM Process Spec function with 1 public call signature; parameters and return types are listed below.
planHarnessCapabilityPathfunctionplanHarnessCapabilityPath(from: HarnessFSMStateId, to: HarnessFSMStateId): HarnessFSMStateId[]Plans only normal capability movement. Recovery, compensation, quarantine, human review, failure, and cancellation are selected by their dedicated supervisors and can never be traversed as a shortcut for Domain work.
validateFSMProcessSpecfunctionvalidateFSMProcessSpec(spec: FSMProcessSpec): voidValidate FSM Process Spec function with 1 public call signature; parameters and return types are listed below.
validateFSMSnapshotfunctionvalidateFSMSnapshot(spec: FSMProcessSpec, snapshot: FSMSnapshot, expectedRunId?: string): voidValidate FSM Snapshot function with 1 public call signature; parameters and return types are listed below.
FSMGuardContextinterfaceinterface FSMGuardContextFSM Guard Context interface with 3 public fields or methods.
FSMProcessSpecinterfaceinterface FSMProcessSpec extends VersionedSpec, SpecMetadataFSM Process Spec interface with 13 public fields or methods.
FSMRecoveryDecisionRecordinterfaceinterface FSMRecoveryDecisionRecordFSM Recovery Decision Record interface with 4 public fields or methods.
FSMRuntimeCancelOptionsinterfaceinterface FSMRuntimeCancelOptions extends FSMRuntimeTransitionOptionsFSM Runtime Cancel Options interface with 8 public fields or methods.
FSMRuntimeOptionsinterfaceinterface FSMRuntimeOptionsFSM Runtime Options interface with 5 public fields or methods.
FSMRuntimeTransitionOptionsinterfaceinterface FSMRuntimeTransitionOptions extends FSMTransitionOptionsFSM Runtime Transition Options interface with 7 public fields or methods.
FSMSnapshotinterfaceinterface FSMSnapshotFSM Snapshot interface with 8 public fields or methods.
FSMStateEnteredRecordinterfaceinterface FSMStateEnteredRecordFSM State Entered Record interface with 7 public fields or methods.
FSMStateSpecinterfaceinterface FSMStateSpec extends SpecMetadataFSM State Spec interface with 15 public fields or methods.
FSMTimeoutEvaluationinterfaceinterface FSMTimeoutEvaluationFSM Timeout Evaluation interface with 5 public fields or methods.
FSMTopologyAnalysisinterfaceinterface FSMTopologyAnalysisFSM Topology Analysis interface with 5 public fields or methods.
FSMTransitionOptionsinterfaceinterface FSMTransitionOptionsFSM Transition Options interface with 3 public fields or methods.
FSMTransitionSpecinterfaceinterface FSMTransitionSpecFSM Transition Spec interface with 5 public fields or methods.
StateTransitioninterfaceinterface StateTransitionState Transition interface with 8 public fields or methods.
FSMGuardEvaluatortypetype FSMGuardEvaluator = (guard: string, context: FSMGuardContext) => booleanPublic type alias for FSM Guard Evaluator; the declaration contains its complete type expression.
FSMStateKindtypetype FSMStateKind = 'idle' | 'run_initialized' | 'context_built' | 'reasoning' | 'action_selected' | 'policy_checked' | 'acting' | 'observation_recorded' | 'verifying' | 'memory_sync' | 'recovering' | 'compensating' | 'quarantined' | 'human_review' | 'completed' | 'failed' | 'cancelled' | 'domain'Public type alias for FSM State Kind; the declaration contains its complete type expression.
FsmTerminalStatustypetype FsmTerminalStatus = 'completed' | 'failed' | 'cancelled'Public type alias for FSM Terminal Status; the declaration contains its complete type expression.
HarnessCapabilityAreatypetype HarnessCapabilityArea = 'lifecycle' | 'context' | 'reasoning' | 'policy' | 'activity' | 'observation' | 'verification' | 'memory' | 'recovery' | 'human_review' | 'terminal'Public type alias for Harness Capability Area; the declaration contains its complete type expression.
HarnessFSMStateIdtypetype HarnessFSMStateId = (typeof HARNESS_FSM_STATE_IDS)[number]Public type alias for Harness FSM State ID; the declaration contains its complete type expression.

FSMRuntime ​

FSM Runtime class with 8 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { FSMRuntime } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare class FSMRuntime {
    constructor(spec: FSMProcessSpec, runId: string, options?: FSMRuntimeOptions, snapshot?: FSMSnapshot);
    getSnapshot(): FSMSnapshot;
    start(metadata?: Record<string, unknown>): Promise<FSMSnapshot>;
    transition(to: string, options?: FSMRuntimeTransitionOptions): Promise<StateTransition>;
    transitionPath(states: string[], options?: FSMRuntimeTransitionOptions): Promise<StateTransition[]>;
    cancel(options?: FSMRuntimeCancelOptions): Promise<StateTransition>;
    decideRecovery(anomaly: FSMAnomaly, options?: {
            stateId?: string;
            now?: string;
        }): Promise<FSMRecoveryDecision>;
    registerRecoverySuccess(circuitKey: string, now?: string): FSMSnapshot;
}

Public members ​

MemberKindSignatureDescription
cancelmethodcancel(options?: FSMRuntimeCancelOptions): Promise<StateTransition>Public method; parameters and return type are shown in the signature.
constructorconstructor(spec: FSMProcessSpec, runId: string, options?: FSMRuntimeOptions, snapshot?: FSMSnapshot): FSMRuntimeCreates an instance of this class.
decideRecoverymethoddecideRecovery(anomaly: FSMAnomaly, options?: { stateId?: string; now?: string; }): Promise<FSMRecoveryDecision>Public method; parameters and return type are shown in the signature.
getSnapshotmethodgetSnapshot(): FSMSnapshotPublic method; parameters and return type are shown in the signature.
registerRecoverySuccessmethodregisterRecoverySuccess(circuitKey: string, now?: string): FSMSnapshotPublic method; parameters and return type are shown in the signature.
startmethodstart(metadata?: Record<string, unknown>): Promise<FSMSnapshot>Public method; parameters and return type are shown in the signature.
transitionmethodtransition(to: string, options?: FSMRuntimeTransitionOptions): Promise<StateTransition>Public method; parameters and return type are shown in the signature.
transitionPathmethodtransitionPath(states: string[], options?: FSMRuntimeTransitionOptions): Promise<StateTransition[]>Public method; parameters and return type are shown in the signature.

defaultReActFSMProcessSpec ​

Default ReAct FSM Process Spec constant exported by the index module.

  • Kind: constant
  • Import: import { defaultReActFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const defaultReActFSMProcessSpec: FSMProcessSpec;

fsmProcessSpecDefinition ​

Runtime validation entrypoint for the FSM Process spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { fsmProcessSpecDefinition } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmProcessSpecDefinition: SpecSchemaDefinition<FSMProcessSpec>;

fsmProcessSpecExample ​

Valid example value for FSM Process Spec.

  • Kind: constant
  • Import: import { fsmProcessSpecExample } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmProcessSpecExample: FSMProcessSpec;

fsmProcessSpecJsonSchema ​

JSON Schema for FSM Process Spec.

  • Kind: constant
  • Import: import { fsmProcessSpecJsonSchema } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmProcessSpecJsonSchema: JsonSchema;

fsmProcessSpecSchema ​

Runtime schema for FSM Process Spec.

  • Kind: constant
  • Import: import { fsmProcessSpecSchema } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const fsmProcessSpecSchema: (typeof import('@codesoul-co/hypha-fsm'))['fsmProcessSpecSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

fsmSpecDefinitions ​

FSM Spec Definitions constant exported by the index module.

  • Kind: constant
  • Import: import { fsmSpecDefinitions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmSpecDefinitions: readonly [SpecSchemaDefinition<FSMProcessSpec>];

fsmSpecJsonSchemas ​

FSM Spec JSON Schemas constant exported by the index module.

  • Kind: constant
  • Import: import { fsmSpecJsonSchemas } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmSpecJsonSchemas: Record<string, JsonSchema>;

fsmStateSpecSchema ​

Runtime schema for FSM State Spec.

  • Kind: constant
  • Import: import { fsmStateSpecSchema } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const fsmStateSpecSchema: (typeof import('@codesoul-co/hypha-fsm'))['fsmStateSpecSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

fsmTransitionSpecSchema ​

Runtime schema for FSM Transition Spec.

  • Kind: constant
  • Import: import { fsmTransitionSpecSchema } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const fsmTransitionSpecSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; guard: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; traceEvent: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { from: string; to: string; description?: string | undefined; guard?: string | undefined; traceEvent?: string | undefined; }, { from: string; to: string; description?: string | undefined; guard?: string | undefined; traceEvent?: string | undefined; }>;

HARNESS_FSM_STATE_IDS ​

Stable Harness states owned by the framework runtime. Domain Packs may bind capabilities and policy to these phases, but must not add, remove, rename, or reconnect them.

  • Kind: constant
  • Import: import { HARNESS_FSM_STATE_IDS } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const HARNESS_FSM_STATE_IDS: readonly ["Idle", "RunInitialized", "ContextBuilt", "Reasoning", "ActionSelected", "PolicyChecked", "Acting", "ObservationRecorded", "Verifying", "MemorySync", "Recovering", "Compensating", "Quarantined", "HumanReview", "Completed", "Failed", "Cancelled"];

HARNESS_STATE_CAPABILITY_AREA ​

activity is the governed side-effect phase shared by Tool, MCP, Execution, file, Memory-write, and external-write adapters. The concrete activity type remains Event evidence; it never becomes a Domain-defined FSM state.

  • Kind: constant
  • Import: import { HARNESS_STATE_CAPABILITY_AREA } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const HARNESS_STATE_CAPABILITY_AREA: Readonly<Record<"Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled", HarnessCapabilityArea>>;

REACT_FSM_STATE_PATH ​

REACT FSM STATE PATH constant exported by the index module.

  • Kind: constant
  • Import: import { REACT_FSM_STATE_PATH } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const REACT_FSM_STATE_PATH: readonly ["Idle", "RunInitialized", "ContextBuilt", "Reasoning", "ActionSelected", "PolicyChecked", "Acting", "ObservationRecorded", "Verifying", "MemorySync", "Completed"];

REACT_PHASE_TO_HARNESS_STATE ​

REACT PHASE TO HARNESS STATE constant exported by the index module.

  • Kind: constant
  • Import: import { REACT_PHASE_TO_HARNESS_STATE } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare const REACT_PHASE_TO_HARNESS_STATE: Readonly<{ reason: "Reasoning"; select_action: "ActionSelected"; policy_check: "PolicyChecked"; act: "Acting"; observe_result: "ObservationRecorded"; verify: "Verifying"; memory_sync: "MemorySync"; complete: "Completed"; fail: "Failed"; human_review: "HumanReview"; cancel: "Cancelled"; }>;

analyzeFSMTopology ​

Describes graph properties without imposing product-specific topology rules. Callers can decide whether unreachable states, non-terminal dead ends, or cycles are valid for their Domain workflow.

  • Kind: function
  • Import: import { analyzeFSMTopology } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function analyzeFSMTopology(spec: FSMProcessSpec): FSMTopologyAnalysis;

Call signature ​

text
analyzeFSMTopology(spec: FSMProcessSpec): FSMTopologyAnalysis

Describes graph properties without imposing product-specific topology rules. Callers can decide whether unreachable states, non-terminal dead ends, or cycles are valid for their Domain workflow.

Parameters ​

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

Returns ​

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

applyTransition ​

Apply Transition function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { applyTransition } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function applyTransition(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, nowOrOptions?: string | FSMTransitionOptions): FSMSnapshot;

Call signature ​

text
applyTransition(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, nowOrOptions?: string | FSMTransitionOptions): FSMSnapshot

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
snapshotFSMSnapshotYesRequired parameter; accepted values are defined by the type column.
tostringYesRequired parameter; accepted values are defined by the type column.
nowOrOptionsstring | FSMTransitionOptionsNoOptional parameter; accepted values are defined by the type column.

Returns ​

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

applyTransitionWithRuntimePolicy ​

Apply Transition With Runtime Policy function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { applyTransitionWithRuntimePolicy } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function applyTransitionWithRuntimePolicy(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, options?: FSMRuntimeTransitionOptions): Promise<FSMSnapshot>;

Call signature ​

text
applyTransitionWithRuntimePolicy(spec: FSMProcessSpec, snapshot: FSMSnapshot, to: string, options?: FSMRuntimeTransitionOptions): Promise<FSMSnapshot>

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
snapshotFSMSnapshotYesRequired parameter; accepted values are defined by the type column.
tostringYesRequired parameter; accepted values are defined by the type column.
optionsFSMRuntimeTransitionOptionsNoOptional parameter; accepted values are defined by the type column.

Returns ​

  • Type: Promise<FSMSnapshot>
  • Description: The return contract is defined by the type shown above.

assertHarnessFSMProcessSpec ​

Fails closed when an application or Domain Pack attempts to replace the Harness capability topology with a product workflow.

  • Kind: function
  • Import: import { assertHarnessFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function assertHarnessFSMProcessSpec(spec: FSMProcessSpec): void;

Call signature ​

text
assertHarnessFSMProcessSpec(spec: FSMProcessSpec): void

Fails closed when an application or Domain Pack attempts to replace the Harness capability topology with a product workflow.

Parameters ​

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

Returns ​

  • Type: void
  • Description: Returns no value.

canRetryState ​

Can Retry State function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { canRetryState } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function canRetryState(spec: FSMProcessSpec, stateId: string, attemptedCount: number): boolean;

Call signature ​

text
canRetryState(spec: FSMProcessSpec, stateId: string, attemptedCount: number): boolean

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
stateIdstringYesRequired parameter; accepted values are defined by the type column.
attemptedCountnumberYesRequired parameter; accepted values are defined by the type column.

Returns ​

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

createHarnessFSMProcessSpec ​

Returns an isolated copy so composition code cannot mutate the shared contract.

  • Kind: function
  • Import: import { createHarnessFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function createHarnessFSMProcessSpec(): FSMProcessSpec;

Call signature ​

text
createHarnessFSMProcessSpec(): FSMProcessSpec

Returns an isolated copy so composition code cannot mutate the shared contract.

Parameters ​

No parameters.

Returns ​

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

createInitialSnapshot ​

Create Initial Snapshot function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createInitialSnapshot } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function createInitialSnapshot(spec: FSMProcessSpec, runId: string, now?: string): FSMSnapshot;

Call signature ​

text
createInitialSnapshot(spec: FSMProcessSpec, runId: string, now?: string): FSMSnapshot

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
runIdstringYesRequired parameter; accepted values are defined by the type column.
nowstringNoOptional parameter; accepted values are defined by the type column.

Returns ​

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

evaluateGuardExpression ​

Evaluate Guard Expression function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { evaluateGuardExpression } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function evaluateGuardExpression(guard: string, context?: FSMGuardContext): boolean;

Call signature ​

text
evaluateGuardExpression(guard: string, context?: FSMGuardContext): boolean

Parameters ​

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

Returns ​

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

evaluateStateTimeout ​

Evaluate State Timeout function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { evaluateStateTimeout } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function evaluateStateTimeout(spec: FSMProcessSpec, snapshot: FSMSnapshot, now?: string): FSMTimeoutEvaluation | null;

Call signature ​

text
evaluateStateTimeout(spec: FSMProcessSpec, snapshot: FSMSnapshot, now?: string): FSMTimeoutEvaluation | null

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
snapshotFSMSnapshotYesRequired parameter; accepted values are defined by the type column.
nowstringNoOptional parameter; accepted values are defined by the type column.

Returns ​

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

getAllowedTransitions ​

Get Allowed Transitions function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { getAllowedTransitions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function getAllowedTransitions(spec: FSMProcessSpec, stateId: string): FSMTransitionSpec[];

Call signature ​

text
getAllowedTransitions(spec: FSMProcessSpec, stateId: string): FSMTransitionSpec[]

Parameters ​

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

Returns ​

  • Type: FSMTransitionSpec[]
  • Description: The return contract is defined by the type shown above.

harnessStateForReActPhase ​

Harness State For ReAct Phase function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { harnessStateForReActPhase } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function harnessStateForReActPhase(phase: string): HarnessFSMStateId | undefined;

Call signature ​

text
harnessStateForReActPhase(phase: string): HarnessFSMStateId | undefined

Parameters ​

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

Returns ​

  • Type: "Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled"
  • Description: The return contract is defined by the type shown above.

isHarnessFSMProcessSpec ​

Returns false for either an invalid process or a valid non-Harness topology.

  • Kind: function
  • Import: import { isHarnessFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function isHarnessFSMProcessSpec(spec: FSMProcessSpec): boolean;

Call signature ​

text
isHarnessFSMProcessSpec(spec: FSMProcessSpec): boolean

Returns false for either an invalid process or a valid non-Harness topology.

Parameters ​

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

Returns ​

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

isHarnessFSMStateId ​

Is Harness FSM State ID function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { isHarnessFSMStateId } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function isHarnessFSMStateId(value: string): value is HarnessFSMStateId;

Call signature ​

text
isHarnessFSMStateId(value: string): value is HarnessFSMStateId

Parameters ​

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

Returns ​

  • Type: value is "Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled"
  • Description: The return contract is defined by the type shown above.

parseFSMProcessSpec ​

Parse FSM Process Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { parseFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function parseFSMProcessSpec(input: unknown): FSMProcessSpec;

Call signature ​

text
parseFSMProcessSpec(input: unknown): FSMProcessSpec

Parameters ​

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

Returns ​

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

planHarnessCapabilityPath ​

Plans only normal capability movement. Recovery, compensation, quarantine, human review, failure, and cancellation are selected by their dedicated supervisors and can never be traversed as a shortcut for Domain work.

  • Kind: function
  • Import: import { planHarnessCapabilityPath } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function planHarnessCapabilityPath(from: HarnessFSMStateId, to: HarnessFSMStateId): HarnessFSMStateId[];

Call signature ​

text
planHarnessCapabilityPath(from: HarnessFSMStateId, to: HarnessFSMStateId): HarnessFSMStateId[]

Plans only normal capability movement. Recovery, compensation, quarantine, human review, failure, and cancellation are selected by their dedicated supervisors and can never be traversed as a shortcut for Domain work.

Parameters ​

ParameterTypeRequiredDescription
from"Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled"YesRequired parameter; accepted values are defined by the type column.
to"Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled"YesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: ("Idle" | "RunInitialized" | "ContextBuilt" | "Reasoning" | "ActionSelected" | "PolicyChecked" | "Acting" | "ObservationRecorded" | "Verifying" | "MemorySync" | "Recovering" | "Compensating" | "Quarantined" | "HumanReview" | "Completed" | "Failed" | "Cancelled")[]
  • Description: The return contract is defined by the type shown above.

validateFSMProcessSpec ​

Validate FSM Process Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateFSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function validateFSMProcessSpec(spec: FSMProcessSpec): void;

Call signature ​

text
validateFSMProcessSpec(spec: FSMProcessSpec): void

Parameters ​

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

Returns ​

  • Type: void
  • Description: Returns no value.

validateFSMSnapshot ​

Validate FSM Snapshot function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateFSMSnapshot } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export declare function validateFSMSnapshot(spec: FSMProcessSpec, snapshot: FSMSnapshot, expectedRunId?: string): void;

Call signature ​

text
validateFSMSnapshot(spec: FSMProcessSpec, snapshot: FSMSnapshot, expectedRunId?: string): void

Parameters ​

ParameterTypeRequiredDescription
specFSMProcessSpecYesRequired parameter; accepted values are defined by the type column.
snapshotFSMSnapshotYesRequired parameter; accepted values are defined by the type column.
expectedRunIdstringNoOptional parameter; accepted values are defined by the type column.

Returns ​

  • Type: void
  • Description: Returns no value.

FSMGuardContext ​

FSM Guard Context interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { FSMGuardContext } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMGuardContext {
    input?: unknown;
    variables?: Record<string, unknown>;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
inputpropertyinput?: unknownPublic 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.
variablespropertyvariables?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.

FSMProcessSpec ​

FSM Process Spec interface with 13 public fields or methods.

  • Kind: interface
  • Import: import type { FSMProcessSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMProcessSpec extends VersionedSpec, SpecMetadata {
    initialState: string;
    states: FSMStateSpec[];
    transitions: FSMTransitionSpec[];
    terminalStates: string[];
    recoveryPolicy?: FSMRecoveryPolicySpec;
}

Contract members ​

MemberKindSignatureDescription
createdAtpropertycreatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic 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.
initialStatepropertyinitialState: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerpropertyowner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recoveryPolicypropertyrecoveryPolicy?: FSMRecoveryPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
statespropertystates: FSMStateSpec[]Public property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
terminalStatespropertyterminalStates: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
transitionspropertytransitions: FSMTransitionSpec[]Public property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMRecoveryDecisionRecord ​

FSM Recovery Decision Record interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { FSMRecoveryDecisionRecord } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMRecoveryDecisionRecord {
    processId: string;
    runId: string;
    decision: FSMRecoveryDecision;
    snapshot: FSMSnapshot;
}

Contract members ​

MemberKindSignatureDescription
decisionpropertydecision: FSMRecoveryDecisionPublic property; its type, readonly modifier and optionality are shown in the signature.
processIdpropertyprocessId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
snapshotpropertysnapshot: FSMSnapshotPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMRuntimeCancelOptions ​

FSM Runtime Cancel Options interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { FSMRuntimeCancelOptions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMRuntimeCancelOptions extends FSMRuntimeTransitionOptions {
    reason?: string;
}

Contract members ​

MemberKindSignatureDescription
guardContextpropertyguardContext?: FSMGuardContextPublic property; its type, readonly modifier and optionality are shown in the signature.
guardEvaluatormethodguardEvaluator?(guard: string, context: FSMGuardContext): booleanPublic method; parameters and return type are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
nowpropertynow?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policypropertypolicy?: PolicyEnginePublic 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.
stepIdpropertystepId?: 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.

FSMRuntimeOptions ​

FSM Runtime Options interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { FSMRuntimeOptions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMRuntimeOptions {
    now?: () => string;
    policy?: PolicyEngine;
    onStateEntered?: (record: FSMStateEnteredRecord) => Promise<void> | void;
    onTransition?: (record: StateTransition) => Promise<void> | void;
    onRecoveryDecision?: (record: FSMRecoveryDecisionRecord) => Promise<void> | void;
}

Contract members ​

MemberKindSignatureDescription
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.
onRecoveryDecisionmethodonRecoveryDecision?(record: FSMRecoveryDecisionRecord): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
onStateEnteredmethodonStateEntered?(record: FSMStateEnteredRecord): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
onTransitionmethodonTransition?(record: StateTransition): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
policypropertypolicy?: PolicyEnginePublic property; its type, readonly modifier and optionality are shown in the signature.

FSMRuntimeTransitionOptions ​

FSM Runtime Transition Options interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { FSMRuntimeTransitionOptions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMRuntimeTransitionOptions extends FSMTransitionOptions {
    userId?: string;
    stepId?: string;
    policy?: PolicyEngine;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
guardContextpropertyguardContext?: FSMGuardContextPublic property; its type, readonly modifier and optionality are shown in the signature.
guardEvaluatormethodguardEvaluator?(guard: string, context: FSMGuardContext): booleanPublic method; parameters and return type are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
nowpropertynow?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policypropertypolicy?: PolicyEnginePublic property; its type, readonly modifier and optionality are shown in the signature.
stepIdpropertystepId?: 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.

FSMSnapshot ​

FSM Snapshot interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { FSMSnapshot } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMSnapshot {
    processId: string;
    runId: string;
    currentState: string;
    statePath: string[];
    status: 'running' | FsmTerminalStatus;
    updatedAt: string;
    recovery?: FSMRecoverySnapshot;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
currentStatepropertycurrentState: 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.
processIdpropertyprocessId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recoverypropertyrecovery?: FSMRecoverySnapshotPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statePathpropertystatePath: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "running" | FsmTerminalStatusPublic property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMStateEnteredRecord ​

FSM State Entered Record interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { FSMStateEnteredRecord } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMStateEnteredRecord {
    processId: string;
    runId: string;
    stateId: string;
    fromState?: string;
    snapshot: FSMSnapshot;
    enteredAt: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
enteredAtpropertyenteredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fromStatepropertyfromState?: 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.
processIdpropertyprocessId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
snapshotpropertysnapshot: FSMSnapshotPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMStateSpec ​

FSM State Spec interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { FSMStateSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMStateSpec extends SpecMetadata {
    id: string;
    kind?: FSMStateKind;
    entryAction?: string;
    exitAction?: string;
    timeoutPolicy?: TimeoutPolicySpec;
    retryPolicy?: RetryPolicySpec;
    humanReviewPolicy?: HumanReviewPolicySpec;
    policyRefs?: string[];
    traceEvents?: string[];
}

Contract members ​

MemberKindSignatureDescription
createdAtpropertycreatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
entryActionpropertyentryAction?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
exitActionpropertyexitAction?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
humanReviewPolicypropertyhumanReviewPolicy?: HumanReviewPolicySpecPublic 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.
kindpropertykind?: FSMStateKindPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerpropertyowner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policyRefspropertypolicyRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
retryPolicypropertyretryPolicy?: RetryPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
timeoutPolicypropertytimeoutPolicy?: TimeoutPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
traceEventspropertytraceEvents?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMTimeoutEvaluation ​

FSM Timeout Evaluation interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { FSMTimeoutEvaluation } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMTimeoutEvaluation {
    timedOut: boolean;
    action?: NonNullable<TimeoutPolicySpec['onTimeout']>;
    stateId: string;
    elapsedMs: number;
    timeoutMs: number;
}

Contract members ​

MemberKindSignatureDescription
actionpropertyaction?: NonNullable<"fail" | "retry" | "human_review">Public property; its type, readonly modifier and optionality are shown in the signature.
elapsedMspropertyelapsedMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
timedOutpropertytimedOut: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
timeoutMspropertytimeoutMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMTopologyAnalysis ​

FSM Topology Analysis interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { FSMTopologyAnalysis } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMTopologyAnalysis {
    initialState: string;
    reachableStates: string[];
    unreachableStates: string[];
    deadEndStates: string[];
    cycleStates: string[];
}

Contract members ​

MemberKindSignatureDescription
cycleStatespropertycycleStates: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
deadEndStatespropertydeadEndStates: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
initialStatepropertyinitialState: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reachableStatespropertyreachableStates: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
unreachableStatespropertyunreachableStates: string[]Public property; its type, readonly modifier and optionality are shown in the signature.

FSMTransitionOptions ​

FSM Transition Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { FSMTransitionOptions } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMTransitionOptions {
    now?: string;
    guardContext?: FSMGuardContext;
    guardEvaluator?: FSMGuardEvaluator;
}

Contract members ​

MemberKindSignatureDescription
guardContextpropertyguardContext?: FSMGuardContextPublic property; its type, readonly modifier and optionality are shown in the signature.
guardEvaluatormethodguardEvaluator?(guard: string, context: FSMGuardContext): booleanPublic method; parameters and return type are shown in the signature.
nowpropertynow?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMTransitionSpec ​

FSM Transition Spec interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { FSMTransitionSpec } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface FSMTransitionSpec {
    from: string;
    to: string;
    guard?: string;
    description?: string;
    traceEvent?: string;
}

Contract members ​

MemberKindSignatureDescription
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
frompropertyfrom: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
guardpropertyguard?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
topropertyto: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
traceEventpropertytraceEvent?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

StateTransition ​

State Transition interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { StateTransition } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export interface StateTransition {
    processId: string;
    runId: string;
    from: string;
    to: string;
    transition: FSMTransitionSpec;
    snapshot: FSMSnapshot;
    acceptedAt: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
acceptedAtpropertyacceptedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
frompropertyfrom: 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.
processIdpropertyprocessId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
snapshotpropertysnapshot: FSMSnapshotPublic property; its type, readonly modifier and optionality are shown in the signature.
topropertyto: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
transitionpropertytransition: FSMTransitionSpecPublic property; its type, readonly modifier and optionality are shown in the signature.

FSMGuardEvaluator ​

Public type alias for FSM Guard Evaluator; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { FSMGuardEvaluator } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export type FSMGuardEvaluator = (guard: string, context: FSMGuardContext) => boolean;

FSMStateKind ​

Public type alias for FSM State Kind; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { FSMStateKind } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export type FSMStateKind = 'idle' | 'run_initialized' | 'context_built' | 'reasoning' | 'action_selected' | 'policy_checked' | 'acting' | 'observation_recorded' | 'verifying' | 'memory_sync' | 'recovering' | 'compensating' | 'quarantined' | 'human_review' | 'completed' | 'failed' | 'cancelled' | 'domain';

FsmTerminalStatus ​

Public type alias for FSM Terminal Status; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { FsmTerminalStatus } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export type FsmTerminalStatus = 'completed' | 'failed' | 'cancelled';

HarnessCapabilityArea ​

Public type alias for Harness Capability Area; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { HarnessCapabilityArea } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export type HarnessCapabilityArea = 'lifecycle' | 'context' | 'reasoning' | 'policy' | 'activity' | 'observation' | 'verification' | 'memory' | 'recovery' | 'human_review' | 'terminal';

HarnessFSMStateId ​

Public type alias for Harness FSM State ID; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { HarnessFSMStateId } from '@codesoul-co/hypha-fsm';
  • Source module: index

Declaration ​

text
export type HarnessFSMStateId = (typeof HARNESS_FSM_STATE_IDS)[number];