Documentation
¶
Index ¶
- func ApplyAll(ctx context.Context, services []capscompaction.Service, ...) ([]agentkit.ModelMessage, int, error)
- func EstimateMessagesTokens(messages []agentkit.ModelMessage) int
- func EstimateTokens(msg agentkit.ModelMessage) int
- func FindCutPoint(messages []capscompaction.IndexedMessage, ...) capscompaction.CutPointResult
- func Prepare(indexed []capscompaction.IndexedMessage, boundaryStart int, ...) *capscompaction.Preparation
- func PruneToolResults(messages []agentkit.ModelMessage, maxBytes int) []agentkit.ModelMessage
- func ResolveRetrySettings(cfg *capscompaction.RetryConfig) capscompaction.RetryPolicy
- func RetryCall(ctx context.Context, policy capscompaction.RetryPolicy, ...) error
- func SerializeConversation(messages []agentkit.ModelMessage) string
- func TruncateToolResult(result agentkit.ToolResult, maxBytes int) agentkit.ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAll ¶
func ApplyAll(ctx context.Context, services []capscompaction.Service, req capscompaction.Request) ([]agentkit.ModelMessage, int, error)
ApplyAll runs compaction services in order, returning the latest message view and how many services reported Applied.
func EstimateMessagesTokens ¶
func EstimateMessagesTokens(messages []agentkit.ModelMessage) int
EstimateMessagesTokens sums token estimates for a message slice.
func EstimateTokens ¶
func EstimateTokens(msg agentkit.ModelMessage) int
EstimateTokens approximates message size with a chars/4 heuristic (Pi-compatible).
func FindCutPoint ¶
func FindCutPoint(messages []capscompaction.IndexedMessage, startIndex, endIndex, keepRecentTokens int) capscompaction.CutPointResult
FindCutPoint walks backward until keepRecentTokens is reached, then cuts at the nearest valid cut point. Tool messages are never cut points (Pi-compatible).
func Prepare ¶
func Prepare(indexed []capscompaction.IndexedMessage, boundaryStart int, keepRecentTokens int, previousSummary string, tokensBefore int) *capscompaction.Preparation
Prepare builds a compaction plan from indexed messages. boundaryStart is the first index eligible for summarization (after any previous compaction summary).
func PruneToolResults ¶
func PruneToolResults(messages []agentkit.ModelMessage, maxBytes int) []agentkit.ModelMessage
PruneToolResults truncates oversized tool result text deterministically.
func ResolveRetrySettings ¶
func ResolveRetrySettings(cfg *capscompaction.RetryConfig) capscompaction.RetryPolicy
ResolveRetrySettings applies defaults aligned with agent-level auto retry.
func RetryCall ¶
func RetryCall( ctx context.Context, policy capscompaction.RetryPolicy, isRetryable func(error) bool, call func() error, callbacks *capscompaction.SummarizationRetryCallbacks, ) error
RetryCall runs call with bounded retries. isRetryable classifies transient failures; when nil, only context cancellation is treated as non-retryable.
func SerializeConversation ¶
func SerializeConversation(messages []agentkit.ModelMessage) string
SerializeConversation formats messages as plain text for summarization (Pi-style).
func TruncateToolResult ¶
func TruncateToolResult(result agentkit.ToolResult, maxBytes int) agentkit.ToolResult
TruncateToolResult truncates oversized tool result content after execution.
Types ¶
This section is empty.