Help us shape the future of Go! Take the 2026 Go Developer Survey

window

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor struct {
	// contains filtered or unexported fields
}

Compressor keeps the newest whole turns that fit the budget and replaces everything older with one summary message. The budget covers system messages and the kept conversation; the summary is not counted, and a Summarizer receives the budget to size it.

Compress is incremental: feed it its previous output plus the new messages and only the newly dropped messages are summarized, together with the previous summary, instead of the whole history again.

func New

func New(cfg Config) *Compressor

func (*Compressor) Compress

func (c *Compressor) Compress(ctx context.Context, req contextkit.Request) (*contextkit.Result, error)

type Config

type Config struct {
	Budget contextkit.Budget
	// Profile defaults to contextkit.ProfileFromEnv.
	Profile contextkit.Profile
	// MinRecent is the number of trailing messages always kept, even over
	// budget; at least 1. The kept window then extends back to the start of
	// its turn.
	MinRecent    int
	MaxToolChars int
	Summarizer   contextkit.Summarizer
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL