textscreen

package
v0.329.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 6 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 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

View Source
const SecretRemoved = "[removed]"

SecretRemoved is what StripSecretShaped puts where it removed something.

Variables

This section is empty.

Functions

func AgentTextRefusal

func AgentTextRefusal(text string, words []string) string

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

func HiddenCharRefusal(v string) string

HiddenCharRefusal reports why v is refused for carrying a character its approver could not see, or "". v is expected to be NFKC already.

func HiddenCharRefusalInPost added in v0.307.0

func HiddenCharRefusalInPost(v string) string

HiddenCharRefusalInPost is HiddenCharRefusal for text that is POSTED to a venue (a draft's body, a content set's entry): the same refusal, except that U+FE0F/U+FE0E, U+200D and U+20E3 are taken inside a valid emoji sequence (see EMOJI SEQUENCES above), and only there.

func MaskBareNames

func MaskBareNames(text string, names map[string]bool) string

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

func NormalizeAgentText(v string) string

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

func OutboundTextRefusal(text string, words, publicLinks []string) string

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(text string, allow []string) string

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

func StripSecretShaped(text string) (string, int)

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

func VisibleEscape(v string) string

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.

Jump to

Keyboard shortcuts

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