Documentation
¶
Overview ¶
Package textutil holds small string helpers shared across packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clip ¶
Clip truncates s to at most max bytes without splitting a multibyte UTF-8 rune, returning the (possibly shorter) string and whether it was truncated. Backing off to a rune boundary avoids feeding the model — and the JSONL trace — a broken trailing rune (the byte-cap-halves-Cyrillic bug class).
func OneLine ¶ added in v0.17.0
OneLine collapses all runs of whitespace (incl. newlines) to single spaces and rune-safely clips the result to at most max bytes — the shared "flatten to one tidy line, capped" helper used across the packages for log/error rendering.
func Tail ¶ added in v0.23.0
Tail keeps the last max bytes of s, backing off to a rune boundary so a multibyte character is never split; a clipped result is prefixed with "…". The counterpart of Clip for when the END of the text is the valuable part (e.g. a CLI agent's final answer after pages of progress noise).
Types ¶
This section is empty.