MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / dequeueAllMatching

Function dequeueAllMatching

source code/utils/messageQueueManager.ts:246–268  ·  view source on GitHub ↗
(
  predicate: (cmd: QueuedCommand) => boolean,
)

Source from the content-addressed store, hash-verified

244 * Non-matching commands stay in the queue.
245 */
246export function dequeueAllMatching(
247 predicate: (cmd: QueuedCommand) => boolean,
248): QueuedCommand[] {
249 const matched: QueuedCommand[] = []
250 const remaining: QueuedCommand[] = []
251 for (const cmd of commandQueue) {
252 if (predicate(cmd)) {
253 matched.push(cmd)
254 } else {
255 remaining.push(cmd)
256 }
257 }
258 if (matched.length === 0) {
259 return []
260 }
261 commandQueue.length = 0
262 commandQueue.push(...remaining)
263 notifySubscribers()
264 for (const _cmd of matched) {
265 logOperation('dequeue')
266 }
267 return matched
268}
269
270/**
271 * Remove specific commands from the queue by reference identity.

Callers 3

processQueueIfReadyFunction · 0.85
runHeadlessStreamingFunction · 0.85
killShellTasksForAgentFunction · 0.85

Calls 2

notifySubscribersFunction · 0.85
logOperationFunction · 0.85

Tested by

no test coverage detected