agentstate

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() string

func HookIsActive

func HookIsActive(session registry.Session, now time.Time) bool

func ShouldDetectScreen

func ShouldDetectScreen(session registry.Session, now time.Time) bool

func SupportsScreen

func SupportsScreen(harness registry.Harness) bool

Types

type Authority

type Authority string
const (
	AuthorityHook   Authority = "hook"
	AuthorityScreen Authority = "screen"
)

type Decision

type Decision struct {
	Activity        registry.Activity `json:"activity"`
	Reason          string            `json:"reason"`
	RuleID          string            `json:"rule_id,omitempty"`
	ManifestSource  string            `json:"manifest_source"`
	ManifestVersion int               `json:"manifest_version"`
	Warning         string            `json:"warning,omitempty"`
	Evidence        []RuleEvidence    `json:"evidence"`
}

func Evaluate

func Evaluate(manifest Manifest, snapshot Snapshot) Decision

type HookEvaluation

type HookEvaluation struct {
	Active         bool
	Fresh          bool
	ProcessMatches bool
	Reason         string
}

func EvaluateHook

func EvaluateHook(session registry.Session, now time.Time) HookEvaluation

type Loader

type Loader struct{ ConfigDir string }

func (Loader) Load

func (l Loader) Load(harness registry.Harness) (Manifest, error)

func (Loader) Supports

func (l Loader) Supports(harness registry.Harness) bool

type Manifest

type Manifest struct {
	Version int    `json:"version"           toml:"version"`
	Agent   string `json:"agent"             toml:"agent"`
	Rules   []Rule `json:"rules"             toml:"rules"`
	Source  string `json:"source"            toml:"-"`
	Warning string `json:"warning,omitempty" toml:"-"`
}

func ParseManifest

func ParseManifest(data []byte, harness registry.Harness) (Manifest, error)

type Policy

type Policy struct {
	Primary          Authority
	ScreenFallback   bool
	IntegrationValue string
}

func PolicyFor

func PolicyFor(harness registry.Harness) Policy

type Rule

type Rule struct {
	ID            string   `json:"id"                        toml:"id"`
	State         string   `json:"state"                     toml:"state"`
	Priority      int      `json:"priority"                  toml:"priority"`
	Region        string   `json:"region"                    toml:"region"`
	CaseSensitive bool     `json:"case_sensitive"            toml:"case_sensitive"`
	All           []string `json:"all,omitempty"             toml:"all"`
	Any           []string `json:"any,omitempty"             toml:"any"`
	None          []string `json:"none,omitempty"            toml:"none"`
	RegexAll      []string `json:"regex_all,omitempty"       toml:"regex_all"`
	RegexAny      []string `json:"regex_any,omitempty"       toml:"regex_any"`
	RegexNone     []string `json:"regex_none,omitempty"      toml:"regex_none"`
	TitleAny      []string `json:"title_any,omitempty"       toml:"title_any"`
	TitleRegexAny []string `json:"title_regex_any,omitempty" toml:"title_regex_any"`
	// contains filtered or unexported fields
}

type RuleEvidence

type RuleEvidence struct {
	RuleID  string `json:"rule_id"`
	Matched bool   `json:"matched"`
}

type Snapshot

type Snapshot struct {
	Lines []string
	Title string
}

func NormalizeSnapshot

func NormalizeSnapshot(text string, title string) Snapshot

Jump to

Keyboard shortcuts

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