Skip to main content

Module handler

Module handler 

Source
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§

ApproveAllHandler
A SessionHandler that auto-approves all permissions and ignores all events.
DenyAllHandler
A SessionHandler that 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 on SessionConfig::handler — sessions will not stall on permission prompts (they’re denied immediately) but no privileged actions will be taken without an explicit opt-in.
ExitPlanModeResult
Result of an exit-plan-mode request.
UserInputResponse
Response to a user input request.

Enums§

AutoModeSwitchResponse
Response to a HandlerEvent::AutoModeSwitch request.
HandlerEvent
Events dispatched by the SDK session event loop to the handler.
HandlerResponse
Response from the handler back to the SDK, used to construct the JSON-RPC reply sent to the CLI.
PermissionResult
Result of a permission request.

Traits§

SessionHandler
Callback trait for session events.