-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
538 lines (508 loc) · 24.1 KB
/
index.html
File metadata and controls
538 lines (508 loc) · 24.1 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RAPP Brainstem</title>
<meta name="description" content="RAPP Brainstem — local-first AI agent server. One dependency: a GitHub account.">
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #0d1117; color: #e6edf3;
min-height: 100vh; padding: 48px 24px;
display: flex; flex-direction: column; align-items: center;
}
a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
font-family: "SF Mono", "Fira Code", monospace; font-size: 13px;
background: #161b22; padding: 2px 6px; border-radius: 4px;
}
.hero { text-align: center; max-width: 620px; margin-bottom: 48px; }
.hero .logo { font-size: 64px; margin-bottom: 16px; }
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 8px; }
.hero p { color: #8b949e; font-size: 16px; line-height: 1.6; }
.hero .tagline { color: #58a6ff; font-weight: 600; font-size: 14px; margin-top: 12px; }
.one-liner {
max-width: 620px; width: 100%;
background: #161b22; border: 2px solid #238636; border-radius: 12px;
padding: 20px 24px; margin-bottom: 48px;
text-align: center; cursor: pointer;
transition: border-color 0.15s, transform 0.1s;
}
.one-liner:hover { border-color: #3fb950; transform: translateY(-1px); }
.one-liner .label { font-size: 12px; color: #3fb950; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.one-liner .cmd {
font-family: "SF Mono", "Fira Code", monospace; font-size: 15px;
color: #e6edf3; word-break: break-all;
}
.one-liner .hint { font-size: 11px; color: #484f58; margin-top: 8px; }
.one-liner.copied .hint { color: #3fb950; }
.tiers { max-width: 620px; width: 100%; }
.tier {
background: #161b22; border: 1px solid #21262d; border-radius: 12px;
margin-bottom: 24px; overflow: hidden;
transition: border-color 0.15s;
}
.tier:hover { border-color: #30363d; }
.tier-header {
padding: 20px 24px; display: flex; align-items: center; gap: 16px;
cursor: pointer; user-select: none;
}
.tier-icon { font-size: 32px; flex-shrink: 0; }
.tier-title h2 { font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.tier-title .subtitle { font-size: 13px; color: #8b949e; }
.tier-badge {
margin-left: auto; font-size: 11px; font-weight: 600; padding: 4px 10px;
border-radius: 12px; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.5px;
}
.tier-badge.start { background: #238636; color: #fff; }
.tier-badge.next { background: #1f6feb33; color: #58a6ff; border: 1px solid #1f6feb; }
.tier-badge.advanced { background: #8b5cf633; color: #a78bfa; border: 1px solid #8b5cf6; }
.tier-arrow {
color: #484f58; font-size: 18px; transition: transform 0.2s; flex-shrink: 0;
}
.tier.open .tier-arrow { transform: rotate(90deg); }
.tier-body {
display: none; padding: 0 24px 24px; border-top: 1px solid #21262d;
}
.tier.open .tier-body { display: block; }
.tier-body p { color: #8b949e; font-size: 14px; line-height: 1.6; margin-top: 16px; }
.tier-body .metaphor { color: #d2a8ff; font-style: italic; font-size: 13px; margin-top: 12px; }
.steps { margin-top: 16px; }
.step {
background: #0d1117; border: 1px solid #21262d; border-radius: 8px;
padding: 14px 16px; margin-top: 10px;
}
.step h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.step p { color: #8b949e; font-size: 13px; margin: 0; }
.cmd {
display: block; background: #0d1117; border: 1px solid #21262d;
border-radius: 8px; padding: 10px 14px; margin-top: 8px;
font-family: "SF Mono", "Fira Code", monospace; font-size: 13px;
color: #e6edf3; cursor: pointer; position: relative;
transition: border-color 0.15s; white-space: pre-wrap;
}
.cmd:hover { border-color: #30363d; }
.cmd::after {
content: "📋"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
font-size: 13px; opacity: 0.3; transition: opacity 0.15s;
}
.cmd:hover::after { opacity: 1; }
.cmd.copied::after { content: "✓"; color: #3fb950; opacity: 1; }
/* ── Install widget ── */
.install-widget {
max-width: 620px; width: 100%; margin-bottom: 48px;
background: #161b22; border: 2px solid #238636; border-radius: 12px;
overflow: hidden; transition: border-color 0.15s;
}
.install-tabs {
display: flex; align-items: center; justify-content: space-between;
padding: 0 16px; border-bottom: 1px solid #21262d; height: 40px;
}
.install-tabs-left {
display: flex; align-items: center; gap: 2px;
}
.install-tabs-left .dots {
display: flex; gap: 5px; margin-right: 14px;
}
.install-tabs-left .dots span {
width: 10px; height: 10px; border-radius: 50%;
}
.install-tabs-left .dots span:nth-child(1) { background: #f85149; }
.install-tabs-left .dots span:nth-child(2) { background: #d29922; }
.install-tabs-left .dots span:nth-child(3) { background: #3fb950; }
.install-tab {
background: none; border: none; color: #484f58; font-size: 12px;
padding: 8px 14px; cursor: pointer; font-family: "SF Mono", "Fira Code", monospace;
border-bottom: 2px solid transparent; margin-bottom: -1px;
transition: color 0.15s, border-color 0.15s;
}
.install-tab:hover { color: #8b949e; }
.install-tab.active {
color: #e6edf3; border-bottom-color: #238636;
}
.install-tabs-right {
display: flex; align-items: center; gap: 10px;
}
.os-toggle {
display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8b949e;
}
.os-toggle .os-name { font-family: "SF Mono", "Fira Code", monospace; }
.os-toggle .change-btn {
background: none; border: none; color: #58a6ff; font-size: 12px;
cursor: pointer; text-decoration: none;
font-family: "SF Mono", "Fira Code", monospace;
}
.os-toggle .change-btn:hover { text-decoration: underline; }
.install-body {
padding: 20px 24px; cursor: pointer;
}
.install-body .comment {
color: #3fb950; font-family: "SF Mono", "Fira Code", monospace;
font-size: 13px; margin-bottom: 8px;
}
.install-body .prompt {
font-family: "SF Mono", "Fira Code", monospace; font-size: 14px;
color: #e6edf3; display: flex; align-items: center; gap: 8px;
}
.install-body .prompt .dollar { color: #8b949e; user-select: none; }
.install-body .copy-icon {
margin-left: auto; font-size: 16px; opacity: 0.3;
transition: opacity 0.15s; cursor: pointer; flex-shrink: 0;
}
.install-body:hover .copy-icon { opacity: 1; }
.install-body.copied .copy-icon { opacity: 1; }
.install-hint {
padding: 0 24px 14px; font-size: 11px; color: #484f58; text-align: center;
}
.install-download {
padding: 0 24px 16px; text-align: center;
}
.install-download a {
display: inline-flex; align-items: center; gap: 6px;
font-size: 12px; color: #8b949e; text-decoration: none;
padding: 6px 14px; border: 1px solid #30363d; border-radius: 6px;
transition: all 0.15s;
}
.install-download a:hover {
color: #e6edf3; border-color: #58a6ff; background: #1f6feb1a;
}
.status-bar {
max-width: 620px; width: 100%; margin-top: 16px;
background: #161b22; border: 1px solid #21262d; border-radius: 12px;
padding: 16px 24px; text-align: center;
}
.dot {
display: inline-block; width: 10px; height: 10px; border-radius: 50%;
margin-right: 8px; vertical-align: middle;
}
.dot.online { background: #3fb950; }
.dot.offline { background: #f85149; }
.dot.checking { background: #d29922; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-label { font-size: 14px; vertical-align: middle; }
.open-btn {
display: inline-block; margin-top: 12px;
background: #238636; color: #fff; border: none; border-radius: 8px;
padding: 10px 24px; font-size: 14px; font-weight: 600;
cursor: pointer; transition: background 0.15s;
}
.open-btn:hover { background: #2ea043; }
.open-btn:disabled { opacity: 0.4; cursor: default; }
.links {
margin-top: 32px; text-align: center; font-size: 13px; color: #484f58;
}
.links a { margin: 0 12px; }
</style>
</head>
<body>
<div class="hero">
<div class="logo">🧠</div>
<h1>RAPP Brainstem</h1>
<p>A local-first AI agent server powered by GitHub Copilot.<br>No API keys. No cloud setup. Just your GitHub account.</p>
<div class="tagline">Start simple. Layer up when you're ready.</div>
</div>
<div class="install-widget" id="install-widget">
<div class="install-tabs">
<div class="install-tabs-left">
<div class="dots"><span></span><span></span><span></span></div>
<button class="install-tab active" data-tab="one-liner" onclick="switchTab(this)">One-liner</button>
<button class="install-tab" data-tab="manual" onclick="switchTab(this)">Manual</button>
</div>
<div class="install-tabs-right">
<div class="os-toggle">
<span class="os-name" id="os-label">macOS/Linux</span>
<button class="change-btn" onclick="flipOS()">change</button>
</div>
</div>
</div>
<div class="install-body" onclick="copyInstall(this)">
<div class="comment" id="install-comment"># Works everywhere. Installs everything. 🧠</div>
<div class="prompt">
<span class="dollar">$</span>
<span id="install-cmd">curl -fsSL https://kody-w.github.io/rapp-installer/install.sh | bash</span>
<span class="copy-icon" id="copy-icon">📋</span>
</div>
</div>
<div class="install-hint" id="install-hint">Works on macOS & Linux. Auto-installs Python 3.11 if missing.</div>
</div>
<div class="tiers">
<!-- TIER 1: BRAINSTEM -->
<div class="tier" id="brainstem" onclick="toggleTier(event, this)">
<div class="tier-header">
<div class="tier-icon">🧠</div>
<div class="tier-title">
<h2>The Brainstem</h2>
<div class="subtitle">Local agent server — the survival basics</div>
</div>
<span class="tier-badge start">Start here</span>
<span class="tier-arrow">▶</span>
</div>
<div class="tier-body">
<p class="metaphor">The biological brainstem keeps you alive — breathing, heartbeat, reflexes. Your AI brainstem does the same: it runs the core agent loop, calls tools, and responds. Everything else builds on top of this.</p>
<div class="one-liner" style="margin-top:16px">
<div class="step">
<h3>Run the one-liner</h3>
<p>This is the only step. It installs Python, clones the repo, sets up a venv, authenticates, and launches.</p>
<div class="cmd" id="brainstem-cmd" onclick="copyCmd(event, this)">curl -fsSL https://kody-w.github.io/rapp-installer/install.sh | bash</div>
<p style="margin-top:6px;font-size:12px;color:#8b949e;">Windows: <code style="cursor:pointer" onclick="copyCmd(event, this)">irm https://raw.githubusercontent.com/kody-w/rapp-installer/main/install.ps1 | iex</code></p>
</div>
</div>
<div class="install-download" id="install-download" style="margin-top:12px">
<a id="download-link" href="install.command" download>⬇ Download installer</a>
</div>
<details style="margin-top:16px">
<summary style="color:#8b949e;font-size:13px;cursor:pointer;user-select:none">Advanced — manual steps</summary>
<div class="steps">
<div class="step">
<h3>1. Authenticate with GitHub</h3>
<p>Your GitHub Copilot subscription IS the AI engine. No OpenAI keys needed.</p>
<div class="cmd" onclick="copyCmd(event, this)">gh auth login</div>
</div>
<div class="step">
<h3>2. Start the brainstem</h3>
<p>The server starts on port 7071 with a chat UI, health endpoint, and agent auto-discovery.</p>
<div class="cmd" onclick="copyCmd(event, this)">brainstem</div>
</div>
<div class="step">
<h3>3. Talk to it</h3>
<p>Open <code>localhost:7071</code> in your browser, or hit the API directly.</p>
<div class="cmd" onclick="copyCmd(event, this)">curl -s localhost:7071/health | python3 -m json.tool</div>
</div>
<div class="step">
<h3>4. Make it yours</h3>
<p>Write a <code>soul.md</code> to define its personality. Drop <code>*_agent.py</code> files into the agents folder to give it skills. Point <code>SOUL_PATH</code> and <code>AGENTS_PATH</code> in <code>.env</code> to your private files.</p>
</div>
</div>
</details>
</div>
</div>
<!-- TIER 2: HIPPOCAMPUS -->
<div class="tier" id="hippocampus" onclick="toggleTier(event, this)">
<div class="tier-header">
<div class="tier-icon">☁️</div>
<div class="tier-title">
<h2>The Hippocampus</h2>
<div class="subtitle">Persistent memory — runs local, deploys to Azure</div>
</div>
<span class="tier-badge next">Next step</span>
<span class="tier-arrow">▶</span>
</div>
<div class="tier-body">
<p class="metaphor">The hippocampus is where memories form. One command sets up everything — Python, Azure Functions Core Tools, venv, dependencies, start script. No Azure account or API keys needed. Auth happens through the chat UI.</p>
<div class="steps">
<div class="step">
<h3>Run the one-liner</h3>
<p>This is the only step. It clones <a href="https://github.com/kody-w/CommunityRAPP">CommunityRAPP</a>, installs everything, and tells you what to do next.</p>
<div class="cmd" onclick="copyCmd(event, this)">curl -fsSL https://raw.githubusercontent.com/kody-w/rapp-installer/main/community_rapp/install.sh | bash</div>
<p style="margin-top:6px;font-size:12px;color:#8b949e;">Windows: <code style="cursor:pointer" onclick="copyCmd(event, this)">irm https://raw.githubusercontent.com/kody-w/rapp-installer/main/community_rapp/install.ps1 | iex</code></p>
</div>
</div>
<p style="margin-top:16px"><a href="https://kody-w.github.io/CommunityRAPP/onboard.html">Full onboarding guide</a></p>
<!-- Advanced: manual steps -->
<div style="margin-top:20px;border-top:1px solid #21262d;padding-top:16px;">
<div style="cursor:pointer;font-size:13px;color:#484f58;" onclick="var b=this.nextElementSibling;b.style.display=b.style.display==='none'?'block':'none';this.textContent=b.style.display==='none'?'▶ Advanced: manual steps':'▼ Advanced: manual steps'">▶ Advanced: manual steps</div>
<div style="display:none;">
<div class="steps">
<div class="step">
<h3>Start it & authenticate</h3>
<p>Open <code>index.html</code> in your browser and send a message. The chat UI walks you through GitHub device-code auth — no env vars to set.</p>
<div class="cmd" onclick="copyCmd(event, this)">cd ~/rapp-projects/my-project && ./start.sh</div>
</div>
<div class="step">
<h3>Deploy to Azure (when ready)</h3>
<p>Edit <code>local.settings.json</code> with your Azure OpenAI credentials, then publish.</p>
<div class="cmd" onclick="copyCmd(event, this)">func azure functionapp publish YOUR_APP_NAME --build remote</div>
<p style="margin-top:8px">Or deploy from the Azure Portal:</p>
<p style="margin-top:4px"><a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fkody-w%2Frapp-installer%2Fmain%2Fazuredeploy.json" target="_blank"><img src="https://aka.ms/deploytoazurebutton" alt="Deploy to Azure" style="height:32px"></a></p>
</div>
<div class="step">
<h3>Test the cloud deployment</h3>
<div class="cmd" onclick="copyCmd(event, this)">curl -s https://YOUR_APP_NAME.azurewebsites.net/api/health | python3 -m json.tool</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- TIER 3: COPILOT STUDIO -->
<div class="tier" id="nervous-system" onclick="toggleTier(event, this)">
<div class="tier-header">
<div class="tier-icon">🤖</div>
<div class="tier-title">
<h2>The Nervous System</h2>
<div class="subtitle">Connect to Copilot Studio — reach into M365</div>
</div>
<span class="tier-badge advanced">Advanced</span>
<span class="tier-arrow">▶</span>
</div>
<div class="tier-body">
<p class="metaphor">Your nervous system extends your brain's reach to every part of your body — eyes, ears, hands. Copilot Studio does the same: it connects your agent to Teams, M365 Copilot, and the entire Microsoft ecosystem. Your brainstem becomes an enterprise AI.</p>
<div class="steps">
<div class="step">
<h3>1. Download the solution</h3>
<p>Grab the Power Platform solution package from the repo. This <code>.zip</code> contains the declarative agent, connectors, and flows preconfigured for your Azure Function.</p>
<div class="cmd" onclick="copyCmd(event, this)">curl -fsSL -o MSFTAIBASMultiAgentCopilot.zip https://raw.githubusercontent.com/kody-w/rapp-installer/main/MSFTAIBASMultiAgentCopilot_1_0_0_5.zip</div>
</div>
<div class="step">
<h3>2. Import into Power Platform</h3>
<p>Go to <a href="https://make.powerapps.com" target="_blank">make.powerapps.com</a> → Solutions → Import → upload the <code>.zip</code>. This creates the Copilot Studio agent and Power Automate flows in your environment.</p>
</div>
<div class="step">
<h3>3. Wire the connector</h3>
<p>Open the imported Power Automate flow and update the HTTP action URL to point to your deployed Azure Function endpoint from Step 2. Add your Function Key if using key-based auth.</p>
</div>
<div class="step">
<h3>4. Publish to Teams & M365 Copilot</h3>
<p>In Copilot Studio, publish the agent. Your users can now talk to it in Teams, M365 Copilot, and any channel Copilot Studio supports. Same agent logic you tested locally — now enterprise-wide.</p>
</div>
</div>
<p><strong>What you learn:</strong> Copilot Studio, declarative agents, Power Platform solutions, Teams integration, enterprise AI deployment.</p>
</div>
</div>
</div>
<div class="status-bar" id="status-bar">
<span class="dot checking" id="dot"></span>
<span class="status-label" id="status-label">Checking brainstem...</span>
<br>
<button class="open-btn" id="open-btn" disabled onclick="window.open('http://localhost:7071','_blank')">Open Chat UI</button>
</div>
<div class="links">
<a href="https://github.com/kody-w/rapp-installer">GitHub</a>
<a href="https://github.com/kody-w/CommunityRAPP">Hippocampus Repo</a>
<a href="https://kody-w.github.io/CommunityRAPP/onboard.html">Hippocampus Guide</a>
<a href="rapp_brainstem/README.md">Brainstem Docs</a>
<a href="https://github.com/marketplace/models">GitHub Models</a>
</div>
<script>
// ── Install widget ──
const installs = {
'macOS/Linux': {
'one-liner': {
comment: '# Works everywhere. Installs everything. 🧠',
cmd: 'curl -fsSL https://kody-w.github.io/rapp-installer/install.sh | bash',
hint: 'Works on macOS & Linux. Auto-installs Python 3.11 if missing.'
},
'manual': {
comment: '# Clone, install deps, done.',
cmd: 'git clone https://github.com/kody-w/rapp-installer.git ~/.brainstem/src && cd ~/.brainstem/src/rapp_brainstem && pip3 install -r requirements.txt && ./start.sh',
hint: 'Requires Python 3.11+ and Git already installed.'
}
},
'Windows': {
'one-liner': {
comment: '# Factory Windows 11 ready. Installs everything via winget. 🧠',
cmd: 'irm https://raw.githubusercontent.com/kody-w/rapp-installer/main/install.ps1 | iex',
hint: 'Run in PowerShell. Auto-installs Python, Git & GitHub CLI via winget.'
},
'manual': {
comment: '# Clone, install deps, done.',
cmd: 'git clone https://github.com/kody-w/rapp-installer.git %USERPROFILE%\\.brainstem\\src && cd %USERPROFILE%\\.brainstem\\src\\rapp_brainstem && pip install -r requirements.txt && python brainstem.py',
hint: 'Requires Python 3.11+ and Git already installed.'
}
}
};
let currentOS = navigator.platform.includes('Win') ? 'Windows' : 'macOS/Linux';
let currentTab = 'one-liner';
const downloads = {
'macOS/Linux': { href: 'install.command', label: '⬇ Download installer (.command)' },
'Windows': { href: 'install.cmd', label: '⬇ Download installer (.cmd)' }
};
function renderInstall() {
const data = installs[currentOS][currentTab];
document.getElementById('os-label').textContent = currentOS;
document.getElementById('install-comment').textContent = data.comment;
document.getElementById('install-cmd').textContent = data.cmd;
document.getElementById('install-hint').innerHTML = data.hint;
document.getElementById('copy-icon').textContent = '📋';
const dlDiv = document.getElementById('install-download');
if (currentTab === 'one-liner') {
const dl = downloads[currentOS];
const link = document.getElementById('download-link');
link.href = dl.href;
link.textContent = dl.label;
dlDiv.style.display = '';
} else {
dlDiv.style.display = 'none';
}
}
function flipOS() {
currentOS = currentOS === 'macOS/Linux' ? 'Windows' : 'macOS/Linux';
renderInstall();
}
function switchTab(btn) {
document.querySelectorAll('.install-tab').forEach(t => t.classList.remove('active'));
btn.classList.add('active');
currentTab = btn.dataset.tab;
renderInstall();
}
function copyInstall(el) {
const text = document.getElementById('install-cmd').textContent;
navigator.clipboard.writeText(text);
document.getElementById('copy-icon').textContent = '✓';
el.classList.add('copied');
setTimeout(() => {
document.getElementById('copy-icon').textContent = '📋';
el.classList.remove('copied');
}, 2000);
}
renderInstall();
// ── Tier commands ──
function copyCmd(e, el) {
e.stopPropagation();
const text = el.textContent.trim();
navigator.clipboard.writeText(text);
el.classList.add('copied');
setTimeout(() => el.classList.remove('copied'), 1500);
}
function toggleTier(e, el) {
if (e.target.closest('.cmd') || e.target.closest('a')) return;
el.classList.toggle('open');
if (el.id && el.classList.contains('open')) {
history.replaceState(null, '', '#' + el.id);
} else if (location.hash) {
history.replaceState(null, '', location.pathname);
}
}
async function checkBrainstem() {
const dot = document.getElementById('dot');
const label = document.getElementById('status-label');
const btn = document.getElementById('open-btn');
try {
const r = await fetch('http://localhost:7071/health', { signal: AbortSignal.timeout(3000) });
const d = await r.json();
if (d.status === 'ok') {
dot.className = 'dot online';
const agents = d.agents ? d.agents.length : 0;
label.textContent = `Brainstem running · ${d.model} · ${agents} agent${agents !== 1 ? 's' : ''}`;
btn.disabled = false;
} else {
dot.className = 'dot offline';
label.textContent = 'Brainstem running but not authenticated — visit localhost:7071';
btn.disabled = false;
}
} catch {
dot.className = 'dot offline';
label.textContent = 'Brainstem not detected — install and run brainstem to get started';
btn.disabled = true;
}
}
checkBrainstem();
setInterval(checkBrainstem, 5000);
// ── Deep link: #hippocampus opens Tier 2, collapses others ──
function applyHash() {
const hash = location.hash.replace('#', '');
if (!hash) return;
const target = document.getElementById(hash);
if (!target || !target.classList.contains('tier')) return;
document.querySelectorAll('.tier').forEach(t => t.classList.remove('open'));
target.classList.add('open');
setTimeout(() => target.scrollIntoView({ behavior: 'smooth', block: 'start' }), 100);
}
applyHash();
window.addEventListener('hashchange', applyHash);
</script>
</body>
</html>