@@ -36,8 +36,9 @@ service SupervisorMiddleware {
3636// HttpResponsePreReturn evaluates one response for one middleware stage before
3737// OpenShell returns it to the sandbox.
3838service HttpResponsePreReturn {
39- // Evaluate starts with preflight, followed by selected body units. It may end
40- // with one best-effort session_end.
39+ // Evaluate starts with preflight and may continue with selected body units
40+ // and trailers. A body unit marked end_of_stream ends body inspection, not
41+ // the event stream. Trailers and one best-effort session_end may follow.
4142 rpc Evaluate (stream HttpResponseEvent )
4243 returns (stream HttpResponseEventResult );
4344}
@@ -126,7 +127,8 @@ message HttpHeader {
126127}
127128
128129// One ordered response event. A stream starts with preflight, may continue with
129- // body units and trailers, and may end with one best-effort session_end.
130+ // body units ending in end_of_stream, may then include trailers, and may end
131+ // with one best-effort session_end.
130132message HttpResponseEvent {
131133 oneof event {
132134 // Initial response head and request context.
@@ -274,16 +276,18 @@ message HttpResponseBodyUnit {
274276 // Contiguous and stage-local, starting at 1.
275277 uint64 sequence = 1 ;
276278 oneof payload {
277- // Bytes without transfer framing. WHOLE_BODY_BYTES represents an empty body
278- // with present empty data. STREAM_BYTES units are at most the smaller of
279- // 64 KiB and half max_payload_bytes, and may be shorter to preserve flushing.
279+ // Bytes without transfer framing. A body-capable response with no body bytes
280+ // has present empty data in sequence 1. STREAM_BYTES units are at most the
281+ // smaller of 64 KiB and half max_payload_bytes, and may be shorter to
282+ // preserve flushing.
280283 bytes data = 2 ;
281284 }
282- // Marks the final unit. A completed inspection receives exactly one, including
283- // an empty sequence-1 unit for an empty body. OpenShell does not read ahead,
284- // so it may send an empty final unit after the last data unit. The final unit
285- // requires a result containing any deferred bytes. Interrupted streams may
286- // end with session_end instead.
285+ // Marks the final body unit. Every normally completed body inspection receives
286+ // exactly one. For a body-capable response with no body bytes, this is the
287+ // empty sequence-1 unit. OpenShell does not read ahead, so it may send an empty
288+ // final unit after the last nonempty unit. The matching result must flush all
289+ // deferred bytes. Trailers and session_end may follow. A stage ended by
290+ // skip_remaining, block, or failure receives no later final unit.
287291 bool end_of_stream = 3 ;
288292}
289293
0 commit comments