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
- Variables
- func BuildIntent(in terminaldecision.Input, verdict Verdict, reason string) (terminaldecision.ContinuationIntent, bool)
- func EncodeState(state State) (string, error)
- func Fingerprint(in terminaldecision.Input, verdict Verdict) string
- type Action
- type Config
- type Evaluation
- type State
- type Verdict
Constants ¶
const ( DefaultNoProgressLimit = 2 MaxNoProgressLimit = 64 MaxRecoveryReasonBytes = 512 MaxRecoveryObjectiveBytes = 512 )
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" )
const ( MaxStateTokenBytes = 256 MaxStateFingerprintBytes = 96 )
Variables ¶
var ErrInvalidStateToken = errors.New("agent-loop-guard progress: invalid state token")
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 ¶
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.
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 ¶
DecodeState validates and decodes one opaque progress control reference.