Expand description
Event handler traits for session lifecycle. Event handler traits for session lifecycle.
The SessionHandler trait is the primary extension point — implement
on_event to control how sessions respond to
CLI events, permission requests, tool calls, and user input prompts.
Structs§
- Approve
AllHandler - A
SessionHandlerthat auto-approves all permissions and ignores all events. - Deny
AllHandler - A
SessionHandlerthat denies all permission requests and otherwise relies on the trait’s default fallback responses for every other event (e.g. tool invocations return “unhandled”, elicitations cancel, plan-mode prompts decline). This is the safe default used when no handler is set onSessionConfig::handler— sessions will not stall on permission prompts (they’re denied immediately) but no privileged actions will be taken without an explicit opt-in. - Exit
Plan Mode Result - Result of an exit-plan-mode request.
- User
Input Response - Response to a user input request.
Enums§
- Auto
Mode Switch Response - Response to a
HandlerEvent::AutoModeSwitchrequest. - Handler
Event - Events dispatched by the SDK session event loop to the handler.
- Handler
Response - Response from the handler back to the SDK, used to construct the JSON-RPC reply sent to the CLI.
- Permission
Result - Result of a permission request.
Traits§
- Session
Handler - Callback trait for session events.