Package com.github.copilot.sdk.events
Class SessionEventParser
java.lang.Object
com.github.copilot.sdk.events.SessionEventParser
Parser for session events that handles polymorphic deserialization.
This class deserializes JSON event data into the appropriate
AbstractSessionEvent subclass based on the "type" field. It is used
internally by the SDK to convert server events to Java objects.
Supported Event Types
- Session: session.start, session.resume, session.error, session.idle, session.info, etc.
- Assistant: assistant.message, assistant.message_delta, assistant.turn_start, assistant.turn_end, etc.
- Tool: tool.execution_start, tool.execution_complete, etc.
- User: user.message, pending_messages.modified
- Subagent: subagent.started, subagent.completed, etc.
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractSessionEventparse(com.fasterxml.jackson.databind.JsonNode node) Parses a JsonNode into the appropriate SessionEvent subclass.static AbstractSessionEventParses a JSON string into the appropriate SessionEvent subclass.
-
Constructor Details
-
SessionEventParser
public SessionEventParser()
-
-
Method Details
-
parse
Parses a JSON string into the appropriate SessionEvent subclass.- Parameters:
json- the JSON string representing an event- Returns:
- the parsed event, or
nullif parsing fails or type is unknown
-
parse
Parses a JsonNode into the appropriate SessionEvent subclass.- Parameters:
node- the JSON node representing an event- Returns:
- the parsed event, or
nullif parsing fails or type is unknown
-