Expand description
SDK event queue utilities. Translated from ~/claudecode/openclaudecode/src/utils/sdkEventQueue.ts
SDK events are emitted during headless/streaming sessions and drained by the CLI output layer. In TUI mode they are silently dropped to avoid queue buildup.
Structs§
- Drained
SdkEvent - A drained SDK event with UUID and session ID appended.
- SdkEvent
- A single SDK event with all possible fields (matching TS union type).
- SdkEvent
Queue - Thread-safe event queue for SDK communication.
- SdkEvent
Usage - Usage statistics for task_progress events.
- Task
Progress Params - Parameters for task_progress event emission.
Enums§
- SdkEvent
Type - A typed SDK event subtype.
Functions§
- drain_
sdk_ events - Drain all pending SDK events and return them with uuid and session_id. Call this from the output layer (print.ts equivalent) to deliver events to SDK consumers.
- emit_
session_ state_ changed - Emit a
session_state_changedSDK event. MirrorsnotifySessionStateChanged— the ‘idle’ transition fires after heldBackResult flushes and the bg-agent do-while loop exits, serving as the authoritative “turn is over” signal for SDK consumers. - emit_
task_ progress - Emit a
task_progressSDK event. Shared by background agents (per tool_use) and workflows (per flush batch). - emit_
task_ started - Emit a
task_startedSDK event. Called byregister_task()when a new task is registered. - emit_
task_ terminated_ sdk - Emit a
task_notificationSDK event for a task reaching a terminal state. - enqueue_
sdk_ event - Enqueue an SDK event. In TUI mode (interactive session), events are dropped to avoid queue buildup.