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§
- Approve
AllHandler - A
PermissionHandlerthat approves every request. Useful for CLI tools, scripts, and tests that don’t need interactive permission prompts. - Deny
AllHandler - A
PermissionHandlerthat denies every request. - 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 an auto-mode-switch request.
- Permission
Result - Decision returned by a
PermissionHandler.
Traits§
- Auto
Mode Switch Handler - Handler for
auto_mode_switch.requestedevents. When unset,requestAutoModeSwitch: falsegoes on the wire. - Elicitation
Handler - Handler for
elicitation.requestedbroadcasts. - Exit
Plan Mode Handler - Handler for
exit_plan_mode.requestedevents. When unset,requestExitPlanMode: falsegoes on the wire. - Permission
Handler - Handler for
permission.requestedbroadcasts. - User
Input Handler - Handler for
user_input.requestedevents from theask_usertool.