File size: 13,910 Bytes
c3fa188 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
class ArchitectureDiagram extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.diagram-container {
background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
border-radius: 16px;
padding: 2rem;
border: 1px solid rgba(6, 182, 212, 0.3);
position: relative;
overflow: hidden;
}
.diagram-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
position: relative;
z-index: 1;
}
.component {
position: relative;
background: rgba(30, 41, 59, 0.8);
border-radius: 12px;
padding: 1.5rem;
border: 1px solid;
transition: all 0.3s ease;
cursor: pointer;
min-height: 180px;
}
.component:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.brain-component {
border-color: rgba(6, 182, 212, 0.5);
background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.05));
}
.muscle-component {
border-color: rgba(139, 92, 246, 0.5);
background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
}
.nervous-component {
border-color: rgba(239, 68, 68, 0.5);
background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
}
.memory-component {
border-color: rgba(16, 185, 129, 0.5);
background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}
.component-header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 1rem;
}
.component-icon {
width: 48px;
height: 48px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
}
.brain-icon {
background: linear-gradient(135deg, #06b6d4, #0891b2);
color: white;
}
.muscle-icon {
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
color: white;
}
.nervous-icon {
background: linear-gradient(135deg, #ef4444, #dc2626);
color: white;
}
.memory-icon {
background: linear-gradient(135deg, #10b981, #059669);
color: white;
}
.component-title {
font-size: 1.25rem;
font-weight: 700;
}
.component-description {
color: #94a3b8;
font-size: 0.875rem;
line-height: 1.5;
margin-bottom: 0.5rem;
}
.component-stats {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
}
.stat-value {
font-weight: 700;
font-size: 1.25rem;
}
.stat-label {
font-size: 0.75rem;
color: #94a3b8;
}
.connections {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
z-index: 0;
}
.connection-line {
stroke: rgba(6, 182, 212, 0.3);
stroke-width: 2;
stroke-dasharray: 5, 5;
animation: flow 3s infinite linear;
}
@keyframes flow {
from { stroke-dashoffset: 0; }
to { stroke-dashoffset: 20; }
}
@media (max-width: 768px) {
.diagram-grid {
grid-template-columns: 1fr;
}
}
</style>
<div class="diagram-container">
<div class="connections">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<line class="connection-line" x1="25%" y1="50%" x2="45%" y2="50%"/>
<line class="connection-line" x1="55%" y1="50%" x2="75%" y2="50%"/>
<line class="connection-line" x1="40%" y1="50%" x2="40%" y2="80%"/>
<line class="connection-line" x1="60%" y1="50%" x2="60%" y2="80%"/>
</svg>
</div>
<div class="diagram-grid">
<div class="component brain-component" data-component="brain">
<div class="component-header">
<div class="component-icon brain-icon">
<i data-feather="cpu"></i>
</div>
<h3 class="component-title">The Brain</h3>
</div>
<p class="component-description">
Local LLM orchestrator scoring and routing code candidates with zero heavy generation.
</p>
<div class="component-stats">
<div class="stat-item">
<span class="stat-value shimmer-text">JSON Only</span>
<span class="stat-label">IO Format</span>
</div>
<div class="stat-item">
<span class="stat-value shimmer-text">Async</span>
<span class="stat-label">Processing</span>
</div>
</div>
</div>
<div class="component muscle-component" data-component="muscle">
<div class="component-header">
<div class="component-icon muscle-icon">
<i data-feather="activity"></i>
</div>
<h3 class="component-title">The Muscle</h3>
</div>
<p class="component-description">
Cloud LLM workers generating high-volume, parallel code in AST-compliant format.
</p>
<div class="component-stats">
<div class="stat-item">
<span class="stat-value shimmer-text">5-10x</span>
<span class="stat-label">Parallel</span>
</div>
<div class="stat-item">
<span class="stat-value shimmer-text">Stateless</span>
<span class="stat-label">Workers</span>
</div>
</div>
</div>
<div class="component nervous-component" data-component="nervous">
<div class="component-header">
<div class="component-icon nervous-icon">
<i data-feather="radio"></i>
</div>
<h3 class="component-title">Nervous System</h3>
</div>
<p class="component-description">
Redis Pub/Sub queues implementing the hot event loop for async decoupling.
</p>
<div class="component-stats">
<div class="stat-item">
<span class="stat-value shimmer-text">Pub/Sub</span>
<span class="stat-label">Pattern</span>
</div>
<div class="stat-item">
<span class="stat-value shimmer-text">Real-time</span>
<span class="stat-label">Events</span>
</div>
</div>
</div>
<div class="component memory-component" data-component="memory">
<div class="component-header">
<div class="component-icon memory-icon">
<i data-feather="database"></i>
</div>
<h3 class="component-title">Long-Term Memory</h3>
</div>
<p class="component-description">
Neo4j verification graph storing only successful state transitions.
</p>
<div class="component-stats">
<div class="stat-item">
<span class="stat-value shimmer-text">Verified</span>
<span class="stat-label">Only</span>
</div>
<div class="stat-item">
<span class="stat-value shimmer-text">Graph DB</span>
<span class="stat-label">Storage</span>
</div>
</div>
</div>
</div>
</div>
`;
// Add event listeners to components
setTimeout(() => {
this.shadowRoot.querySelectorAll('.component').forEach(component => {
component.addEventListener('click', () => {
const compType = component.getAttribute('data-component');
this.showComponentDetails(compType);
});
});
// Replace feather icons
if (window.feather) {
feather.replace();
}
}, 100);
}
showComponentDetails(componentType) {
const details = {
'brain': {
title: 'The Brain - Orchestrator',
description: 'Local LLM responsible for verification, scoring, and routing. Works only with summarized state objects to maintain context economy.',
attributes: ['Zero heavy generation', 'JSON-in/JSON-out only', 'Hot state processing', 'Promote/Prune/Spawn decisions']
},
'muscle': {
title: 'The Muscle - Workers',
description: 'Stateless cloud LLM functions that receive Task Specs and return raw AST-compliant code or diffs.',
attributes: ['Parallel execution (5-10 workers)', 'No memory of graph', 'High-volume generation', 'Stateless functions']
},
'nervous': {
title: 'Nervous System - Redis',
description: 'Implements the Hot Event Loop using Pub/Sub queues to decouple orchestrator from workers.',
attributes: ['queue:tasks for pending jobs', 'queue:results for candidates', 'Fully async processing', 'Context summarization']
},
'memory': {
title: 'Long-Term Memory - Neo4j',
description: 'Stores the Verification Graph containing only verified state transitions that pass tests/compiles.',
attributes: ['Nodes = Verified states', 'Edges = Derivation paths', 'No failed attempts', 'Prevents graph bloat']
}
};
const detail = details[componentType];
if (detail) {
const alertHtml = `
<strong>${detail.title}</strong><br><br>
${detail.description}<br><br>
<strong>Key Attributes:</strong><br>
${detail.attributes.map(attr => `• ${attr}`).join('<br>')}
`;
alert(alertHtml);
}
}
}
customElements.define('architecture-diagram', ArchitectureDiagram); |