You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For HTTP, history replay and the load response use the connection SSE stream.
71
+
The client correlates the response with the session ID from the load request,
72
+
then opens the session SSE stream for further prompts and agent callbacks. This
73
+
also works with an empty history: a load response need not contain `sessionId`.
74
+
Replay is consumed as it arrives, so histories larger than the SSE buffer do not
75
+
wait for a session stream to open. WebSocket uses its existing bidirectional
76
+
connection for both replay and subsequent messages.
77
+
78
+
A failed load returns its JSON-RPC error on the connection stream and can be
79
+
retried. The server removes streams provisioned only for failed loads, while
80
+
preserving established sessions and overlapping loads. It does not change the
81
+
agent's load response or automatically enable the agent's `loadSession` capability.
82
+
58
83
## Server
59
84
60
85
The server uses Starlette for HTTP requests, responses, routing, streaming,
@@ -122,12 +147,13 @@ has one incoming queue and one SSE buffer per stream. The incoming queue lets
122
147
POST return `202` while the agent handles the request. Output goes directly to
123
148
the relevant SSE buffer; there is no intermediate transport pair or pump task.
124
149
125
-
HTTP output needs three routing rules:
150
+
HTTP output follows these routing rules:
126
151
127
152
| Message | Destination | Why |
128
153
| --- | --- | --- |
129
154
|`initialize` response | POST body, via one Future | Establishes the connection before GET streams open |
130
155
| Response containing a new `sessionId`| Connection SSE stream | The client needs the ID before it can open the session stream |
156
+
|`session/load` replay and response | Connection SSE stream | Replay precedes the response; the client gets the session ID from the original request |
131
157
| Other messages | Session SSE stream when known, otherwise connection stream | Responses use their request's recorded session; requests/notifications carry `sessionId`|
132
158
133
159
`OutboundStream` retains a bounded buffer, backpressure, and close handling.
0 commit comments