OpenHands / OpenHands/software-agent-sdk
Migrate LocalConversation.emitEvent() to typed events, remove legacy format
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Problem
LocalConversation has two event emission methods:
emitTypedEvent(event: BaseEvent)— proper typed events matchingevents/types.tsinterfacesemitEvent({ 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 useemitTypedEvent()with properBaseEventsubtypes - For events like
user_messageandpausedthat have no existing typed interface, either:- Map them to existing types (e.g.,
user_message->MessageEvent) - Create new typed interfaces if needed
- Map them to existing types (e.g.,
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with LocalConversation's emitEvent() and emitTypedEvent() methods, then read events/types.ts to inventory the available BaseEvent subtypes. Trace the 10+ legacy call sites, especially user_message and paused, and determine whether existing types fit or new interfaces are needed. Done means all calls use typed events and the legacy method is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100