-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorchestration.html
More file actions
716 lines (641 loc) · 25.7 KB
/
Copy pathorchestration.html
File metadata and controls
716 lines (641 loc) · 25.7 KB
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>connor-stack — Agent Orchestration Flow</title>
<meta name="description" content="Simulate agent execution loops. Compare linear threads and concurrent subagent dispatch pipelines.">
<link rel="stylesheet" href="../index.css">
<style>
.orch-layout {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 3rem;
margin-top: 2rem;
margin-bottom: 4rem;
}
@media (max-width: 1024px) {
.orch-layout {
grid-template-columns: 1fr;
gap: 2rem;
}
}
/* Diagram Canvas */
.diagram-panel {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 12px;
padding: 2rem;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
display: flex;
flex-direction: column;
height: 520px;
}
.diagram-viewport {
flex-grow: 1;
border: 1px dashed var(--card-border);
border-radius: 8px;
background: rgba(8, 7, 11, 0.4);
position: relative;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
/* Visualizing SVG flows */
.flow-svg {
width: 100%;
height: 100%;
}
.flow-node {
fill: #12111a;
stroke: var(--card-border);
stroke-width: 1.5px;
transition: all var(--transition-speed);
}
.flow-node.active {
stroke: var(--accent-cyan);
fill: rgba(6, 182, 212, 0.05);
filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.3));
}
.flow-node.completed {
stroke: #10b981;
fill: rgba(16, 185, 129, 0.05);
}
.flow-text {
font-family: monospace;
font-size: 0.75rem;
fill: var(--text-secondary);
text-anchor: middle;
pointer-events: none;
transition: fill var(--transition-speed);
}
.flow-node.active + .flow-text {
fill: var(--accent-cyan);
font-weight: bold;
}
.flow-line {
stroke: var(--card-border);
stroke-width: 1.5px;
stroke-dasharray: 4 4;
transition: all var(--transition-speed);
}
.flow-line.active {
stroke: var(--accent-cyan);
stroke-dasharray: none;
animation: dashMove 1s linear infinite;
}
.flow-line.completed {
stroke: #10b981;
stroke-dasharray: none;
}
@keyframes dashMove {
to {
stroke-dashoffset: -20;
}
}
/* Controls & Details */
.orch-panel {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.selector-box {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 12px;
padding: 1.5rem;
display: flex;
gap: 1rem;
}
.mode-btn {
flex: 1;
background: rgba(255, 255, 255, 0.02);
border: 1px solid var(--card-border);
color: var(--text-secondary);
padding: 1rem;
border-radius: 8px;
cursor: pointer;
text-align: left;
font-family: var(--font-display);
font-weight: 700;
transition: all var(--transition-speed);
}
.mode-btn:hover {
border-color: var(--accent-cyan);
background: rgba(6, 182, 212, 0.02);
}
.mode-btn.active {
border-color: var(--accent-cyan);
background: rgba(6, 182, 212, 0.05);
color: var(--accent-cyan);
}
.mode-title {
font-size: 0.95rem;
margin-bottom: 0.25rem;
}
.mode-subtitle {
font-size: 0.75rem;
font-weight: 400;
color: var(--text-muted);
}
.info-card {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 12px;
padding: 2rem;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
display: flex;
flex-direction: column;
gap: 1.25rem;
flex-grow: 1;
}
.info-title {
font-family: var(--font-display);
font-size: 1.25rem;
font-weight: 800;
color: var(--text-primary);
}
.info-desc {
font-size: 0.95rem;
color: var(--text-secondary);
line-height: 1.6;
}
.action-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: auto;
}
.simulate-btn {
background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
color: #08070b;
border: none;
border-radius: 6px;
padding: 0.6rem 1.2rem;
font-family: var(--font-display);
font-weight: 700;
font-size: 0.85rem;
cursor: pointer;
transition: opacity var(--transition-speed);
}
.simulate-btn:hover {
opacity: 0.9;
}
.log-terminal {
background: #0d0c12;
border: 1px solid var(--code-border);
border-radius: 8px;
padding: 1rem;
font-family: monospace;
font-size: 0.8rem;
color: #10b981;
height: 140px;
overflow-y: auto;
line-height: 1.5;
}
.why-section {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 12px;
padding: 2rem;
margin-top: 1rem;
margin-bottom: 2.5rem;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.why-section-title {
font-family: var(--font-display);
font-size: 1.2rem;
font-weight: 800;
color: var(--text-primary);
margin-bottom: 1.5rem;
background: linear-gradient(135deg, var(--text-primary) 50%, var(--accent-cyan));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 0.5rem;
}
.why-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
}
.why-card {
background: rgba(255, 255, 255, 0.02);
border: 1px solid var(--card-border);
border-radius: 8px;
padding: 1.5rem;
transition: all var(--transition-speed) var(--transition-bounce);
}
.why-card:hover {
border-color: rgba(6, 182, 212, 0.3);
transform: translateY(-2px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.why-card-title {
font-family: var(--font-sans);
font-size: 0.95rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.75rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.why-card-desc {
font-size: 0.85rem;
color: var(--text-secondary);
line-height: 1.5;
}
</style>
</head>
<body>
<div class="layout-container">
<!-- Navigation bar -->
<header class="nav-header" role="banner">
<a href="../index.html" class="brand" id="nav-brand-link">
<span class="brand-accent">connor-stack</span>
</a>
<nav class="nav-actions" role="navigation" aria-label="Main Navigation">
<a href="../philosophy.html" class="nav-link" id="nav-philosophy-link">Manifesto</a>
<a href="../tour.html" class="nav-link" id="nav-tour-link">Tour</a>
<a href="../cmo-simulator.html" class="nav-link" id="nav-simulator-link">Simulator</a>
<a href="../spokes.html" class="nav-link" id="nav-spokes-link">Spokes</a>
<button class="theme-toggle-btn" id="theme-toggle-button" aria-label="Toggle color theme" title="Toggle dark/light mode">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="theme-icon">
<circle cx="12" cy="12" r="4"></circle>
<path d="M12 2v2"></path>
<path d="M12 20v2"></path>
<path d="M5 5l1.5 1.5"></path>
<path d="M17.5 17.5L19 19"></path>
<path d="M2 12h2"></path>
<path d="M20 12h2"></path>
<path d="M5 19l1.5-1.5"></path>
<path d="M17.5 6.5L19 5"></path>
</svg>
</button>
</nav>
</header>
<!-- Main Content Area -->
<main role="main">
<section aria-labelledby="orch-heading">
<a href="index.html" class="hero-tag" style="color: var(--accent-cyan); border-color: rgba(6, 182, 212, 0.25); background-color: rgba(6, 182, 212, 0.05); text-decoration: none;">← Builder Hub</a>
<h1 class="hero-title" id="orch-heading" style="text-align: left; margin-top: 1rem; margin-bottom: 0.5rem; background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">Agent Orchestration</h1>
<p style="margin-bottom: 2rem; max-width: 800px; color: var(--text-secondary);">
Understand subagent dispatch frameworks. Execute linear workflows in a single session to prevent drift, or launch isolated parallel subagents for independent tasks.
</p>
</section>
<!-- Why We Limit Parallel Subagents to Independent Jobs Panel -->
<section class="why-section" aria-labelledby="why-orchestration-title">
<h2 class="why-section-title" id="why-orchestration-title">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-cyan);">
<polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
<polyline points="2 17 12 22 22 17"></polyline>
<polyline points="2 12 12 17 22 12"></polyline>
</svg>
Why We Limit Parallel Subagents to Independent Jobs
</h2>
<div class="why-grid">
<div class="why-card">
<h3 class="why-card-title">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-cyan);">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<line x1="9" y1="3" x2="9" y2="21"></line>
</svg>
Prevents Context Fragmentation
</h3>
<p class="why-card-desc">
Confining subagents to isolated workspaces with narrow target paths keeps prompts small, preventing context-drift and irrelevant tool calls.
</p>
</div>
<div class="why-card">
<h3 class="why-card-title">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-cyan);">
<line x1="18" y1="2" x2="22" y2="6"></line>
<path d="M7.5 11.5L2 6l5.5-5.5"></path>
<path d="M16.5 12.5L22 18l-5.5 5.5"></path>
<line x1="2" y1="18" x2="6" y2="22"></line>
</svg>
Eliminates Stitching Deadlocks
</h3>
<p class="why-card-desc">
Avoiding shared-state editing locks avoids merge conflicts, keeping the codebase buildable without complex reconciliation engines.
</p>
</div>
<div class="why-card">
<h3 class="why-card-title">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-cyan);">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
Direct Code Symbol Visibility
</h3>
<p class="why-card-desc">
A single chronological path for heavy file refactoring keeps all symbols and edits visible to the master thread for simple debugging.
</p>
</div>
<div class="why-card">
<h3 class="why-card-title">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-cyan);">
<path d="M22 12h-4l-3 9L9 3l-3 9H2"></path>
</svg>
Decoupled Monitoring Metrics
</h3>
<p class="why-card-desc">
Running subagents asynchronously under thin wrappers lets external observers monitor status codes and audit resources without halting coding pipelines.
</p>
</div>
</div>
</section>
<div class="orch-layout">
<!-- Interactive Diagram Panel -->
<div class="diagram-panel">
<h2 class="feed-title" style="margin-bottom: 1rem;">Execution Flowchart</h2>
<div class="diagram-viewport">
<svg class="flow-svg" id="flow-svg-canvas" viewBox="0 0 400 400">
<!-- Elements injected/managed by script -->
</svg>
</div>
</div>
<!-- Mode Selector and Info panel -->
<div class="orch-panel">
<div class="selector-box">
<button class="mode-btn active" id="btn-mode-linear">
<div class="mode-title">Linear Execution</div>
<div class="mode-subtitle">Single thread, no context drift</div>
</button>
<button class="mode-btn" id="btn-mode-parallel">
<div class="mode-title">Always-On Harness</div>
<div class="mode-subtitle">OpenClaw / Hermes Orchestration</div>
</button>
</div>
<div class="info-card">
<h2 class="info-title" id="panel-title">Linear Thread Workflow</h2>
<p class="info-desc" id="panel-desc">
Linear tasks execute chronologically in one single Claude Code workspace. Keeping operations in sequence prevents context fragmentation, ensures direct code symbol visibility, and matches human pair programming.
</p>
<div class="log-terminal" id="log-terminal-output">
<span style="color: #64748b;">// Terminal output logs will print here during simulation.</span>
</div>
<div class="action-row">
<span style="font-size: 0.8rem; color: var(--text-muted);">Simulation time: <strong id="sim-duration">~4.5s</strong></span>
<button class="simulate-btn" id="btn-simulate">Run Simulation</button>
</div>
</div>
</div>
</div>
</main>
<!-- Footer Area -->
<footer class="footer" role="contentinfo">
<p class="footer-text">Built by Connor Gallic. Code licensed MIT. Personal configurations and proofs of concept for remixing.</p>
<div class="footer-links">
<a href="../philosophy.html" class="footer-link">Philosophy</a>
<a href="../tour.html" class="footer-link">Architecture Tour</a>
<a href="../spokes.html" class="footer-link">Spoke Registry</a>
<a href="https://github.com/cgallic/connor-stack" class="footer-link" target="_blank" rel="noopener">GitHub</a>
</div>
</footer>
</div>
<script>
// Theme control
const themeBtn = document.getElementById('theme-toggle-button');
let currentTheme = localStorage.getItem('theme');
if (!currentTheme) {
currentTheme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
}
document.documentElement.style.colorScheme = currentTheme;
updateThemeIcon(currentTheme);
themeBtn.addEventListener('click', () => {
const isDark = document.documentElement.style.colorScheme === 'dark';
const nextTheme = isDark ? 'light' : 'dark';
document.documentElement.style.colorScheme = nextTheme;
localStorage.setItem('theme', nextTheme);
updateThemeIcon(nextTheme);
});
function updateThemeIcon(theme) {
const isDark = theme === 'dark';
themeBtn.querySelector('.theme-icon').innerHTML = isDark
? `<circle cx="12" cy="12" r="4"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="M5 5l1.5 1.5"></path><path d="M17.5 17.5L19 19"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="M5 19l1.5-1.5"></path><path d="M17.5 6.5L19 5"></path>`
: `<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>`;
}
// Orchestration data
const flowData = {
linear: {
title: "Linear Thread Workflow",
desc: "Linear tasks execute chronologically in one single Claude Code workspace. Keeping operations in sequence prevents context fragmentation, ensures direct code symbol visibility, and matches human pair programming.",
duration: "~4.5s",
logs: [
"Starting master session...",
"Read file: index.html [OK]",
"Locate element: #hero-heading [OK]",
"Modify file: index.html (applying typography styling) [OK]",
"Verify build: npm run check [Success]",
"Workflow finalized. Single thread session closed."
],
draw: `
<!-- Nodes -->
<rect id="node-1" x="150" y="40" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="65" class="flow-text">1. Master Init</text>
<rect id="node-2" x="150" y="140" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="165" class="flow-text">2. Read & Analyze</text>
<rect id="node-3" x="150" y="240" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="265" class="flow-text">3. Edit Files</text>
<rect id="node-4" x="150" y="340" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="365" class="flow-text">4. Verify Build</text>
<!-- Lines -->
<line id="line-1" x1="200" y1="80" x2="200" y2="140" class="flow-line"/>
<line id="line-2" x1="200" y1="180" x2="200" y2="240" class="flow-line"/>
<line id="line-3" x1="200" y1="280" x2="200" y2="340" class="flow-line"/>
`
},
parallel: {
title: "Always-On Harness & Multi-Agent Orchestration",
desc: "Demonstrates how three always-on agents (such as Beast running on Hermes) communicate via a thin OpenClaw or Hermes harness layer. While Codex Gemini writes code in real-time, the always-on agents coordinate, run checks, and manage workflows in parallel.",
duration: "~5.5s",
logs: [
"Harness: Initializing OpenClaw/Hermes message broker...",
"Harness: Verifying active connections to 3 always-on agents...",
"Harness: Beast agent active on Hermes VPS [Online]",
"Harness: Dispatching code writing task to Codex Gemini...",
"Codex Gemini: Generating codebase edits... [OK]",
"Beast on Hermes: Inspecting edits, verifying safety gates... [Clear]",
"Harness: Code merged and active.",
"Orchestration completed."
],
draw: `
<!-- Nodes -->
<rect id="node-1" x="150" y="40" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="65" class="flow-text">Harness Layer</text>
<!-- Subagent 1 -->
<rect id="node-2" x="30" y="180" width="100" height="40" rx="6" class="flow-node"/>
<text x="80" y="205" class="flow-text">Beast (Hermes)</text>
<!-- Subagent 2 -->
<rect id="node-3" x="150" y="180" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="205" class="flow-text">Codex Gemini</text>
<!-- Subagent 3 -->
<rect id="node-4" x="270" y="180" width="100" height="40" rx="6" class="flow-node"/>
<text x="320" y="205" class="flow-text">Scout & Casa</text>
<!-- Merge Node -->
<rect id="node-5" x="150" y="320" width="100" height="40" rx="6" class="flow-node"/>
<text x="200" y="345" class="flow-text">Commit / Merge</text>
<!-- Lines -->
<line id="line-1" x1="200" y1="80" x2="80" y2="180" class="flow-line"/>
<line id="line-2" x1="200" y1="80" x2="200" y2="180" class="flow-line"/>
<line id="line-3" x1="200" y1="80" x2="320" y2="180" class="flow-line"/>
<line id="line-4" x1="80" y1="220" x2="200" y2="320" class="flow-line"/>
<line id="line-5" x1="200" y1="220" x2="200" y2="320" class="flow-line"/>
<line id="line-6" x1="320" y1="220" x2="200" y2="320" class="flow-line"/>
`
}
};
let activeMode = 'linear';
let simInterval = null;
function renderCanvas() {
const canvas = document.getElementById('flow-svg-canvas');
canvas.innerHTML = flowData[activeMode].draw;
}
function switchMode(mode) {
if (simInterval) clearInterval(simInterval);
activeMode = mode;
document.getElementById('btn-mode-linear').classList.toggle('active', mode === 'linear');
document.getElementById('btn-mode-parallel').classList.toggle('active', mode === 'parallel');
document.getElementById('panel-title').textContent = flowData[mode].title;
document.getElementById('panel-desc').textContent = flowData[mode].desc;
document.getElementById('sim-duration').textContent = flowData[mode].duration;
const term = document.getElementById('log-terminal-output');
term.innerHTML = '<span style="color: #64748b;">// Terminal output logs will print here during simulation.</span>';
renderCanvas();
}
document.getElementById('btn-mode-linear').addEventListener('click', () => switchMode('linear'));
document.getElementById('btn-mode-parallel').addEventListener('click', () => switchMode('parallel'));
// Simulation Engine
const btnSimulate = document.getElementById('btn-simulate');
btnSimulate.addEventListener('click', () => {
if (simInterval) clearInterval(simInterval);
const term = document.getElementById('log-terminal-output');
term.innerHTML = '';
// Reset nodes visual
document.querySelectorAll('.flow-node').forEach(n => {
n.classList.remove('active', 'completed');
});
document.querySelectorAll('.flow-line').forEach(l => {
l.classList.remove('active', 'completed');
});
const logs = flowData[activeMode].logs;
let step = 0;
btnSimulate.disabled = true;
btnSimulate.textContent = "Running...";
if (activeMode === 'linear') {
// Steps: Node 1 -> Line 1 -> Node 2 -> Line 2 -> Node 3 -> Line 3 -> Node 4
const animate = () => {
if (step === 0) {
printLog(logs[0]);
highlightNode(1, 'active');
} else if (step === 1) {
printLog(logs[1]);
highlightNode(1, 'completed');
highlightLine(1, 'active');
} else if (step === 2) {
printLog(logs[2]);
highlightLine(1, 'completed');
highlightNode(2, 'active');
} else if (step === 3) {
printLog(logs[3]);
highlightNode(2, 'completed');
highlightLine(2, 'active');
highlightNode(3, 'active');
} else if (step === 4) {
printLog(logs[4]);
highlightNode(3, 'completed');
highlightLine(3, 'active');
highlightNode(4, 'active');
} else if (step === 5) {
printLog(logs[5]);
highlightLine(3, 'completed');
highlightNode(4, 'completed');
clearInterval(simInterval);
btnSimulate.disabled = false;
btnSimulate.textContent = "Run Simulation";
}
step++;
};
animate();
simInterval = setInterval(animate, 800);
} else {
// Parallel Flow
const animate = () => {
if (step === 0) {
printLog(logs[0]);
highlightNode(1, 'active');
} else if (step === 1) {
printLog(logs[1]);
printLog(logs[2]);
printLog(logs[3]);
printLog(logs[4]);
highlightNode(1, 'completed');
highlightLine(1, 'active');
highlightLine(2, 'active');
highlightLine(3, 'active');
highlightNode(2, 'active');
highlightNode(3, 'active');
highlightNode(4, 'active');
} else if (step === 2) {
printLog(logs[5]);
highlightNode(2, 'completed');
highlightLine(1, 'completed');
highlightLine(4, 'active');
} else if (step === 3) {
printLog(logs[6]);
highlightNode(3, 'completed');
highlightNode(4, 'completed');
highlightLine(2, 'completed');
highlightLine(3, 'completed');
highlightLine(5, 'active');
highlightLine(6, 'active');
highlightNode(5, 'active');
} else if (step === 4) {
printLog(logs[7]);
highlightLine(4, 'completed');
highlightLine(5, 'completed');
highlightLine(6, 'completed');
highlightNode(5, 'completed');
clearInterval(simInterval);
btnSimulate.disabled = false;
btnSimulate.textContent = "Run Simulation";
}
step++;
};
animate();
simInterval = setInterval(animate, 1000);
}
});
function printLog(text) {
const term = document.getElementById('log-terminal-output');
const p = document.createElement('p');
p.textContent = `> ${text}`;
term.appendChild(p);
term.scrollTop = term.scrollHeight;
}
function highlightNode(id, cls) {
const node = document.getElementById(`node-${id}`);
if (node) {
node.classList.remove('active', 'completed');
node.classList.add(cls);
}
}
function highlightLine(id, cls) {
const line = document.getElementById(`line-${id}`);
if (line) {
line.classList.remove('active', 'completed');
line.classList.add(cls);
}
}
// Init
switchMode('linear');
</script>
</body>
</html>