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
121
+
has one incoming queue and one SSE buffer per stream. The incoming queue lets
122
+
POST return `202` while the agent handles the request. Output goes directly to
123
+
the relevant SSE buffer; there is no intermediate transport pair or pump task.
124
+
125
+
HTTP output needs three routing rules:
126
+
127
+
| Message | Destination | Why |
128
+
| --- | --- | --- |
129
+
|`initialize` response | POST body, via one Future | Establishes the connection before GET streams open |
130
+
| Response containing a new `sessionId`| Connection SSE stream | The client needs the ID before it can open the session stream |
131
+
| Other messages | Session SSE stream when known, otherwise connection stream | Responses use their request's recorded session; requests/notifications carry `sessionId`|
132
+
133
+
`OutboundStream` retains a bounded buffer, backpressure, and close handling.
134
+
Idle SSE streams emit keepalives. These support slow readers, streams that open
135
+
after messages arrive, and orderly teardown. `DELETE` and server shutdown close
136
+
the HTTP connections and cancel their agent work.
137
+
138
+
WebSocket already provides one bidirectional stream. Its transport adapts
139
+
Starlette's socket to JSON-RPC messages; it needs no HTTP connection registry,
140
+
session routing, SSE buffers, or multiplex mode. The ASGI handler owns the agent
141
+
connection and closes it on socket disconnect or handler cancellation.
142
+
143
+
### Simplification experiment
144
+
145
+
The original 80 HTTP, WebSocket, and RPC tests passed after each ablation.
146
+
The Starlette migration also passes these behaviors; assertions now inspect
147
+
Starlette response objects and WebSocket tests use the framework's socket:
148
+
149
+
| Stage | Removed | Lines across the three server files |
0 commit comments