Problem
LocalConversation has two event emission methods:
emitTypedEvent(event: BaseEvent) — proper typed events matching events/types.ts interfaces
emitEvent({ type, timestamp, data }) — legacy format that creates ad-hoc events
The legacy method creates events like { kind: 'user_message', content } and { kind: 'paused' } that don't match any typed event interface. It even has a @deprecated JSDoc tag but is still used in 10+ places.
// Legacy — creates untyped events
this.emitEvent({
type: 'message',
timestamp: Date.now(),
data: { kind: 'user_message', content },
});
// Proper — uses typed interfaces
this.emitTypedEvent(stateEvent);
Consumers receiving these events via callbacks get inconsistent shapes depending on which code path emitted them.
Proposed Fix
- Convert all
emitEvent() calls to use emitTypedEvent() with proper BaseEvent subtypes
- For events like
user_message and paused that have no existing typed interface, either:
- Map them to existing types (e.g.,
user_message -> MessageEvent)
- Create new typed interfaces if needed
- Delete
emitEvent() entirely
Impact
Low — consistency improvement. All events will match documented typed interfaces.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.
Problem
LocalConversationhas two event emission methods:emitTypedEvent(event: BaseEvent)— proper typed events matchingevents/types.tsinterfacesemitEvent({ type, timestamp, data })— legacy format that creates ad-hoc eventsThe legacy method creates events like
{ kind: 'user_message', content }and{ kind: 'paused' }that don't match any typed event interface. It even has a@deprecatedJSDoc tag but is still used in 10+ places.Consumers receiving these events via callbacks get inconsistent shapes depending on which code path emitted them.
Proposed Fix
emitEvent()calls to useemitTypedEvent()with properBaseEventsubtypesuser_messageandpausedthat have no existing typed interface, either:user_message->MessageEvent)emitEvent()entirelyImpact
Low — consistency improvement. All events will match documented typed interfaces.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.