agentterminal

package
v1.0.0-beta.162 Latest Latest
Warning

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

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

Documentation

Overview

Package agentterminal is the repository-internal interpretation boundary for the three agent loop terminal payloads. It deliberately exposes no public framework API: Go's internal import rule limits consumers to this repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class uint8

Class is the closed semantic terminal set.

const (
	// ClassSucceeded represents loop_completed + success.
	ClassSucceeded Class = iota + 1
	// ClassFailed represents loop_failed + failed.
	ClassFailed
	// ClassCancelled represents loop_cancelled + cancelled.
	ClassCancelled
)

type Event

type Event struct {
	SourceMessageID string
	Category        string
	Outcome         string
	Class           Class
	State           string
	LoopID          string
	TaskID          string
	RunID           string
	RunEntityID     string
	Role            string
	Result          string
	Error           string
	Reason          string
	UserID          string
	ChannelType     string
	ChannelID       string
	Prompt          string
	Model           string
	Iterations      int
	TokensIn        int
	TokensOut       int
	WorkflowSlug    string
	WorkflowStep    string
	CancelledBy     string
	TerminalAt      time.Time
	Metadata        map[string]any
	// Decision is the typed decision of a `decide` terminal, carried only
	// on the succeeded lane (ADR-101, gh#1094). Nil for every other
	// terminal. Validate has already rejected a present decision with an
	// empty action or reason, so a non-nil Decision here is complete.
	Decision *agentic.CoordinatorDecision
}

Event is the normalized internal projection shared by dispatch, AgentRun, and OTel. The source payload remains authoritative; this is not a wire type.

func Decode

func Decode(decoder *message.Decoder, data []byte) (Event, error)

Decode decodes only through the registry-bound production decoder and then closes every structural hole before returning a terminal projection.

type Reason

type Reason string

Reason is a bounded rejection class suitable for logs and metric labels.

const (
	// ReasonEnvelope covers registry decode, type, and metadata rejection.
	ReasonEnvelope Reason = "envelope_or_type"
	// ReasonPayload covers nil, nonterminal, and invalid concrete payloads.
	ReasonPayload Reason = "payload_validation"
	// ReasonTimestamp covers a zero applicable terminal timestamp.
	ReasonTimestamp Reason = "zero_terminal_timestamp"
	// ReasonIdentity covers a missing source message identity.
	ReasonIdentity Reason = "source_identity"
	// ReasonCollision covers category/outcome identity collisions.
	ReasonCollision Reason = "identity_category_outcome_collision"
)

func ErrorReason

func ErrorReason(err error) Reason

ErrorReason returns the bounded reason carried by a Decode error.

Jump to

Keyboard shortcuts

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