Skip to content
TypeScript

Redesign report.html into a single-screen decision dashboard

Claude10715262d370
diff --git a/NOTES.md b/NOTES.md
index c95af58..3bb4473 100644
--- a/NOTES.md
+++ b/NOTES.md
@@ -2,6 +2,20 @@
비전문 감시자용 기록. 용어 최소화, AS-IS → TO-BE.
+## 2026-06-30 — report.html 전면 재설계(결정 대시보드)
+
+**AS-IS**: 리포트가 사실상 "표 8개 + 작은 산점도 1개"의 스크롤 더미였다 — 한눈에 답이 안 보이고,
+조합을 나란히 비교하기 어렵고, 5개 축(정확도·비용·시간·토큰·서브에이전트)이 2D 점 하나로 뭉개졌다.
+
+**TO-BE**: `report.html` 을 **단일 화면 결정 대시보드**로 재설계(여전히 외부 JS/CDN/script 0 — 인터랙션은
+전부 CSS: 라디오 :checked 탭 · :hover · <details>).
+- **3개 탭** — Decide(한눈에 보는 답) · Detail(표 드릴다운) · Flow(흐름 그래프).
+- **Decide** 신규 4종: ① 관점별 승자 **스트립**(카드), ② 강화된 **파레토 평면**(격자·눈금·지배점
+ 회색·경계 로프선·hover 확대), ③ **평행좌표**(조합당 한 선, 전 축 트레이드오프, hover 로 한 조합만
+ 강조 — 빠져 있던 다차원 비교 뷰), ④ **축별 순위막대**(스몰 멀티플).
+- **디자인 시스템** 실제 적용 — THEME 토큰, 조합별 **고정 색 정체성**을 모든 차트에서 공유, 위계/여백 정리.
+- 테스트가 요구하는 제목/클래스 모두 유지(59 테스트 그대로 통과).
+
## 2026-06-29 — 배너·다이어그램·OpenRouter·view
- **배너**: 레퍼런스(ASCII-pixel 영웅 / HERMES 3B 듀오톤 카드)에 맞춰 `assets/theseus-banner.svg` 를
diff --git a/src/i18n.ts b/src/i18n.ts
index 00b2970..45406a5 100644
--- a/src/i18n.ts
+++ b/src/i18n.ts
@@ -38,6 +38,23 @@ export const STRINGS: Record<string, Entry> = {
kr: "MOCK 러너 — 합성 결과(오프라인). 실측 아님.",
},
+ // dashboard chrome
+ tab_decide: { en: "Decide", kr: "결정" },
+ tab_detail: { en: "Detail", kr: "상세" },
+ tab_flow: { en: "Flow", kr: "흐름" },
+ decide_lead: {
+ en: "The answer at a glance — pick the trade-off, not a single score.",
+ kr: "한눈에 보는 답 — 단일 점수가 아니라 트레이드오프를 고른다.",
+ },
+ sec_parallel: { en: "Trade-off across every axis", kr: "전 축 트레이드오프" },
+ parallel_note: {
+ en: "one line per combo · axes oriented so up = better · hover a line to isolate it",
+ kr: "조합당 한 선 · 위로 갈수록 좋음 · 선에 마우스를 올리면 그 조합만 강조",
+ },
+ sec_rankings: { en: "Ranking on each axis", kr: "축별 순위" },
+ legend_combos: { en: "Combos", kr: "조합" },
+ axis_better: { en: "better", kr: "좋음" },
+
// report sections
sec_best: { en: "0. Best by perspective", kr: "0. 관점별 최적" },
sec_score: { en: "0.5 Composite score (opt-in)", kr: "0.5 종합점수 (opt-in)" },
diff --git a/src/report.ts b/src/report.ts
index b32636a..20b9880 100644
--- a/src/report.ts
+++ b/src/report.ts
@@ -1,7 +1,11 @@
/**
- * 리포트 (PRD §14, §22.3). self-contained HTML(외부 JS/CDN 0, 모든 외부 입력 escape) + 산점도 SVG.
- * 섹션 0 관점별 최적 · 0.5 종합점수(opt-in) · 1 정확도 · 2 효율 · 3 가성비 산점도 ·
- * 4 task 매트릭스 · 5 흐름 그래프(+토글) · 6 실패 원인 · 7 미수집 지표.
+ * 리포트 (PRD §14, §22.3) — self-contained 결정 대시보드(외부 JS/CDN 0, script 0, 모든 입력 escape).
+ * 인터랙션은 전부 CSS 로만: 라디오 :checked 탭 · :hover 하이라이트 · <details> 토글.
+ *
+ * 탭 구성:
+ * Decide — 한눈에 보는 답: 관점별 승자 스트립 · 파레토 결정 평면 · 평행좌표(전 축 트레이드오프) · 축별 순위막대
+ * Detail — 표(정확도·효율·종합점수·과제 매트릭스·실패 원인·미수집·제외) 드릴다운
+ * Flow — 서브에이전트 흐름 그래프
*/
import { writeFileSync } from "node:fs";
import { THEME, philosophy, svgWordmark } from "./brand";
@@ -26,6 +30,29 @@ export interface ReportInput {
const COST_MARK = { actual: "✓", estimated: "~", none: "" } as const;
+/** 조합별 안정적 색 — sortCombos 순서 인덱스로 결정적 배정(모든 차트에서 동일 색). */
+const PALETTE = [
+ "#c08a3e", // rope
+ "#7fb2c9", // foam
+ "#2e8b6f", // ok green
+ "#b5651d", // hull amber
+ "#8b5cf6", // violet
+ "#e07a5f", // terracotta
+ "#3d8eb9", // steel blue
+ "#d4a017", // goldenrod
+ "#5b8c5a", // moss
+ "#c0392b", // danger red
+ "#577590", // slate
+ "#9b5de5", // orchid
+];
+function comboColorMap(metrics: ComboMetrics[]): Map<string, string> {
+ const order = sortCombos(metrics);
+ const map = new Map<string, string>();
+ order.forEach((m, i) => map.set(m.comboId, PALETTE[i % PALETTE.length]!));
+ return map;
+}
+
+// ── 포맷터 ───────────────────────────────────────────────
function fmtMetric(metric: keyof ComboMetrics, v: number): string {
switch (metric) {
case "accuracy":
@@ -51,39 +78,156 @@ function th(cells: string[]): string {
function td(cells: string[], cls: (i: number) => string = () => ""): string {
return `<tr>${cells.map((c, i) => `<td class="${cls(i)}">${c}</td>`).join("")}</tr>`;
}
+function section(title: string, body: string, sub?: string): string {
+ const s = sub ? `<p class="sub">${esc(sub)}</p>` : "";
+ return `<section><h2>${esc(title)}</h2>${s}${body}</section>`;
+}
+function swatch(color: string): string {
+ return `<span class="sw" style="background:${color}"></span>`;
+}
+
+// ── 축 정의(공통) ─────────────────────────────────────────
+type Dir = "max" | "min";
+interface Axis {
+ key: keyof ComboMetrics;
+ label: string;
+ dir: Dir;
+ nullable?: boolean;
+ fmt: (v: number) => string;
+}
+function axes(lang: Lang): Axis[] {
+ return [
+ { key: "accuracy", label: tr(lang, "col_acc"), dir: "max", fmt: (v) => `${v.toFixed(0)}%` },
+ {
+ key: "costUsd",
+ label: tr(lang, "col_cost"),
+ dir: "min",
+ nullable: true,
+ fmt: (v) => `$${v.toFixed(4)}`,
+ },
+ {
+ key: "wallTimeMs",
+ label: tr(lang, "col_wall"),
+ dir: "min",
+ fmt: (v) => `${(v / 1000).toFixed(1)}s`,
+ },
+ {
+ key: "totalTokens",
+ label: tr(lang, "col_tokens"),
+ dir: "min",
+ fmt: (v) => `${Math.round(v / 1000)}k`,
+ },
+ {
+ key: "subagentCount",
+ label: tr(lang, "col_subagents"),
+ dir: "min",
+ fmt: (v) => v.toFixed(1),
+ },
+ ];
+}
+/** 한 축의 유한값 범위. */
+function axisRange(metrics: ComboMetrics[], a: Axis): { min: number; max: number } | null {
+ const vs = metrics
+ .map((m) => m[a.key])
+ .filter((v): v is number => typeof v === "number" && Number.isFinite(v));
+ if (!vs.length) return null;
+ return { min: Math.min(...vs), max: Math.max(...vs) };
+}
+/** 0(나쁨)–1(좋음) 정규화. 동률 범위는 0.5. */
+function norm(v: number, r: { min: number; max: number }, dir: Dir): number {
+ const span = r.max - r.min;
+ if (span === 0) return 0.5;
+ return dir === "max" ? (v - r.min) / span : (r.max - v) / span;
+}
-function section(title: string, body: string): string {
- return `<section><h2>${esc(title)}</h2>${body}</section>`;
+// ── 0. 관점별 승자 스트립 ─────────────────────────────────
+function verdictStrip(input: ReportInput, colors: Map<string, string>): string {
+ const lang = input.language;
+ const best = bestByPerspectiveDetailed(input.metrics, lang, { judge: input.judge });
+ const cards = best
+ .map((b) => {
+ const c = colors.get(b.comboId) ?? THEME.mist;
+ return `<div class="vcard" style="--c:${c}">
+<div class="vlabel">${esc(b.label)}</div>
+<div class="vval">${esc(fmtMetric(b.metric, b.value))}</div>
+<div class="vcombo">${swatch(c)}<code>${esc(b.comboId)}</code></div>
+</div>`;
+ })
+ .join("");
+ return `<div class="verdict">${cards}</div>`;
+}
+
+// ── 범례(조합 색) ─────────────────────────────────────────
+function legend(metrics: ComboMetrics[], colors: Map<string, string>, lang: Lang): string {
+ const items = sortCombos(metrics)
+ .map(
+ (m) =>
+ `<span class="lg"><span class="sw" style="background:${colors.get(m.comboId)}"></span><code>${esc(m.comboId)}</code></span>`,
+ )
+ .join("");
+ return `<div class="legend"><span class="lg-title">${esc(tr(lang, "legend_combos"))}</span>${items}</div>`;
+}
+
+// ── 파레토 결정 평면 ──────────────────────────────────────
+function paretoFrontier(pts: ComboMetrics[]): ComboMetrics[] {
+ return pts.filter(
+ (a) =>
+ !pts.some(
+ (b) =>
+ b.comboId !== a.comboId &&
+ b.costUsd! <= a.costUsd! &&
+ b.accuracy >= a.accuracy &&
+ (b.costUsd! < a.costUsd! || b.accuracy > a.accuracy),
+ ),
+ );
}
-// ── 산점도 ───────────────────────────────────────────────
-function renderScatter(metrics: ComboMetrics[], lang: Lang): string {
+function renderScatter(metrics: ComboMetrics[], colors: Map<string, string>, lang: Lang): string {
const pts = metrics.filter((m) => m.costUsd !== null && Number.isFinite(m.costUsd));
- if (!pts.length) return `<p>${esc(tr(lang, "uncollected_note"))}</p>`;
- const W = 520;
- const H = 320;
- const pad = 50;
+ if (!pts.length) return `<p class="muted">${esc(tr(lang, "uncollected_note"))}</p>`;
+ const W = 640;
+ const H = 380;
+ const padL = 58;
+ const padR = 24;
+ const padT = 24;
+ const padB = 46;
const costs = pts.map((m) => m.costUsd!);
const maxCost = Math.max(...costs, 0.0001);
- const xf = (c: number) => pad + (c / maxCost) * (W - 2 * pad);
- const yf = (a: number) => H - pad - (a / 100) * (H - 2 * pad);
- const colors = ["#7c3aed", "#0ea5e9", "#10b981", "#f59e0b", "#ef4444", "#64748b", "#db2777"];
- const parts: string[] = [];
- parts.push(
- `<svg viewBox="0 0 ${W + 180} ${H}" width="${W + 180}" height="${H}" xmlns="http://www.w3.org/2000/svg" font-family="system-ui,sans-serif">`,
- );
- parts.push(
- `<line x1="${pad}" y1="${H - pad}" x2="${W - pad}" y2="${H - pad}" stroke="#94a3b8"/>`,
+ const xf = (c: number) => padL + (c / maxCost) * (W - padL - padR);
+ const yf = (a: number) => H - padB - (a / 100) * (H - padT - padB);
+ const p: string[] = [];
+ p.push(
+ `<svg viewBox="0 0 ${W} ${H}" width="100%" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" font-family="ui-sans-serif,system-ui,sans-serif" class="pareto">`,
);
- parts.push(`<line x1="${pad}" y1="${pad}" x2="${pad}" y2="${H - pad}" stroke="#94a3b8"/>`);
- parts.push(
- `<text x="${W / 2}" y="${H - 12}" font-size="11" text-anchor="middle" fill="#475569">${esc(tr(lang, "col_cost"))} ($)</text>`,
+ // gridlines + ticks (accuracy 0..100 by 25; cost 0..max by quarters)
+ for (let g = 0; g <= 100; g += 25) {
+ const y = yf(g);
+ p.push(
+ `<line x1="${padL}" y1="${y}" x2="${W - padR}" y2="${y}" stroke="${THEME.grid}" stroke-width="1"/>`,
+ );
+ p.push(
+ `<text x="${padL - 8}" y="${y + 3}" font-size="10" text-anchor="end" fill="${THEME.mist}">${g}</text>`,
+ );
+ }
+ for (let q = 0; q <= 4; q++) {
+ const c = (maxCost * q) / 4;
+ const x = xf(c);
+ p.push(
+ `<line x1="${x}" y1="${padT}" x2="${x}" y2="${H - padB}" stroke="${THEME.grid}" stroke-width="1" opacity="0.6"/>`,
+ );
+ p.push(
+ `<text x="${x}" y="${H - padB + 16}" font-size="10" text-anchor="middle" fill="${THEME.mist}">$${c.toFixed(4)}</text>`,
+ );
+ }
+ // axis titles
+ p.push(
+ `<text x="${(padL + W - padR) / 2}" y="${H - 6}" font-size="11" text-anchor="middle" fill="${THEME.ink}">${esc(tr(lang, "col_cost"))} ($) →</text>`,
);
- parts.push(
- `<text x="14" y="${H / 2}" font-size="11" text-anchor="middle" fill="#475569" transform="rotate(-90 14 ${H / 2})">${esc(tr(lang, "col_acc"))} (%)</text>`,
+ p.push(
+ `<text x="14" y="${(padT + H - padB) / 2}" font-size="11" text-anchor="middle" fill="${THEME.ink}" transform="rotate(-90 14 ${(padT + H - padB) / 2})">${esc(tr(lang, "col_acc"))} (%) ↑</text>`,
);
- // Pareto frontier: 더 싸면서 더 정확한 조합에 지배당하지 않는 점들(낮은 비용·높은 정확도).
+ // Pareto frontier: 더 싸면서 더 정확 — 비지배 집합.
const frontier = paretoFrontier(pts);
const fset = new Set(frontier.map((m) => m.comboId));
const fpath = frontier
@@ -94,52 +238,149 @@ function renderScatter(metrics: ComboMetrics[], lang: Lang): string {
)
.join(" ");
if (frontier.length > 1) {
- parts.push(
- `<path d="${fpath}" fill="none" stroke="${THEME.rope}" stroke-width="2" stroke-dasharray="5 3" opacity="0.8"/>`,
+ p.push(
+ `<path d="${fpath}" fill="none" stroke="${THEME.rope}" stroke-width="2.5" stroke-dasharray="6 4" opacity="0.9"/>`,
);
}
- parts.push(
- `<text x="${pad + 6}" y="${pad - 8}" font-size="10" fill="${THEME.rope}">— ${esc(tr(lang, "pareto_frontier"))}</text>`,
+ p.push(
+ `<text x="${padL + 6}" y="${padT + 4}" font-size="11" fill="${THEME.rope}" font-weight="600">— ${esc(tr(lang, "pareto_frontier"))} ★</text>`,
);
- pts.forEach((m, i) => {
- const color = colors[i % colors.length]!;
- const onFront = fset.has(m.comboId);
- parts.push(
- `<circle cx="${xf(m.costUsd!).toFixed(1)}" cy="${yf(m.accuracy).toFixed(1)}" r="${onFront ? 7 : 5}" fill="${color}" opacity="0.85" stroke="${onFront ? THEME.rope : "none"}" stroke-width="${onFront ? 2.5 : 0}"><title>${esc(m.comboId)} · ${m.accuracy.toFixed(1)}% · $${m.costUsd!.toFixed(4)}</title></circle>`,
+ // dominated 먼저(흐리게), frontier 나중(선명·고리)
+ const draw = (m: ComboMetrics, onFront: boolean) => {
+ const color = colors.get(m.comboId) ?? THEME.mist;
+ const cx = xf(m.costUsd!).toFixed(1);
+ const cy = yf(m.accuracy).toFixed(1);
+ if (onFront) {
+ p.push(
+ `<g class="pt front"><circle cx="${cx}" cy="${cy}" r="11" fill="none" stroke="${THEME.rope}" stroke-width="2"/><circle cx="${cx}" cy="${cy}" r="6.5" fill="${color}"/><title>★ ${esc(m.comboId)} — ${m.accuracy.toFixed(1)}% · $${m.costUsd!.toFixed(4)}</title></g>`,
+ );
+ } else {
+ p.push(
+ `<g class="pt"><circle cx="${cx}" cy="${cy}" r="5" fill="${color}" opacity="0.5"/><title>${esc(m.comboId)} — ${m.accuracy.toFixed(1)}% · $${m.costUsd!.toFixed(4)}</title></g>`,
+ );
+ }
+ };
+ for (const m of pts) if (!fset.has(m.comboId)) draw(m, false);
+ for (const m of pts) if (fset.has(m.comboId)) draw(m, true);
+ p.push("</svg>");
+ return `<div class="chart">${p.join("")}</div>`;
+}
+
+// ── 평행좌표(전 축 트레이드오프) ──────────────────────────
+function parallelCoords(metrics: ComboMetrics[], colors: Map<string, string>, lang: Lang): string {
+ const sorted = sortCombos(metrics);
+ if (sorted.length < 2) return `<p class="muted">—</p>`;
+ const ax = axes(lang);
+ const ranges = ax.map((a) => axisRange(metrics, a));
+ const W = 720;
+ const H = 320;
+ const padL = 40;
+ const padR = 40;
+ const padT = 46;
+ const padB = 40;
+ const yTop = padT;
+ const yBot = H - padB;
+ const n = ax.length;
+ const xAt = (i: number) => padL + (n === 1 ? 0 : (i * (W - padL - padR)) / (n - 1));
+ const yAt = (norm01: number) => yBot - norm01 * (yBot - yTop);
+
+ const p: string[] = [];
+ p.push(
+ `<svg viewBox="0 0 ${W} ${H}" width="100%" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" font-family="ui-sans-serif,system-ui,sans-serif" class="pc">`,
+ );
+ // axes
+ ax.forEach((a, i) => {
+ const x = xAt(i);
+ const r = ranges[i];
+ p.push(
+ `<line x1="${x}" y1="${yTop}" x2="${x}" y2="${yBot}" stroke="${THEME.grid}" stroke-width="1.5"/>`,
);
- parts.push(
- `<text x="${W - pad + 14}" y="${pad + 8 + i * 16}" font-size="10" fill="#334155">${onFront ? "★ " : ""}<tspan fill="${color}">●</tspan> ${esc(m.comboId)}</text>`,
+ p.push(
+ `<text x="${x}" y="${yTop - 22}" font-size="11" font-weight="600" text-anchor="middle" fill="${THEME.ink}">${esc(a.label)}</text>`,
);
+ p.push(
+ `<text x="${x}" y="${yTop - 9}" font-size="9" text-anchor="middle" fill="${THEME.rope}">↑ ${esc(tr(lang, "axis_better"))}</text>`,
+ );
+ if (r) {
+ // top = better extreme, bottom = worse extreme
+ const topVal = a.dir === "max" ? r.max : r.min;
+ const botVal = a.dir === "max" ? r.min : r.max;
+ p.push(
+ `<text x="${x}" y="${yTop - 1}" font-size="9" text-anchor="middle" fill="${THEME.mist}">${esc(a.fmt(topVal))}</text>`,
+ );
+ p.push(
+ `<text x="${x}" y="${yBot + 14}" font-size="9" text-anchor="middle" fill="${THEME.mist}">${esc(a.fmt(botVal))}</text>`,
+ );
+ }
});
- parts.push("</svg>");
- return `<div class="svg-wrap">${parts.join("")}</div>`;
+ // one polyline per combo
+ for (const m of sorted) {
+ const color = colors.get(m.comboId) ?? THEME.mist;
+ const verts: { x: number; y: number; label: string }[] = [];
+ const titleParts: string[] = [];
+ ax.forEach((a, i) => {
+ const v = m[a.key];
+ const r = ranges[i];
+ if (typeof v !== "number" || !Number.isFinite(v) || !r) {
+ titleParts.push(`${a.label}: ${tr(lang, "uncollected_note")}`);
+ return; // nullable(cost) 미수집 → 정점 생략(선이 그 축을 건너뜀)
+ }
+ const x = xAt(i);
+ const y = yAt(norm(v, r, a.dir));
+ verts.push({ x, y, label: a.fmt(v) });
+ titleParts.push(`${a.label}: ${a.fmt(v)}`);
+ });
+ if (verts.length < 2) continue;
+ const pts = verts.map((d) => `${d.x.toFixed(1)},${d.y.toFixed(1)}`).join(" ");
+ p.push(
+ `<g class="pcg"><polyline class="pcline" points="${pts}" fill="none" stroke="${color}" stroke-width="2"/>`,
+ );
+ for (const d of verts)
+ p.push(
+ `<circle class="pcdot" cx="${d.x.toFixed(1)}" cy="${d.y.toFixed(1)}" r="3.2" fill="${color}"/>`,
+ );
+ p.push(`<title>${esc(m.comboId)} · ${esc(titleParts.join(" · "))}</title></g>`);
+ }
+ p.push("</svg>");
+ return `<div class="chart">${p.join("")}</div>`;
}
-/** 비용↓·정확도↑ 기준 비지배 집합(Pareto frontier). */
-function paretoFrontier(pts: ComboMetrics[]): ComboMetrics[] {
- return pts.filter(
- (a) =>
- !pts.some(
- (b) =>
- b.comboId !== a.comboId &&
- b.costUsd! <= a.costUsd! &&
- b.accuracy >= a.accuracy &&
- (b.costUsd! < a.costUsd! || b.accuracy > a.accuracy),
- ),
- );
+// ── 축별 순위막대(스몰 멀티플) ────────────────────────────
+function rankBars(metrics: ComboMetrics[], colors: Map<string, string>, lang: Lang): string {
+ const ax = axes(lang);
+ const blocks = ax
+ .map((a) => {
+ const r = axisRange(metrics, a);
+ if (!r) return "";
+ const ranked = metrics
+ .filter((m) => typeof m[a.key] === "number" && Number.isFinite(m[a.key] as number))
+ .map((m) => ({ m, v: m[a.key] as number, n: norm(m[a.key] as number, r, a.dir) }))
+ .sort((x, y) => y.n - x.n);
+ const rows = ranked
+ .map((d, i) => {
+ const color = colors.get(d.m.comboId) ?? THEME.mist;
+ const w = Math.max(4, d.n * 100);
+ return `<div class="rb-row${i === 0 ? " rb-best" : ""}">
+<span class="rb-name">${swatch(color)}<code>${esc(d.m.comboId)}</code></span>
+<span class="rb-bar"><i style="width:${w.toFixed(1)}%;background:${color}"></i></span>
+<span class="rb-val">${esc(a.fmt(d.v))}${i === 0 ? " <b>★</b>" : ""}</span>
+</div>`;
+ })
+ .join("");
+ return `<div class="rb-block"><div class="rb-title">${esc(a.label)} <span class="rb-dir">↑ ${esc(tr(lang, "axis_better"))}</span></div>${rows}</div>`;
+ })
+ .join("");
+ return `<div class="rankings">${blocks}</div>`;
}
-export function renderReportHtml(input: ReportInput): string {
- const { language: lang } = input;
+// ── Detail 탭의 표들 ──────────────────────────────────────
+function tableBlocks(input: ReportInput): string[] {
+ const lang = input.language;
const sorted = sortCombos(input.metrics);
const blocks: string[] = [];
- if (input.mock) {
- blocks.push(`<div class="banner mock">${esc(tr(lang, "mock_banner"))}</div>`);
- }
-
- // 0. 관점별 최적
+ // 0. 관점별 최적(표 형태도 유지 — 접근성/복붙)
{
const best = bestByPerspectiveDetailed(input.metrics, lang, { judge: input.judge });
const rows = best
@@ -189,7 +430,7 @@ export function renderReportHtml(input: ReportInput): string {
);
}
- // 2. 효율 (combo-id · subagents · total tok · cost · est.cost · Δcost · wall · turns · tool calls)
+ // 2. 효율
{
const minSub = Math.min(...sorted.map((m) => m.subagentCount));
const minTok = Math.min(...sorted.map((m) => m.totalTokens));
@@ -234,9 +475,6 @@ export function renderReportHtml(input: ReportInput): string {
);
}
- // 3. 산점도
- blocks.push(section(tr(lang, "sec_scatter"), renderScatter(input.metrics, lang)));
-
// 4. task 매트릭스
{
const head = th([tr(lang, "col_combo"), ...input.tasks]);
@@ -253,12 +491,6 @@ export function renderReportHtml(input: ReportInput): string {
blocks.push(section(tr(lang, "sec_matrix"), `<table class="matrix">${head}${rows}</table>`));
}
- // 5. 흐름 그래프
- {
- const g = input.graphs.map((gr) => graphSection(gr, lang)).join("\n");
- blocks.push(section(tr(lang, "sec_flow"), g || "<p>—</p>"));
- }
-
// 6. 실패 task & 원인
{
const fails = input.results.filter((r) => !r.success || r.resolved === false);
@@ -319,35 +551,135 @@ export function renderReportHtml(input: ReportInput): string {
),
);
}
+ return blocks;
+}
+
+// ── 셸(탭 + 디자인 시스템) ────────────────────────────────
+export function renderReportHtml(input: ReportInput): string {
+ const lang = input.language;
+ const colors = comboColorMap(input.metrics);
+
+ const mockBanner = input.mock
+ ? `<div class="banner mock">${esc(tr(lang, "mock_banner"))}</div>`
+ : "";
+
+ // Decide 탭
+ const decide = [
+ `<p class="lead">${esc(tr(lang, "decide_lead"))}</p>`,
+ verdictStrip(input, colors),
+ legend(input.metrics, colors, lang),
+ section(tr(lang, "sec_scatter"), renderScatter(input.metrics, colors, lang)),
+ section(
+ tr(lang, "sec_parallel"),
+ parallelCoords(input.metrics, colors, lang),
+ tr(lang, "parallel_note"),
+ ),
+ section(tr(lang, "sec_rankings"), rankBars(input.metrics, colors, lang)),
+ ].join("\n");
+
+ // Detail 탭
+ const detail = tableBlocks(input).join("\n");
+
+ // Flow 탭
+ const flow = section(
+ tr(lang, "sec_flow"),
+ input.graphs.map((gr) => graphSection(gr, lang)).join("\n") || "<p>—</p>",
+ );
return `<!doctype html><html lang="${lang}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>theseus — ${esc(tr(lang, "results_table"))}</title>
<style>
-body{font-family:ui-sans-serif,system-ui,sans-serif;background:#f8fafc;color:#0f172a;margin:0;padding:24px;line-height:1.45}
-h1{font-size:22px}h2{font-size:16px;border-bottom:2px solid #e2e8f0;padding-bottom:4px;margin-top:28px}
-table{border-collapse:collapse;margin:8px 0;font-size:13px;background:#fff}
-th,td{border:1px solid #e2e8f0;padding:5px 9px;text-align:left}
-th{background:#f1f5f9}
+:root{--sea:${THEME.sea};--seaDeep:${THEME.seaDeep};--hull:${THEME.hull};--sail:${THEME.sail};--rope:${THEME.rope};--foam:${THEME.foam};--ink:${THEME.ink};--mist:${THEME.mist};--grid:${THEME.grid}}
+*{box-sizing:border-box}
+body{font-family:ui-sans-serif,system-ui,sans-serif;background:#f4f6f8;color:var(--ink);margin:0;padding:0;line-height:1.45}
+.wrap{max-width:980px;margin:0 auto;padding:20px}
+h2{font-size:15px;letter-spacing:.01em;margin:26px 0 6px;padding-bottom:5px;border-bottom:2px solid var(--rope)}
+.sub{color:var(--mist);font-size:12px;margin:0 0 10px}
+.lead{font-size:15px;color:var(--hull);font-weight:600;margin:18px 0 14px}
code{font-family:ui-monospace,monospace;font-size:12px}
+table{border-collapse:collapse;margin:8px 0;font-size:13px;background:#fff;width:100%}
+th,td{border:1px solid var(--grid);padding:5px 9px;text-align:left}
+th{background:#eef2f6}
.best{background:#dcfce7;font-weight:600}
.pass{background:#dcfce7;text-align:center;color:#15803d}
.failc{background:#fee2e2;text-align:center;color:#b91c1c}
.na{text-align:center;color:#cbd5e1}
-.muted{color:#94a3b8}
-.banner.mock{background:#fef3c7;border:1px solid #f59e0b;color:#92400e;padding:8px 12px;border-radius:8px;margin-bottom:12px;font-weight:600}
-.theseus-graph{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:14px;margin:12px 0;overflow:auto}
+.muted{color:var(--mist)}
+.sw{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:middle}
+.banner.mock{background:#fef3c7;border:1px solid #f59e0b;color:#92400e;padding:9px 13px;border-radius:8px;margin:12px 0;font-weight:600}
+/* hero */
+.hero{background:linear-gradient(135deg,var(--sea),var(--seaDeep));color:var(--sail);padding:20px 24px;display:flex;align-items:center;gap:18px;flex-wrap:wrap}
+.hero .meta{display:flex;flex-direction:column;gap:3px}
+.hero .tag{font-size:13px;opacity:.9}
+.hero .bench{color:var(--foam);font-family:ui-monospace,monospace;font-size:12px}
+/* tabs (CSS-only via radio :checked) */
+.tabs input{position:absolute;opacity:0;pointer-events:none}
+.tabnav{display:flex;gap:4px;background:var(--hull);padding:0 24px}
+.tabnav label{cursor:pointer;color:#cbd8e4;padding:11px 18px;font-size:13px;font-weight:600;border-bottom:3px solid transparent}
+.tabnav label:hover{color:#fff}
+#t-decide:checked~.tabnav label[for=t-decide],
+#t-detail:checked~.tabnav label[for=t-detail],
+#t-flow:checked~.tabnav label[for=t-flow]{color:#fff;border-bottom-color:var(--rope)}
+.panel{display:none}
+#t-decide:checked~.wrap .p-decide,
+#t-detail:checked~.wrap .p-detail,
+#t-flow:checked~.wrap .p-flow{display:block}
+/* verdict strip */
+.verdict{display:grid;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:10px;margin:8px 0 4px}
+.vcard{background:#fff;border:1px solid var(--grid);border-left:5px solid var(--c);border-radius:10px;padding:11px 13px}
+.vlabel{font-size:11px;color:var(--mist);text-transform:uppercase;letter-spacing:.04em}
+.vval{font-size:22px;font-weight:700;color:var(--hull);margin:3px 0}
+.vcombo code{color:var(--ink)}
+/* legend */
+.legend{display:flex;flex-wrap:wrap;gap:4px 14px;align-items:center;margin:14px 0 4px;font-size:12px;color:var(--mist)}
+.legend .lg-title{font-weight:600;color:var(--ink);margin-right:4px}
+.legend .lg{display:inline-flex;align-items:center}
+/* charts */
+.chart{background:#fff;border:1px solid var(--grid);border-radius:12px;padding:14px;margin:8px 0;overflow:hidden}
+.pareto .pt circle{transition:r .1s}
+.pareto .pt:hover circle{r:9}
+.pc .pcline{opacity:.55;transition:opacity .1s,stroke-width .1s}
+.pc .pcdot{opacity:.55;transition:opacity .1s}
+.pc:hover .pcline,.pc:hover .pcdot{opacity:.13}
+.pc .pcg:hover .pcline{opacity:1;stroke-width:3.4}
+.pc .pcg:hover .pcdot{opacity:1}
+/* rankings small-multiples */
+.rankings{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:14px;margin:8px 0}
+.rb-block{background:#fff;border:1px solid var(--grid);border-radius:10px;padding:10px 12px}
+.rb-title{font-size:12px;font-weight:700;color:var(--hull);margin-bottom:7px}
+.rb-dir{font-weight:400;color:var(--rope);font-size:10px}
+.rb-row{display:grid;grid-template-columns:1fr 90px auto;align-items:center;gap:8px;font-size:11px;padding:1.5px 0}
+.rb-best{font-weight:600}
+.rb-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+.rb-bar{background:#eef2f6;border-radius:4px;height:9px;overflow:hidden}
+.rb-bar i{display:block;height:100%;border-radius:4px}
+.rb-val{color:var(--ink);white-space:nowrap;font-variant-numeric:tabular-nums}
+.rb-val b{color:var(--rope)}
+/* flow */
+.theseus-graph{background:#fff;border:1px solid var(--grid);border-radius:12px;padding:14px;margin:12px 0;overflow:auto}
.theseus-graph h3{font-size:13px;margin:0 0 8px}
.svg-wrap{overflow:auto}
-.theseus-hero{background:${THEME.sea};color:${THEME.sail};border-radius:12px;padding:16px 20px;margin:-8px 0 18px;display:flex;align-items:center;gap:16px}
-.theseus-hero .sub{font-size:13px;opacity:.85}
-.theseus-hero .bench{color:${THEME.foam};font-family:ui-monospace,monospace;font-size:12px}
-h2{border-bottom-color:${THEME.rope}}
-.theseus-foot{margin-top:32px;padding-top:14px;border-top:1px solid ${THEME.grid};color:${THEME.mist};font-size:12px;font-style:italic}
+.foot{margin:34px 0 8px;padding-top:14px;border-top:1px solid var(--grid);color:var(--mist);font-size:12px;font-style:italic}
${DETAILS_CSS}
</style></head><body>
-<header class="theseus-hero">${svgWordmark()}<div><div class="sub">${esc(tr(lang, "app_tagline"))}</div><div class="bench">bench: ${esc(input.bench)}</div></div></header>
-${blocks.join("\n")}
-<footer class="theseus-foot">⚓ ${esc(tr(lang, "philosophy_label"))} — ${esc(philosophy(lang))}</footer>
+<header class="hero">${svgWordmark()}<div class="meta"><span class="tag">${esc(tr(lang, "app_tagline"))}</span><span class="bench">bench: ${esc(input.bench)}</span></div></header>
+<form class="tabs">
+<input type="radio" name="tab" id="t-decide" checked>
+<input type="radio" name="tab" id="t-detail">
+<input type="radio" name="tab" id="t-flow">
+<nav class="tabnav">
+<label for="t-decide">${esc(tr(lang, "tab_decide"))}</label>
+<label for="t-detail">${esc(tr(lang, "tab_detail"))}</label>
+<label for="t-flow">${esc(tr(lang, "tab_flow"))}</label>
+</nav>
+<div class="wrap">
+${mockBanner}
+<div class="panel p-decide">${decide}</div>
+<div class="panel p-detail">${detail}</div>
+<div class="panel p-flow">${flow}</div>
+<footer class="foot">⚓ ${esc(tr(lang, "philosophy_label"))} — ${esc(philosophy(lang))}</footer>
+</div>
+</form>
</body></html>`;
}