feat: complete agent monitoring - hook, UI, and backend filter

- Add event_type and framework filters to events query endpoint
- Add /agents SPA route to web-ui server
- Add Agents nav link and route in frontend
- Add agents page CSS (timeline, VM pills, stats panel)
- Build VM status strip, activity timeline, and real-time stats
- Add agentmon hook for OpenClaw (HOOK.md + handler.ts)
- Add docker-compose, Dockerfile, and supporting infra files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
William Valentin
2026-03-14 00:26:42 -07:00
parent 1927ec6622
commit 3434db3c59
29 changed files with 6228 additions and 231 deletions
+870 -61
View File
@@ -1,70 +1,280 @@
* { box-sizing: border-box; margin: 0; padding: 0; }
/* ============================================================
agentmon — Refined Dark UI
============================================================ */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #0d1117;
color: #c9d1d9;
line-height: 1.5;
:root {
--bg: #07090f;
--surface: #0d1117;
--surface-2: #121922;
--card: rgba(13, 20, 32, 0.85);
--border: #1c2637;
--border-soft: rgba(28, 38, 55, 0.6);
--text: #c8d3e0;
--text-dim: #4e6070;
--text-bright: #e8eef4;
--accent: #22d3ee;
--accent-dim: rgba(34, 211, 238, 0.08);
--accent-glow: rgba(34, 211, 238, 0.2);
--success: #34d399;
--error: #f87171;
--warning: #fbbf24;
--purple: #a78bfa;
--font-display: 'Syne', sans-serif;
--font-body: 'Outfit', sans-serif;
--font-mono: 'Fira Code', monospace;
--radius: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
}
/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* ── Base ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
font-family: var(--font-body);
font-size: 15px;
background-color: var(--bg);
background-image:
radial-gradient(ellipse 80% 40% at 50% -20%, rgba(34, 211, 238, 0.04) 0%, transparent 70%),
radial-gradient(circle at 1px 1px, rgba(34, 211, 238, 0.045) 1px, transparent 0);
background-size: 100% 100%, 28px 28px;
color: var(--text);
line-height: 1.6;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
}
/* ── Header ────────────────────────────────────────────────── */
header {
background: #161b22;
padding: 1rem 2rem;
border-bottom: 1px solid #30363d;
position: sticky;
top: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 2rem;
height: 54px;
background: rgba(7, 9, 15, 0.82);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border);
}
header::after {
content: '';
position: absolute;
bottom: -1px;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, var(--accent) 60%, transparent 100%);
opacity: 0.15;
pointer-events: none;
}
.header-logo {
display: flex;
align-items: center;
gap: 0.5rem;
}
header h1 a {
color: #58a6ff;
font-family: var(--font-display);
font-size: 1rem;
font-weight: 800;
color: var(--text-bright);
text-decoration: none;
letter-spacing: 0.08em;
text-transform: uppercase;
}
main {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
.back-link {
.logo-dot {
display: inline-block;
margin-bottom: 1rem;
color: #58a6ff;
text-decoration: none;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 8px var(--accent-glow);
margin-left: 2px;
vertical-align: middle;
position: relative;
top: -1px;
}
.back-link:hover { text-decoration: underline; }
header nav {
display: flex;
align-items: center;
gap: 0.25rem;
}
header nav a {
font-size: 0.8rem;
font-weight: 500;
color: var(--text-dim);
text-decoration: none;
padding: 0.375rem 0.875rem;
border-radius: var(--radius);
letter-spacing: 0.04em;
transition: color 0.15s, background 0.15s;
}
header nav a:hover {
color: var(--text-bright);
background: var(--surface-2);
}
/* ── Main ──────────────────────────────────────────────────── */
main {
max-width: 1240px;
margin: 0 auto;
padding: 2.5rem 2rem;
}
/* Page entry animation */
@keyframes fadeUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
main > * {
animation: fadeUp 0.28s ease both;
}
/* ── Back link ─────────────────────────────────────────────── */
.back-link {
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin-bottom: 1.75rem;
color: var(--text-dim);
text-decoration: none;
font-size: 0.8rem;
font-weight: 500;
letter-spacing: 0.03em;
transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }
/* ── Page header ───────────────────────────────────────────── */
.page-header {
margin-bottom: 1.5rem;
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid var(--border-soft);
}
.page-header h2 {
font-size: 1.5rem;
margin-bottom: 0.5rem;
font-family: var(--font-display);
font-size: 1.55rem;
font-weight: 700;
color: var(--text-bright);
margin-bottom: 0.6rem;
letter-spacing: -0.02em;
}
.meta { color: #8b949e; font-size: 0.9rem; }
.meta {
display: flex;
flex-wrap: wrap;
gap: 0.4rem 1.25rem;
color: var(--text-dim);
font-size: 0.8rem;
}
.meta-item {
display: flex;
align-items: center;
gap: 0.3rem;
}
.meta-label {
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
/* ── Section title ─────────────────────────────────────────── */
.section-title {
font-family: var(--font-display);
font-size: 1rem;
font-weight: 700;
color: var(--text-bright);
margin-bottom: 1rem;
letter-spacing: 0.01em;
display: flex;
align-items: center;
gap: 0.6rem;
}
.section-title .count {
font-family: var(--font-mono);
font-size: 0.72rem;
font-weight: 500;
color: var(--text-dim);
background: var(--surface-2);
border: 1px solid var(--border);
padding: 0.1rem 0.45rem;
border-radius: 999px;
letter-spacing: 0.04em;
}
/* ── Filters ───────────────────────────────────────────────── */
.filters {
display: flex;
gap: 1rem;
gap: 0.75rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
align-items: flex-end;
}
.filters label {
display: flex;
flex-direction: column;
gap: 0.25rem;
font-size: 0.85rem;
color: #8b949e;
gap: 0.35rem;
font-size: 0.7rem;
font-weight: 600;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.08em;
}
.filters input, .filters select {
background: #21262d;
border: 1px solid #30363d;
color: #c9d1d9;
padding: 0.5rem;
border-radius: 4px;
.filters input,
.filters select {
background: var(--surface);
border: 1px solid var(--border);
color: var(--text);
padding: 0.45rem 0.75rem;
border-radius: var(--radius);
font-family: var(--font-body);
font-size: 0.85rem;
transition: border-color 0.15s, box-shadow 0.15s;
outline: none;
min-width: 140px;
}
.filters input:focus,
.filters select:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-dim);
}
.filters select option {
background: var(--surface-2);
}
/* ── Table container ───────────────────────────────────────── */
.table-container {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
overflow: hidden;
}
table {
@@ -74,55 +284,654 @@ table {
th, td {
text-align: left;
padding: 0.75rem 1rem;
border-bottom: 1px solid #21262d;
padding: 0.7rem 1.25rem;
}
th {
background: #161b22;
font-weight: 600;
font-size: 0.85rem;
background: var(--surface-2);
font-size: 0.68rem;
font-weight: 700;
text-transform: uppercase;
color: #8b949e;
letter-spacing: 0.1em;
color: var(--text-dim);
border-bottom: 1px solid var(--border);
white-space: nowrap;
}
tr:hover { background: #161b22; }
td {
font-size: 0.875rem;
border-bottom: 1px solid var(--border-soft);
color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
.status-success { color: #3fb950; }
.status-error { color: #f85149; }
.status-unknown { color: #d29922; }
tr.clickable:hover td {
background: var(--surface-2);
color: var(--text-bright);
}
tr.clickable:hover td:first-child {
border-left: 2px solid var(--accent);
padding-left: calc(1.25rem - 2px);
}
/* ── Status badges ─────────────────────────────────────────── */
.status-badge {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.2rem 0.6rem;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.04em;
white-space: nowrap;
}
.status-dot {
width: 5px;
height: 5px;
border-radius: 50%;
flex-shrink: 0;
}
.status-success {
color: var(--success);
background: rgba(52, 211, 153, 0.1);
border: 1px solid rgba(52, 211, 153, 0.2);
}
.status-success .status-dot { background: var(--success); }
.status-error {
color: var(--error);
background: rgba(248, 113, 113, 0.1);
border: 1px solid rgba(248, 113, 113, 0.2);
}
.status-error .status-dot { background: var(--error); }
.status-unknown {
color: var(--warning);
background: rgba(251, 191, 36, 0.1);
border: 1px solid rgba(251, 191, 36, 0.2);
}
.status-unknown .status-dot { background: var(--warning); }
/* ── Monospace cells ───────────────────────────────────────── */
.id-cell {
font-family: var(--font-mono);
font-size: 0.78rem;
color: var(--accent);
letter-spacing: 0.02em;
}
/* ── Load more ─────────────────────────────────────────────── */
.load-more {
display: block;
width: 100%;
margin-top: 1rem;
padding: 0.75rem;
background: #21262d;
border: 1px solid #30363d;
color: #c9d1d9;
margin-top: 0.875rem;
padding: 0.7rem;
background: transparent;
border: 1px dashed var(--border);
color: var(--text-dim);
cursor: pointer;
border-radius: 4px;
border-radius: var(--radius);
font-family: var(--font-body);
font-size: 0.8rem;
font-weight: 500;
letter-spacing: 0.05em;
text-transform: uppercase;
transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.load-more:hover { background: #30363d; }
.load-more:hover {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-dim);
}
/* ── Span expand ───────────────────────────────────────────── */
.expandable { cursor: pointer; }
.expand-icon { margin-right: 0.5rem; }
.expand-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
margin-right: 0.5rem;
color: var(--text-dim);
font-size: 0.6rem;
transition: transform 0.18s ease;
}
.span-details {
background: #161b22;
padding: 1rem;
margin: 0.5rem 0;
border-radius: 4px;
font-family: monospace;
font-size: 0.85rem;
background: #020508;
padding: 1.25rem;
font-family: var(--font-mono);
font-size: 0.78rem;
white-space: pre-wrap;
word-break: break-all;
color: #7a9ab5;
line-height: 1.75;
border-top: 1px solid var(--border);
}
/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
text-align: center;
padding: 3rem;
color: #8b949e;
padding: 4rem 2rem;
color: var(--text-dim);
font-size: 0.875rem;
letter-spacing: 0.02em;
}
/* ── Live indicator ────────────────────────────────────────── */
.live-indicator {
display: inline-flex;
align-items: center;
gap: 0.4rem;
font-size: 0.68rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--success);
}
.live-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--success);
box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
50% { opacity: 0.6; box-shadow: 0 0 2px rgba(52, 211, 153, 0.2); }
}
/* ── VM Grid ───────────────────────────────────────────────── */
.vm-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
gap: 1.25rem;
}
/* ── VM Card ───────────────────────────────────────────────── */
.vm-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-xl);
padding: 1.25rem;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
transition: border-color 0.2s, transform 0.2s;
position: relative;
overflow: hidden;
}
.vm-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 1px;
background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
opacity: 0;
transition: opacity 0.2s;
}
.vm-card:hover {
border-color: rgba(34, 211, 238, 0.18);
transform: translateY(-2px);
}
.vm-card:hover::before { opacity: 1; }
.vm-card-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 0.875rem;
}
.vm-card h3 {
font-family: var(--font-display);
font-size: 0.95rem;
font-weight: 700;
color: var(--text-bright);
letter-spacing: 0.03em;
}
.vm-status {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.2rem 0.65rem;
border-radius: 999px;
font-size: 0.68rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.vm-status.running {
background: rgba(52, 211, 153, 0.1);
color: var(--success);
border: 1px solid rgba(52, 211, 153, 0.2);
}
.vm-status.stopped {
background: rgba(248, 113, 113, 0.1);
color: var(--error);
border: 1px solid rgba(248, 113, 113, 0.2);
}
.vm-updated {
font-size: 0.7rem;
color: var(--text-dim);
margin-bottom: 0.75rem;
font-family: var(--font-mono);
letter-spacing: 0.02em;
}
.vm-divider {
height: 1px;
background: var(--border-soft);
margin: 0.875rem 0;
}
.vm-stats { width: 100%; }
.vm-stats td {
padding: 0.28rem 0;
border-bottom: none;
font-size: 0.82rem;
}
.vm-stats td:first-child {
color: var(--text-dim);
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
width: 42%;
}
.vm-stats td:last-child {
font-family: var(--font-mono);
font-size: 0.78rem;
color: var(--text);
}
.vm-issues {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-top: 0.875rem;
}
.issue {
font-size: 0.68rem;
padding: 0.22rem 0.6rem;
border-radius: 4px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.issue.gateway_down {
background: rgba(248, 113, 113, 0.12);
color: var(--error);
border: 1px solid rgba(248, 113, 113, 0.2);
}
.issue.http_unhealthy {
background: rgba(251, 191, 36, 0.1);
color: var(--warning);
border: 1px solid rgba(251, 191, 36, 0.2);
}
.issue.backup_stale {
background: rgba(251, 191, 36, 0.08);
color: var(--warning);
border: 1px solid rgba(251, 191, 36, 0.15);
}
.issue.version_mismatch {
background: rgba(167, 139, 250, 0.1);
color: var(--purple);
border: 1px solid rgba(167, 139, 250, 0.2);
}
/* ── Agents Page ───────────────────────────────────────────── */
.agents-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 1.5rem;
margin-top: 1.25rem;
}
@media (max-width: 900px) {
.agents-layout {
grid-template-columns: 1fr;
}
}
.vm-strip {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 1.5rem;
}
.vm-pill {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 999px;
font-size: 0.78rem;
font-weight: 600;
letter-spacing: 0.04em;
transition: border-color 0.2s, opacity 0.2s;
}
.vm-pill.active {
border-color: rgba(52, 211, 153, 0.3);
}
.vm-pill.inactive {
border-color: rgba(248, 113, 113, 0.2);
opacity: 0.6;
}
.vm-pill-dot {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
.vm-pill.active .vm-pill-dot {
background: var(--success);
box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
animation: livePulse 2s ease-in-out infinite;
}
.vm-pill.inactive .vm-pill-dot {
background: var(--error);
}
.vm-pill-name {
font-family: var(--font-mono);
color: var(--text-bright);
}
.vm-pill-label {
color: var(--text-dim);
font-size: 0.68rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.timeline {
display: flex;
flex-direction: column;
gap: 0.5rem;
min-width: 0;
}
.timeline-event {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 0.875rem 1.125rem;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
animation: fadeUp 0.25s ease both;
transition: border-color 0.15s;
}
.timeline-event:hover {
border-color: rgba(34, 211, 238, 0.15);
}
.timeline-event-header {
display: flex;
align-items: center;
gap: 0.6rem;
margin-bottom: 0.35rem;
}
.timeline-vm-tag {
font-family: var(--font-mono);
font-size: 0.68rem;
font-weight: 700;
padding: 0.15rem 0.5rem;
border-radius: 4px;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.timeline-vm-tag.zap {
background: rgba(34, 211, 238, 0.12);
color: var(--accent);
border: 1px solid rgba(34, 211, 238, 0.2);
}
.timeline-vm-tag.orb {
background: rgba(167, 139, 250, 0.12);
color: var(--purple);
border: 1px solid rgba(167, 139, 250, 0.2);
}
.timeline-vm-tag.sun {
background: rgba(251, 191, 36, 0.12);
color: var(--warning);
border: 1px solid rgba(251, 191, 36, 0.2);
}
.timeline-vm-tag.unknown {
background: var(--surface-2);
color: var(--text-dim);
border: 1px solid var(--border);
}
.timeline-event-type {
font-size: 0.75rem;
font-weight: 600;
color: var(--text-bright);
}
.timeline-event-time {
font-family: var(--font-mono);
font-size: 0.68rem;
color: var(--text-dim);
margin-left: auto;
}
.timeline-event-body {
font-size: 0.82rem;
color: var(--text);
line-height: 1.5;
padding-left: 0.15rem;
}
.timeline-event-body.tool-name {
font-family: var(--font-mono);
color: var(--accent);
font-size: 0.78rem;
}
.timeline-event-body.message-preview {
color: var(--text-dim);
font-style: italic;
}
.timeline-event-body.error-message {
color: var(--error);
}
.timeline-duration {
font-family: var(--font-mono);
font-size: 0.72rem;
color: var(--text-dim);
margin-left: 0.5rem;
}
.timeline-detail {
margin-top: 0.5rem;
padding: 0.75rem;
background: #020508;
border-radius: var(--radius);
font-family: var(--font-mono);
font-size: 0.75rem;
color: #7a9ab5;
white-space: pre-wrap;
word-break: break-all;
line-height: 1.65;
display: none;
}
.timeline-event.expanded .timeline-detail {
display: block;
}
.timeline-expand-hint {
display: inline-flex;
align-items: center;
margin-top: 0.3rem;
padding: 0;
background: transparent;
border: none;
color: var(--text-dim);
cursor: pointer;
font-family: var(--font-body);
font-size: 0.68rem;
letter-spacing: 0.03em;
}
.timeline-expand-hint:hover {
color: var(--accent);
}
.stats-panel {
display: flex;
flex-direction: column;
gap: 1rem;
}
.stat-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 1rem;
}
.stat-card-title {
font-size: 0.68rem;
font-weight: 700;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.1em;
margin-bottom: 0.6rem;
}
.stat-card-value {
font-family: var(--font-display);
font-size: 1.6rem;
font-weight: 800;
color: var(--text-bright);
letter-spacing: -0.02em;
}
.stat-card-sub {
font-size: 0.72rem;
color: var(--text-dim);
margin-top: 0.1rem;
}
.stat-list {
list-style: none;
}
.stat-list li {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.35rem 0;
border-bottom: 1px solid var(--border-soft);
font-size: 0.8rem;
}
.stat-list li:last-child {
border-bottom: none;
}
.stat-list-name {
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--text);
}
.stat-list-count {
font-family: var(--font-mono);
font-size: 0.72rem;
color: var(--text-dim);
background: var(--surface-2);
padding: 0.1rem 0.4rem;
border-radius: 4px;
}
.event-icon {
width: 18px;
height: 18px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.6rem;
flex-shrink: 0;
}
.event-icon.message-in {
background: rgba(52, 211, 153, 0.12);
color: var(--success);
border: 1px solid rgba(52, 211, 153, 0.25);
}
.event-icon.message-out {
background: rgba(34, 211, 238, 0.12);
color: var(--accent);
border: 1px solid rgba(34, 211, 238, 0.25);
}
.event-icon.tool {
background: rgba(167, 139, 250, 0.12);
color: var(--purple);
border: 1px solid rgba(167, 139, 250, 0.25);
}
.event-icon.error {
background: rgba(248, 113, 113, 0.12);
color: var(--error);
border: 1px solid rgba(248, 113, 113, 0.25);
}
.event-icon.session {
background: rgba(251, 191, 36, 0.12);
color: var(--warning);
border: 1px solid rgba(251, 191, 36, 0.25);
}
.event-icon.internal {
background: var(--surface-2);
color: var(--text-dim);
border: 1px solid var(--border);
}