Files
dirigent/core-architecture.svg
T
2026-05-09 21:59:28 +02:00

119 lines
8.2 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 520" width="720" height="520" font-family="system-ui, sans-serif" font-size="11">
<defs>
<marker id="arr" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
<path d="M0,0 L8,3 L0,6" fill="none" stroke="#666" stroke-width="1"/>
</marker>
<marker id="arr-blue" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
<path d="M0,0 L8,3 L0,6" fill="none" stroke="#4285f4" stroke-width="1"/>
</marker>
<marker id="arr-green" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
<path d="M0,0 L8,3 L0,6" fill="none" stroke="#1e8449" stroke-width="1"/>
</marker>
</defs>
<rect width="720" height="520" rx="8" fill="#f8f9fa"/>
<text x="360" y="24" text-anchor="middle" font-size="14" font-weight="bold" fill="#1a1a2e">dirigent_core — internal architecture</text>
<!-- CoreRuntime box -->
<rect x="230" y="42" width="260" height="52" rx="8" fill="#fff3e0" stroke="#e65100" stroke-width="2"/>
<text x="360" y="62" text-anchor="middle" font-size="12" font-weight="bold" fill="#e65100">CoreRuntime</text>
<text x="360" y="78" text-anchor="middle" font-size="9" fill="#888">stateless orchestrator — owns connectors, bus, hooks</text>
<!-- Connectors layer -->
<rect x="20" y="115" width="680" height="100" rx="8" fill="#e8f0fe" stroke="#4285f4" stroke-width="1.5"/>
<text x="30" y="133" font-size="10" font-weight="600" fill="#4285f4">CONNECTORS</text>
<rect x="40" y="142" width="140" height="60" rx="6" fill="#fff" stroke="#4285f4"/>
<text x="110" y="160" text-anchor="middle" fill="#333" font-size="10" font-weight="600">AcpConnector</text>
<text x="110" y="174" text-anchor="middle" fill="#888" font-size="8">JSON-RPC over</text>
<text x="110" y="186" text-anchor="middle" fill="#888" font-size="8">stdio | HTTP+SSE</text>
<rect x="200" y="142" width="140" height="60" rx="6" fill="#fff" stroke="#4285f4"/>
<text x="270" y="160" text-anchor="middle" fill="#333" font-size="10" font-weight="600">GatewayConnector</text>
<text x="270" y="174" text-anchor="middle" fill="#888" font-size="8">local echo + session</text>
<text x="270" y="186" text-anchor="middle" fill="#888" font-size="8">transfer routing</text>
<rect x="360" y="142" width="140" height="60" rx="6" fill="#fff" stroke="#4285f4"/>
<text x="430" y="160" text-anchor="middle" fill="#333" font-size="10" font-weight="600">OpenCodeConnector</text>
<text x="430" y="174" text-anchor="middle" fill="#888" font-size="8">REST + SSE</text>
<text x="430" y="186" text-anchor="middle" fill="#888" font-size="8">opencode.ai client</text>
<rect x="520" y="142" width="140" height="60" rx="6" fill="#fff" stroke="#4285f4"/>
<text x="590" y="160" text-anchor="middle" fill="#333" font-size="10" font-weight="600">AcpAcceptor</text>
<text x="590" y="174" text-anchor="middle" fill="#888" font-size="8">incoming ACP</text>
<text x="590" y="186" text-anchor="middle" fill="#888" font-size="8">connections</text>
<!-- Connector trait label -->
<text x="40" y="208" fill="#4285f4" font-size="8" font-style="italic">all implement Connector trait: command_tx() + subscribe() + state()</text>
<!-- Arrows: CoreRuntime -> Connectors -->
<line x1="310" y1="94" x2="110" y2="142" stroke="#666" stroke-width="1" marker-end="url(#arr)"/>
<line x1="360" y1="94" x2="270" y2="142" stroke="#666" stroke-width="1" marker-end="url(#arr)"/>
<line x1="410" y1="94" x2="430" y2="142" stroke="#666" stroke-width="1" marker-end="url(#arr)"/>
<line x1="460" y1="94" x2="590" y2="142" stroke="#666" stroke-width="1" marker-end="url(#arr)"/>
<!-- SharingBus -->
<rect x="140" y="240" width="440" height="50" rx="8" fill="#fce4ec" stroke="#c62828" stroke-width="1.5"/>
<text x="360" y="260" text-anchor="middle" font-size="12" font-weight="bold" fill="#c62828">SharingBus</text>
<text x="360" y="276" text-anchor="middle" font-size="9" fill="#888">event multiplexer — filtered fan-out to subscribers via EventFilter</text>
<!-- Arrows: Connectors -> SharingBus -->
<line x1="110" y1="202" x2="220" y2="240" stroke="#4285f4" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr-blue)"/>
<line x1="270" y1="202" x2="300" y2="240" stroke="#4285f4" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr-blue)"/>
<line x1="430" y1="202" x2="420" y2="240" stroke="#4285f4" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr-blue)"/>
<line x1="590" y1="202" x2="500" y2="240" stroke="#4285f4" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr-blue)"/>
<text x="635" y="235" fill="#4285f4" font-size="8" font-style="italic">Events</text>
<!-- Subscribers layer -->
<rect x="20" y="310" width="680" height="70" rx="8" fill="#f3e5f5" stroke="#7b1fa2" stroke-width="1.5"/>
<text x="30" y="328" font-size="10" font-weight="600" fill="#7b1fa2">SUBSCRIBERS (downstream, not in this crate)</text>
<rect x="40" y="338" width="100" height="30" rx="5" fill="#fff" stroke="#7b1fa2" stroke-dasharray="3,2"/>
<text x="90" y="357" text-anchor="middle" fill="#7b1fa2" font-size="9">Archivist</text>
<rect x="160" y="338" width="100" height="30" rx="5" fill="#fff" stroke="#7b1fa2" stroke-dasharray="3,2"/>
<text x="210" y="357" text-anchor="middle" fill="#7b1fa2" font-size="9">Web UI (SSE)</text>
<rect x="280" y="338" width="100" height="30" rx="5" fill="#fff" stroke="#7b1fa2" stroke-dasharray="3,2"/>
<text x="330" y="357" text-anchor="middle" fill="#7b1fa2" font-size="9">ACP Server</text>
<rect x="400" y="338" width="100" height="30" rx="5" fill="#fff" stroke="#7b1fa2" stroke-dasharray="3,2"/>
<text x="450" y="357" text-anchor="middle" fill="#7b1fa2" font-size="9">Langfuse</text>
<rect x="520" y="338" width="100" height="30" rx="5" fill="#fff" stroke="#7b1fa2" stroke-dasharray="3,2"/>
<text x="570" y="357" text-anchor="middle" fill="#7b1fa2" font-size="9">Matrix</text>
<!-- Arrow: SharingBus -> Subscribers -->
<line x1="360" y1="290" x2="360" y2="310" stroke="#c62828" stroke-width="1.5" marker-end="url(#arr)"/>
<!-- Hooks + Traits (right side injection) -->
<rect x="20" y="400" width="330" height="100" rx="8" fill="#e8f8f0" stroke="#1e8449" stroke-width="1.5"/>
<text x="30" y="418" font-size="10" font-weight="600" fill="#1e8449">INJECTION TRAITS (core::traits)</text>
<rect x="40" y="428" width="130" height="28" rx="5" fill="#fff" stroke="#1e8449"/>
<text x="105" y="446" text-anchor="middle" fill="#333" font-size="9" font-weight="600">ConnectorInspector</text>
<rect x="40" y="462" width="130" height="28" rx="5" fill="#fff" stroke="#1e8449"/>
<text x="105" y="480" text-anchor="middle" fill="#333" font-size="9" font-weight="600">ProcessGroupManager</text>
<rect x="195" y="428" width="130" height="28" rx="5" fill="#fff" stroke="#1e8449"/>
<text x="260" y="446" text-anchor="middle" fill="#333" font-size="9" font-weight="600">ProcessLifecycle</text>
<text x="195" y="494" fill="#1e8449" font-size="8" font-style="italic">injected via ConnectorLifecycleHooks</text>
<!-- Hooks box -->
<rect x="370" y="400" width="330" height="100" rx="8" fill="#fff8e1" stroke="#f57f17" stroke-width="1.5"/>
<text x="380" y="418" font-size="10" font-weight="600" fill="#f57f17">LIFECYCLE HOOKS (core::hooks)</text>
<rect x="390" y="430" width="290" height="24" rx="5" fill="#fff" stroke="#f57f17"/>
<text x="535" y="446" text-anchor="middle" fill="#333" font-size="9" font-weight="600">ConnectorLifecycleHooks</text>
<text x="390" y="472" fill="#888" font-size="8">on_connector_created(id, kind, title, owner)</text>
<text x="390" y="484" fill="#888" font-size="8">on_connector_removed(id)</text>
<text x="390" y="496" fill="#888" font-size="8">inspector() / process_manager() providers</text>
<!-- Arrow: Hooks -> CoreRuntime -->
<line x1="535" y1="400" x2="440" y2="94" stroke="#f57f17" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr)"/>
<!-- Arrow: Traits -> Connectors (injection) -->
<line x1="185" y1="400" x2="110" y2="202" stroke="#1e8449" stroke-width="1" stroke-dasharray="4,2" marker-end="url(#arr-green)"/>
<!-- Legend -->
<text x="360" y="515" text-anchor="middle" font-size="9" fill="#999">Solid arrows = ownership &#x2022; Dashed blue = events &#x2022; Dashed green = injection &#x2022; Dashed orange = callbacks</text>
</svg>