Interface: TurnTrackerOptions<TRecord>
Makaio Framework / ai-adapters-core / TurnTrackerOptions
Interface: TurnTrackerOptions<TRecord>
Section titled “Interface: TurnTrackerOptions<TRecord>”Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:48
Configuration options for the turn tracker.
Remarks
Section titled “Remarks”Adapters provide detection functions specific to their log format:
- Claude Code:
detectTurnStarttriggers on user messages,detectTurnCompletetriggers on final text content blocks - Copilot: Explicit
turn_start/turn_endevents, may bypass this tracker
TurnTracker - Uses these options
Type Parameters
Section titled “Type Parameters”TRecord
Section titled “TRecord”TRecord
The adapter’s native log record type
Properties
Section titled “Properties”detectTurnComplete
Section titled “detectTurnComplete”detectTurnComplete: (
record) =>boolean
Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:73
Detect if a record indicates the completion of a turn.
Parameters
Section titled “Parameters”record
Section titled “record”TRecord
Log record to check
Returns
Section titled “Returns”boolean
True if this record completes the current turn
Example
Section titled “Example”// Claude Code: final text block completes a turndetectTurnComplete: (record) => record.type === 'assistant' && record.message?.content?.some((b) => b.type === 'text')detectTurnStart
Section titled “detectTurnStart”detectTurnStart: (
record) =>boolean
Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:59
Detect if a record indicates the start of a turn.
Parameters
Section titled “Parameters”record
Section titled “record”TRecord
Log record to check
Returns
Section titled “Returns”boolean
True if this record starts a new turn
Example
Section titled “Example”// Claude Code: user message starts a turndetectTurnStart: (record) => record.type === 'user'generateTurnId?
Section titled “generateTurnId?”
optionalgenerateTurnId?: (sessionId) =>string
Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:94
Optional custom function to generate turn IDs.
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”string
The session ID for context
Returns
Section titled “Returns”string
Unique turn ID string
Default Value
Section titled “Default Value”Uses crypto.randomUUID()
Remarks
Section titled “Remarks”Override this for deterministic testing or custom ID schemes.
getSessionId
Section titled “getSessionId”getSessionId: (
record) =>string
Defined in: ../../../adapters/core/src/log-importer/turn-tracker.ts:84
Extract the session ID from a log record.
Parameters
Section titled “Parameters”record
Section titled “record”TRecord
Log record to extract session ID from
Returns
Section titled “Returns”string
Session ID string
Example
Section titled “Example”getSessionId: (record) => record.sessionId