Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
refactor: move dashboard mode switch to header
Garm06c1b32cdf15
diff --git a/headroom/dashboard/templates/dashboard.html b/headroom/dashboard/templates/dashboard.htmlindex bfc8dea97..e20832b46 100644--- a/headroom/dashboard/templates/dashboard.html+++ b/headroom/dashboard/templates/dashboard.html@@ -33,12 +33,24 @@</head><body class="text-gray-200 min-h-screen" x-data="dashboard()" x-init="init()"><!-- Header -->- <header class="border-b border-border px-6 py-4 flex items-center justify-between">+ <header class="border-b border-border px-6 py-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between"><div class="flex items-center gap-4"><h1 class="text-xl font-semibold tracking-tight">HEADROOM</h1><span class="text-xs text-gray-500 font-mono" x-text="'v' + version"></span></div>- <div class="flex items-center gap-6">+ <div class="flex flex-col gap-3 md:flex-row md:items-center md:gap-6">+ <div class="inline-flex rounded-lg border border-border bg-surface p-1">+ <button class="px-3 py-1.5 text-sm rounded-md transition-colors"+ :class="viewMode === 'session' ? 'bg-accent text-black' : 'text-gray-400 hover:text-gray-200'"+ @click="viewMode = 'session'">+ Session+ </button>+ <button class="px-3 py-1.5 text-sm rounded-md transition-colors"+ :class="viewMode === 'history' ? 'bg-accent text-black' : 'text-gray-400 hover:text-gray-200'"+ @click="viewMode = 'history'">+ Historical+ </button>+ </div><div class="flex items-center gap-2"><span class="text-xs text-gray-500">Status</span><span class="flex items-center gap-1.5">@@ -50,32 +62,14 @@<div class="text-xs text-gray-500">Updated <span x-text="lastUpdate"></span></div>- </div>- </header>-- <main class="p-6 max-w-7xl mx-auto">- <div class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between mb-6">- <div>- <div class="text-xs text-gray-500 uppercase tracking-wide mb-2">Dashboard View</div>- <div class="inline-flex rounded-lg border border-border bg-surface p-1">- <button class="px-3 py-1.5 text-sm rounded-md transition-colors"- :class="viewMode === 'live' ? 'bg-accent text-black' : 'text-gray-400 hover:text-gray-200'"- @click="viewMode = 'live'">- Current / Live- </button>- <button class="px-3 py-1.5 text-sm rounded-md transition-colors"- :class="viewMode === 'history' ? 'bg-accent text-black' : 'text-gray-400 hover:text-gray-200'"- @click="viewMode = 'history'">- Historical- </button>- </div>- </div><div class="text-xs text-gray-500" x-show="viewMode === 'history'">Stored at <span class="font-mono text-gray-400" x-text="historyStats.storage_path || '~/.headroom/proxy_savings.json'"></span></div></div>+ </header>- <template x-if="viewMode === 'live'">+ <main class="p-6 max-w-7xl mx-auto">+ <template x-if="viewMode === 'session'"><div><!-- Hero Metrics (reordered: Savings $ -> Tokens Saved % -> Quality Confidence -> Overhead) --><div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">@@ -719,7 +713,7 @@healthy: true,version: '0.3.0',lastUpdate: 'never',- viewMode: 'live',+ viewMode: 'session',requestHistory: [],savingsHistory: [],expandedRows: {},diff --git a/tests/test_proxy_savings_history.py b/tests/test_proxy_savings_history.pyindex a74fcad0f..30c912db2 100644--- a/tests/test_proxy_savings_history.py+++ b/tests/test_proxy_savings_history.py@@ -166,6 +166,6 @@ def test_dashboard_includes_history_toggle_and_endpoint(tmp_path, monkeypatch):response = client.get("/dashboard")assert response.status_code == 200html = response.text- assert "Current / Live" in html+ assert "Session" in htmlassert "Historical" in htmlassert "fetch('/stats-history')" in html