基于对
index.html(58行)、styles.css(15KB, 540行)、dashboard.js(54KB, 1344行)的全面分析
| # | 问题 | 严重程度 | 说明 |
|---|---|---|---|
| 1 | 无变量体系 | 🔴 | 所有颜色硬编码,间距不统一(6, 8, 10, 12, 14px 混用) |
| 2 | 信息密度过高 | 🔴 | .topbar 挤了10个 stat → 容器窄时直接溢出 |
| 3 | 无断点/响应式 | 🔴 | 280px sidebar + 220px observer = 固定 500px,<1024px 不可用 |
| 4 | 视觉层次平 | 🟡 | 标题/数据/标签不分级;font-size 除了 13(base) 就是 10/11/12 |
| 5 | Card 边界弱 | 🟡 | agent-row 只有 border-left: 2px,hover 靠 background,没有卡片容器 |
| 6 | Context bar 太小 | 🟡 | 56px × 4px 的 bar 在密集 fleet 里难读 |
| 7 | Flex 替代 Grid | 🟡 | topbar 用 flex-wrap: false → 溢出无保护;#app 用 Grid 但 sub-grid 混用 flex |
| 8 | Focus 状态缺失 | 🟢 | 除了 .search-box input:focus 外,button/clickable 缺少 focus ring |
:root {
/* ─ Background */
--bg-base: #0d1117;
--bg-surface: #151b23;
--bg-elevated: #1c2333;
--bg-hover: #1c2128;
--bg-active: #262c36;
/* ─ Border */
--border-subtle: #21262d;
--border-default: #30363d;
--border-strong: #484f58;
/* ─ Text */
--text-primary: #e6edf3;
--text-secondary: #8b949e;
--text-muted: #6e7681;
--text-accent: #79c0ff;
/* ─ Semantic */
--accent-blue: #58a6ff;
--accent-green: #3fb950;
--accent-yellow: #d29922;
--accent-red: #f85149;
--accent-purple: #bc8cff;
/* ─ Spacing (4px base) */
--sp-1: 4px;
--sp-2: 8px;
--sp-3: 12px;
--sp-4: 16px;
--sp-5: 20px;
--sp-6: 24px;
--sp-8: 32px;
--sp-10: 40px心地--sp-12: 48px;
/* ─ Radius */
--r-sm: 4px;
--r-md: 6px;
--r-lg: 8px;
--r-xl: 12px;
/* ─ Font sizes */
--fs-xs: 10px;
--fs-sm: 11px;
--fs-base: 12px;
--fs-md: 13px;
--fs-lg: 14px;
--fs-xl: 16px;
/* ─ Font weights */
--fw-normal: 400;
--fw-medium: 500;
--fw-semibold: 600;
--fw-bold: 700;
/* ─ Shadows */
--shadow-sm: 0 1px 2px rgba(0,0,0,.3);
--shadow-md: 0 2px 6px rgba(0,0,0,.4);
--shadow-lg: 0 4px 12px rgba(0,0,0,.5);
/* ─ Transitions */
--ease: cubic-bezier(.4,0,.2,1);
--duration: 150ms;
}为什么这样设计:
- 所有间距统一用 4px 为倍数,消除
padding: 4px 14px这种不对称 - 颜色体系升级为 semantic 命名,将来换主题只需改变量值
- 字体层次 10/11/12/13/14/16px + 4 级 weight,覆盖所有场景
*, *::before, *::after { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
font-size: var(--fs-base);
line-height: 1.5;
background: var(--bg-base);
color: var(--text-primary);
overflow: hidden;
-webkit-font-smoothing: antialiased;
}
a {
color: var(--accent-blue);
text-decoration: none;
transition: color var(--duration) var(--ease);
}
a:hover { color: #79c0ff; text-decoration: underline; }要点:line-height 从默认(monospace 约 1.2)提到 1.5,改善密集文本可读性;font-smoothing 确保深色背景不糊。
#app {
display: grid;
grid-template-rows: auto auto 1fr;
height: 100vh;
width: 100vw;
}保持不变,这个三级 Grid(topbar / session-strip / main)是合理的。问题在子级。
当前问题: 10个 stat 挤一行,没有 wrap,窄窗口溢出。
header.topbar {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--sp-2) var(--sp-4);
padding: var(--sp-2) var(--sp-4);
background: var(--bg-surface);
border-bottom: 1px solid var(--border-default);
min-height: 40px;
}
header.topbar .title {
font-size: var(--fs-lg);
font-weight: var(--fw-semibold);
color: var(--text-primary);
margin-right: auto;
white-space: nowrap;
}
/* stat 容器组:用 flex wrap 让它们自然换行 */
header.topbar .stats-group {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--sp-1) var(--sp-3);
}
header.topbar .stat {
font-size: var(--fs-sm);
color: var(--text-secondary);
white-space: nowrap;
padding: 1px var(--sp-1);
border-radius: var(--r-sm);
transition: background var(--duration) var(--ease);
}
header.topbar .stat:hover {
background: var(--bg-hover);
}
header.topbar .stat b {
color: var(--text-primary);
font-weight: var(--fw-semibold);
font-variant-numeric: tabular-nums;
}
header.topbar .stat.warn b { color: var(--accent-yellow); }
header.topbar .stat.err b { color: var(--accent-red); }HTML 结构调整建议:
<header class="topbar">
<span class="title">🤖 multi-agent dashboard</span>
<div class="stats-group"> <!-- ← 新增 wrapper -->
<span class="stat">sessions <b id="stat-sessions">0</b></span>
<span class="stat">agents <b id="stat-agents">0</b></span>
<!-- ... -->
</div>
</header>nav.session-strip {
display: flex;
align-items: stretch;
background: var(--bg-surface);
border-bottom: 1px solid var(--border-default);
min-height: 34px;
overflow-x: auto;
overflow-y: hidden;
padding: 0 var(--sp-2);
scrollbar-width: thin;
}
nav.session-strip .session-tab {
display: inline-flex;
align-items: center;
gap: var(--sp-1);
padding: 0 var(--sp-3);
cursor: pointer;
color: var(--text-secondary);
font-size: var(--fs-sm);
white-space: nowrap;
border-bottom: 2px solid transparent;
user-select: none;
transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
nav.session-strip .session-tab:hover {
color: var(--text-primary);
background: var(--bg-hover);
}
nav.session-strip .session-tab.active {
color: var(--text-primary);
border-bottom-color: var(--accent-blue);
}
nav.session-strip .session-tab .sid { font-family: inherit; }
nav.session-strip .session-tab .badge {
color: var(--text-muted);
font-size: var(--fs-xs);
}
nav.session-strip .session-tab .current-mark {
color: var(--accent-green);
font-size: var(--fs-xs);
}main#main-grid {
display: grid;
grid-template-columns: 280px 1fr;
min-height: 0;
transition: grid-template-columns var(--duration) var(--ease);
}
/* Observer panel visible */
main#main-grid.with-observer {
grid-template-columns: 280px 1fr 220px;
}
/* ─ Responsive: ≤1100px ─────────────────────────── */
@media (max-width: 1100px) {
main#main-grid.with-observer {
grid-template-columns: 260px 1fr;
}
.observer-panel {
position: fixed;
right: 0;
top: 0;
bottom: 0;
z-index: 100;
width: 280px;
transform: translateX(100%);
transition: transform 200ms var(--ease);
box-shadow: var(--shadow-lg);
}
.observer-panel.open {
transform: translateX(0);
}
/* 加一个 toggle button */
.observer-toggle {
display: flex !important;
}
}
/* ─ Responsive: ≤768px ──────────────────────────── */
@media (max-width: 768px) {
main#main-grid,
main#main-grid.with-observer {
grid-template-columns: 1fr;
}
aside.sidebar {
display: none; /* 内联 session 可选展开 */
}
/* 增加一个 "Show Fleet" 切换按钮 */
.sidebar-overlay {
display: none;
position: fixed;
inset: 0;
z-index: 50;
background: rgba(0,0,0,.5);
}
.sidebar-overlay.open {
display: block;
}
aside.sidebar.mobile-open {
display: block;
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 280px;
z-index: 60;
border-right: 1px solid var(--border-default);
box-shadow: var(--shadow-lg);
}
}
.observer-toggle {
display: none; /* 默认隐藏,≤1100px 显示 */
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
background: var(--bg-hover);
border: 1px solid var(--border-default);
border-radius: var(--r-sm);
color: var(--text-secondary);
cursor: pointer;
font-size: 12px;
}
.observer-toggle:hover {
background: var(--bg-active);
color: var(--text-primary);
}HTML 结构调整建议: 在 toolbar 内添加 .observer-toggle 按钮:
<button id="btn-observer-toggle" class="observer-toggle" title="Toggle observer panel">📊</button>aside.sidebar {
background: var(--bg-base);
border-right: 1px solid var(--border-default);
overflow-y: auto;
padding: var(--sp-2) 0;
}
.sidebar-section-title {
padding: var(--sp-1) var(--sp-4);
font-size: var(--fs-xs);
font-weight: var(--fw-semibold);
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.08em;
}
/* ─ Path group — 卡片式分组 ─────────── */
.session-group {
margin: var(--sp-1) 0 var(--sp-2) 0;
}
.session-header {
display: flex;
align-items: center;
gap: var(--sp-1);
padding: var(--sp-1) var(--sp-3);
cursor: pointer;
color: var(--text-secondary);
font-size: var(--fs-sm);
user-select: none;
border-radius: 0;
transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.session-header:hover {
color: var(--text-primary);
background: var(--bg-hover);
}
.session-header .caret {
width: 12px;
display: inline-block;
color: var(--text-muted);
font-size: 10px;
transition: transform 150ms var(--ease);
}
.session-header .caret.collapsed { transform: rotate(-90deg); }
.session-header .path {
font-weight: var(--fw-medium);
color: var(--text-accent);
letter-spacing: 0.02em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
}
.session-header .count {
margin-left: auto;
color: var(--text-muted);
font-size: var(--fs-xs);
background: var(--bg-hover);
padding: 0 var(--sp-1);
border-radius: var(--r-sm);
min-width: 18px;
text-align: center;
}
.session-body {
padding-left: var(--sp-1);
}
.session-body.collapsed { display: none; }
/* ─ Agent row — 真正卡片化 ──────────── */
.agent-row {
display: grid;
grid-template-columns: 10px 1fr auto auto;
align-items: center;
gap: var(--sp-2);
padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
cursor: pointer;
border-left: 3px solid transparent;
border-radius: 0 var(--r-sm) var(--r-sm) 0;
margin: 1px 0;
transition: background var(--duration) var(--ease),
border-color var(--duration) var(--ease),
box-shadow var(--duration) var(--ease);
position: relative;
}
.agent-row:hover {
background: var(--bg-hover);
border-left-color: var(--border-strong);
}
.agent-row.selected {
background: var(--bg-elevated);
border-left-color: var(--accent-blue);
box-shadow: inset 3px 0 0 var(--accent-blue);
}
.agent-row.selected::after {
content: '';
position: absolute;
right: 0;
top: 4px;
bottom: 4px;
width: 3px;
background: var(--accent-blue);
border-radius: 2px 0 0 2px;
opacity: 0.3;
}
/* ─ Status dot ───────────────────────────────── */
.agent-row .dot {
width: 10px;
height: 10px;
border-radius: 50%;
flex-shrink: 0;
transition: box-shadow var(--duration) var(--ease);
}
.dot.idle { background: var(--accent-green); }
.dot.working { background: var(--accent-yellow); box-shadow: 0 0 8px var(--accent-yellow); animation: pulse 1.6s ease-in-out infinite; }
.dot.error { background: var(--accent-red); }
.dot.recalled{ background: var(--text-muted); }
@keyframes pulse {
0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-yellow); }
50% { opacity: 0.35; box-shadow: 0 0 2px var(--accent-yellow); }
}
.agent-row .id {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: var(--fw-medium);
color: var(--text-primary);
font-size: var(--fs-base);
}
.agent-row .meta {
font-size: var(--fs-xs);
color: var(--text-muted);
white-space: nowrap;
font-variant-numeric: tabular-nums;
}关键改点:
- 使用 Grid columns 替代旧 flex,确保 status dot / id / ctx-bar / meta 对齐稳定
- 选中行增加右侧标记和 inset shadow,方向感更强
.meta用 tabular-nums 让数字对齐- status dot 放大到 10px,更清晰
.ctx-bar {
display: inline-flex;
align-items: center;
gap: var(--sp-1);
width: 60px;
height: 6px;
border-radius: 3px;
background: var(--bg-hover);
position: relative;
overflow: hidden;
flex-shrink: 0;
vertical-align: middle;
}
.ctx-bar .fill {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 0%;
background: var(--accent-green);
border-radius: 3px;
transition: width 300ms var(--ease);
}
.ctx-bar.lvl-warn .fill { background: var(--accent-yellow); }
.ctx-bar.lvl-crit .fill { background: var(--accent-red); animation: ctx-pulse 1s ease-in-out infinite; }
.ctx-bar.lvl-none {
background: repeating-linear-gradient(
45deg, var(--bg-hover), var(--bg-hover) 3px, var(--bg-base) 3px, var(--bg-base) 6px
);
}
.ctx-bar.lvl-none .fill { display: none; }
@keyframes ctx-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* Focused view — 大 context bar */
.focused-ctx {
padding: var(--sp-1) var(--sp-4);
border-bottom: 1px solid var(--border-default);
background: var(--bg-surface);
font-size: var(--fs-sm);
color: var(--text-secondary);
display: flex;
align-items: center;
gap: var(--sp-2);
flex-wrap: wrap;
min-height: 32px;
}
.focused-ctx .ctx-bar {
width: 200px;
height: 10px;
border-radius: 5px;
}
.focused-ctx .ctx-bar .fill { border-radius: 5px; }
.focused-ctx .ctx-text {
font-variant-numeric: tabular-nums;
font-size: var(--fs-sm);
}
.focused-ctx .ctx-text.lvl-warn { color: var(--accent-yellow); }
.focused-ctx .ctx-text.lvl-crit { color: var(--accent-red); }
.focused-ctx .ctx-text.lvl-ok { color: var(--accent-green); }
.focused-ctx .ctx-text.lvl-none { color: var(--text-muted); }
.focused-ctx .ctx-agent-name {
color: var(--text-primary);
font-weight: var(--fw-semibold);
}改进: bar 从 56×4 → 60×6,加了 transition: width 平滑变化;crit 级别增加呼吸动画。
section.main-pane {
display: grid;
grid-template-rows: auto 1fr;
min-height: 0;
}
/* ─ Tab bar ───────────────────────────── */
.tabs {
display: flex;
gap: 0;
background: var(--bg-base);
border-bottom: 1px solid var(--border-default);
padding: 0 var(--sp-3);
align-items: center;
min-height: 36px;
}
.tab {
padding: var(--sp-2) var(--sp-3);
cursor: pointer;
color: var(--text-secondary);
border-bottom: 2px solid transparent;
font-size: var(--fs-base);
user-select: none;
transition: color var(--duration) var(--ease),
border-color var(--duration) var(--ease),
background var(--duration) var(--ease);
}
.tab:hover {
color: var(--text-primary);
background: var(--bg-hover);
}
.tab.active {
color: var(--text-primary);
border-bottom-color: var(--accent-blue);
}
.toolbar {
margin-left: auto;
display: flex;
gap: var(--sp-2);
align-items: center;
font-size: var(--fs-sm);
color: var(--text-secondary);
}
.toolbar button {
background: var(--bg-hover);
border: 1px solid var(--border-default);
color: var(--text-secondary);
padding: var(--sp-1) var(--sp-2);
border-radius: var(--r-sm);
font-family: inherit;
font-size: var(--fs-sm);
cursor: pointer;
transition: background var(--duration) var(--ease),
border-color var(--duration) var(--ease),
color var(--duration) var(--ease);
}
.toolbar button:hover {
background: var(--bg-active);
color: var(--text-primary);
border-color: var(--border-strong);
}
.toolbar button:focus-visible {
outline: 2px solid var(--accent-blue);
outline-offset: 2px;
}
.toolbar button.on {
background: var(--accent-blue);
border-color: var(--accent-blue);
color: #fff;
}.view-pane {
display: grid;
grid-template-rows: auto auto 1fr;
min-height: 0;
overflow: hidden;
position: relative;
}
.view-pane.hidden { display: none; }
#view-tiled.view-pane { grid-template-rows: 1fr; }
#view-pipeline.view-pane { grid-template-rows: 1fr; }
.focused-header {
padding: var(--sp-2) var(--sp-4);
border-bottom: 1px solid var(--border-default);
background: var(--bg-surface);
font-size: var(--fs-base);
color: var(--text-secondary);
min-height: 32px;
display: flex;
align-items: center;
gap: var(--sp-1);
}
.focused-header b { color: var(--text-primary); font-weight: var(--fw-semibold); }
.log {
grid-row: 3;
min-height: 0;
overflow-y: auto;
padding: var(--sp-1) var(--sp-4);
font-size: var(--fs-base);
line-height: 1.6;
}
/* ─ Log line (event row) ─────────────── */
.log-line {
display: grid;
grid-template-columns: 92px 130px 1fr;
gap: var(--sp-2);
padding: 2px 0;
white-space: pre-wrap;
word-break: break-word;
border-radius: 2px;
transition: background var(--duration) var(--ease);
}
.log-line:hover {
background: rgba(255,255,255,.03);
}
.log-line .ts {
color: var(--text-muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
font-size: var(--fs-sm);
}
.log-line .ty {
color: var(--text-secondary);
font-size: var(--fs-sm);
}
.log-line .body {
color: var(--text-primary);
}
/* Type-based coloring */
.log-line.error .ty,
.log-line.error .body { color: var(--accent-red); }
.log-line.task_start .ty { color: var(--accent-blue); }
.log-line.task_end .ty { color: var(--accent-green); }
.log-line.task_end.fail .ty { color: var(--accent-red); }
.log-line.tool_call_start .ty { color: var(--accent-yellow); }
.log-line.tool_call_end .ty { color: var(--text-secondary); }
.log-line.llm_chunk .ty { color: var(--text-muted); }
.log-line.llm_chunk .body { color: #adbac7; }
.log-line.llm_message_end .ty { color: var(--text-accent); }
.log-line.status_change .ty { color: var(--accent-purple); }
.log-line.raw .ty,
.log-line.raw .body { color: var(--text-muted); }
/* ─ LLM bubble ─────────────────────────── */
.llm-bubble {
display: grid;
grid-template-columns: 92px 130px 1fr;
gap: var(--sp-2);
padding: var(--sp-1) 0;
white-space: pre-wrap;
word-break: break-word;
border-left: 2px solid transparent;
padding-left: var(--sp-1);
transition: border-color var(--duration) var(--ease);
}
.llm-bubble.streaming {
border-left-color: var(--accent-yellow);
background: linear-gradient(90deg, rgba(210,153,34,.04), transparent);
}
.llm-bubble .ts {
color: var(--text-muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.llm-bubble .ty { color: var(--text-accent); }
.llm-bubble .body { color: #adbac7; }
.llm-bubble.streaming .ty::after {
content: " \2026";
color: var(--accent-yellow);
animation: pulse 1.4s ease-in-out infinite;
}改进点:
.log-line:hover增加细微高亮,方便跟踪行.llm-bubble.streaming增加左侧黄色指示条 + 渐变背景,一眼看出正在流式输出- 统一使用 var() 变量
.tiled-grid {
min-height: 0;
overflow-y: auto;
padding: var(--sp-3);
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: var(--sp-3);
}
.tile {
background: var(--bg-elevated);
border: 1px solid var(--border-default);
border-radius: var(--r-md);
display: flex;
flex-direction: column;
min-height: 160px;
overflow: hidden;
transition: border-color var(--duration) var(--ease),
box-shadow var(--duration) var(--ease);
}
.tile:hover {
border-color: var(--border-strong);
box-shadow: var(--shadow-sm);
}
.tile-header {
display: flex;
align-items: center;
gap: var(--sp-2);
padding: var(--sp-2) var(--sp-2);
border-bottom: 1px solid var(--border-default);
background: var(--bg-surface);
font-size: var(--fs-base);
}
.tile-header .id {
font-weight: var(--fw-semibold);
color: var(--text-primary);
}
.tile-header .meta {
margin-left: auto;
color: var(--text-muted);
font-size: var(--fs-xs);
font-variant-numeric: tabular-nums;
}
.tile-body {
flex: 1;
padding: var(--sp-1) var(--sp-2);
font-size: var(--fs-sm);
line-height: 1.5;
overflow: hidden;
display: flex;
flex-direction: column-reverse;
}
.tile-body .log-line {
grid-template-columns: 72px 100px 1fr;
gap: var(--sp-1);
}
.tile-body .llm-bubble {
grid-template-columns: 72px 100px 1fr;
gap: var(--sp-1);
}.pipeline-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--sp-3);
padding: var(--sp-4);
min-height: 0;
overflow-y: auto;
}
.pipeline-stage {
background: var(--bg-elevated);
border: 1px solid var(--border-default);
border-radius: var(--r-md);
display: flex;
flex-direction: column;
overflow: hidden;
}
.pipeline-stage-header {
padding: var(--sp-2) var(--sp-3);
border-bottom: 1px solid var(--border-default);
font-size: var(--fs-base);
font-weight: var(--fw-semibold);
color: var(--text-primary);
display: flex;
align-items: center;
gap: var(--sp-2);
background: var(--bg-surface);
}
.pipeline-stage-header .stage-icon { font-size: var(--fs-md); }
.pipeline-stage-body {
flex: 1;
padding: var(--sp-2) var(--sp-3);
font-size: var(--fs-sm);
}
.pipeline-item {
display: flex;
align-items: center;
gap: var(--sp-2);
padding: var(--sp-1) 0;
border-bottom: 1px solid var(--border-subtle);
}
.pipeline-item:last-child { border-bottom: none; }
.pipeline-item .pstat {
font-size: 13px;
width: 18px;
text-align: center;
}
.pipeline-item .pstat.pending { color: var(--text-muted); }
.pipeline-item .pstat.running { color: var(--accent-yellow); animation: pulse 1.6s ease-in-out infinite; }
.pipeline-item .pstat.done { color: var(--accent-green); }
.pipeline-item .pstat.fail { color: var(--accent-red); }
.pipeline-item .pname {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-primary);
}
.pipeline-item .pmeta {
font-size: var(--fs-xs);
color: var(--text-muted);
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.pipeline-empty {
color: var(--text-muted);
font-size: var(--fs-sm);
padding: var(--sp-3) 0;
text-align: center;
}.observer-panel {
width: 220px;
background: var(--bg-surface);
border-left: 1px solid var(--border-default);
overflow-y: auto;
padding: 0;
display: flex;
flex-direction: column;
min-height: 0;
}
.observer-panel.hidden { display: none; }
.observer-section {
padding: var(--sp-2) var(--sp-3);
border-bottom: 1px solid var(--border-default);
}
.observer-section-title {
font-size: var(--fs-xs);
font-weight: var(--fw-semibold);
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.08em;
margin-bottom: var(--sp-2);
}
.observer-stat {
display: flex;
justify-content: space-between;
align-items: center;
padding: 3px 0;
font-size: var(--fs-sm);
font-variant-numeric: tabular-nums;
}
.observer-stat .olabel { color: var(--text-secondary); }
.observer-stat .ovalue {
color: var(--text-primary);
font-weight: var(--fw-semibold);
background: var(--bg-hover);
padding: 0 var(--sp-1);
border-radius: var(--r-sm);
min-width: 28px;
text-align: right;
}
.observer-stat .ovalue.warn { color: var(--accent-yellow); background: rgba(210,153,34,.1); }
.observer-stat .ovalue.err { color: var(--accent-red); background: rgba(248,81,73,.1); }
.observer-event {
padding: var(--sp-1) 0;
font-size: var(--fs-xs);
color: var(--text-secondary);
border-bottom: 1px solid var(--border-subtle);
display: flex;
gap: var(--sp-1);
line-height: 1.4;
}
.observer-event:last-child { border-bottom: none; }
.observer-event .ote {
color: var(--accent-blue);
white-space: nowrap;
flex-shrink: 0;
}
.observer-event .ob {
color: var(--text-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}.search-box {
padding: var(--sp-1) var(--sp-4) var(--sp-2);
border-bottom: 1px solid var(--border-default);
}
.search-box input {
width: 100%;
padding: var(--sp-1) var(--sp-2);
background: var(--bg-hover);
border: 1px solid var(--border-default);
border-radius: var(--r-md);
color: var(--text-primary);
font-family: inherit;
font-size: var(--fs-base);
outline: none;
transition: border-color var(--duration) var(--ease),
box-shadow var(--duration) var(--ease);
}
.search-box input::placeholder {
color: var(--text-muted);
}
.search-box input:focus {
border-color: var(--accent-blue);
box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.search-match {
background: rgba(88, 166, 255, 0.12) !important;
border-radius: var(--r-sm);
}.chart-area {
padding: var(--sp-1) var(--sp-4);
background: var(--bg-base);
border-bottom: 1px solid var(--border-default);
display: flex;
align-items: center;
gap: var(--sp-2);
min-height: 36px;
}
.chart-area canvas {
border-radius: var(--r-sm);
background: var(--bg-elevated);
border: 1px solid var(--border-default);
}
.chart-area .chart-label {
font-size: var(--fs-xs);
color: var(--text-muted);
white-space: nowrap;
}@keyframes flash-error {
0% { border-color: var(--accent-red); box-shadow: inset 0 0 6px rgba(248,81,73,.3); }
50% { border-color: var(--accent-red); box-shadow: inset 0 0 12px rgba(248,81,73,.5); }
100% { border-color: transparent; box-shadow: none; }
}
@keyframes flash-success {
0% { border-color: var(--accent-green); box-shadow: inset 0 0 6px rgba(63,185,80,.3); }
50% { border-color: var(--accent-green); box-shadow: inset 0 0 10px rgba(63,185,80,.5); }
100% { border-color: transparent; box-shadow: none; }
}
.agent-row.flash-error { animation: flash-error 1.2s ease-out; }
.agent-row.flash-success { animation: flash-success 1.2s ease-out; }::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
background: var(--border-default);
border-radius: 4px;
border: 2px solid transparent;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }.empty {
padding: var(--sp-8);
text-align: center;
color: var(--text-muted);
font-size: var(--fs-md);
}以下是对 index.html 的具体改动建议(最小化):
<header class="topbar">
<span class="title">🤖 multi-agent dashboard</span>
<div class="stats-group"> <!-- ← NEW -->
<span class="stat">sessions <b id="stat-sessions">0</b></span>
<span class="stat">agents <b id="stat-agents">0</b></span>
<!-- ... -->
</div>
</header>原因: 不用 wrapper 时 flex-wrap: wrap 会让 title 与 stat 混在一起换行。wrapper 确保 title 始终独占 left,stats 在 right 区域换行。
<div class="toolbar">
<button id="btn-raw" title="...">raw events</button>
<button id="btn-autoscroll" class="on" title="...">autoscroll</button>
<button id="btn-observer-toggle" class="observer-toggle" title="Toggle observer panel">📊</button> <!-- ← NEW -->
<button id="btn-clear" title="...">clear</button>
</div>原因: 响应式方案需要 toggle 按钮来显示/隐藏 observer panel。
<aside class="observer-panel" id="observer-panel">
<!-- ... -->
</aside>
<!-- Optional: 响应式 overlay(由 JS 添加/移除 .open) -->无需改动现有 observer 内容,只在 CSS 中控制 .observer-panel 的 transform。
无需改动 HTML,CSS 用 media query + .mobile-open class 控制。JS 只需添加一个 toggle listener。
| 断点 | 行为 |
|---|---|
| >1100px | 三栏完整:280px sidebar | 1fr main | 220px observer |
| ≤1100px | observer 变为 overlay(fixed right, transform: translateX),toolbar 出现 toggle 按钮 |
| ≤768px | sidebar 也变为 overlay(fixed left),#app 变为单栏。toggle 按钮控制 sidebar 显示 |
| ≤480px | topbar 的 stat 改为 2 列 inline,session strip 可左右滚动 |
关键 JS 改动(约 10 行):
// Observer toggle
const btnObserverToggle = document.getElementById('btn-observer-toggle');
if (btnObserverToggle) {
btnObserverToggle.addEventListener('click', () => {
document.getElementById('observer-panel').classList.toggle('open');
});
}
// Sidebar toggle (mobile)
// 可以在 fleet header 加一个 hamburger 或利用已存在的 sidebar-section-title无需改动 dashboard.js 的渲染逻辑、状态管理、SSE 处理等——所有改动都是 CSS + HTML 结构微调 + 少量 toggle event listener。
| 维度 | 现在 | 改后 |
|---|---|---|
| 间距系统 | 混乱(6/8/10/12/14px 混用) | 统一 4px 倍数(--sp-1 到 --sp-12) |
| 颜色管理 | 硬编码 30+ 处 | 16 个 CSS 变量覆盖全部 |
| 响应式 | 不存在 | 3 个断点(1100/768/480) |
| 卡片感 | 无(只有 border-left) | 圆角 + shadow + hover 反馈 |
| Context bar | 56×4px 难读 | 60×6px + transition 动画 |
| 视觉层次 | 全 12-13px | 4 级字号 + 4 级权重 |
| 颜色对比度 | #c9d1d9 on #0d1117 (7.58:1) | #e6edf3 on #0d1117 (10.8:1) —— 更亮的主色 |
| Streaming 指示 | 仅文字 "…" | 左侧彩色边框 + 渐变背景 |
| Focus ring | 仅 search input | 所有 button + input |
| 代码体积 | 540 行 flat CSS | 约 480 行变量驱动 CSS |
| 维护性 | 改颜色要搜 30+ 处 | 改 1 个变量值 |
- 评审此 proposal
- 确认 HTML 结构调整(stats-group wrapper + observer-toggle button)
- 替换
styles.css为上述 Design System 版本 - 在 dashboard.js 中添加约 10-15 行 toggle listener 代码
- 在浏览器中验证 1100/768/480 三个断点
- 检查所有现有功能不受影响:focused/tiled/pipeline view、SSE 流式更新、搜索过滤、flash 动画、context bar 更新