0108: Streaming: SSE, UTF-8 and tool arguments
Status: Proposed (default; pending owner confirmation)
Context
Provider streams may split protocol fields, UTF-8 sequences and JSON arguments at arbitrary byte boundaries. Partial tool arguments must not reach agents or execute.
Decision
Parse SSE across arbitrary chunks, recognizing CR, LF and CRLF, joining data lines with LF, and handling event, id and comments. Ignore retry; bound buffering and report oversize. Hold incomplete trailing UTF-8 until more input; invalid UTF-8 fails explicitly. Track partial tool JSON structure but decode and validate only when its block stops. Preserve distinct completed, refused, truncated, failed, disconnected and cancelled outcomes; use bounded pull-based backpressure.
Consequences
Chunk boundaries do not change parsed results, and incomplete arguments remain unobservable. Implementations must retain explicit bounds and terminal distinctions.