Skip to content

Conversation

@Smidge
Copy link
Contributor

@Smidge Smidge commented Oct 28, 2025

  • 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

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.

  • New Features
    • Standardized on CLIENT_TOOL_EVENT (removed TOOL_CALL and CLIENT_EVENT).
    • Added ClientToolEvent and WebRtcClientToolEvent types, plus ToolCallManager for mapping.
    • StreamingClient emits InternalEvent.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED and AnamEvent.CLIENT_TOOL_EVENT_RECEIVED.
    • Added EventCallbacks for CLIENT_TOOL_EVENT_RECEIVED.

Written for commit 86cb958. Summary will update automatically on new commits.

… 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
Copilot AI review requested due to automatic review settings October 28, 2025 16:58
Copy link

Copilot AI left a 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.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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
@Smidge Smidge changed the title feat: add support for TOOL_CALL and CLIENT_EVENT data channel messages feat: add support for CLIENT_TOOL_EVENT data channel messages Oct 28, 2025
ao-anam
ao-anam previously approved these changes Oct 28, 2025
Copy link
Contributor

@ao-anam ao-anam left a 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
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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

@ao-anam ao-anam merged commit e7c6c82 into main Oct 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants