Interface SessionUiApi


public interface SessionUiApi
Provides UI methods for eliciting information from the user during a session.

All methods on this interface throw IllegalStateException if the host does not report elicitation support via CopilotSession.getCapabilities(). Check session.getCapabilities().getUi() != null && Boolean.TRUE.equals(session.getCapabilities().getUi().getElicitation()) before calling.

Example Usage


 var caps = session.getCapabilities();
 if (caps.getUi() != null && Boolean.TRUE.equals(caps.getUi().getElicitation())) {
 	boolean confirmed = session.getUi().confirm("Are you sure?").get();
 }
 
Since:
1.0.0
See Also:
  • Method Details

    • elicitation

      Shows a generic elicitation dialog with a custom schema.
      Parameters:
      params - the elicitation parameters including message and schema
      Returns:
      a future that resolves with the ElicitationResult
      Throws:
      IllegalStateException - if the host does not support elicitation
    • confirm

      CompletableFuture<Boolean> confirm(String message)
      Shows a confirmation dialog and returns the user's boolean answer.

      Returns false if the user declines or cancels.

      Parameters:
      message - the message to display
      Returns:
      a future that resolves to true if the user confirmed
      Throws:
      IllegalStateException - if the host does not support elicitation
    • select

      CompletableFuture<String> select(String message, String[] options)
      Shows a selection dialog with the given options.

      Returns the selected value, or null if the user declines/cancels.

      Parameters:
      message - the message to display
      options - the options to present
      Returns:
      a future that resolves to the selected string, or null
      Throws:
      IllegalStateException - if the host does not support elicitation
    • input

      CompletableFuture<String> input(String message, InputOptions options)
      Shows a text input dialog.

      Returns the entered text, or null if the user declines/cancels.

      Parameters:
      message - the message to display
      options - optional input field options, or null
      Returns:
      a future that resolves to the entered string, or null
      Throws:
      IllegalStateException - if the host does not support elicitation