Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithRenderer ¶
func WithRenderer(ctx context.Context, r EventRenderer) context.Context
WithRenderer returns a context carrying a per-step EventRenderer. A nil renderer is stored as-is (RendererFromContext then returns nil).
Types ¶
type DisplayEvent ¶
type DisplayEvent struct {
Type string
Kind EventKind
Text string
Name string
Arg string
ID string
Delta bool
}
DisplayEvent represents a parsed event from a provider's streaming output. Kind discriminates the event type for rendering; Type holds the raw provider JSON event type. Text holds displayable output for EventText events; Name, Arg, ID are populated for EventToolUse events. Delta indicates the event is a streaming token fragment that should be written without a trailing newline.
type DisplayEventParser ¶
type DisplayEventParser func(line []byte) []DisplayEvent
DisplayEventParser parses a raw NDJSON line from a provider's streaming output into a slice of DisplayEvents. Implementations return nil to indicate that the line carries no displayable content.
type DisplayMode ¶
type DisplayMode int
DisplayMode controls which event categories are rendered to the writer.
const ( DisplayModeDefault DisplayMode = iota // text events only DisplayModeVerbose // text events + tool-use markers )
type EventKind ¶
type EventKind string
EventKind discriminates between event types: text output, tool use, or reasoning.
type EventRenderer ¶
type EventRenderer func(events []DisplayEvent)
EventRenderer receives parsed DisplayEvents for rendering to a transport. It shares the same underlying function type as agents.DisplayEventRenderer (func([]DisplayEvent)), but Go's type system requires an explicit conversion between named types from different packages even when the underlying types are identical — e.g. DisplayEventRenderer(r) at the call site.
func RendererFromContext ¶
func RendererFromContext(ctx context.Context) EventRenderer
RendererFromContext extracts the EventRenderer set by WithRenderer, or nil when none is present (the common case — all non-ACP execution paths).
type RenderFunc ¶
type RenderFunc func(w io.Writer, events []DisplayEvent, mode DisplayMode)
RenderFunc is a callback that renders display events to a writer. Used by StreamFilterWriter to decouple parsing from rendering.