Documentation
¶
Index ¶
Constants ¶
const ( ChannelLLM = "llm" ChannelFlow = "flow" ChannelTools = "tools" ChannelMessages = "messages" ChannelLifecycle = "lifecycle" ChannelCustom = "custom" )
Variables ¶
This section is empty.
Functions ¶
func Interleave ¶
Interleave merges multiple ordered frame channels into a single channel. Merging is round-robin across non-empty channels, falling back to Seq ordering when all channels have pending frames.
func Only ¶
Only returns a channel that forwards only frames whose Channel is in the allowed set. The custom channel always passes through.
func ValidateChannel ¶
ValidateChannel returns an error if name is outside the canonical set.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer accumulates tokens and flushes on sentence boundary or timeout.
func NewBuffer ¶
NewBuffer creates a streaming buffer that flushes via onFlush callback. Flush emits an llm-channel Frame with accumulated content.
type ErrInvalidChannel ¶
type ErrInvalidChannel struct {
Channel string
}
ErrInvalidChannel is returned when a channel name is not in the canonical set.
func (*ErrInvalidChannel) Error ¶
func (e *ErrInvalidChannel) Error() string
type Frame ¶
type Frame struct {
Channel string
Type string
Content string
Event string
Source string
Seq uint64
}
Frame represents a fine-grained streaming event emitted during agent execution.
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a non-blocking frame delivery channel with bounded capacity. Send never blocks. If the buffer is full, the oldest frame is dropped. Receive blocks when the buffer is empty.
func NewRingBuffer ¶
func NewRingBuffer(cap int) *RingBuffer
NewRingBuffer creates a RingBuffer with the given capacity. Panics if cap < 1.
func (*RingBuffer) Chan ¶
func (rb *RingBuffer) Chan() <-chan Frame
Chan returns a channel that receives frames from the ring buffer. The channel is closed when the ring buffer is closed and drained.
func (*RingBuffer) Close ¶
func (rb *RingBuffer) Close()
Close closes the buffer. Pending frames can still be received.
func (*RingBuffer) Receive ¶
func (rb *RingBuffer) Receive() (Frame, bool)
Receive returns the next frame, blocking if empty. Returns false if the buffer is closed and empty.
func (*RingBuffer) Send ¶
func (rb *RingBuffer) Send(f Frame)
Send sends a frame non-blocking. Drops oldest if buffer is full.