Documentation
¶
Index ¶
- func CleanCarriageReturns(s string) string
- func ComputeFastHash(s string) uint64
- func ComputeRef(s string) string
- func DeduplicateHistoricalReads(blocks []BlockRecord) ([]string, bool)
- func DistillDiff(s string) (string, bool)
- func DistillJSON(s string) (string, bool)
- func FoldRepeatedLines(s string) string
- func IsLockfileOrGenerated(path string) bool
- func IsUnifiedDiff(s string) bool
- func SanitizeTerminal(s string) (string, bool)
- func StripANSI(s string) string
- type BlockRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanCarriageReturns ¶
CleanCarriageReturns resolves in-place line overwrites caused by terminal progress bars (\r). Standard CRLF (\r\n) is normalized to \n. Standalone \r keeps only the last segment before \n.
func ComputeFastHash ¶
ComputeFastHash calculates a 64-bit FNV-1a hash of a string.
func ComputeRef ¶
ComputeRef creates a 12-char SHA-256 ref for a string.
func DeduplicateHistoricalReads ¶
func DeduplicateHistoricalReads(blocks []BlockRecord) ([]string, bool)
DeduplicateHistoricalReads detects identical large blocks (>512 bytes) across turns. The LATEST occurrence of each block is kept 100% intact (active working memory). EARLIER redundant occurrences are replaced with a concise backwards reference.
func DistillDiff ¶
DistillDiff processes git unified diffs: 1. Collapses massive lockfile and minified asset diffs into 1-line semantic summaries. 2. Compacts excessive unchanged context lines (>8 lines) in application code diffs down to 3 lines. 3. Real code modifications are preserved 100% verbatim.
func DistillJSON ¶
DistillJSON applies structural pruning and tabular schema-lifting to JSON strings: 1. Drops null fields, empty arrays/objects, and envelope telemetry. 2. Lifts homogeneous arrays of objects into compact, token-efficient Markdown tables. 3. Emits dense, unindented JSON for non-tabular structures.
func FoldRepeatedLines ¶
FoldRepeatedLines folds consecutive identical lines repeated >3 times into a single line with count.
func IsLockfileOrGenerated ¶
IsLockfileOrGenerated reports whether a path matches generated files, dependency lockfiles, or minified assets that pollute agent context.
func IsUnifiedDiff ¶
IsUnifiedDiff reports whether text appears to be a unified git diff.
func SanitizeTerminal ¶
SanitizeTerminal runs the full terminal hygiene pipeline: ANSI stripping, progress overwrite resolution, and line folding.