runview

package
v0.247.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type End

type End int

End is where a reduced frame leaves the run a Reducer follows.

const (
	Open End = iota
	Resumed
	Suspended
	Finished
	Cancelled
	Failed
)

type Prompt

type Prompt struct {
	InterruptID string
	Event       agentdomain.ChatEvent
}

Prompt is one interrupt a suspended run waits on, as the event the chat TUI answers on its ResponseChan. Event is nil for an interrupt of an unknown reason, which the client can only cancel.

type Reducer

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

Reducer folds the AG-UI events of a thread's runs into the chat events the TUI handlers render: deltas become chunks, a model step its completion and an interrupt the prompt the user answers. It follows one client request across a suspended run and its continuations, and tolerates attaching mid-run.

func New

func New(requestID string) *Reducer

New builds the reducer for the client request requestID, the id every event it returns carries.

func (*Reducer) Decode

func (r *Reducer) Decode(frame []byte) ([]agentdomain.ChatEvent, End)

Decode reduces one frame into the events it stands for and reports where it leaves the run. A frame that is not an AG-UI event, or one outside a run's vocabulary, reduces to nothing.

func (*Reducer) Prompts

func (r *Reducer) Prompts() []Prompt

Prompts are the interrupts the run suspended on, valid after Decode reported Suspended.

func (*Reducer) Reduce

func (r *Reducer) Reduce(event agui.Event) ([]agentdomain.ChatEvent, End)

Reduce folds one typed event into the run and returns the chat events it completes, with where it leaves the run.

type SessionUsageEvent

type SessionUsageEvent struct {
	agentdomain.BaseChatEvent
	Model        string
	InputTokens  int
	OutputTokens int
	CachedTokens int
}

SessionUsageEvent is a usage patch read back: the token totals of the run's session after the model step the patch closes. A chat whose agent runs elsewhere mirrors them into its repository, where the status bar reads them, so no handler renders it.

Jump to

Keyboard shortcuts

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