Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
230 lines (216 loc) · 18 KB
/
Copy pathindex.html
File metadata and controls
230 lines (216 loc) · 18 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark light">
<meta name="description" content="Local-first Codex token, model and quota usage dashboard">
<title>Ledger · Codex usage dashboard</title>
<link rel="stylesheet" href="app.css">
</head>
<body class="light">
<div class="app-shell">
<aside class="sidebar" aria-label="Primary navigation">
<a class="brand" href="#overview" aria-label="Ledger home">
<span class="brand-mark" aria-hidden="true"><i></i><i></i><i></i></span>
<span class="brand-copy"><strong>Ledger</strong><small>Codex usage</small></span>
</a>
<nav class="nav-list">
<button class="nav-item active" data-target="overview" aria-current="page">
<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="2"/><rect x="14" y="3" width="7" height="7" rx="2"/><rect x="3" y="14" width="7" height="7" rx="2"/><rect x="14" y="14" width="7" height="7" rx="2"/></svg>
<span>Overview</span>
</button>
<button class="nav-item" data-target="models">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 19V9M10 19V4M16 19v-7M22 19V7"/></svg>
<span>Models</span>
</button>
<button class="nav-item" data-target="sessions">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 18V9M9 18V5M14 18v-6M19 18V8"/><path d="M3 21h18"/></svg>
<span>Sessions</span>
</button>
<button class="nav-item" data-target="attribution">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7.5h7l2 2h9v9.5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M3 7.5V5a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v2.5"/></svg>
<span>Attribution</span>
</button>
</nav>
<div class="privacy-note">
<span class="privacy-status"><i></i><span>Processed locally</span></span>
<p>No conversations, prompts, or API keys are uploaded.</p>
</div>
</aside>
<main class="main" id="overview">
<header class="topbar">
<div class="breadcrumb"><span>Workspace</span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg><strong id="breadcrumb-current">Usage overview</strong></div>
<div class="top-actions">
<span class="demo-badge"><i></i><span id="mode-badge">Demo data</span></span>
<div class="language-switch" role="group" aria-label="Language"><button class="active" data-language="en" aria-pressed="true">EN</button><button data-language="zh" aria-pressed="false">中</button></div>
<button class="icon-button" id="theme-toggle" aria-label="Toggle theme" title="Toggle theme" aria-pressed="true">
<svg class="theme-dark-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 15.2A8.4 8.4 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/></svg>
<svg class="theme-light-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
</button>
<button class="export-button" id="export-button" title="Export dashboard image" aria-label="Export dashboard image">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12M7 10l5 5 5-5M5 21h14"/></svg>
<span>Export</span>
</button>
<div class="refresh-cluster">
<button class="refresh-button" id="refresh-button" aria-label="Refresh data"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 11a8 8 0 1 0-2.34 5.66M20 4v7h-7"/></svg><span>Refresh data</span></button>
<button class="refresh-info" id="refresh-info" aria-label="How refresh works" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 11v6M12 7.5v.5"/></svg></button>
<div class="refresh-popover" id="refresh-popover" hidden>
<span class="refresh-eyebrow">Refresh engine</span><strong>Local parser · No model</strong>
<p>Refresh re-reads local usage logs and recalculates the dashboard. It does not call a model or use Codex quota.</p>
<div class="refresh-note"><i></i><span id="refresh-quota-note">Refresh can only read quota snapshots already persisted by Codex; it cannot force an account sync.</span></div>
<div class="refresh-note"><i></i><span id="refresh-model-note">Starting a new Codex task to run this skill does use the model selected for that task.</span></div>
</div>
</div>
</div>
</header>
<section class="hero" aria-labelledby="page-title">
<div>
<h1 id="page-title">Usage, at a glance.</h1>
<p>See where your Codex usage goes, from account quota to individual model calls.</p>
</div>
<div class="snapshot-status"><i></i><span>Static snapshot</span><strong id="snapshot-time">2026.09.17 · 19:30 CST</strong></div>
</section>
<section class="quota-layout" aria-label="账户额度快照">
<article class="quota-card quota-five">
<div class="quota-top"><div><span>5-hour window</span><small>Account-wide · Observed window</small></div><strong><span id="five-used">73</span><small id="five-used-label">% used</small></strong></div>
<div class="quota-meter warning" id="five-meter" role="meter" aria-label="Five-hour quota 73% used" aria-valuemin="0" aria-valuemax="100" aria-valuenow="73"><i style="--quota:.73"></i></div>
<div class="quota-bottom"><span id="five-usage-copy">27% remaining</span><span><span id="five-reset-label">Resets in </span><b id="five-countdown">02:14:32</b></span></div>
<p class="quota-estimate"><span id="five-snapshot-badge">Window snapshot</span><span id="five-estimate-copy">Observed locally; never inferred from token totals</span></p>
</article>
<article class="quota-card quota-week">
<div class="quota-top"><div><span>Weekly window</span><small>Account-wide · Observed window</small></div><strong><span id="week-used">18</span><small id="week-used-label">% used</small></strong></div>
<div class="quota-meter" id="week-meter" role="meter" aria-label="Weekly quota 18% used" aria-valuemin="0" aria-valuemax="100" aria-valuenow="18"><i style="--quota:.18"></i></div>
<div class="quota-bottom"><span id="week-usage-copy">82% remaining</span><span><span id="week-reset-label">Resets in </span><b id="week-countdown">6d 11h</b></span></div>
<p class="quota-estimate"><span id="week-snapshot-badge">Window snapshot</span><span id="week-estimate-copy">Observed locally; never inferred from token totals</span></p>
</article>
<article class="quota-advice">
<span class="advice-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 3v10M12 18v.5"/><circle cx="12" cy="12" r="9"/></svg></span>
<div><strong>Short-window pace is high</strong><p>The 5-hour window is ahead of elapsed time; weekly pacing remains normal. Quota snapshots are independent of the token filters below.</p><small class="status-source" id="quota-source">Observed quota snapshot · demo data</small></div>
</article>
</section>
<section class="filter-dock" aria-label="数据筛选">
<div class="filter-controls">
<div class="segmented" aria-label="时间范围">
<button data-range="today">Today</button>
<button class="active" data-range="7d" aria-pressed="true">Last 7 days</button>
<button data-range="30d">Last 30 days</button>
<button data-range="custom">Custom</button>
</div>
<select id="project-filter" aria-label="Filter by project"><option value="all">All projects</option></select>
<select id="task-filter" aria-label="Filter by task"><option value="all">All tasks</option></select>
<select id="model-filter" aria-label="Filter by model"><option value="all">All models</option></select>
<div class="custom-range" id="custom-range">
<input type="date" id="start-date" value="2026-09-11" aria-label="开始日期">
<span>to</span>
<input type="date" id="end-date" value="2026-09-17" aria-label="结束日期">
</div>
<button class="reset-button" id="reset-filters">Reset</button>
</div>
<div class="filter-context"><span id="filter-summary"></span><small>Local time · Local observations</small></div>
</section>
<section class="kpi-rail" aria-label="当前范围摘要" aria-live="polite">
<div class="kpi-primary"><span>Total Tokens · Observed</span><strong id="total-tokens">—</strong><small id="total-detail">—</small></div>
<div><span>Burn Rate · Calculated</span><strong id="burn-rate">—</strong><small id="burn-detail">—</small></div>
<div><span>Tokens / Task · Calculated</span><strong id="tokens-task">—</strong><small id="tokens-task-detail">—</small></div>
<div><span>Tokens / Turn · Calculated</span><strong id="tokens-turn">—</strong><small id="tokens-turn-detail">—</small></div>
<div><span>Cache Hit · Calculated</span><strong id="cache-rate">—</strong><small id="cache-detail">—</small></div>
</section>
<section class="panel insights-panel" aria-labelledby="insights-title">
<header class="section-head compact"><div><h2 id="insights-title">Usage insights</h2><p>Generated from transparent rules using the current filters. Up to four insights.</p></div><span class="scope-label">Calculated · Current period</span></header>
<div class="insights-list" id="usage-insights" aria-live="polite"></div>
</section>
<section class="session-grid" id="sessions" aria-label="Session health and context growth">
<article class="panel session-health-panel">
<header class="section-head compact"><div><h2 id="session-health-title">Session health</h2><p id="session-health-copy">Transparent status from context growth, turns, and tokens / turn.</p></div><span class="scope-label" id="session-health-scope">Calculated · Your baseline</span></header>
<div class="session-health-body">
<div class="health-summary" id="session-health-summary"></div>
<div class="baseline-summary" id="session-baseline-summary"></div>
</div>
</article>
<article class="panel context-watch-panel">
<header class="section-head compact"><div><h2 id="context-watch-title">Context growth watch</h2><p id="context-watch-copy">First 5 vs last 5 turns. Click a session for detail.</p></div><span class="scope-label">Observed + Calculated</span></header>
<div class="context-watch-list" id="context-watch-list"></div>
</article>
</section>
<section class="model-card" id="models" aria-labelledby="model-title">
<header class="section-head model-section-head">
<div><h2 id="model-title">Model quota intensity & token usage</h2><p>Compare estimated quota intensity or generation speed on the left, observed token volume on the right.</p></div>
<div class="formula-chip"><span>Intensity metric</span><strong>Estimated credits ÷ model turns</strong></div>
</header>
<div class="insight-row" id="model-insights"></div>
<div class="model-columns">
<section class="rank-panel speed-panel" aria-labelledby="left-rank-title">
<div class="rank-title"><div><span>Quota & performance</span><h3 id="left-rank-title">Quota intensity</h3></div><div class="metric-switch" aria-label="Ranking metric"><button class="active" data-left-metric="burn" aria-pressed="true">Quota intensity</button><button data-left-metric="speed" aria-pressed="false">Generation speed</button></div></div>
<div class="rank-list" id="left-ranking" aria-live="polite"></div>
</section>
<section class="rank-panel volume-panel" aria-labelledby="volume-title">
<div class="rank-title"><div><span>Usage</span><h3 id="volume-title">Token volume</h3></div><small>tokens</small></div>
<div class="rank-list" id="volume-ranking" aria-live="polite"></div>
</section>
</div>
<footer class="model-footnote"><span><i class="speed-key"></i><span id="intensity-footnote">Quota intensity is shown only when a built-in rate mapping is available</span></span><span><i class="volume-key"></i><span id="speed-footnote">Generation speed is output token/s; durations are synthetic in this demo</span></span></footer>
</section>
<section class="analytics-grid" aria-label="时间趋势与构成">
<article class="panel trend-panel">
<header class="section-head compact"><div><h2>Token timeline</h2><p>Hover to compare the matching day in the previous period; click to drill down.</p></div><div class="legend"><span><i class="cache"></i><span id="legend-cached">Cached input</span></span><span><i class="input"></i><span id="legend-uncached">Uncached input</span></span><span><i class="output"></i><span id="legend-output">Output</span></span></div></header>
<div class="chart-frame"><svg id="timeline-chart" viewBox="0 0 820 260" role="group" aria-label="按日 Token 消耗堆叠柱状图"></svg><div class="chart-tooltip" id="timeline-tooltip"></div></div>
<div class="chart-caption"><span id="timeline-range"></span><span>Input + output = total</span></div>
</article>
<article class="panel composition-panel">
<header class="section-head compact"><div><h2>Token composition</h2><p>Current filter range</p></div></header>
<strong class="composition-total" id="composition-total">—</strong>
<div class="composition-track" id="composition-track"></div>
<div class="composition-list" id="composition-list"></div>
<p class="panel-note">Reasoning tokens are a subset of output and are not counted twice.</p>
</article>
</section>
<section class="diagnostics-grid" aria-label="交叉分析与异常任务">
<article class="panel matrix-panel">
<header class="section-head compact matrix-section-head">
<div><h2>Model × project</h2><p>Darker cells indicate more concentrated token usage.</p></div>
<div class="matrix-header-tools">
<span class="scope-label" id="matrix-scope">Current period · Top projects / models</span>
<div class="matrix-view-switch" role="group" aria-label="Matrix view">
<button id="matrix-compact" class="active" type="button" aria-pressed="true">Compact</button>
<button id="matrix-all" type="button" aria-pressed="false">Show all</button>
</div>
</div>
</header>
<div class="heatmap-scroll" id="heatmap-scroll"><div class="heatmap" id="model-project-heatmap"></div></div>
</article>
<article class="panel outlier-panel">
<header class="section-head compact"><div><h2>Task efficiency map</h2><p>Total tokens × cache hit rate; only high-usage outliers are labelled.</p></div><span class="scope-label">Point area = turns</span></header>
<div class="outlier-frame"><svg id="outlier-chart" viewBox="0 0 520 250" role="group" aria-label="任务 Token 总量与缓存命中率散点图"></svg><div class="chart-tooltip" id="outlier-tooltip"></div></div>
</article>
</section>
<section class="attribution-grid" id="attribution" aria-label="消耗归因">
<article class="panel projects-panel">
<header class="section-head compact"><div><h2>Project distribution</h2><p>Click a project to filter every detail.</p></div><span class="scope-label" id="project-count">—</span></header>
<div class="project-list" id="project-list"></div>
</article>
<article class="panel expensive-panel">
<header class="section-head compact"><div><h2>Top expensive tasks</h2><p id="top-task-summary">Top 5 in the current period.</p></div><span class="scope-label">Calculated · Click for drivers</span></header>
<div class="expensive-list" id="top-expensive-tasks"></div>
</article>
</section>
<section class="panel tasks-panel task-table-panel" aria-label="任务明细">
<header class="section-head compact"><div><h2><span id="task-details-title">Task details</span> <small id="task-count"></small></h2><p>Open any task to inspect its consumption drivers and turns.</p></div><input id="task-search" type="search" placeholder="Search tasks or models" aria-label="Search tasks or models"></header>
<div class="table-scroll"><table><thead><tr><th>Task / Project</th><th>Model</th><th><button id="sort-tasks">Total tokens ↓</button></th><th>Tokens / Turn</th><th>Context growth</th><th>Cache</th><th>Health</th></tr></thead><tbody id="task-table-body"></tbody></table></div>
<footer class="table-footer"><span id="table-status"></span><div><button id="previous-page" aria-label="Previous page">Previous</button><span id="page-number"></span><button id="next-page" aria-label="Next page">Next</button></div></footer>
</section>
<footer class="page-footer"><span>Ledger · Independent community tool</span><div><button id="motion-toggle">Reduce motion</button><span>Local records ≠ complete account billing</span></div></footer>
</main>
</div>
<div class="drawer-backdrop" id="drawer-backdrop">
<section class="drawer" role="dialog" aria-modal="true" aria-labelledby="drawer-title" tabindex="-1">
<button class="drawer-close" id="drawer-close" aria-label="Close details"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18"/></svg></button>
<div id="drawer-content"></div>
</section>
</div>
<div class="toast" id="toast" role="status"></div>
<!-- Optional local bridge emitted by the skill. It works from file:// where fetch() may be blocked. -->
<script src="quota-snapshot.example.js?v=demo-1"></script>
<script src="app.js?v=codex-ledger-4"></script>
</body>
</html>