Package com.github.copilot.sdk.events
Class UnknownSessionEvent
java.lang.Object
com.github.copilot.sdk.events.AbstractSessionEvent
com.github.copilot.sdk.events.UnknownSessionEvent
Represents an unrecognized session event type received from the CLI.
When the CLI sends an event with a type that this SDK does not recognize (for
example, an event type introduced in a newer CLI version), the SDK wraps it
in an UnknownSessionEvent rather than dropping it. This ensures
forward compatibility: event handlers can simply ignore unknown event types
without the SDK crashing.
Example
session.on(event -> {
if (event instanceof UnknownSessionEvent unknown) {
// Ignore events from newer CLI versions
}
});
- Since:
- 1.2.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUnknownSessionEvent(String originalType) Creates an unknown session event with the given original type string. -
Method Summary
Modifier and TypeMethodDescriptionReturns the original event type string as received from the CLI.getType()Returns"unknown"as the canonical type for all unrecognized events.Methods inherited from class com.github.copilot.sdk.events.AbstractSessionEvent
getEphemeral, getId, getParentId, getTimestamp, setEphemeral, setId, setParentId, setTimestamp
-
Constructor Details
-
UnknownSessionEvent
Creates an unknown session event with the given original type string.- Parameters:
originalType- the event type string received from the CLI; may benull
-
-
Method Details
-
getType
Returns"unknown"as the canonical type for all unrecognized events.- Specified by:
getTypein classAbstractSessionEvent- Returns:
- always
"unknown"
-
getOriginalType
Returns the original event type string as received from the CLI.- Returns:
- the original type, never
null
-