1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! What the caller is told when a tapped stream ends.
//!
//! Two endings, and both used to be silence. A stream that stopped with no
//! terminal event was audited as failed while the client saw only a closed
//! socket, indistinguishable from a hang; a stream that ended cleanly on the
//! Chat Completions surface still owed the caller its usage chunk and the
//! `[DONE]` sentinel. Both are rendered here, through the inbound adapter, so
//! each surface states them in its own wire's vocabulary.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.
use Arc;
use Bytes;
use ;
use InboundAdapter;
use Summary;
// Why: the message names the missing signal rather than the symptom, because
// it is what a human reading a client log has to act on, and it matches the
// reason the audit row carries for the same turn.
pub const STREAM_ABORT_MESSAGE: &str = "upstream stream ended without a terminal event";
// Why: an error the upstream already stated is relayed as itself; the abort
// frame is only for a stream that stated nothing at all.
pub const
// Why: the abort reaches the caller as an ordinary canonical error, so each
// inbound surface renders the frame its own clients read -- `event: error` on
// Anthropic, an error chunk on Chat Completions, `response.failed` on the
// Responses wire.
pub
// Why: the closing frames of a turn that ended properly. Only Chat
// Completions renders any, and the counts come from the accumulated snapshot
// because they arrive after the finish chunk on that wire.
pub