Skip to content

ChildLink

Defined in: types.ts:717

Internal adapter that wraps either an Fsm or BehavioralFsm child, presenting a uniform API for parent-initiated delegation.

instance: MachinaInstance

Defined in: types.ts:760

The raw Fsm or BehavioralFsm instance this ChildLink wraps. Exposed for inspection tooling (machina-inspect) — allows external tools to introspect child graph structure without reaching through private fields.

canHandle(client, inputName): boolean

Defined in: types.ts:719

Check if the child’s current state can handle this input

object

string

boolean


compositeState(client): string

Defined in: types.ts:727

The child FSM’s compositeState for the given client

object

string


dehydrate(client, isOnActivePath): ClientSnapshot | undefined

Defined in: types.ts:744

Snapshot everything this child tracks for client, recursing into its own children. undefined when the child has never seen this client. Throws for Fsm children that are on the active path — an Fsm owns its own context, so there’s nothing per-client to snapshot. isOnActivePath is threaded down from the true root’s dehydrate() call: it’s false whenever ANY ancestor declaring state didn’t match its own parent’s active state, so a nested BehavioralFsm child correctly treats every one of its own Fsm children as off-path once the child itself is off-path, rather than recomputing reachability from its own (possibly dormant) state alone.

object

boolean

ClientSnapshot | undefined


dispose(): void

Defined in: types.ts:753

Dispose the child FSM

void


handle(client, inputName, …args): void

Defined in: types.ts:721

Dispatch the input to the child

object

string

unknown[]

void


onAny(callback): object

Defined in: types.ts:725

Subscribe to all child events (wildcard). Returns unsubscribe fn.

(eventName, data) => void

object

off(): void

void


planRehydrate(client, snapshot): () => void[]

Defined in: types.ts:751

Validates snapshot against this child’s state graph (recursing into its own children) and returns write thunks to run only once the ENTIRE tree validates — nothing is written here. Throws for Fsm children, matching dehydrate().

object

ClientSnapshot

() => void[]


rehydrate(client, compositeState): void

Defined in: types.ts:732

Silently place client at the given composite state within the child hierarchy. Throws for Fsm children (no per-client state to rehydrate).

object

string

void


reset(client): void

Defined in: types.ts:723

Reset the child to its initialState

object

void