statemachine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package statemachine validates strict typed stream and tool lifecycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Sequence    uint64
	Type        EventType
	ItemID      string
	ItemKind    string
	OutputIndex int
	CallID      string
	Delta       string
	Arguments   string
}

type EventType

type EventType string
const (
	EventResponseCreated    EventType = "response.created"
	EventResponseInProgress EventType = "response.in_progress"
	EventOutputItemAdded    EventType = "response.output_item.added"
	EventArgumentsDelta     EventType = "response.function_call_arguments.delta"
	EventArgumentsDone      EventType = "response.function_call_arguments.done"
	EventOutputItemDone     EventType = "response.output_item.done"
	EventToolResult         EventType = "tool.result"
	EventResponseCompleted  EventType = "response.completed"
	EventResponseFailed     EventType = "response.failed"
	EventResponseIncomplete EventType = "response.incomplete"
)

type Machine

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

func New

func New() *Machine

func (*Machine) Apply

func (machine *Machine) Apply(event Event) error

Apply accepts one semantic event. Transport read chunks must be assembled into logical events before reaching this state machine.

func (*Machine) Finish

func (machine *Machine) Finish() error

func (*Machine) ReconstructedArguments

func (machine *Machine) ReconstructedArguments(itemID string) (string, bool)

func (*Machine) Terminal

func (machine *Machine) Terminal() EventType

type Violation

type Violation struct {
	Code     string
	Expected string
	Observed string
}

func (*Violation) Error

func (violation *Violation) Error() string

Jump to

Keyboard shortcuts

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