Function: serializeTurnContext()
Makaio Framework / ai-adapters-core / serializeTurnContext
Function: serializeTurnContext()
Section titled “Function: serializeTurnContext()”serializeTurnContext(
turnContext):SerializedContextBlock[]
Defined in: ../../../adapters/core/src/utils/serializeTurnContext.ts:204
Serialize a MessageHandle’s turnContext into ordered text blocks.
All non-null, non-undefined keys are serialized. The skillCatalog,
skills, and contextRules keys get dedicated markdown formatting;
all other keys are JSON-serialized.
Each adapter converts these blocks to its wire format:
- Claude SDK: each block → prependContextBlock(msg, tag, content)
- Anthropic/OpenAI: join and prepend to user message
- Gemini: push as requestPart
- CLI/Copilot: prepend to prompt string
- Codex: push as userInput
Parameters
Section titled “Parameters”turnContext
Section titled “turnContext”Record<string, JsonValue | undefined> | undefined
The context record from MessageHandle.turnContext
Returns
Section titled “Returns”Ordered blocks: skillCatalog, skills, contextRules, then remaining keys alphabetical. Empty when turnContext is nullish or empty.