Function: ensureToolResultsExist()
ensureToolResultsExist(
messages):ChatMessage[]
Defined in: packages/core/src/segments/derivation.ts:168
Ensure all tool calls have corresponding results. Injects synthetic error results for any orphaned tool calls. This is required by LLM APIs (Anthropic, OpenAI) which expect every tool_use to have a matching tool_result.