contentsafety

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p Provider)

Register installs a content-safety Provider. Later registrations override earlier ones (last-write-wins). Typically called from init() via blank import.

Types

type Alert

type Alert struct {
	Provider     string   `json:"provider"`
	MatchedRules []string `json:"matched_rules"`
}

Alert holds the result of a content-safety scan that detected issues.

type Provider

type Provider interface {
	Name() string
	Scan(ctx context.Context, req ScanRequest) (*Alert, error)
}

Provider scans parsed response data for content-safety issues. Implementations must be safe for concurrent use.

func GetProvider

func GetProvider() Provider

GetProvider returns the currently registered Provider. Returns nil if no provider has been registered.

type ScanRequest

type ScanRequest struct {
	Path   string    // normalized command path (e.g. "im.messages_search")
	Data   any       // parsed response data (generic JSON shape)
	ErrOut io.Writer // stderr for provider-level notices (e.g. lazy-config creation)
}

ScanRequest carries the data to scan.

Jump to

Keyboard shortcuts

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