-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublic.html
More file actions
589 lines (538 loc) · 28.4 KB
/
public.html
File metadata and controls
589 lines (538 loc) · 28.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Obsidian Command Center — Public View</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Inter:wght@400;500;600;700&display=swap');
body { font-family: 'Inter', sans-serif; background: #0a0a0f; color: #e2e8f0; }
.mono { font-family: 'JetBrains Mono', monospace; }
.glass { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); backdrop-filter: blur(10px); }
.glow-purple { box-shadow: 0 0 20px rgba(139,92,246,0.15); }
.glow-green { box-shadow: 0 0 15px rgba(34,197,94,0.2); }
.glow-red { box-shadow: 0 0 15px rgba(239,68,68,0.2); }
.glow-yellow { box-shadow: 0 0 15px rgba(234,179,8,0.2); }
.pulse-green { animation: pulseGreen 2s ease-in-out infinite; }
.pulse-red { animation: pulseRed 1.5s ease-in-out infinite; }
@keyframes pulseGreen { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulseRed { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.kanban-col { min-height: 200px; }
.task-card { transition: transform 0.15s, box-shadow 0.15s; cursor: pointer; }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.task-details { max-height: 0; overflow: hidden; transition: max-height 0.25s ease-out, opacity 0.2s ease-out; opacity: 0; }
.task-card.expanded .task-details { max-height: 200px; opacity: 1; transition: max-height 0.3s ease-in, opacity 0.25s ease-in; }
.task-chevron { transition: transform 0.25s ease; }
.task-card.expanded .task-chevron { transform: rotate(180deg); }
.agent-avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.timeline-item::before { content: ''; position: absolute; left: 15px; top: 28px; bottom: -12px; width: 2px; background: rgba(139,92,246,0.2); }
.timeline-item:last-child::before { display: none; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mobile-menu { transform: translateY(-100%); transition: transform 0.25s ease; }
.mobile-menu.open { transform: translateY(0); }
</style>
</head>
<body class="min-h-screen">
<!-- Header -->
<header class="border-b border-white/5 px-6 py-4">
<div class="max-w-7xl mx-auto flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-xl bg-purple-600/20 flex items-center justify-center text-xl">
<svg class="w-6 h-6 text-purple-400" fill="currentColor" viewBox="0 0 20 20"><path d="M10 12a2 2 0 100-4 2 2 0 000 4z"/><path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"/></svg>
</div>
<div>
<h1 class="text-lg font-bold text-white">Obsidian Command Center</h1>
<p class="text-xs text-gray-500">JSJ Consulting — Agent Orchestration</p>
</div>
</div>
<div class="hidden md:flex items-center gap-4" id="desktop-nav">
<span class="text-xs text-gray-500 mono" id="last-updated"></span>
<span class="px-2 py-1 rounded-md text-xs font-medium bg-gray-700/50 text-gray-300 border border-gray-600/30">Public View</span>
<a href="https://x.com/ObsidianLabsAI" target="_blank" rel="noopener noreferrer" id="follow-cta" class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium bg-gray-800 text-gray-200 border border-white/10 hover:bg-gray-700 hover:text-white transition-colors"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>Follow @ObsidianLabsAI</a>
<span class="px-2 py-1 rounded-md text-xs font-medium bg-purple-600/20 text-purple-300 border border-purple-500/20">Built by AI</span>
<a href="https://github.com/jadye527/obsidian-growth-kit" target="_blank" rel="noopener noreferrer" id="growth-kit-cta" class="px-4 py-2 rounded-lg text-sm font-semibold bg-purple-600 text-white hover:bg-purple-500 transition-colors">Get the Growth Kit</a>
</div>
<button class="md:hidden p-2 text-gray-400 hover:text-white" id="hamburger-btn" onclick="toggleMobileMenu()" aria-label="Toggle menu">
<svg class="w-6 h-6" id="hamburger-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
<svg class="w-6 h-6 hidden" id="hamburger-close-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
</header>
<!-- Mobile Menu -->
<nav class="mobile-menu md:hidden fixed top-0 left-0 right-0 z-50 bg-[#0a0a0f]/95 border-b border-white/10 backdrop-filter backdrop-blur-md" id="mobile-menu">
<div class="px-6 pt-16 pb-6 flex flex-col gap-4">
<span class="text-xs text-gray-500 mono" id="last-updated-mobile"></span>
<span class="px-2 py-1 rounded-md text-xs font-medium bg-gray-700/50 text-gray-300 border border-gray-600/30 w-fit">Public View</span>
<a href="https://x.com/ObsidianLabsAI" target="_blank" rel="noopener noreferrer" class="follow-cta-mobile inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium bg-gray-800 text-gray-200 border border-white/10 hover:bg-gray-700 hover:text-white transition-colors w-fit"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>Follow @ObsidianLabsAI</a>
<span class="px-2 py-1 rounded-md text-xs font-medium bg-purple-600/20 text-purple-300 border border-purple-500/20 w-fit">Built by AI</span>
<a href="https://github.com/jadye527/obsidian-growth-kit" target="_blank" rel="noopener noreferrer" class="growth-kit-cta-mobile mt-2 px-4 py-2 rounded-lg text-sm font-semibold bg-purple-600 text-white hover:bg-purple-500 transition-colors text-center">Get the Growth Kit</a>
</div>
</nav>
<!-- Agent Status Cards -->
<section class="max-w-7xl mx-auto px-6 py-6">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Agent Fleet</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4" id="agent-cards"></div>
</section>
<!-- Cost Summary (totals only — no line items) -->
<section class="max-w-7xl mx-auto px-6 py-4" id="cost-section">
<div class="glass rounded-xl p-5 glow-purple">
<div class="flex items-center justify-between mb-3">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider">Monthly Cost Summary</h2>
<span class="mono text-2xl font-bold text-white" id="total-cost"></span>
</div>
<div>
<div class="flex justify-between text-xs text-gray-500">
<span id="budget-label"></span>
<span id="budget-pct"></span>
</div>
<div class="w-full h-2 bg-gray-800 rounded-full mt-1 overflow-hidden">
<div class="h-full rounded-full transition-all duration-500" id="budget-bar"></div>
</div>
</div>
</div>
</section>
<!-- Trading Stats (sanitized — no P&L) -->
<section class="max-w-7xl mx-auto px-6 py-4">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Trading Performance</h2>
<div class="glass rounded-xl p-5" id="trading-panel">
<div class="grid grid-cols-2 md:grid-cols-3 gap-6">
<div class="text-center">
<p class="text-2xl font-bold mono" id="trading-winrate">—</p>
<p class="text-xs text-gray-500 mt-1">Win Rate</p>
</div>
<div class="text-center">
<p class="text-2xl font-bold mono text-white" id="trading-total">—</p>
<p class="text-xs text-gray-500 mt-1">Total Trades</p>
</div>
<div class="text-center">
<p class="text-2xl font-bold mono text-white" id="trading-last">—</p>
<p class="text-xs text-gray-500 mt-1">Last Trade</p>
</div>
</div>
<div class="mt-4 pt-4 border-t border-white/5 flex items-center justify-between text-xs text-gray-500">
<span id="trading-record"></span>
<span id="trading-resolved"></span>
</div>
</div>
</section>
<!-- PRD Progress -->
<section class="max-w-7xl mx-auto px-6 py-4" id="prd-progress-section">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">PRD Progress</h2>
<div class="glass rounded-xl p-5" id="prd-progress"></div>
</section>
<!-- Task Board (Kanban) -->
<section class="max-w-7xl mx-auto px-6 py-6">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Task Board</h2>
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div class="kanban-col">
<div class="flex items-center gap-2 mb-3">
<span class="status-dot bg-gray-500"></span>
<span class="text-sm font-semibold text-gray-400">Backlog</span>
<span class="text-xs text-gray-600 mono" id="count-backlog"></span>
</div>
<div id="col-backlog" class="space-y-2"></div>
</div>
<div class="kanban-col">
<div class="flex items-center gap-2 mb-3">
<span class="status-dot bg-blue-500"></span>
<span class="text-sm font-semibold text-blue-400">In Progress</span>
<span class="text-xs text-gray-600 mono" id="count-progress"></span>
</div>
<div id="col-progress" class="space-y-2"></div>
</div>
<div class="kanban-col">
<div class="flex items-center gap-2 mb-3">
<span class="status-dot bg-yellow-500"></span>
<span class="text-sm font-semibold text-yellow-400">Review</span>
<span class="text-xs text-gray-600 mono" id="count-review"></span>
</div>
<div id="col-review" class="space-y-2"></div>
</div>
<div class="kanban-col">
<div class="flex items-center gap-2 mb-3">
<span class="status-dot bg-green-500"></span>
<span class="text-sm font-semibold text-green-400">Done</span>
<span class="text-xs text-gray-600 mono" id="count-done"></span>
</div>
<div id="col-done" class="space-y-2"></div>
</div>
</div>
</section>
<!-- Activity Timeline + Delegation Map -->
<section class="max-w-7xl mx-auto px-6 py-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Timeline -->
<div>
<div class="flex items-center justify-between mb-4">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider">Activity Feed</h2>
<div class="flex gap-1" id="timeline-filters">
<button onclick="filterTimeline('all')" data-filter="all" class="timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-purple-600/30 text-purple-300 border border-purple-500/30">All</button>
<button onclick="filterTimeline('obsidian')" data-filter="obsidian" class="timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-gray-800 text-gray-400 border border-white/5 hover:border-purple-500/20">Obsidian</button>
<button onclick="filterTimeline('sentinel')" data-filter="sentinel" class="timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-gray-800 text-gray-400 border border-white/5 hover:border-red-500/20">Sentinel</button>
<button onclick="filterTimeline('ralph')" data-filter="ralph" class="timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-gray-800 text-gray-400 border border-white/5 hover:border-green-500/20">Ralph</button>
</div>
</div>
<div class="glass rounded-xl p-4 max-h-96 overflow-y-auto" id="timeline"></div>
</div>
<!-- Delegation Map -->
<div>
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Delegation Map</h2>
<div class="glass rounded-xl p-4" id="delegation-map"></div>
</div>
</div>
</section>
<!-- System Health -->
<section class="max-w-7xl mx-auto px-6 py-6 pb-12" id="health-section">
<h2 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">System Health</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4" id="health-checks"></div>
</section>
<!-- Footer -->
<footer class="border-t border-white/5 py-6 text-center">
<div class="flex justify-center mb-4">
<a href="https://github.com/openclaw" target="_blank" rel="noopener noreferrer" id="openclaw-badge" class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600/20 border border-purple-500/30 text-purple-300 hover:bg-purple-600/30 hover:text-purple-200 transition-colors">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.337-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"/></svg>
<span class="text-sm font-semibold">Powered by OpenClaw</span>
</a>
</div>
<p class="text-xs text-gray-600">Obsidian Command Center — JSJ Consulting — Public View</p>
<p class="text-xs text-gray-700 mt-1">
<a href="https://x.com/ObsidianLabsAI" class="hover:text-purple-400">@ObsidianLabsAI</a>
</p>
</footer>
<script>
// ============================================================
// PUBLIC VIEW — Sanitized data, no sensitive details
// ============================================================
// Sanitize functions strip sensitive fields from live data
function sanitizeAgent(a) {
return {
id: a.id,
name: a.name,
role: a.role,
emoji: a.emoji,
status: a.status,
model: a.model,
color: a.color,
// Omit: uptime, tasksToday, lastAction, warning
};
}
function sanitizeTrading(t) {
if (!t) return null;
return {
total: t.total,
resolved: t.resolved,
wins: t.wins,
winRate: t.winRate,
lastTrade: t.lastTrade,
// Omit: pnl
};
}
function sanitizeCosts(costs, budget) {
if (!costs || Object.keys(costs).length === 0) return null;
const total = Object.values(costs).reduce((s, c) => s + (c.amount || 0), 0);
return { total, budget: budget || 0 };
// Omit: per-service line items
}
function sanitizeData(raw) {
return {
updated: raw.updated,
agents: (raw.agents || []).map(sanitizeAgent),
trading: sanitizeTrading(raw.trading),
prdProgress: raw.prdProgress || {},
costs: sanitizeCosts(raw.costs, raw.budget),
tasks: (raw.tasks || []).map(t => ({
id: t.id,
title: t.title,
status: t.status,
// Omit: agent, priority, description
})),
timeline: (raw.timeline || []).map(t => ({
time: t.time,
agent: t.agent,
action: t.action,
})),
health: (raw.health || []).map(h => ({
name: h.name,
status: h.status,
detail: h.detail,
})),
delegations: (raw.delegations || []).map(d => ({
from: d.from,
to: d.to,
task: d.task,
status: d.status,
})),
};
}
let DATA = sanitizeData({
updated: "2026-03-10T21:46:00Z",
agents: [
{ id: "obsidian", name: "Obsidian", role: "CEO / Strategy", emoji: "\u{1f9e0}", status: "active", model: "Claude Opus", color: "purple" },
{ id: "sentinel", name: "Sentinel", role: "Trading Ops", emoji: "\u{1f6e1}\ufe0f", status: "warning", model: "Claude Sonnet", color: "red" },
{ id: "ralph", name: "Ralph", role: "Developer", emoji: "\u{1f528}", status: "active", model: "Codex (GPT)", color: "green" }
],
costs: {
claudeMax: { label: "Claude Max", amount: 200, icon: "" },
codex: { label: "Codex / ChatGPT", amount: 20, icon: "" },
haiku: { label: "Haiku Crons", amount: 3.20, icon: "" },
xApi: { label: "X API", amount: 5.00, icon: "" }
},
budget: 250,
trading: { total: 11, resolved: 11, wins: 3, winRate: 27, pnl: 0, lastTrade: "2026-02-20T12:22:24.752571" },
tasks: [],
timeline: [
{ time: "5:46 PM", agent: "obsidian", action: "Documentation committed & pushed" },
{ time: "5:30 PM", agent: "obsidian", action: "Performance review completed for agent fleet" },
{ time: "5:20 PM", agent: "ralph", action: "Completed CLI tool docs (task 3/18)" },
{ time: "5:15 PM", agent: "ralph", action: "Completed CLI tool docs (task 2/18)" },
{ time: "4:30 PM", agent: "ralph", action: "Started PRD task loop \u2014 18 tasks queued" },
{ time: "9:00 AM", agent: "sentinel", action: "Data collection daemon running" },
],
health: [
{ name: "Data Daemon", status: "healthy", detail: "Running" },
{ name: "Monitor", status: "healthy", detail: "Running" },
{ name: "Post Queue", status: "healthy", detail: "Running" },
{ name: "Ralph", status: "healthy", detail: "Responsive" },
{ name: "Scanner", status: "error", detail: "Not running" },
{ name: "Index Service", status: "warning", detail: "Processing" },
{ name: "Social API", status: "healthy", detail: "OK" },
{ name: "Market Feed", status: "error", detail: "Unavailable" },
],
delegations: [
{ from: "obsidian", to: "ralph", task: "Code improvements", status: "active" },
{ from: "obsidian", to: "sentinel", task: "Market monitoring", status: "warning" },
{ from: "obsidian", to: "sentinel", task: "Data collection", status: "active" },
{ from: "jason", to: "obsidian", task: "Dashboard improvements", status: "active" },
{ from: "jason", to: "obsidian", task: "Research & positioning", status: "active" },
],
prdProgress: {},
});
// ============================================================
// RENDER FUNCTIONS
// ============================================================
function renderAgentCards() {
const container = document.getElementById('agent-cards');
const statusColors = {
active: 'bg-green-500 pulse-green',
warning: 'bg-yellow-500 pulse-red',
error: 'bg-red-500 pulse-red',
offline: 'bg-gray-600'
};
const borderColors = { active: 'border-green-500/20', warning: 'border-yellow-500/20', error: 'border-red-500/20', offline: 'border-gray-700' };
const glowClass = { active: 'glow-green', warning: 'glow-yellow', error: 'glow-red', offline: '' };
container.innerHTML = DATA.agents.map(a => `
<div class="glass rounded-xl p-5 ${glowClass[a.status] || ''} border ${borderColors[a.status] || 'border-gray-700'}">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-3">
<div class="agent-avatar bg-${a.color}-600/20">${a.emoji}</div>
<div>
<h3 class="font-bold text-white">${a.name}</h3>
<p class="text-xs text-gray-500">${a.role}</p>
</div>
</div>
<div class="flex items-center gap-2">
<span class="status-dot ${statusColors[a.status] || 'bg-gray-600'}"></span>
<span class="text-xs text-gray-400 capitalize">${a.status}</span>
</div>
</div>
<div class="text-center pt-2 border-t border-white/5">
<p class="text-xs text-gray-400 mono">${a.model}</p>
</div>
</div>
`).join('');
}
function renderTrading() {
const t = DATA.trading;
if (!t) { document.getElementById('trading-panel').style.display = 'none'; return; }
const winColor = t.winRate >= 50 ? 'text-green-400' : 'text-red-400';
document.getElementById('trading-winrate').className = `text-2xl font-bold mono ${winColor}`;
document.getElementById('trading-winrate').textContent = `${t.winRate}%`;
document.getElementById('trading-total').textContent = t.total;
const lastDate = new Date(t.lastTrade);
document.getElementById('trading-last').textContent = lastDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
document.getElementById('trading-record').textContent = `Record: ${t.wins}W / ${t.total - t.wins}L`;
document.getElementById('trading-resolved').textContent = `${t.resolved} of ${t.total} resolved`;
}
function renderCosts() {
const section = document.getElementById('cost-section');
const c = DATA.costs;
if (!c) { section.style.display = 'none'; return; }
section.style.display = '';
document.getElementById('total-cost').textContent = `$${c.total.toFixed(2)}`;
document.getElementById('budget-label').textContent = `Budget: $${c.budget}/mo`;
const pct = c.budget > 0 ? (c.total / c.budget * 100).toFixed(0) : 0;
document.getElementById('budget-pct').textContent = `${pct}% of budget`;
const bar = document.getElementById('budget-bar');
bar.style.width = `${Math.min(pct, 100)}%`;
bar.className = `h-full rounded-full transition-all duration-500 ${pct > 90 ? 'bg-red-500' : pct > 70 ? 'bg-yellow-500' : 'bg-green-500'}`;
}
function renderTasks() {
const cols = { backlog: 'col-backlog', progress: 'col-progress', review: 'col-review', done: 'col-done' };
const counts = { backlog: 0, progress: 0, review: 0, done: 0 };
Object.values(cols).forEach(id => document.getElementById(id).innerHTML = '');
DATA.tasks.forEach(t => {
counts[t.status]++;
const el = document.getElementById(cols[t.status]);
if (!el) return;
el.innerHTML += `
<div class="glass rounded-lg p-3 border-l-2 border-l-gray-500">
<span class="text-sm text-white">${t.title}</span>
</div>
`;
});
document.getElementById('count-backlog').textContent = counts.backlog;
document.getElementById('count-progress').textContent = counts.progress;
document.getElementById('count-review').textContent = counts.review;
document.getElementById('count-done').textContent = counts.done;
}
function renderDelegations() {
const container = document.getElementById('delegation-map');
const statusBadge = {
active: '<span class="px-1.5 py-0.5 rounded text-xs bg-green-500/20 text-green-300">Active</span>',
warning: '<span class="px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-300">Warning</span>',
done: '<span class="px-1.5 py-0.5 rounded text-xs bg-gray-700 text-gray-400">Done</span>'
};
const names = { obsidian: '\u{1f9e0} Obsidian', sentinel: '\u{1f6e1}\ufe0f Sentinel', ralph: '\u{1f528} Ralph', jason: '\u{1f468}\u200d\u{1f4bc} Jason' };
if (!DATA.delegations || DATA.delegations.length === 0) {
container.innerHTML = '<p class="text-xs text-gray-500 text-center py-4">No active delegations.</p>';
return;
}
container.innerHTML = DATA.delegations.map(d => `
<div class="flex items-center gap-3 py-3 border-b border-white/5 last:border-0">
<span class="text-sm text-gray-400 w-28">${names[d.from] || d.from}</span>
<svg class="w-4 h-4 text-purple-400 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"/></svg>
<span class="text-sm text-gray-400 w-28">${names[d.to] || d.to}</span>
<span class="text-sm text-white flex-1">${d.task}</span>
${statusBadge[d.status] || ''}
</div>
`).join('');
}
function renderHealth() {
const container = document.getElementById('health-checks');
const section = document.getElementById('health-section');
if (!DATA.health || DATA.health.length === 0) { section.style.display = 'none'; return; }
section.style.display = '';
const statusConfig = {
healthy: { dot: 'bg-green-500', bg: 'border-green-500/10', text: 'text-green-400' },
warning: { dot: 'bg-yellow-500', bg: 'border-yellow-500/10', text: 'text-yellow-400' },
error: { dot: 'bg-red-500 pulse-red', bg: 'border-red-500/10', text: 'text-red-400' }
};
container.innerHTML = DATA.health.map(h => {
const cfg = statusConfig[h.status] || statusConfig.healthy;
return `
<div class="glass rounded-lg p-3 border ${cfg.bg}">
<div class="flex items-center gap-2 mb-1">
<span class="status-dot ${cfg.dot}"></span>
<span class="text-sm font-medium text-white">${h.name}</span>
</div>
<p class="text-xs ${cfg.text}">${h.detail}</p>
</div>
`;
}).join('');
}
let activeTimelineFilter = 'all';
function renderTimeline() {
const container = document.getElementById('timeline');
const agentEmoji = {};
DATA.agents.forEach(a => agentEmoji[a.id] = a.emoji);
const items = activeTimelineFilter === 'all'
? DATA.timeline
: DATA.timeline.filter(t => t.agent === activeTimelineFilter);
if (items.length === 0) {
container.innerHTML = '<p class="text-xs text-gray-500 text-center py-4">No activity for this agent.</p>';
return;
}
container.innerHTML = items.map(t => `
<div class="timeline-item relative pl-10 pb-4">
<div class="absolute left-0 top-1 w-8 h-8 rounded-lg bg-purple-600/10 flex items-center justify-center text-sm">
${agentEmoji[t.agent] || '\u{1f464}'}
</div>
<p class="text-sm text-white">${t.action}</p>
<p class="text-xs text-gray-500 mono mt-0.5">${t.time} — ${t.agent}</p>
</div>
`).join('');
}
function filterTimeline(agent) {
activeTimelineFilter = agent;
const agentColors = { obsidian: 'purple', sentinel: 'red', ralph: 'green' };
document.querySelectorAll('.timeline-filter-btn').forEach(btn => {
const f = btn.getAttribute('data-filter');
if (f === agent) {
const color = agentColors[f] || 'purple';
btn.className = `timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-${color}-600/30 text-${color}-300 border border-${color}-500/30`;
} else {
btn.className = 'timeline-filter-btn px-2 py-1 rounded text-xs font-medium bg-gray-800 text-gray-400 border border-white/5 hover:border-purple-500/20';
}
});
renderTimeline();
}
function renderPrdProgress() {
const container = document.getElementById('prd-progress');
const section = document.getElementById('prd-progress-section');
const prds = DATA.prdProgress;
if (!prds || Object.keys(prds).length === 0) { section.style.display = 'none'; return; }
section.style.display = '';
container.innerHTML = Object.entries(prds).map(([key, p]) => {
const label = key.replace(/([A-Z])/g, ' $1').replace(/^./, c => c.toUpperCase());
const barColor = p.pct === 100 ? 'bg-green-500' : p.pct >= 60 ? 'bg-purple-500' : 'bg-blue-500';
const glowClass = p.pct === 100 ? 'glow-green' : '';
return `
<div class="mb-4 last:mb-0 ${glowClass}">
<div class="flex items-center justify-between mb-1">
<span class="text-sm font-medium text-white">${label}</span>
<span class="text-xs mono text-gray-400">${p.done}/${p.total} tasks — ${p.pct}%</span>
</div>
<div class="w-full h-3 bg-gray-800 rounded-full overflow-hidden">
<div class="h-full rounded-full transition-all duration-500 ${barColor}" style="width: ${p.pct}%"></div>
</div>
</div>
`;
}).join('');
}
// ============================================================
// INIT + AUTO-REFRESH
// ============================================================
function toggleMobileMenu() {
const menu = document.getElementById('mobile-menu');
const openIcon = document.getElementById('hamburger-icon');
const closeIcon = document.getElementById('hamburger-close-icon');
const isOpen = menu.classList.contains('open');
menu.classList.toggle('open');
openIcon.classList.toggle('hidden', !isOpen);
closeIcon.classList.toggle('hidden', isOpen);
}
function renderAll(data) {
DATA = data;
const ts = `Updated: ${new Date(data.updated).toLocaleString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true, month: 'short', day: 'numeric' })}`;
document.getElementById('last-updated').textContent = ts;
const mobileTs = document.getElementById('last-updated-mobile');
if (mobileTs) mobileTs.textContent = ts;
renderAgentCards();
renderCosts();
renderTrading();
renderTasks();
renderTimeline();
renderDelegations();
renderPrdProgress();
renderHealth();
}
async function fetchAndRender() {
try {
const resp = await fetch('dashboard-state.json?t=' + Date.now());
if (resp.ok) {
const raw = await resp.json();
renderAll(sanitizeData(raw));
}
} catch (e) {
// Fall back to embedded DATA
}
}
// Initial render with embedded data
renderAll(DATA);
// Load live data then refresh every 60s
fetchAndRender();
setInterval(fetchAndRender, 60000);
</script>
</body>
</html>