StripAndCaptureInjectedMessages removes injected tool call / result pairs and also extracts the content of tool results produced by injected calls.
(rawJSON []byte, format string)
| 27 | // StripAndCaptureInjectedMessages removes injected tool call / result pairs |
| 28 | // and also extracts the content of tool results produced by injected calls. |
| 29 | func StripAndCaptureInjectedMessages(rawJSON []byte, format string) ([]byte, []CapturedResult) { |
| 30 | f := GetFormat(format) |
| 31 | if f == nil { |
| 32 | return rawJSON, nil |
| 33 | } |
| 34 | return f.StripAndCapture(rawJSON) |
| 35 | } |
| 36 | |
| 37 | // messageHasInjectedContent checks if a message contains injected tool call IDs. |
| 38 | func messageHasInjectedContent(msg gjson.Result, format string) bool { |