Versions in this module Expand all Collapse all v0 v0.5.1 May 12, 2026 v0.1.0 May 12, 2026 Changes in this version + const DefaultMinChunkSize + func CompressJSON(text string, maxItems int) string + func CompressLog(text string) string + func DetectLanguageByExtension(path string) string + func EstimateTokens(text string) int + func EstimateTokensPrecise(text string) int + func GetLanguagePatterns(lang string) []string + func RegisterChunker(ext string, fn ChunkerFunc) + func RegisterLanguagePatterns(lang string, patterns []string) + func WarmupTokenizer() + type ChunkOptions struct + KeepSeparator SeparatorKeep + Language string + MaxTokens int + MinChunkSize int + MinTokens int + Overlap int + func DefaultChunkOptions() ChunkOptions + type ChunkerFunc func(path, content string) (language string, chunks []CodeChunk) + type CodeChunk struct + Content string + EndLine int + StartLine int + Symbol string + Tokens int + func ChunkCode(source string, opts ChunkOptions) []CodeChunk + func ChunkCodePath(path, source string, opts ChunkOptions) []CodeChunk + type Compressor struct + func NewCompressor(opts ...Option) *Compressor + func (c *Compressor) Compress(text string) (string, Stats) + type LayerStat struct + DurationMs int64 + TokensSaved int + type Mode string + const ModeAggressive + const ModeMinimal + type Option interface + var Adaptive Option = WithTier(TierAdaptive) + var Aggressive Option = WithMode(ModeAggressive) + var Code Option = WithTier(TierCode) + var Log Option = WithTier(TierLog) + var Minimal Option = WithMode(ModeMinimal) + var Surface Option = WithTier(TierSurface) + func WithBudget(tokens int) Option + func WithMode(m Mode) Option + func WithQuery(intent string) Option + func WithTier(t Tier) Option + type SeparatorKeep int + const SepDiscard + const SepLeft + const SepRight + type Stats struct + FinalTokens int + Layers map[string]LayerStat + OriginalTokens int + ReductionPercent float64 + TokensSaved int + func Compress(text string, opts ...Option) (string, Stats) + type StreamCompressor struct + func NewStreamCompressor(threshold int, opts ...Option) *StreamCompressor + func (sc *StreamCompressor) Append(content string) + func (sc *StreamCompressor) Close() + func (sc *StreamCompressor) Raw() string + func (sc *StreamCompressor) Snapshot() (string, Stats) + func (sc *StreamCompressor) TokenCount() int + type Tier string + const TierAdaptive + const TierCode + const TierCore + const TierExtract + const TierLog + const TierSurface + const TierThread + const TierTrim