progress

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: 10 Imported by: 0

Documentation

Overview

Package progress contains the pure ALG progress breaker and bounded recovery-intent policy. It owns no runtime, terminal, backend, or transcript authority; callers retain the returned State for one logical request.

Index

Constants

View Source
const (
	DefaultNoProgressLimit = 2
	MaxNoProgressLimit     = 64

	MaxRecoveryReasonBytes    = 512
	MaxRecoveryObjectiveBytes = 512
)
View Source
const (
	VerdictComplete         Verdict = "COMPLETE"
	VerdictIncomplete       Verdict = "INCOMPLETE"
	VerdictNeedsUser        Verdict = "NEEDS_USER"
	VerdictUncertain        Verdict = "UNCERTAIN"
	ReasonComplete                  = "complete"
	ReasonNeedsUser                 = "user_input_required"
	ReasonUncertain                 = "insufficient_evidence"
	ReasonUnfinished                = "unfinished_objective"
	ReasonNoProgress                = "no_progress"
	ReasonBudgetExhausted           = "budget_exhausted"
	ReasonInvalidInput              = "invalid_input"
	ReasonOutputUncommitted         = "output_not_committed"
	ReasonMissingEvidence           = "insufficient_evidence"
	ReasonMissingSafePoint          = "missing_safe_point"
)
View Source
const (
	MaxStateTokenBytes       = 256
	MaxStateFingerprintBytes = 96
)

Variables

View Source
var ErrInvalidStateToken = errors.New("agent-loop-guard progress: invalid state token")
View Source
var ErrInvalidVerdict = errors.New("agent-loop-guard progress: invalid verdict")

Functions

func BuildIntent

func BuildIntent(in terminaldecision.Input, verdict Verdict, reason string) (terminaldecision.ContinuationIntent, bool)

BuildIntent returns a bounded internal continuation intent only for concrete existing work with a canonical trajectory. Complete, user-dependent, incomplete-evidence, and authoritative candidates return no intent.

func EncodeState

func EncodeState(state State) (string, error)

EncodeState serializes only bounded progress counters and the canonical fingerprint into an opaque continuation control reference.

func Fingerprint

func Fingerprint(in terminaldecision.Input, verdict Verdict) string

Fingerprint hashes stable canonical evidence. Request/leg/candidate/action identifiers, policy revisions, deadlines, and attempt numbers are excluded because they are volatile identity or budget metadata rather than progress. Raw evidence never leaves this function.

Types

type Action

type Action string

Action identifies the provider-level result without granting platform authority.

const (
	ActionContinue  Action = "continue"
	ActionAllowStop Action = "allow_stop"
)

type Config

type Config struct {
	NoProgressLimit int
}

Config contains only the local no-progress bound. The semantic maximum is read from the immutable terminaldecision.Input policy snapshot.

type Evaluation

type Evaluation struct {
	State                 State
	Fingerprint           string
	NewProgress           bool
	NoProgressTripped     bool
	BudgetExhausted       bool
	ConsecutiveNoProgress int
	TotalAttempts         int
	SemanticAttempt       int
	MaxSemanticAttempts   int
	Action                Action
	Decision              terminaldecision.Decision
}

Evaluation contains the pure policy result and next request-scoped state.

func Evaluate

func Evaluate(in terminaldecision.Input, verdict Verdict, prior State, cfg Config) (Evaluation, error)

Evaluate records one candidate observation and returns the next pure policy result. Every stop path is conservative and carries no continuation intent.

type State

type State struct {
	LastFingerprint       string
	HasBaseline           bool
	TotalAttempts         int
	ConsecutiveNoProgress int
	NoProgressTripped     bool
	BudgetExhausted       bool
	Terminal              bool
}

State is a request-scoped value. It stores only a digest and bounded counters so a Provider can own it without globals, goroutines, maps, or raw evidence.

func DecodeState

func DecodeState(token string) (State, error)

DecodeState validates and decodes one opaque progress control reference.

type Verdict

type Verdict string

Verdict is the bounded semantic classification consumed by the progress policy. NeedsUser is a conservative policy outcome; the current verifier may map user-dependent evidence to UNCERTAIN instead.

Jump to

Keyboard shortcuts

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