Class UnknownSessionEvent

java.lang.Object
com.github.copilot.sdk.events.AbstractSessionEvent
com.github.copilot.sdk.events.UnknownSessionEvent

public final class UnknownSessionEvent extends AbstractSessionEvent
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 Details

    • UnknownSessionEvent

      public UnknownSessionEvent(String originalType)
      Creates an unknown session event with the given original type string.
      Parameters:
      originalType - the event type string received from the CLI; may be null
  • Method Details

    • getType

      public String getType()
      Returns "unknown" as the canonical type for all unrecognized events.
      Specified by:
      getType in class AbstractSessionEvent
      Returns:
      always "unknown"
    • getOriginalType

      public String getOriginalType()
      Returns the original event type string as received from the CLI.
      Returns:
      the original type, never null