Skip to content

Function: processQueueMessages()

Makaio Framework


Makaio Framework / ai-adapters-core / processQueueMessages

processQueueMessages<TExtra>(queue, callbacks): Promise<boolean>

Defined in: ../../../adapters/core/src/session/process-queue.ts:100

Shared processQueue orchestration for all session implementations.

Handles the complete immediate-mode flow:

  1. Detect immediate message while a turn is active
  2. Pause the active turn
  3. Supersede the in-flight message and drain enqueued messages
  4. Collect merged content from all superseded/merged messages
  5. Start a new turn with the immediate message and merged context

Also handles the normal queue flow:

  • Late immediate rejection (immediate arrives after turn finishes)
  • Normal enqueue/replace message processing

Returns true when a new turn was started, false otherwise. Callers can use this to decide whether to transition to idle when the queue drains without starting a new turn (e.g., all-rejection case).

TExtra = unknown

Type of adapter-specific extra merge data

UserMessageQueue

The user message queue to process

ProcessQueueCallbacks<TExtra>

Adapter-specific callbacks

Promise<boolean>

True if a new turn was started, false otherwise