Skip to content

Self-improving AI Employees for everyone

19.4 KB
Raw Blame
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080" width="100%" role="img" aria-labelledby="title desc">
<title id="title">Runtime and Trust Topology</title>
<desc id="desc">A runtime topology that distinguishes the browser and CLI clients, Vite development proxy, FastAPI application, protected and restricted protocol surfaces, Temporal orchestration, and lazily started helper processes. Sources: .env.template; client/vite.config.js; server/main.py; server/middleware/auth.py; server/routers/websocket.py; server/services/authz/ws_surface.py; server/services/cli_agent/mcp_server.py; server/services/temporal/lifecycle.py; server/nodes/code/_runtime.py</desc>
<defs>
  <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="#e8eaed"/></marker>
  <style>
    .title { fill:#e8eaed; font:700 30px Geist,system-ui,sans-serif; }
    .subtitle { fill:#9aa1ac; font:400 18px Geist,system-ui,sans-serif; }
    .group-label { fill:#9aa1ac; font:600 16px 'JetBrains Mono',ui-monospace,monospace; letter-spacing:1.2px; }
    .type-label { fill:#9aa1ac; font:600 16px 'JetBrains Mono',ui-monospace,monospace; letter-spacing:.8px; }
    .node-label { fill:#e8eaed; font:650 20px Geist,system-ui,sans-serif; }
    .node-detail { fill:#9aa1ac; font:400 16px Geist,system-ui,sans-serif; }
    .edge-label { fill:#e8eaed; font:500 16px Geist,system-ui,sans-serif; }
    .edge-protocol { fill:#9aa1ac; font:500 16px 'JetBrains Mono',ui-monospace,monospace; }
    .callout-title { fill:#e8eaed; font:650 18px Geist,system-ui,sans-serif; }
    .callout-text { fill:#9aa1ac; font:400 16px Geist,system-ui,sans-serif; }
    .legend { fill:#9aa1ac; font:500 16px Geist,system-ui,sans-serif; }
  </style>
</defs>
<rect width="1920" height="1080" fill="#0d0f13"/>
<text x="72" y="58" class="title">Runtime and Trust Topology</text>
<text x="72" y="91" class="subtitle">Development and production paths, authenticated surfaces, durable orchestration and lazy helpers</text>
<g data-group-id="client-zone"><rect x="40" y="135" width="350" height="830" rx="18" fill="#15171c" stroke="#f1fa8c" stroke-width="2"/><text x="60" y="167" class="group-label">CLIENTS AND PUBLIC SENDERS</text></g><g data-group-id="app-zone"><rect x="425" y="135" width="1050" height="830" rx="18" fill="#15171c" stroke="#bd93f9" stroke-width="2"/><text x="445" y="167" class="group-label">OPENCOMPANY APPLICATION</text></g><g data-group-id="runtime-zone"><rect x="1510" y="135" width="370" height="830" rx="18" fill="#15171c" stroke="#ffb86c" stroke-width="2"/><text x="1530" y="167" class="group-label">DURABLE AND LAZY RUNTIMES</text></g><g data-relationship-id="r-browser-vite"><title>Loads SPA in development · via HTTP</title><path d="M 360 272.5 L 455 257.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 405.0 238.0 L 315 400" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="211.8" y="376.0" width="206.39999999999998" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="315" y="397" class="edge-label" text-anchor="middle" textLength="188.4" lengthAdjust="spacingAndGlyphs">Loads SPA in development</text><text x="315" y="417" class="edge-protocol" text-anchor="middle">via HTTP</text></g><g data-relationship-id="r-vite-fastapi"><title>Proxies /api /ws /webhook /health /mcp · via HTTP / WS</title><path d="M 735 257.5 L 820 257.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 780.0 340.0 L 780 556" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="623.6" y="532.0" width="312.8" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="780" y="553" class="edge-label" text-anchor="middle" textLength="294.8" lengthAdjust="spacingAndGlyphs">Proxies /api /ws /webhook /health /mcp</text><text x="780" y="573" class="edge-protocol" text-anchor="middle">via HTTP / WS</text></g><g data-relationship-id="r-cli-fastapi"><title>Launches and administers · via Typer / process</title><path d="M 360 527.5 L 405 527 L 405 365 L 790 365 L 790 257 L 820 257.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="486.8" y="341.0" width="206.39999999999998" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="590" y="362" class="edge-label" text-anchor="middle" textLength="188.4" lengthAdjust="spacingAndGlyphs">Launches and administers</text><text x="590" y="382" class="edge-protocol" text-anchor="middle">via Typer / process</text></g><g data-relationship-id="r-browser-rest"><title>Calls protected routes · via HTTPS + JWT cookie</title><path d="M 360 272.5 L 405 272 L 405 460 L 455 460.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 405.0 395.0 L 495 557" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="399.4" y="533.0" width="191.2" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="495" y="554" class="edge-label" text-anchor="middle" textLength="173.2" lengthAdjust="spacingAndGlyphs">Calls protected routes</text><text x="495" y="574" class="edge-protocol" text-anchor="middle">via HTTPS + JWT cookie</text></g><g data-relationship-id="r-browser-status"><title>Commands and receives status · via WebSocket + cookie</title><path d="M 360 272.5 L 400 272 L 400 580 L 780 580 L 780 460 L 820 460.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 585.0 580.0 L 315 634" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="196.60000000000002" y="610.0" width="236.79999999999998" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="315" y="631" class="edge-label" text-anchor="middle" textLength="218.8" lengthAdjust="spacingAndGlyphs">Commands and receives status</text><text x="315" y="651" class="edge-protocol" text-anchor="middle">via WebSocket + cookie</text></g><g data-relationship-id="r-cli-mcp"><title>Invokes scoped tools · via MCP over HTTP + Bearer</title><path d="M 360 527.5 L 405 527 L 405 715 L 455 715.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 405.0 635.0 L 315 689" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="204.2" y="665.0" width="221.6" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="315" y="686" class="edge-label" text-anchor="middle">Invokes scoped tools</text><text x="315" y="706" class="edge-protocol" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">via MCP over HTTP + Bearer</text></g><g data-relationship-id="r-webhook-ingress"><title>Delivers provider events · via HTTPS webhook</title><path d="M 360 792.5 L 820 715.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 585.0 815.0 L 405 923" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="301.8" y="899.0" width="206.39999999999998" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="405" y="920" class="edge-label" text-anchor="middle" textLength="188.4" lengthAdjust="spacingAndGlyphs">Delivers provider events</text><text x="405" y="940" class="edge-protocol" text-anchor="middle">via HTTPS webhook</text></g><g data-relationship-id="r-surfaces-app"><title>Dispatches request · via ASGI</title><path d="M 595.0 400 L 595 365 L 970 365 L 970.0 325" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="704.6" y="341.0" width="160.79999999999998" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="785" y="362" class="edge-label" text-anchor="middle" textLength="142.8" lengthAdjust="spacingAndGlyphs">Dispatches request</text><text x="785" y="382" class="edge-protocol" text-anchor="middle">via ASGI</text></g><g data-relationship-id="r-status-app"><title>Dispatches authenticated message · via ASGI WebSocket</title><path d="M 960.0 400 L 970.0 325" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 970.0 365.0 L 1060 365" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="926.4" y="341.0" width="267.2" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1060" y="362" class="edge-label" text-anchor="middle" textLength="249.2" lengthAdjust="spacingAndGlyphs">Dispatches authenticated message</text><text x="1060" y="382" class="edge-protocol" text-anchor="middle">via ASGI WebSocket</text></g><g data-relationship-id="r-temporal-internal"><title>Calls legacy node handlers · via WebSocket</title><path d="M 1540 282.5 L 1500 282 L 1500 460 L 1445 460.0" fill="none" stroke="#e8eaed" stroke-width="2" stroke-dasharray="10 8" marker-end="url(#arrow)"/><path d="M 1500.0 390.0 L 1590 390" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="1479.2" y="366.0" width="221.6" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1590" y="387" class="edge-label" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">Calls legacy node handlers</text><text x="1590" y="407" class="edge-protocol" text-anchor="middle">via WebSocket</text></g><g data-relationship-id="r-fastapi-temporal"><title>Starts workflows and polls tasks · via Temporal gRPC</title><path d="M 1120 257.5 L 1540 282.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="1191.4" y="231.0" width="267.2" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1325" y="252" class="edge-label" text-anchor="middle" textLength="249.2" lengthAdjust="spacingAndGlyphs">Starts workflows and polls tasks</text><text x="1325" y="272" class="edge-protocol" text-anchor="middle">via Temporal gRPC</text></g><g data-relationship-id="r-fastapi-nodejs"><title>Starts on demand and executes JavaScript · via HTTP</title><path d="M 1120 257.5 L 1485 257 L 1485 537 L 1540 537.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1390.0 537.0 L 1300 591" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="1136.0" y="567.0" width="328.0" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1300" y="588" class="edge-label" text-anchor="middle" textLength="310.0" lengthAdjust="spacingAndGlyphs">Starts on demand and executes JavaScript</text><text x="1300" y="608" class="edge-protocol" text-anchor="middle">via HTTP</text></g><g data-relationship-id="r-fastapi-whatsapp"><title>Starts on demand and sends commands · via RPC</title><path d="M 1120 257.5 L 1460 257 L 1460 797 L 1540 797.5" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1395.0 797.0 L 1575 905" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="1430.0" y="881.0" width="290.0" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1575" y="902" class="edge-label" text-anchor="middle" textLength="272.0" lengthAdjust="spacingAndGlyphs">Starts on demand and sends commands</text><text x="1575" y="922" class="edge-protocol" text-anchor="middle">via RPC</text></g><g data-relationship-id="r-fastapi-spa"><title>Serves production fallback · via StaticFiles / HTML</title><path d="M 970.0 325 L 970 605 L 1305 605 L 1305.0 655" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1140.0 605.0 L 960 605" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="849.2" y="581.0" width="221.6" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="960" y="602" class="edge-label" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">Serves production fallback</text><text x="960" y="622" class="edge-protocol" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">via StaticFiles / HTML</text></g><g data-component-id="browser-spa"><title>Browser SPA</title><rect x="70" y="215" width="290" height="115" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="70" y="215" width="290" height="7" rx="4" fill="#f1fa8c"/><text x="88" y="241" class="type-label">CLIENT</text><text x="88" y="267" class="node-label">Browser SPA</text><text x="88" y="293" class="node-detail">browser tab or desktop app</text></g><g data-component-id="opencompany-cli"><title>OpenCompany CLI</title><rect x="70" y="470" width="290" height="115" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="70" y="470" width="290" height="7" rx="4" fill="#f1fa8c"/><text x="88" y="496" class="type-label">CLIENT</text><text x="88" y="522" class="node-label">OpenCompany CLI</text><text x="88" y="548" class="node-detail" textLength="254.0" lengthAdjust="spacingAndGlyphs">Typer launcher and agent client</text></g><g data-component-id="webhook-senders"><title>Webhook senders</title><rect x="70" y="735" width="290" height="115" rx="12" fill="#1b1e25" stroke="#ff79c6" stroke-width="2"/><rect x="70" y="735" width="290" height="7" rx="4" fill="#ff79c6"/><text x="88" y="761" class="type-label">EXTERNAL</text><text x="88" y="787" class="node-label">Webhook senders</text><text x="88" y="813" class="node-detail">Provider callbacks</text></g><g data-component-id="vite-dev"><title>Vite development server</title><rect x="455" y="190" width="280" height="135" rx="12" fill="#1b1e25" stroke="#8be9fd" stroke-width="2"/><rect x="455" y="190" width="280" height="7" rx="4" fill="#8be9fd"/><text x="473" y="216" class="type-label">CONTAINER</text><text x="473" y="242" class="node-label">Vite development</text><text x="473" y="264" class="node-label">server</text><text x="473" y="290" class="node-detail">app port · development only</text></g><g data-component-id="fastapi-app"><title>FastAPI application</title><rect x="820" y="190" width="300" height="135" rx="12" fill="#1b1e25" stroke="#bd93f9" stroke-width="2"/><rect x="820" y="190" width="300" height="7" rx="4" fill="#bd93f9"/><text x="838" y="216" class="type-label">CONTAINER</text><text x="838" y="242" class="node-label">FastAPI application</text><text x="838" y="268" class="node-detail">PYTHON_BACKEND_PORT</text></g><g data-component-id="rest-surface"><title>Protected REST API</title><rect x="455" y="400" width="280" height="120" rx="12" fill="#1b1e25" stroke="#8be9fd" stroke-width="2"/><rect x="455" y="400" width="280" height="7" rx="4" fill="#8be9fd"/><text x="473" y="426" class="type-label">INTERFACE</text><text x="473" y="452" class="node-label">Protected REST API</text><text x="473" y="478" class="node-detail">Authenticated /api routes</text></g><g data-component-id="status-socket"><title>/ws/status</title><rect x="820" y="400" width="280" height="120" rx="12" fill="#1b1e25" stroke="#8be9fd" stroke-width="2"/><rect x="820" y="400" width="280" height="7" rx="4" fill="#8be9fd"/><text x="838" y="426" class="type-label">WEBSOCKET</text><text x="838" y="452" class="node-label">/ws/status</text><text x="838" y="478" class="node-detail">Cookie-derived user identity</text></g><g data-component-id="internal-socket"><title>/ws/internal</title><rect x="1165" y="400" width="280" height="120" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="1165" y="400" width="280" height="7" rx="4" fill="#f1fa8c"/><text x="1183" y="426" class="type-label">WEBSOCKET</text><text x="1183" y="452" class="node-label">/ws/internal</text><text x="1183" y="478" class="node-detail" textLength="244.0" lengthAdjust="spacingAndGlyphs">Local allowlist · payload identity</text></g><g data-component-id="mcp-surface"><title>/mcp/ide/mcp</title><rect x="455" y="655" width="280" height="120" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="455" y="655" width="280" height="7" rx="4" fill="#f1fa8c"/><text x="473" y="681" class="type-label">MCP ENDPOINT</text><text x="473" y="707" class="node-label">/mcp/ide/mcp</text><text x="473" y="733" class="node-detail">Per-batch bearer token</text></g><g data-component-id="webhook-ingress"><title>/webhook/*</title><rect x="820" y="655" width="280" height="120" rx="12" fill="#1b1e25" stroke="#ff79c6" stroke-width="2"/><rect x="820" y="655" width="280" height="7" rx="4" fill="#ff79c6"/><text x="838" y="681" class="type-label">HTTP INGRESS</text><text x="838" y="707" class="node-label">/webhook/*</text><text x="838" y="733" class="node-detail" textLength="244.0" lengthAdjust="spacingAndGlyphs">Public route · provider verification</text></g><g data-component-id="production-spa"><title>Production SPA assets</title><rect x="1165" y="655" width="280" height="120" rx="12" fill="#1b1e25" stroke="#8be9fd" stroke-width="2"/><rect x="1165" y="655" width="280" height="7" rx="4" fill="#8be9fd"/><text x="1183" y="681" class="type-label">STATIC CONTENT</text><text x="1183" y="707" class="node-label">Production SPA assets</text><text x="1183" y="733" class="node-detail">Served by FastAPI</text></g><g data-component-id="temporal-runtime"><title>Temporal server and worker</title><rect x="1540" y="210" width="310" height="145" rx="12" fill="#1b1e25" stroke="#ffb86c" stroke-width="2"/><rect x="1540" y="210" width="310" height="7" rx="4" fill="#ffb86c"/><text x="1558" y="236" class="type-label">DURABLE RUNTIME</text><text x="1558" y="262" class="node-label">Temporal server</text><text x="1558" y="284" class="node-label">and worker</text><text x="1558" y="310" class="node-detail">ports from .env.template</text></g><g data-component-id="nodejs-sidecar"><title>JS/TS executor (bun)</title><rect x="1540" y="475" width="310" height="125" rx="12" fill="#1b1e25" stroke="#ffb86c" stroke-width="2"/><rect x="1540" y="475" width="310" height="7" rx="4" fill="#ffb86c"/><text x="1558" y="501" class="type-label">LAZY SIDECAR</text><text x="1558" y="527" class="node-label">JS/TS executor (bun)</text><text x="1558" y="553" class="node-detail">HTTP · NODEJS_EXECUTOR_PORT</text></g><g data-component-id="whatsapp-sidecar"><title>WhatsApp RPC</title><rect x="1540" y="735" width="310" height="125" rx="12" fill="#1b1e25" stroke="#ffb86c" stroke-width="2"/><rect x="1540" y="735" width="310" height="7" rx="4" fill="#ffb86c"/><text x="1558" y="761" class="type-label">LAZY SIDECAR</text><text x="1558" y="787" class="node-label">WhatsApp RPC</text><text x="1558" y="813" class="node-detail">RPC · WHATSAPP_RPC_PORT</text></g><g data-callout-id="trust-rules"><rect x="535" y="795" width="835" height="155" rx="10" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2" stroke-dasharray="7 6"/><text x="551" y="825" class="callout-title">Trust rules</text><text x="551" y="851" class="callout-text">REST and /ws/status use authenticated server-owned identity.</text><text x="551" y="873" class="callout-text">/ws/internal is local-only, unauthenticated, and restricted to</text><text x="551" y="895" class="callout-text">execute_node, execute_ai_node, and ping.</text><text x="551" y="917" class="callout-text">/mcp/ide/mcp uses a short-lived per-batch Bearer token;</text><text x="551" y="939" class="callout-text">/webhook/* verifies provider signatures where configured.</text></g>
<g aria-label="Legend"><circle cx="72" cy="1038" r="7" fill="#bd93f9"/><text x="86" y="1044" class="legend">Agents / system</text><circle cx="317" cy="1038" r="7" fill="#8be9fd"/><text x="331" y="1044" class="legend">Models / interfaces</text><circle cx="562" cy="1038" r="7" fill="#50fa7b"/><text x="576" y="1044" class="legend">Tools / results</text><circle cx="807" cy="1038" r="7" fill="#ff79c6"/><text x="821" y="1044" class="legend">Triggers / events</text><circle cx="1052" cy="1038" r="7" fill="#ffb86c"/><text x="1066" y="1044" class="legend">Workflow / runtime</text><circle cx="1297" cy="1038" r="7" fill="#f1fa8c"/><text x="1311" y="1044" class="legend">Security note</text></g>
</svg>