filter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Completed

func Completed(ctx context.Context, ch <-chan agentrun.Message) <-chan agentrun.Message

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.

func ResultOnly

func ResultOnly(ctx context.Context, ch <-chan agentrun.Message) <-chan agentrun.Message

ResultOnly returns a channel that passes only MessageResult. Spawns a goroutine that exits when ctx is cancelled or ch is closed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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