 }
}
</code></pre>
<h3 id="3-node-transitions">3. Node Transitions</h3>
<p>Nodes connect through action-based transitions:</p>
<pre><code class="language-typescript">class BaseNode {
    public successors: Map&lt;string, BaseNode&gt;;

    public addSuccessor(newSuccessor: BaseNode, action: string = &quot;default&quot;): void {
        if (this.successors.has(action)) {
            throw new Error(`Action ${action} already exists`);
        }
        this.successors.set(action, newSuccessor);
    }

    pub