Package com.github.copilot.sdk.json
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 Summary
Modifier and TypeMethodDescriptionShows a confirmation dialog and returns the user's boolean answer.elicitation(ElicitationParams params) Shows a generic elicitation dialog with a custom schema.input(String message, InputOptions options) Shows a text input dialog.Shows a selection dialog with the given options.
-
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
Shows a confirmation dialog and returns the user's boolean answer.Returns
falseif the user declines or cancels.- Parameters:
message- the message to display- Returns:
- a future that resolves to
trueif the user confirmed - Throws:
IllegalStateException- if the host does not support elicitation
-
select
Shows a selection dialog with the given options.Returns the selected value, or
nullif the user declines/cancels.- Parameters:
message- the message to displayoptions- 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
Shows a text input dialog.Returns the entered text, or
nullif the user declines/cancels.- Parameters:
message- the message to displayoptions- optional input field options, ornull- Returns:
- a future that resolves to the entered string, or
null - Throws:
IllegalStateException- if the host does not support elicitation
-