refactor(history): add helpers to get content of tool "use" and "result"
There are many places in the code that wants to work with content of "tool use" and "tool result" messages. Currently such code uses is_tool_use_message() and is_tool_result() message to check if message is of right kind, and then pokes into message internals. This is not very efficient. Introduce get_tool_use_data() and get_tool_result_data() that would return contents of the message if it is of right kind, or nil otherwise. Also introduce get_tool_result() that attempts to locate result of a tool execution by its invocation ID.
D
Dmitry Torokhov committed
520ca47a8feb13469f75811932b251b906585642
Parent: 06cc3b3
Committed by yetone <yetoneful@gmail.com>
on 7/16/2025, 4:49:15 AM