package stream import "strings" // ToolTagPrefixes are possible tool call tag prefixes var ToolTagPrefixes = []string{ "", "", " 0 { safeText := b.PendingText[:safeEndIndex] if safeText != "" { emitFunc(safeText) } b.PendingText = b.PendingText[safeEndIndex:] } } // FlushAll flushes all pending text func (b *TextBuffer) FlushAll(emitFunc func(string)) { if b.PendingText != "" { emitFunc(b.PendingText) b.PendingText = "" } } // Clear clears the buffer func (b *TextBuffer) Clear() { b.PendingText = "" } // IsEmpty checks if buffer is empty func (b *TextBuffer) IsEmpty() bool { return b.PendingText == "" }