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, `AcpServer` owns a dictionary of active connections. Each connection
146
+
has one incoming queue and one SSE buffer per stream. The incoming queue lets
147
+
POST return `202` while the agent handles the request. Output goes directly to
148
+
the relevant SSE buffer; there is no intermediate transport pair or pump task.
149
+
150
+
HTTP output follows these routing rules:
151
+
152
+
| Message | Destination | Why |
153
+
| --- | --- | --- |
154
+
|`initialize` response | POST body, via one Future | Establishes the connection before GET streams open |
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 |
157
+
| Other messages | Session SSE stream when known, otherwise connection stream | Responses use their request's recorded session; requests/notifications carry `sessionId`|
158
+
159
+
`OutboundStream` retains a bounded buffer, backpressure, and close handling.
160
+
Idle SSE streams emit keepalives. These support slow readers, streams that open
161
+
after messages arrive, and orderly teardown. `DELETE` and server shutdown close
162
+
the HTTP connections and cancel their agent work.
163
+
164
+
WebSocket already provides one bidirectional stream. Its transport adapts
165
+
Starlette's socket to JSON-RPC messages; it needs no HTTP connection registry,
166
+
session routing, SSE buffers, or multiplex mode. The ASGI handler owns the agent
167
+
connection and closes it on socket disconnect or handler cancellation.
168
+
169
+
### Simplification experiment
170
+
171
+
The original 80 HTTP, WebSocket, and RPC tests passed after each ablation.
172
+
The Starlette migration also passes these behaviors; assertions now inspect
173
+
Starlette response objects and WebSocket tests use the framework's socket:
174
+
175
+
| Stage | Removed | Lines across the three server files |
0 commit comments