Skip to main content

Module handler

Module handler 

Source
Expand description

Event handler traits for session lifecycle. Optional session-callback traits.

Each callback the CLI may dispatch (permission requests, elicitation prompts, user-input questions, exit-plan-mode prompts, auto-mode-switch prompts) has its own focused trait with a single handle method.

Handlers are optional: install only the ones the application cares about. The SDK derives the corresponding wire flag on session.create / session.resume from the presence of each handler, so the runtime does not emit broadcasts this client would never respond to.

Tool dispatch uses its own per-tool registry built from Tool::with_handler on entries passed to SessionConfig::with_tools.

Structs§

ApproveAllHandler
A PermissionHandler that approves every request. Useful for CLI tools, scripts, and tests that don’t need interactive permission prompts.
DenyAllHandler
A PermissionHandler that denies every request.
ExitPlanModeResult
Result of an exit-plan-mode request.
UserInputResponse
Response to a user input request.

Enums§

AutoModeSwitchResponse
Response to an auto-mode-switch request.
PermissionResult
Decision returned by a PermissionHandler.

Traits§

AutoModeSwitchHandler
Handler for auto_mode_switch.requested events. When unset, requestAutoModeSwitch: false goes on the wire.
ElicitationHandler
Handler for elicitation.requested broadcasts.
ExitPlanModeHandler
Handler for exit_plan_mode.requested events. When unset, requestExitPlanMode: false goes on the wire.
PermissionHandler
Handler for permission.requested broadcasts.
UserInputHandler
Handler for user_input.requested events from the ask_user tool.