Documentation
¶
Overview ¶
Package filter provides composable channel middleware for filtering agentrun message streams. Consumers wrap proc.Output() with these functions to select the message granularity they need.
Index ¶
- func Completed(ctx context.Context, ch <-chan agentrun.Message) <-chan agentrun.Message
- func Filter(ctx context.Context, ch <-chan agentrun.Message, types ...agentrun.MessageType) <-chan agentrun.Message
- func IsDelta(t agentrun.MessageType) bool
- func ResultOnly(ctx context.Context, ch <-chan agentrun.Message) <-chan agentrun.Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Completed ¶
Completed returns a channel that drops all delta types, passing only complete messages. Spawns a goroutine that exits when ctx is cancelled or ch is closed.
func Filter ¶
func Filter(ctx context.Context, ch <-chan agentrun.Message, types ...agentrun.MessageType) <-chan agentrun.Message
Filter returns a channel that only passes messages of the given types. Spawns a goroutine that exits when ctx is cancelled or ch is closed. The returned channel is closed when the goroutine exits.
func IsDelta ¶
func IsDelta(t agentrun.MessageType) bool
IsDelta reports whether t is a streaming delta (partial) message type. Convention: all delta types use the "_delta" suffix (e.g., text_delta, tool_use_delta, thinking_delta). This avoids needing to update a switch statement each time a new delta type is added.
Types ¶
This section is empty.