ChildLink
Defined in: types.ts:717
Internal adapter that wraps either an Fsm or BehavioralFsm child, presenting a uniform API for parent-initiated delegation.
Properties
Section titled “Properties”instance
Section titled “instance”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.
Methods
Section titled “Methods”canHandle()
Section titled “canHandle()”canHandle(
client,inputName):boolean
Defined in: types.ts:719
Check if the child’s current state can handle this input
Parameters
Section titled “Parameters”client
Section titled “client”object
inputName
Section titled “inputName”string
Returns
Section titled “Returns”boolean
compositeState()
Section titled “compositeState()”compositeState(
client):string
Defined in: types.ts:727
The child FSM’s compositeState for the given client
Parameters
Section titled “Parameters”client
Section titled “client”object
Returns
Section titled “Returns”string
dehydrate()
Section titled “dehydrate()”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.
Parameters
Section titled “Parameters”client
Section titled “client”object
isOnActivePath
Section titled “isOnActivePath”boolean
Returns
Section titled “Returns”ClientSnapshot | undefined
dispose()
Section titled “dispose()”dispose():
void
Defined in: types.ts:753
Dispose the child FSM
Returns
Section titled “Returns”void
handle()
Section titled “handle()”handle(
client,inputName, …args):void
Defined in: types.ts:721
Dispatch the input to the child
Parameters
Section titled “Parameters”client
Section titled “client”object
inputName
Section titled “inputName”string
…unknown[]
Returns
Section titled “Returns”void
onAny()
Section titled “onAny()”onAny(
callback):object
Defined in: types.ts:725
Subscribe to all child events (wildcard). Returns unsubscribe fn.
Parameters
Section titled “Parameters”callback
Section titled “callback”(eventName, data) => void
Returns
Section titled “Returns”object
off():
void
Returns
Section titled “Returns”void
planRehydrate()
Section titled “planRehydrate()”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().
Parameters
Section titled “Parameters”client
Section titled “client”object
snapshot
Section titled “snapshot”Returns
Section titled “Returns”() => void[]
rehydrate()
Section titled “rehydrate()”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).
Parameters
Section titled “Parameters”client
Section titled “client”object
compositeState
Section titled “compositeState”string
Returns
Section titled “Returns”void
reset()
Section titled “reset()”reset(
client):void
Defined in: types.ts:723
Reset the child to its initialState
Parameters
Section titled “Parameters”client
Section titled “client”object
Returns
Section titled “Returns”void