Documentation
¶
Overview ¶
Package textscreen is the screen on text an AGENT composes for someone else to read: its normal form (NFKC), the refusal of characters an approver cannot see, the one-to-one visible escape an approval card renders, and the deny patterns (deny.go) and public-link allowlist (public_links.go) on top. It holds no state and touches no storage; browser flows, plugin reply and outbound drafts, officer pages and the fleet report all screen through it.
Index ¶
- Constants
- func AgentTextRefusal(text string, words []string) string
- func HiddenCharRefusal(v string) string
- func MaskBareNames(text string, names map[string]bool) string
- func NormalizeAgentText(v string) string
- func OutboundTextRefusal(text string, words, publicLinks []string) string
- func StripPublicLinks(text string, allow []string) string
- func StripSecretShaped(text string) (string, int)
- func VisibleEscape(v string) string
Constants ¶
const SecretRemoved = "[removed]"
SecretRemoved is what StripSecretShaped puts where it removed something.
Variables ¶
This section is empty.
Functions ¶
func AgentTextRefusal ¶
AgentTextRefusal reports why agent-composed free text is refused, or "". words are the deployment's OWN infrastructure names (cluster, host and project names — MUSTER_FLOW_AGENT_DENY_WORDS): they are configuration, not source, because this repository is public and may not name them.
func HiddenCharRefusal ¶
HiddenCharRefusal reports why v is refused for carrying a character its approver could not see, or "". v is expected to be NFKC already.
func MaskBareNames ¶
MaskBareNames is text with every standalone occurrence of a name in names (lower-case; compared without case) replaced by as many spaces: one whose neighbour on each side is prose (proseBeside).
func NormalizeAgentText ¶
NormalizeAgentText is the form an agent-composed value is screened, stored, shown and sent in: NFKC, so compatibility look-alikes (full-width letters, ligatures, the many Unicode spaces) are folded to the plain characters the ASCII deny patterns and the owner's eyes both read.
func OutboundTextRefusal ¶
OutboundTextRefusal is AgentTextRefusal for an officer's OUTBOUND draft (internal/plugins outbound.go): public host names and URLs pass, so a post can link to the project; internal host names, IP addresses, secrets, infrastructure words and the deployment's own names are refused as ever, with two exemptions, both from publicLinks (public_links.go):
- INSIDE a link on publicLinks, whose allowlisted prefix is taken out before the screen runs (StripPublicLinks), so `github.com/<owner>/<repo>` may spell a deployment name when the deployment declared that repository public;
- a STANDALONE occurrence of the <repo> of an entry `host/<owner>/<repo>` (without case; publicRepoNames) is masked for the scan of that name only (MaskBareNames), so the post may name the public project bare even when that name is a deny word. Standalone is an allowlist of prose neighbours (proseBeside): the name inside any other run (`<repo>-prod`, `<repo>:5432`, `x.<repo>`, `…/<repo>`) is screened as ever. <owner> and every other deny word are scanned against the UNMASKED text, and so are the pattern screens (hosts, IPs, secrets, infrastructure words).
🔴 Only an outbound draft of a plugin bound to an officer is screened by this; every other agent text keeps AgentTextRefusal, with no allowlist and no exempt name.
func StripPublicLinks ¶
StripPublicLinks is text with every link on allow (parsePublicLink entries; an entry that does not parse is ignored) cut down to what follows its allowlisted prefix: the prefix becomes a space, the rest of the link stays.
func StripSecretShaped ¶
StripSecretShaped is text with every credential-shaped or long token-shaped run (secretShapedDeny: the screen's secret patterns, and only those) replaced by SecretRemoved, and how many runs it replaced.
func VisibleEscape ¶
VisibleEscape renders v so that NOTHING in it is left to the eye's guess: printable ASCII is itself (a backslash is doubled), newline and tab are the two-character escapes \n and \t, and every other code point — every non-ASCII letter included, since a look-alike letter reads as the ASCII one — is \u{HEX}. The mapping is one-to-one, so the card can be decoded back to the exact bytes; screen_test.go's unescapeVisible does exactly that.
Types ¶
This section is empty.