MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / drainSdkEvents

Function drainSdkEvents

src/utils/sdkEventQueue.ts:89–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87}
88
89export function drainSdkEvents(): Array<
90 SdkEvent & { uuid: UUID; session_id: string }
91> {
92 if (queue.length === 0) {
93 return []
94 }
95 const events = queue.splice(0)
96 return events.map(e => ({
97 ...e,
98 uuid: randomUUID(),
99 session_id: getSessionId(),
100 }))
101}
102
103/**
104 * Emit a task_notification SDK event for a task reaching a terminal state.

Callers 2

drainCommandQueueFunction · 0.85
runFunction · 0.85

Calls 1

getSessionIdFunction · 0.85

Tested by

no test coverage detected