loopguard

package
v0.1.0-p8a.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashArguments

func HashArguments(args map[string]any) string

func HashText

func HashText(text string) string

Types

type Action

type Action string
const (
	ActionAllow Action = "allow"
	ActionWarn  Action = "warn"
	ActionBlock Action = "block"
	ActionHalt  Action = "halt"
)

type Config

type Config struct {
	Enabled             bool
	WarningsEnabled     bool
	HardStopsEnabled    bool
	ExactFailureWarn    int
	ExactFailureBlock   int
	SameToolFailureWarn int
	SameToolFailureHalt int
	NoProgressWarn      int
	NoProgressBlock     int
	IdenticalCallWarn   int
	IdenticalCallHalt   int
	MaxSignatures       int
}

func DefaultConfig

func DefaultConfig() Config

func (Config) Normalized

func (c Config) Normalized() Config

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) *Controller

func (*Controller) After

func (c *Controller) After(observation Observation) Decision

func (*Controller) Before

func (c *Controller) Before(tool string, args map[string]any, semantics Semantics) Decision

type Decision

type Decision struct {
	Action    Action
	Code      string
	Tool      string
	ArgsHash  string
	Count     int
	Threshold int
	Message   string
}

func (Decision) AllowsExecution

func (d Decision) AllowsExecution() bool

type Observation

type Observation struct {
	Tool       string
	Args       map[string]any
	ResultText string
	Failed     bool
	Semantics  Semantics
}

type Semantics

type Semantics string
const (
	SemanticsUnknown            Semantics = "unknown"
	SemanticsReadOnlyIdempotent Semantics = "read_only_idempotent"
	SemanticsMutating           Semantics = "mutating"
)

Jump to

Keyboard shortcuts

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