agentloopguard

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVerifierRole             = "loop_guard"
	DefaultVerifierTimeoutSeconds   = 4
	DefaultMaxSemanticContinuations = 3
	DefaultNoProgressLimit          = 2
	DefaultMaxProtocolReprompts     = 1

	MaxVerifierRoleLength     = 128
	MaxVerifierTimeoutSeconds = 300
	MaxSemanticContinuations  = 64
	MaxNoProgressLimit        = 64
	MaxMaxProtocolReprompts   = 3
)
View Source
const ID = providerID

ID is the standard feature factory id and provider identity.

Variables

This section is empty.

Functions

func NewCompletionToolProvider

func NewCompletionToolProvider() controltool.Provider

NewCompletionToolProvider is the stable SDK-provider construction seam for the explicit-completion control tool.

func NewConfiguredProvider

func NewConfiguredProvider(cfg Config) (terminaldecision.Provider, error)

NewConfiguredProvider is the single error-returning terminal-policy constructor for a selected ALG strategy.

It normalizes the raw programmatic configuration strictly once and switches on the resolved strategy: the semantic verifier keeps the existing legacy provider value, and the explicit-completion strategy gets the distinct preferred receiver that owns only the protocol numeric limits. It never calls NewProvider, and an unknown or incompatible configuration is refused instead of falling back to another strategy.

It has no enable/disable authority: Enabled stays the composition gate.

func NewProvider

func NewProvider(config ...Config) terminaldecision.Provider

NewProvider constructs the conservative, stateless ALG provider with default provider settings. Feature composition validates the raw config before calling this constructor.

An explicitly selected strategy or an explicit protocol-reprompt bound is new input: it is delegated to NewConfiguredProvider so strategy selection and mutual exclusion are enforced strictly. This signature has no error result, so an invalid explicit configuration returns a nil interface rather than the legacy default provider. Callers that select or configure a strategy must use NewConfiguredProvider to receive the error and must not interpret this compatibility nil as a disabled or generic no-provider outcome.

Types

type Config

type Config struct {
	Enabled                  bool                     `yaml:"enabled"`
	Strategy                 Strategy                 `yaml:"strategy"`
	MaxProtocolReprompts     int                      `yaml:"max_protocol_reprompts"`
	VerifierRole             string                   `yaml:"verifier_role"`
	VerifierTimeoutSeconds   int                      `yaml:"verifier_timeout_seconds"`
	VerifierTimeout          time.Duration            `yaml:"-"`
	MaxSemanticContinuations int                      `yaml:"max_semantic_continuations"`
	NoProgressLimit          int                      `yaml:"no_progress_limit"`
	ExplicitCompletionPolicy ExplicitCompletionPolicy `yaml:"explicit_completion_policy"`
}

Config is the generation-local ALG contribution. Verifier and progress bounds are retained in the immutable provider configuration and consumed by the stateless provider.

func DecodeConfig

func DecodeConfig(n yaml.Node) (Config, error)

DecodeConfig parses and validates the nested feature YAML block.

func NormalizeProgrammatic

func NormalizeProgrammatic(c Config) (Config, error)

NormalizeProgrammatic validates a raw programmatic config and fills only the active strategy's omitted defaults. Programmatic zero values mean omission because Config is a value struct.

func (Config) Normalize

func (c Config) Normalize() (Config, error)

Normalize fills safe defaults and validates all provider configuration bounds.

func (Config) Validate

func (c Config) Validate() error

Validate checks an already materialized feature configuration.

type ExplicitCompletionPolicy

type ExplicitCompletionPolicy string

ExplicitCompletionPolicy controls the treatment of a trusted normalized explicit-completion fact before progress policy evaluation.

const (
	ExplicitCompletionPolicyTrust  ExplicitCompletionPolicy = "trust"
	ExplicitCompletionPolicyVerify ExplicitCompletionPolicy = "verify"
)

type Strategy

type Strategy string

Strategy selects the mutually exclusive ALG completion strategy.

const (
	StrategyAttemptCompletion Strategy = "attempt_completion"
	StrategySemanticVerifier  Strategy = "semantic_verifier"
)

Directories

Path Synopsis
Package causepolicy contains the provider-independent ALG eligibility policy for canonical terminal causes and bounded evidence.
Package causepolicy contains the provider-independent ALG eligibility policy for canonical terminal causes and bounded evidence.
Package progress contains the pure ALG progress breaker and bounded recovery-intent policy.
Package progress contains the pure ALG progress breaker and bounded recovery-intent policy.
Package protocolpolicy holds the preferred-strategy missing-completion-signal policy as pure values.
Package protocolpolicy holds the preferred-strategy missing-completion-signal policy as pure values.
Package protocolstate owns the preferred-strategy missing-signal protocol state: a bounded progress fingerprint, bounded counters, and an independent opaque state token.
Package protocolstate owns the preferred-strategy missing-signal protocol state: a bounded progress fingerprint, bounded counters, and an independent opaque state token.

Jump to

Keyboard shortcuts

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