Interface UserPromptSubmittedHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface UserPromptSubmittedHandler
Handler for user-prompt-submitted hooks.

This handler is invoked when the user submits a prompt, allowing you to intercept and modify the prompt before it is processed.

Example Usage

UserPromptSubmittedHandler handler = (input, invocation) -> {
	System.out.println("User submitted: " + input.prompt());
	if (input.prompt().contains("password")) {
		// Refuse the prompt: no model turn runs, and the session emits a
		// session.warning carrying the reason
		return CompletableFuture.completedFuture(UserPromptSubmittedHookOutput.block("No credentials, please."));
	}
	// Optionally modify the prompt
	return CompletableFuture
			.completedFuture(new UserPromptSubmittedHookOutput(input.prompt() + " (enhanced)", null, null));
};
Since:
1.0.7