(msg map[string]any)
| 99 | } |
| 100 | |
| 101 | func isToolResultMessage(msg map[string]any) bool { |
| 102 | if role, ok := msg["role"].(string); !ok || role != "user" { |
| 103 | return false |
| 104 | } |
| 105 | content, ok := contentBlocks(msg["content"]) |
| 106 | if !ok { |
| 107 | return false |
| 108 | } |
| 109 | for _, block := range content { |
| 110 | blockType, ok := block["type"].(string) |
| 111 | if !ok { |
| 112 | continue |
| 113 | } |
| 114 | if blockType == "tool_result" { |
| 115 | return true |
| 116 | } |
| 117 | } |
| 118 | return false |
| 119 | } |
| 120 | |
| 121 | func SnipCompactIfNeeded( |
| 122 | messages []map[string]any, |
no test coverage detected