Package com.github.copilot.sdk.json
Interface SessionStartHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler for session-start hooks.
This handler is invoked when a session starts, allowing you to perform initialization or modify the session configuration.
Example Usage
SessionStartHandler handler = (input, invocation) -> {
System.out.println("Session started from: " + input.getSource());
return CompletableFuture
.completedFuture(new SessionStartHookOutput().setAdditionalContext("Custom initialization context"));
};
- Since:
- 1.0.7
-
Method Summary
Modifier and TypeMethodDescriptionhandle(SessionStartHookInput input, HookInvocation invocation) Handles a session start event.
-
Method Details
-
handle
CompletableFuture<SessionStartHookOutput> handle(SessionStartHookInput input, HookInvocation invocation) Handles a session start event.- Parameters:
input- the hook input containing session start detailsinvocation- metadata about the hook invocation- Returns:
- a future that resolves with the hook output, or
nullto proceed without modification
-