Fix agent event ordering: update state before emitting events
Previously, Agent.emit() was called before state was updated (e.g., appendMessage). This meant event handlers saw stale state - when message_end fired, agent.state.messages didn't include the message yet. Now state is updated first, then events are emitted, so handlers see consistent state that matches the event.
This commit is contained in:
951
package-lock.json
generated
951
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user