agentops

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package agentops owns the provider-neutral Agent Operations V1 lifecycle.

Index

Constants

View Source
const (

	// TerminalRetention is the period during which completed operation keys
	// remain replayable.
	TerminalRetention = 30 * 24 * time.Hour
)

Variables

View Source
var (
	ErrNotFound            = errors.New("operation not found")
	ErrIdempotencyConflict = errors.New("operation idempotency conflict")
	ErrInvalidTransition   = errors.New("invalid operation state transition")
	ErrNotCancelable       = errors.New("operation is not cancelable")
	ErrCapacity            = errors.New("operation store capacity reached")
)

Functions

This section is empty.

Types

type Store

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

func New

func New(database *state.Database) *Store

func (*Store) BindPlan

func (s *Store) BindPlan(id string, plan state.PlanRecord, approvalID string, direct bool) (agentv1.Operation, error)

BindPlan atomically stores the immutable plan and binds a pending operation to either an approval request or direct execution.

func (*Store) Cancel

func (s *Store) Cancel(clientID, id string) (agentv1.Operation, error)

Cancel atomically cancels a requester-owned pending or approved operation. Terminal operations are returned unchanged; executing work is not cancelable.

func (*Store) Fail

func (s *Store) Fail(id string, state agentv1.State, code, message string) (agentv1.Operation, error)

func (*Store) Get

func (s *Store) Get(clientID, id string) (agentv1.Operation, error)

func (*Store) GetByID

func (s *Store) GetByID(id string) (agentv1.Operation, error)

GetByID returns one operation for trusted in-process lifecycle recovery.

func (*Store) GetByIdempotency

func (s *Store) GetByIdempotency(clientID, key string) (agentv1.Operation, error)

GetByIdempotency returns an existing submission for provider lifecycle services that must avoid re-resolving mutable upstream state on replay.

func (*Store) ListUnfinished

func (s *Store) ListUnfinished() ([]agentv1.Operation, error)

func (*Store) NewID

func (s *Store) NewID() (string, error)

NewID allocates an operation identifier for callers that bind an approval and immutable plan before inserting the operation row.

func (*Store) SetApproval

func (s *Store) SetApproval(id, approvalID string) (agentv1.Operation, error)

func (*Store) Submit

func (s *Store) Submit(input Submit) (agentv1.Operation, bool, error)

func (*Store) SubmitApprovedWithPlan

func (s *Store) SubmitApprovedWithPlan(input Submit, plan state.PlanRecord) (agentv1.Operation, bool, error)

SubmitApprovedWithPlan atomically persists a direct operation in its approved state so restart recovery never has to infer whether approval was required.

func (*Store) SubmitWithPlan

func (s *Store) SubmitWithPlan(input Submit, plan state.PlanRecord) (agentv1.Operation, bool, error)

SubmitWithPlan atomically persists an immutable execution plan and its operation. Replays must provide the same plan digest.

func (*Store) Succeed

func (s *Store) Succeed(id string, result json.RawMessage) (agentv1.Operation, error)

func (*Store) Transition

func (s *Store) Transition(id string, state agentv1.State) (agentv1.Operation, error)

func (*Store) Wait

func (s *Store) Wait(ctx context.Context, clientID, id string, after int64) (agentv1.Operation, error)

type Submit

type Submit struct {
	ID             string
	Broker         string
	ClientID       string
	IdempotencyKey string
	Operation      string
	Target         json.RawMessage
	Arguments      json.RawMessage
	Reason         string
	Presentation   agentv1.Presentation
	PlanDigest     string
}

Jump to

Keyboard shortcuts

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