SlidingWindow keeps the last KeepLast messages and drops everything older. It snaps to a safe boundary so it never separates a tool_use from its tool_result.
| 10 | // It snaps to a safe boundary so it never separates a tool_use from its |
| 11 | // tool_result. |
| 12 | type SlidingWindow struct { |
| 13 | KeepLast int |
| 14 | } |
| 15 | |
| 16 | func (s *SlidingWindow) Compact(_ context.Context, messages []api.Message) ([]api.Message, error) { |
| 17 | if len(messages) <= s.KeepLast { |
nothing calls this directly
no outgoing calls
no test coverage detected