Files
dirigate/rpc-buffering.svg
2026-05-29 18:21:24 +02:00

61 lines
3.1 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 820 470" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="13">
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
<path d="M0,0 L10,5 L0,10 z" fill="#374151"/>
</marker>
<marker id="arrowR" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
<path d="M0,0 L10,5 L0,10 z" fill="#1d4ed8"/>
</marker>
</defs>
<!-- participant boxes -->
<rect x="40" y="20" width="220" height="40" rx="6" fill="#f3f4f6" stroke="#9ca3af"/>
<text x="150" y="45" text-anchor="middle" fill="#111827">Zed / Claude Code</text>
<rect x="560" y="20" width="220" height="40" rx="6" fill="#f3f4f6" stroke="#9ca3af"/>
<text x="670" y="45" text-anchor="middle" fill="#111827">Dirigent ACP Server</text>
<!-- lifelines -->
<line x1="150" y1="60" x2="150" y2="440" stroke="#9ca3af" stroke-dasharray="3,3"/>
<line x1="670" y1="60" x2="670" y2="440" stroke="#9ca3af" stroke-dasharray="3,3"/>
<!-- buffered region highlight on server side -->
<rect x="660" y="115" width="20" height="245" fill="#dbeafe" stroke="#1d4ed8" stroke-width="1"/>
<text x="690" y="125" fill="#1d4ed8" font-style="italic">response held</text>
<text x="690" y="143" fill="#1d4ed8" font-style="italic">in buffer</text>
<!-- POST request -->
<line x1="150" y1="100" x2="666" y2="100" stroke="#374151" marker-end="url(#arrow)"/>
<text x="408" y="93" text-anchor="middle" fill="#111827">POST /rpc {"method":"session/prompt","id":1}</text>
<!-- chunks coming back -->
<g stroke="#374151" stroke-width="1" fill="none">
<line x1="670" y1="160" x2="156" y2="160" marker-end="url(#arrow)"/>
<line x1="670" y1="190" x2="156" y2="190" marker-end="url(#arrow)"/>
<line x1="670" y1="220" x2="156" y2="220" marker-end="url(#arrow)"/>
<line x1="670" y1="250" x2="156" y2="250" marker-end="url(#arrow)"/>
<line x1="670" y1="280" x2="156" y2="280" marker-end="url(#arrow)"/>
<line x1="670" y1="310" x2="156" y2="310" marker-end="url(#arrow)"/>
</g>
<g fill="#111827" text-anchor="start">
<text x="170" y="155">SSE: agent_message_chunk</text>
<text x="170" y="185">SSE: agent_message_chunk</text>
<text x="170" y="215">SSE: tool_call_started</text>
<text x="170" y="245">SSE: tool_call_completed</text>
<text x="170" y="275">SSE: agent_message_chunk</text>
<text x="170" y="305" font-weight="bold">SSE: turn.complete</text>
</g>
<!-- final flushed response (highlighted blue) -->
<line x1="670" y1="355" x2="156" y2="355" stroke="#1d4ed8" stroke-width="2" marker-end="url(#arrowR)"/>
<text x="170" y="350" fill="#1d4ed8" font-weight="bold">{"result":{"stopReason":"end_turn"},"id":1} ◂ flushed</text>
<!-- final state -->
<text x="150" y="400" text-anchor="middle" fill="#6b7280" font-style="italic">(client accepts new input)</text>
<!-- caption -->
<text x="410" y="445" text-anchor="middle" fill="#374151" font-size="12">
The JSON-RPC response is buffered until turn.complete arrives, so chunks reach the client first and the response arrives last.
</text>
</svg>