MCPcopy Index your code
hub / github.com/codehamr/codehamr / newestToolIndex

Function newestToolIndex

internal/ctx/ctx.go:287–294  ·  view source on GitHub ↗

newestToolIndex returns the index of the newest tool-result message in history, or -1. Everything after it can only be non-tool (a system nudge, an assistant summary), so it marks the current turn's newest tool exchange.

(history []Message)

Source from the content-addressed store, hash-verified

285// newestToolIndex returns the index of the newest tool-result message in
286// history, or -1. Everything after it can only be non-tool (a system nudge, an
287// assistant summary), so it marks the current turn's newest tool exchange.
288func newestToolIndex(history []Message) int {
289 for i := len(history) - 1; i >= 0; i-- {
290 if history[i].Role == RoleTool {
291 return i
292 }
293 }
294 return -1
295}
296
297// onlyNonSubstantive reports whether kept carries no substantive conversation:

Callers 1

PackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected