-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add support for CLIENT_TOOL_EVENT data channel messages #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… types - Added ToolCallEvent and ClientEventEvent type definitions - Extended DataChannelMessage enum with TOOL_CALL and CLIENT_EVENT - Added internal events WEBRTC_TOOL_CALL_RECEIVED and WEBRTC_CLIENT_EVENT_RECEIVED - Added public events TOOL_CALL_RECEIVED and CLIENT_EVENT_RECEIVED - Updated StreamingClient to handle and emit new message types - Added event callbacks for consumers to listen to tool calls and client events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for handling TOOL_CALL and CLIENT_EVENT messages received through WebRTC data channels. The implementation follows the existing pattern used for SPEECH_TEXT messages by defining new event types, extending the data channel message enum, and updating the StreamingClient to properly handle and emit these new message types.
Key Changes:
- Added ToolCallEvent and ClientEventEvent interfaces to define the structure of tool call and client event data
- Extended DataChannelMessage enum and event systems with TOOL_CALL and CLIENT_EVENT variants
- Updated StreamingClient message handler to process and emit the new message types
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/streaming/index.ts | Exports new ToolCallEvent and ClientEventEvent type definitions |
| src/types/streaming/ToolCallEvent.ts | Defines interface for tool call events with ID, name, arguments and timestamp |
| src/types/streaming/ClientEventEvent.ts | Defines interface for client events with ID, type, data and timestamp |
| src/types/streaming/DataChannelMessage.ts | Adds TOOL_CALL and CLIENT_EVENT enum values |
| src/types/events/public/AnamEvent.ts | Adds public TOOL_CALL_RECEIVED and CLIENT_EVENT_RECEIVED event types |
| src/types/events/public/EventCallbacks.ts | Registers callback signatures for the new public events |
| src/types/events/internal/InternalEvent.ts | Adds internal WEBRTC_TOOL_CALL_RECEIVED and WEBRTC_CLIENT_EVENT_RECEIVED events |
| src/types/events/internal/InternalEventCallbacks.ts | Registers callback signatures for the new internal events |
| src/modules/StreamingClient.ts | Implements message handlers for TOOL_CALL and CLIENT_EVENT that emit both internal and public events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 9 files
- Removed ToolCallEvent type and TOOL_CALL message type - Renamed ClientEventEvent to ClientToolEvent - Renamed CLIENT_EVENT to CLIENT_TOOL_EVENT across all enums and event handlers - Updated internal event WEBRTC_CLIENT_EVENT_RECEIVED to WEBRTC_CLIENT_TOOL_EVENT_RECEIVED - Updated public event CLIENT_EVENT_RECEIVED to CLIENT_TOOL_EVENT_RECEIVED - Updated StreamingClient to handle only CLIENT_TOOL_EVENT message type
ao-anam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Changed event_id to event_uid - Changed event_type to event_name - Changed data to event_data - Added session_id field - Added timestamp_user_action field - Added user_action_correlation_id field - Added used_outside_engine boolean field - Updated comments to reflect actual usage from engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 13 files

Summary by cubic
Add support for CLIENT_TOOL_EVENT WebRTC data channel messages. StreamingClient now maps the wire payload to a ClientToolEvent and emits typed events apps can handle.
Written for commit 86cb958. Summary will update automatically on new commits.