Documentation
¶
Overview ¶
Package textsafe makes text from prompts, transcripts, models and settings safe to store and to print (invariant 1 in AGENTS.md). A Text can only be made here, and the render and encode code accepts nothing else, so unfiltered text cannot reach a terminal by accident.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text has had its control (Cc, including C1) and format (Cf, including bidi) characters removed. The field is private, so no other package can make one from raw text; it gets one from Clean, Sane or Strip.
func Clean ¶
Clean makes text for storing: one flat line, no control or format characters, no trailing spaces, at most max characters (a max below 1 means no limit). Invalid UTF-8 becomes U+FFFD, where perl kept the bad bytes, so state written by the Go version is always valid UTF-8.
func Strip ¶
Strip makes text for showing: it removes the same characters but keeps line breaks and tabs.
func Truncate ¶
Truncate keeps at most max characters of t (a max below 1 means no limit), with no ellipsis.
func (Text) MarshalText ¶
MarshalText lets a Text be a JSON string, and nothing else is accepted there.