compress

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package compress implements the first real transform: head/tail elision of verbose machine output, under the quality contracts.

Contracts enforced here:

  • never-elide: lines that look like failures/errors survive the middle cut
  • idempotency: an already-elided blob is never compressed again (provider prompt caches see a stable body across turns)
  • savings floor: if the squeeze saves less than 10%, skip it — breaking a prefix for pocket change is a net loss

Index

Constants

View Source
const RefHexLen = 12

RefPrefix is how much of the original's SHA256 hex is embedded in markers.

Variables

View Source
var Default = Params{
	MinBytes:     2048,
	HeadLines:    20,
	TailLines:    20,
	MaxKept:      50,
	ContextAfter: 2,
	Marker:       "[... squoze: %d middle lines elided · full text kept locally as %s ...]",
}

Default is the standard preset.

Functions

func MustKeep added in v0.2.0

func MustKeep(line string) bool

MustKeep exposes the error signal detector publicly for distillers.

func Text

func Text(s string, p Params) (string, bool)

Text squeezes one text blob. Returns the result plus applied flag.

Types

type Params

type Params struct {
	MinBytes     int    // blobs below this size pass through
	HeadLines    int    // leading lines kept verbatim
	TailLines    int    // trailing lines kept verbatim (most recent signal)
	MaxKept      int    // max middle error-lines rescued
	ContextAfter int    // extra trailing lines rescued with each error line
	Marker       string // elision marker line
}

Params controls one compression pass.

Jump to

Keyboard shortcuts

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