Documentation
¶
Overview ¶
Package sse provides shared server-sent event decoding helpers.
Index ¶
Constants ¶
const MemoryContextRedaction = "[memory-context redacted]"
MemoryContextRedaction is emitted when prompt-only memory fences are removed.
Variables ¶
var ErrStop = errors.New("sse: stop stream")
ErrStop stops SSE decoding without surfacing an error.
Functions ¶
func Decode ¶
Decode reads one SSE stream from reader until EOF, context cancellation, or a handler error.
Decode never closes reader; the caller owns its lifecycle. Context cancellation interrupts a blocked Read only when the underlying reader is context-aware, such as an HTTP response body whose request carries ctx. The handler runs synchronously and must return before Decode can continue or stop.
func ScrubMemoryContextBytes ¶
ScrubMemoryContextBytes removes prompt-only memory fences from raw SSE bytes.
func ScrubMemoryContextString ¶
ScrubMemoryContextString removes literal and JSON-escaped memory context fences.