Issue
1764
Changes
Simplified and Improved Code Readability
Added a new isInvalidEvent
method to centralize common null checks and type validation logic.
Refactored isToolUseStart
and isToolUseFinish
methods to remove redundant code and improve clarity.
Improved Maintainability
By separating shared logic into the isInvalidEvent method, future changes to EventType handling or related logic will require minimal updates.
Why This Change Was Made
- To reduce code duplication and improve readability and maintainability.
- To make the logic more robust and easier to extend in the future by centralizing common checks.