Repository navigation
v0.13.0
Control-protocol extensions for interactive clients: interrupt, live model and permission-mode switching, context usage, user dialogs, enriched permission prompts, and renderer observability.
Context
These additions power alternative frontends that drive the claude CLI directly. AskUserQuestion is answered by feeding the choice back through a permission updatedInput, so interactive tools resolve without a separate answer channel. A correlation registry tracks pending control requests with restart-safe hard failures, so a dropped or restarted session surfaces an explicit error rather than a silently unresolved future.
Breaking
- Breaking. Renamed
--no-colorflag to--color(default: true) across all commands. Use--no-colorto disable color output.
Features
- New feature. Added
__version__attribute to theclaudestreampackage. - Control-request wire structs. New
ControlRequestmessage struct and aControlResponse.errorfield expose the CLI control protocol for interrupt, model, and mode requests. - Control-request correlation. Sessions can issue correlated control requests with pending-future tracking, turn-loop and between-turns response resolution, timeouts, and restart/close safety.
- Interactive session controls.
interrupt(),set_permission_mode(),set_model(), andget_context_usage()are now available on bothAsyncSessionandSyncSession, andSessionConfig.permission_modesets the initial permission mode via--permission-mode. - Dialog and enriched-permission responses. New
DialogCompletedandDialogCancelledmessages answer user dialogs,AllowPermissionacceptsupdated_permissionsto apply permission-rule updates on allow, andInitializeRequestcan declaresupported_dialog_kinds. - Tool-permission prompts now decode correctly. The current Claude CLI sends permission prompts as
can_use_tool; these now surface asPermissionRequest(with new fields likepermission_suggestions,display_name, andrequires_user_interaction) instead of being missed. A newUserDialogRequestevent carries CLI-driven user dialogs. - User-dialog handling on sessions.
respond_dialog()andrespond_dialog_cancelled()answer dialog requests,respond_allow()acceptsupdated_permissions, andSessionConfig.supported_dialog_kindsdeclares which dialogs the consumer can render (forcing the initialize handshake). Available on bothAsyncSessionandSyncSession. - Renderer observability.
ToolResultnow carriestool_name(correlated from the matchingToolUse), andResultexposes per-modelmodel_usagefrom the CLI'smodelUsagepayload. - Permission interception. New
SessionConfig.intercept_permissionsroutes permission prompts and interactive tools like AskUserQuestion to the consumer as PermissionRequest events. - Tool error signal.
ToolResultandToolResultBlocknow exposeis_error, so consumers can distinguish failed tool executions from successful ones.
Fixes
- Fix.
ToolSchemafieldsdescription,input_schema, andserverare now optional, supporting name-only tool entries.