Skip to content

Interface: TurnTrackerOptions<TRecord>

Makaio Framework


Makaio Framework / ai-adapters-core / TurnTrackerOptions

Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:48

Configuration options for the turn tracker.

Adapters provide detection functions specific to their log format:

  • Claude Code: detectTurnStart triggers on user messages, detectTurnComplete triggers on final text content blocks
  • Copilot: Explicit turn_start/turn_end events, may bypass this tracker

TurnTracker - Uses these options

TRecord

The adapter’s native log record type

detectTurnComplete: (record) => boolean

Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:73

Detect if a record indicates the completion of a turn.

TRecord

Log record to check

boolean

True if this record completes the current turn

// Claude Code: final text block completes a turn
detectTurnComplete: (record) =>
record.type === 'assistant' &&
record.message?.content?.some((b) => b.type === 'text')

detectTurnStart: (record) => boolean

Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:59

Detect if a record indicates the start of a turn.

TRecord

Log record to check

boolean

True if this record starts a new turn

// Claude Code: user message starts a turn
detectTurnStart: (record) => record.type === 'user'

optional generateTurnId?: (sessionId) => string

Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:94

Optional custom function to generate turn IDs.

string

The session ID for context

string

Unique turn ID string

Uses crypto.randomUUID()

Override this for deterministic testing or custom ID schemes.


getSessionId: (record) => string

Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:84

Extract the session ID from a log record.

TRecord

Log record to extract session ID from

string

Session ID string

getSessionId: (record) => record.sessionId