compactor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package compactor implements the compactor seam as an in-process plugin. It keeps the first N and last M messages, LLM-summarizes the middle via the mounted provider, and returns the compacted list.

Seam: compactor (exclusive). Requires: provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compactor

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

Compactor implements agent.CompactionProvider. It holds a reference to the provider (set at Mount time) and the compaction config (read from ctx.Configs at Mount time).

func (*Compactor) Compact

func (c *Compactor) Compact(ctx context.Context, messages []ai.Message) ([]ai.Message, error)

Compact compacts the message history. If disabled or under budget, returns the original messages unchanged.

type Plugin

type Plugin struct{}

Plugin adapts the compactor to the agent.Plugin interface.

func NewPlugin

func NewPlugin() *Plugin

NewPlugin creates a compactor plugin instance.

func (*Plugin) Mount

func (p *Plugin) Mount(ctx *agent.Context) error

Mount reads CompactionConfig from ctx.Configs, wires the provider from the already-mounted provider slot, sets ctx.Compactor, and registers the /compact command.

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Provides

func (p *Plugin) Provides() []string

func (*Plugin) Requires

func (p *Plugin) Requires() []string

Jump to

Keyboard shortcuts

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