basal-engine 3.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- basal/__init__.py +7 -0
- basal/adapter.py +420 -0
- basal/adapters.py +8 -0
- basal/agree.py +393 -0
- basal/attach.py +160 -0
- basal/attn512.py +132 -0
- basal/auth.py +194 -0
- basal/bench.py +367 -0
- basal/blockquant.py +227 -0
- basal/calibrate.py +2198 -0
- basal/chat.py +175 -0
- basal/cli.py +70 -0
- basal/client.py +8 -0
- basal/decision_log.py +189 -0
- basal/decision_rules.py +569 -0
- basal/decisions.py +158 -0
- basal/derive.py +98 -0
- basal/disconnect.py +85 -0
- basal/engine.py +6023 -0
- basal/evidence.py +133 -0
- basal/examples/choice.jsonl +8 -0
- basal/examples/complex.jsonl +5 -0
- basal/examples/labelled_tickets.jsonl +500 -0
- basal/examples/local_backend.py +34 -0
- basal/examples/noul.jsonl +8 -0
- basal/examples/questions.jsonl +20 -0
- basal/examples/score.jsonl +8 -0
- basal/examples/selfcheck_basal-omni-pico-Q8_0.json +1 -0
- basal/examples/selfcheck_basal-omni-pico.json +1 -0
- basal/examples/types_demo.py +74 -0
- basal/facts.py +497 -0
- basal/feedback.py +234 -0
- basal/file_identity.py +39 -0
- basal/finetune.py +321 -0
- basal/fit_decisions.py +944 -0
- basal/fla_configs.json +1822 -0
- basal/fold.py +206 -0
- basal/fonts/OFL-DMSans.txt +93 -0
- basal/fonts/OFL-SpaceGrotesk.txt +93 -0
- basal/fonts/dm-sans-latin-ext.woff2 +0 -0
- basal/fonts/dm-sans-latin.woff2 +0 -0
- basal/fonts/space-grotesk-latin-ext.woff2 +0 -0
- basal/fonts/space-grotesk-latin.woff2 +0 -0
- basal/fp8block.py +100 -0
- basal/gdn_graph.py +1792 -0
- basal/gemma4.py +726 -0
- basal/gemma4_graph.py +931 -0
- basal/gguf_export.py +497 -0
- basal/identity.py +217 -0
- basal/int8block.py +50 -0
- basal/interpolate.py +330 -0
- basal/jsonl.py +172 -0
- basal/lean.py +204 -0
- basal/llama_attn.py +252 -0
- basal/llama_attn_kernels.py +266 -0
- basal/llama_graph.py +587 -0
- basal/llama_kernels.py +593 -0
- basal/loadtest.py +189 -0
- basal/mcp_server.py +432 -0
- basal/media.py +138 -0
- basal/metrics.py +16 -0
- basal/mlx_attn_kernels.py +1057 -0
- basal/mlx_forward.py +326 -0
- basal/mlx_kernels.py +543 -0
- basal/mlx_metal.py +510 -0
- basal/navcut.py +283 -0
- basal/navigate.py +646 -0
- basal/navtree.py +397 -0
- basal/nvfp4.py +245 -0
- basal/ordercheck.py +165 -0
- basal/pdf.py +183 -0
- basal/prepared.py +355 -0
- basal/presets.py +8 -0
- basal/prompt.py +462 -0
- basal/rank.py +373 -0
- basal/readout.py +121 -0
- basal/request.py +327 -0
- basal/response_cache.py +105 -0
- basal/router.py +1551 -0
- basal/router_ui.html +902 -0
- basal/router_ui.py +277 -0
- basal/run.py +376 -0
- basal/selfcheck.py +215 -0
- basal/server.py +5279 -0
- basal/sets.py +214 -0
- basal/signals.py +28 -0
- basal/state_disk.py +942 -0
- basal/strix.py +505 -0
- basal/synth.py +92 -0
- basal/tasks.py +848 -0
- basal/textio.py +21 -0
- basal/think.py +390 -0
- basal/tools.py +171 -0
- basal/tpu.py +336 -0
- basal/tpu_kernels.py +129 -0
- basal/trace.py +125 -0
- basal/ui.html +861 -0
- basal/ui.py +526 -0
- basal/varloop.py +813 -0
- basal/varloop_graph.py +1377 -0
- basal/varloop_kernels.py +907 -0
- basal/viz.html +660 -0
- basal/viz.py +375 -0
- basal/vllm_unified.py +100 -0
- basal_engine-3.0.3.dist-info/METADATA +416 -0
- basal_engine-3.0.3.dist-info/RECORD +111 -0
- basal_engine-3.0.3.dist-info/WHEEL +5 -0
- basal_engine-3.0.3.dist-info/entry_points.txt +21 -0
- basal_engine-3.0.3.dist-info/licenses/LICENSE +202 -0
- basal_engine-3.0.3.dist-info/licenses/NOTICE +34 -0
- basal_engine-3.0.3.dist-info/top_level.txt +1 -0
basal/ui.html
ADDED
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="referrer" content="no-referrer">
|
|
7
|
+
<meta name="color-scheme" content="dark">
|
|
8
|
+
<title>basal-serve</title>
|
|
9
|
+
<style>
|
|
10
|
+
@font-face{font-family:'DM Sans';font-style:normal;font-display:swap;font-weight:100 1000;src:url(ui/fonts/dm-sans-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
|
|
11
|
+
@font-face{font-family:'DM Sans';font-style:normal;font-display:swap;font-weight:100 1000;src:url(ui/fonts/dm-sans-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
|
|
12
|
+
@font-face{font-family:'Space Grotesk';font-style:normal;font-display:swap;font-weight:300 700;src:url(ui/fonts/space-grotesk-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
|
|
13
|
+
@font-face{font-family:'Space Grotesk';font-style:normal;font-display:swap;font-weight:300 700;src:url(ui/fonts/space-grotesk-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
|
|
14
|
+
:root{
|
|
15
|
+
--bg:#0b0f16;--top:#0e131b;--panel:#111720;--panel-2:#0f1721;--line:#242d38;--line-2:#2b3441;--row:#1d2731;
|
|
16
|
+
--text:#e7eaf0;--soft:#b9c4d2;--muted:#7d899b;--dim:#5f6d80;
|
|
17
|
+
--green:#b0ed93;--green-bg:#202c24;--green-line:#3c5038;--purple:#a892ee;--purple-bg:#272b45;--purple-line:#3a3f5b;
|
|
18
|
+
--amber:#e8c07a;--amber-bg:#352e21;--red:#ec9a87;--red-bg:#3d2b28;--blue:#9dc6dd;--blue-bg:#1e3545;
|
|
19
|
+
--mono:'SFMono-Regular',ui-monospace,Menlo,Consolas,'Liberation Mono',monospace;
|
|
20
|
+
--head:'Space Grotesk','DM Sans',system-ui,sans-serif;
|
|
21
|
+
color-scheme:dark;
|
|
22
|
+
}
|
|
23
|
+
*{box-sizing:border-box}
|
|
24
|
+
html{background:var(--bg);scroll-behavior:smooth;scroll-padding-top:84px}
|
|
25
|
+
body{margin:0;background:var(--bg);color:var(--text);font:400 13px/1.5 'DM Sans',system-ui,sans-serif;font-synthesis:none;
|
|
26
|
+
-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow-x:hidden}
|
|
27
|
+
h1,h2,h3,p{margin:0}
|
|
28
|
+
h2,h3{font-weight:550}
|
|
29
|
+
a{color:inherit;text-decoration:none}
|
|
30
|
+
button,input{font:inherit;color:inherit}
|
|
31
|
+
button{cursor:pointer;border:0;background:none;-webkit-tap-highlight-color:transparent}
|
|
32
|
+
button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid var(--green);outline-offset:3px}
|
|
33
|
+
::selection{color:#0b1510;background:var(--green)}
|
|
34
|
+
::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-thumb{background:#354150;border-radius:5px}
|
|
35
|
+
.mono,code{font-family:var(--mono)}
|
|
36
|
+
svg{flex-shrink:0}
|
|
37
|
+
.ic{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
|
|
38
|
+
|
|
39
|
+
/* top bar */
|
|
40
|
+
.topbar{position:sticky;top:0;z-index:5;height:68px;padding:0 32px;border-bottom:1px solid var(--line);display:flex;
|
|
41
|
+
align-items:center;justify-content:space-between;gap:22px;background:rgba(14,19,27,.94);backdrop-filter:blur(8px)}
|
|
42
|
+
.brand{display:flex;align-items:center;gap:10px;flex-shrink:0}
|
|
43
|
+
.brand-mark{color:#bbf7a3;width:34px;height:34px;background:var(--green-bg);display:grid;place-items:center;
|
|
44
|
+
border:1px solid var(--green-line);border-radius:9px}
|
|
45
|
+
.brand-mark .ic{width:18px;height:18px}
|
|
46
|
+
.brand-name{font:700 25px/1 var(--head);letter-spacing:-1.1px}
|
|
47
|
+
.brand-name b{color:var(--green);font-weight:700}
|
|
48
|
+
.brand-divider{height:22px;width:1px;background:#313944;margin:0 6px}
|
|
49
|
+
.brand-caption{color:#758296;font-size:8px;letter-spacing:1.7px;line-height:1.6;text-transform:uppercase}
|
|
50
|
+
.topbar nav{display:flex;align-items:center;gap:6px;height:100%;min-width:0}
|
|
51
|
+
.topbar nav a{display:flex;align-items:center;gap:8px;color:#8c98a9;padding:9px 13px;border-radius:6px;font-weight:500;
|
|
52
|
+
white-space:nowrap;transition:background .18s,color .18s}
|
|
53
|
+
.topbar nav a:hover{color:#e5e9ef;background:#19202b}
|
|
54
|
+
.topbar nav a.active{color:var(--green);background:var(--green-bg)}
|
|
55
|
+
.header-right{display:flex;align-items:center;gap:10px;flex-shrink:0}
|
|
56
|
+
.conn{display:flex;align-items:center;gap:8px;font-size:11px;color:#9aa6b5;white-space:nowrap;padding:7px 10px;
|
|
57
|
+
border:1px solid var(--line);border-radius:6px;background:#10161e}
|
|
58
|
+
.conn i{width:6px;height:6px;border-radius:50%;background:#8593a4}
|
|
59
|
+
.conn.live i{background:var(--green);box-shadow:0 0 9px #a9e89566;animation:pulse 2s ease-in-out infinite}
|
|
60
|
+
.conn.offline i{background:var(--amber)}
|
|
61
|
+
.conn.locked i{background:var(--purple)}
|
|
62
|
+
@keyframes pulse{50%{opacity:.45}}
|
|
63
|
+
.btn{border-radius:7px;padding:8px 12px;font-weight:600;display:inline-flex;align-items:center;justify-content:center;
|
|
64
|
+
gap:8px;white-space:nowrap;font-size:12px;background:#161e28;color:#c3cdd9;border:1px solid #2e3946;
|
|
65
|
+
transition:background .18s,border-color .18s,color .18s}
|
|
66
|
+
.btn:hover{border-color:#6a7b70;background:#1e2a30}
|
|
67
|
+
.btn.primary{background:var(--green);color:#0d1710;border-color:var(--green)}
|
|
68
|
+
.btn.primary:hover{background:#c4f7ab;box-shadow:0 0 18px #abeb8f19}
|
|
69
|
+
|
|
70
|
+
/* page */
|
|
71
|
+
main{max-width:1370px;margin:0 auto;padding:0 32px 36px}
|
|
72
|
+
.hero{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:40px;align-items:end;padding:34px 0 26px}
|
|
73
|
+
.eyebrow{display:flex;align-items:center;gap:8px;font:600 9px/1.6 'DM Sans',sans-serif;letter-spacing:1.6px;
|
|
74
|
+
color:#8d9caa;text-transform:uppercase}
|
|
75
|
+
.eyebrow::before{content:'';width:6px;height:6px;background:var(--green);border-radius:1px}
|
|
76
|
+
.hero h1{font:700 clamp(32px,3.6vw,50px)/1.1 var(--head);letter-spacing:-1.8px;margin:16px 0 14px;overflow-wrap:anywhere}
|
|
77
|
+
.hero h1 .accent{color:var(--purple)}
|
|
78
|
+
.hero h1 .accent.warn{color:var(--amber)}
|
|
79
|
+
.lede{color:#aab5c3;font-size:14px;line-height:1.75;max-width:640px}
|
|
80
|
+
.tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
|
|
81
|
+
.tag{font:10px var(--mono);letter-spacing:.4px;color:#a9b6c3;padding:5px 8px;border:1px solid var(--line-2);border-radius:5px;
|
|
82
|
+
background:#121922;white-space:nowrap}
|
|
83
|
+
.tag.green{color:var(--green);border-color:var(--green-line);background:var(--green-bg)}
|
|
84
|
+
.tag.purple{color:#c9bdf5;border-color:var(--purple-line);background:var(--purple-bg)}
|
|
85
|
+
.panel{background:var(--panel);border:1px solid var(--line);border-radius:10px;min-width:0}
|
|
86
|
+
.session{padding:4px 0}
|
|
87
|
+
.session dl{display:grid;grid-template-columns:auto minmax(0,1fr);margin:0}
|
|
88
|
+
.session dt,.session dd{margin:0;padding:10px 18px;border-bottom:1px solid var(--row);font-size:12px}
|
|
89
|
+
.session dt{color:var(--muted)}
|
|
90
|
+
.session dd{color:var(--soft);text-align:right;font-family:var(--mono);font-size:11px;overflow-wrap:anywhere}
|
|
91
|
+
.session dl>:nth-last-child(-n+2){border-bottom:0}
|
|
92
|
+
.kicker{display:flex;align-items:center;gap:7px;font:10px/1.7 var(--mono);letter-spacing:1px;color:var(--green);
|
|
93
|
+
text-transform:uppercase}
|
|
94
|
+
.kicker.purple{color:var(--purple)}
|
|
95
|
+
|
|
96
|
+
.metrics{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;margin:0 0 18px}
|
|
97
|
+
.metric{position:relative;padding:16px 18px 18px;overflow:hidden}
|
|
98
|
+
.metric-label{display:flex;align-items:center;gap:8px;color:#8796a6;font-size:9px;letter-spacing:1px;font-weight:600;
|
|
99
|
+
text-transform:uppercase;white-space:nowrap}
|
|
100
|
+
.metric-label .ic{color:#8ea68c;width:14px;height:14px}
|
|
101
|
+
.metric-label .extra{margin-left:auto;font:9px var(--mono);letter-spacing:.3px;color:#607b6b;text-transform:none}
|
|
102
|
+
.metric-value{font:400 30px/1.1 var(--head);letter-spacing:-.8px;margin:12px 0 6px;color:#e9eedf;white-space:nowrap;
|
|
103
|
+
overflow:hidden;text-overflow:ellipsis}
|
|
104
|
+
.metric-value small{font:14px var(--mono);letter-spacing:-.5px;margin-left:7px;color:#5f7a6d}
|
|
105
|
+
.metric-detail{font-size:11px;color:#7a8b9a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
106
|
+
.metric-detail b{color:var(--soft);font-weight:500}
|
|
107
|
+
.metric-detail .bad{color:var(--red)}
|
|
108
|
+
.progress{position:absolute;left:0;right:0;bottom:0;height:2px;background:#22302a}
|
|
109
|
+
.progress span{display:block;height:100%;width:0;background:var(--green);transition:width .5s}
|
|
110
|
+
|
|
111
|
+
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-bottom:18px}
|
|
112
|
+
.grid-tel{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:18px;margin-bottom:18px}
|
|
113
|
+
.section-header{padding:15px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px;
|
|
114
|
+
border-bottom:1px solid var(--line);min-height:56px}
|
|
115
|
+
.section-header h2{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:600;color:#dfe5ec}
|
|
116
|
+
.section-header h2 .ic{color:var(--muted)}
|
|
117
|
+
.section-header .note{font:9px var(--mono);letter-spacing:.8px;color:#6c7b8d;text-transform:uppercase;white-space:nowrap}
|
|
118
|
+
.count{font:9px var(--mono);color:#91a48f;background:#243229;min-width:20px;text-align:center;border:1px solid #354432;
|
|
119
|
+
border-radius:4px;padding:2px 5px}
|
|
120
|
+
.body{padding:16px 18px 18px}
|
|
121
|
+
|
|
122
|
+
/* charts */
|
|
123
|
+
.chart{position:relative;height:150px;margin-top:4px}
|
|
124
|
+
.chart svg{position:absolute;top:0;bottom:0;left:0;right:52px;width:calc(100% - 52px);height:100%;overflow:visible}
|
|
125
|
+
.chart .y{position:absolute;right:0;width:46px;font:9px var(--mono);color:#5f6e80;transform:translateY(-50%);white-space:nowrap}
|
|
126
|
+
.chart-foot{display:flex;justify-content:space-between;font:9px var(--mono);color:#5f6e80;margin:8px 52px 0 0;letter-spacing:.4px}
|
|
127
|
+
.legend{display:flex;gap:14px;font-size:11px;color:#8b98a8}
|
|
128
|
+
.legend i{display:inline-block;width:10px;height:2px;border-radius:2px;margin-right:6px;vertical-align:middle}
|
|
129
|
+
.empty{display:grid;place-items:center;height:100%;color:#5f6e80;font-size:12px;text-align:center}
|
|
130
|
+
|
|
131
|
+
/* tables */
|
|
132
|
+
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
|
|
133
|
+
table{border-collapse:collapse;width:100%;font-size:11px;text-align:left;white-space:nowrap}
|
|
134
|
+
th{padding:10px 18px;font-weight:500;font-size:9px;letter-spacing:.8px;text-transform:uppercase;color:#6a7f91;
|
|
135
|
+
background:var(--panel-2);border-bottom:1px solid var(--line)}
|
|
136
|
+
td{padding:10px 18px;border-bottom:1px solid var(--row);color:#a8b6c1}
|
|
137
|
+
tbody tr:last-child td{border-bottom:0}
|
|
138
|
+
tbody tr:hover{background:#161f29}
|
|
139
|
+
td.num,th.num{text-align:right;font-family:var(--mono)}
|
|
140
|
+
th.num{font-family:inherit}
|
|
141
|
+
td.ep{color:#cfd8e1;font-family:var(--mono);font-size:11px}
|
|
142
|
+
td.t{font-family:var(--mono);color:#6e8698;font-size:10px}
|
|
143
|
+
.badge{display:inline-flex;align-items:center;gap:5px;font:10px var(--mono);border-radius:4px;padding:3px 7px;
|
|
144
|
+
color:#b4d296;background:#253523}
|
|
145
|
+
.badge::before{content:'';width:4px;height:4px;border-radius:50%;background:currentColor}
|
|
146
|
+
.badge.warn{color:var(--amber);background:var(--amber-bg)}
|
|
147
|
+
.badge.err{color:var(--red);background:var(--red-bg)}
|
|
148
|
+
.codes{display:flex;flex-wrap:wrap;gap:8px;padding:14px 18px;border-top:1px solid var(--line)}
|
|
149
|
+
.codes .label{font:9px var(--mono);letter-spacing:.8px;color:#6a7f91;text-transform:uppercase;align-self:center;margin-right:4px}
|
|
150
|
+
|
|
151
|
+
/* bars and stats */
|
|
152
|
+
.stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:var(--row);border-radius:8px;overflow:hidden;
|
|
153
|
+
border:1px solid var(--row)}
|
|
154
|
+
.stat{background:var(--panel);padding:12px 14px;min-width:0}
|
|
155
|
+
.stat span{display:block;font-size:9px;letter-spacing:.9px;color:#7a8a9b;text-transform:uppercase;font-weight:600}
|
|
156
|
+
.stat b{display:block;font:400 20px/1.3 var(--head);letter-spacing:-.4px;color:#e3e9e0;margin-top:4px;white-space:nowrap;
|
|
157
|
+
overflow:hidden;text-overflow:ellipsis}
|
|
158
|
+
.stat b small{font:11px var(--mono);color:#617a6d;margin-left:5px}
|
|
159
|
+
.meter{margin:14px 0 2px}
|
|
160
|
+
.meter-top{display:flex;justify-content:space-between;gap:10px;font-size:11px;color:#8b98a8;margin-bottom:7px}
|
|
161
|
+
.meter-top b{font:11px var(--mono);color:var(--soft);font-weight:400}
|
|
162
|
+
.bar{height:6px;border-radius:6px;background:#1b242e;overflow:hidden}
|
|
163
|
+
.bar span{display:block;height:100%;width:0;border-radius:6px;background:var(--green);transition:width .5s}
|
|
164
|
+
.bar.purple span{background:var(--purple)}
|
|
165
|
+
.bar.amber span{background:var(--amber)}
|
|
166
|
+
.notice{border:1px dashed #394555;border-radius:8px;padding:12px 14px;color:#93a1b1;font-size:12px;line-height:1.6;
|
|
167
|
+
background:#0f151d}
|
|
168
|
+
.notice code{color:var(--green);font-size:11px}
|
|
169
|
+
.gpus{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}
|
|
170
|
+
.gpu{border:1px solid var(--line-2);border-radius:9px;padding:14px 16px;background:#10161f}
|
|
171
|
+
.gpu-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
|
|
172
|
+
.gpu-head strong{font-size:12px;font-weight:600;color:#d7dee6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
173
|
+
.gpu-id{font:10px var(--mono);color:#7d899b;letter-spacing:.3px;margin-top:4px}
|
|
174
|
+
.gpu-facts{display:flex;gap:14px;margin-top:12px;font:11px var(--mono);color:#8796a6;flex-wrap:wrap}
|
|
175
|
+
.gpu-facts b{color:var(--soft);font-weight:400}
|
|
176
|
+
.spark{height:34px;margin-top:12px}
|
|
177
|
+
.spark svg{width:100%;height:100%;display:block}
|
|
178
|
+
|
|
179
|
+
/* configuration */
|
|
180
|
+
.config{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.35fr)}
|
|
181
|
+
.facts{border-right:1px solid var(--line);padding:6px 0}
|
|
182
|
+
.facts dl{display:grid;grid-template-columns:minmax(120px,auto) minmax(0,1fr);margin:0}
|
|
183
|
+
.facts dt,.facts dd{margin:0;padding:8px 18px;border-bottom:1px solid var(--row);font-size:12px}
|
|
184
|
+
.facts dt{color:var(--muted)}
|
|
185
|
+
.facts dd{color:var(--soft);font:11px/1.6 var(--mono);overflow-wrap:anywhere}
|
|
186
|
+
.facts dl>:nth-last-child(-n+2){border-bottom:0}
|
|
187
|
+
.opts-tools{display:flex;gap:10px;align-items:center;padding:12px 18px;border-bottom:1px solid var(--line)}
|
|
188
|
+
.opts-tools input[type=search]{flex:1;min-width:0;padding:8px 11px;background:#0d131c;border:1px solid #2b3542;border-radius:7px;
|
|
189
|
+
color:#dce2e9;font-size:12px}
|
|
190
|
+
.opts-tools input[type=search]:focus{border-color:#91b980;outline:none}
|
|
191
|
+
.toggle{display:flex;align-items:center;gap:7px;font-size:11px;color:#9aa6b5;white-space:nowrap;cursor:pointer}
|
|
192
|
+
.toggle input{accent-color:var(--green)}
|
|
193
|
+
.opts-col{display:flex;flex-direction:column;min-width:0;contain:size}
|
|
194
|
+
.opts{flex:1 1 0;min-height:0;overflow:auto}
|
|
195
|
+
.opts th{position:sticky;top:0;z-index:1}
|
|
196
|
+
.opts td{padding:8px 18px}
|
|
197
|
+
.opts td.k{font-family:var(--mono);color:#c7d1db;font-size:11px}
|
|
198
|
+
.opts td.v{font-family:var(--mono);font-size:11px;white-space:normal;overflow-wrap:anywhere;min-width:120px}
|
|
199
|
+
.opts tr.changed td.k::before{content:'';display:inline-block;width:5px;height:5px;border-radius:50%;background:var(--green);
|
|
200
|
+
margin:0 8px 1px -13px}
|
|
201
|
+
.opts tr.changed td.v{color:var(--green)}
|
|
202
|
+
|
|
203
|
+
.req-tools{display:flex;gap:8px;align-items:center}
|
|
204
|
+
.chip{font-size:11px;padding:5px 10px;border-radius:6px;color:#8c98a9;border:1px solid transparent}
|
|
205
|
+
.chip:hover{color:#e5e9ef;background:#19202b}
|
|
206
|
+
.chip.on{color:var(--green);background:var(--green-bg);border-color:var(--green-line)}
|
|
207
|
+
.table-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid var(--line);
|
|
208
|
+
padding:11px 18px;color:#6a7f91;font-size:11px}
|
|
209
|
+
.text-btn{font-size:11px;font-weight:500;color:#9aa8b6}
|
|
210
|
+
.text-btn:hover{color:var(--green)}
|
|
211
|
+
footer{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap;color:#5f6e80;font-size:11px;padding:22px 0 0;
|
|
212
|
+
border-top:1px solid var(--line);margin-top:26px}
|
|
213
|
+
footer a{color:#8796a6;border-bottom:1px solid #2c3743}
|
|
214
|
+
footer a:hover{color:var(--green)}
|
|
215
|
+
.section{margin-bottom:18px}
|
|
216
|
+
.reset-chip{display:none;align-items:center;gap:6px;font:10px var(--mono);color:#c9bdf5;background:var(--purple-bg);
|
|
217
|
+
border:1px solid var(--purple-line);border-radius:5px;padding:4px 8px}
|
|
218
|
+
.reset-chip.on{display:inline-flex}
|
|
219
|
+
.reset-chip button{color:#c9bdf5;font-size:12px;line-height:1;padding:0 0 0 4px}
|
|
220
|
+
|
|
221
|
+
/* request panel (--ui full) */
|
|
222
|
+
#recent tr.open{cursor:pointer}
|
|
223
|
+
#recent tr.open:hover td.ep,#recent tr.open:focus-visible td.ep{color:var(--green)}
|
|
224
|
+
#recent tr.open:focus-visible{outline:1px solid var(--green-line);outline-offset:-1px}
|
|
225
|
+
#recent tr.sel{background:#18222c}
|
|
226
|
+
.drawer-bg{position:fixed;inset:0;z-index:8;background:rgba(8,11,16,.55)}
|
|
227
|
+
.drawer{position:fixed;top:0;right:0;bottom:0;z-index:9;width:min(660px,100%);background:var(--panel);
|
|
228
|
+
border-left:1px solid var(--line-2);display:flex;flex-direction:column;box-shadow:-30px 0 80px #0007}
|
|
229
|
+
.drawer[hidden],.drawer-bg[hidden]{display:none}
|
|
230
|
+
.drawer-head{padding:18px 20px 16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:14px;
|
|
231
|
+
align-items:flex-start}
|
|
232
|
+
.drawer-head h3{font:600 20px/1.25 var(--head);letter-spacing:-.4px;margin:8px 0 8px;overflow-wrap:anywhere}
|
|
233
|
+
.drawer-meta{display:flex;flex-wrap:wrap;gap:10px;align-items:center;font:11px var(--mono);color:#8b98a8}
|
|
234
|
+
.drawer-body{overflow:auto;padding:4px 20px 26px;flex:1;overscroll-behavior:contain}
|
|
235
|
+
.drawer-sec{margin-top:18px}
|
|
236
|
+
.drawer-sec .row{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
|
|
237
|
+
pre.json{margin:0;padding:14px 16px;background:#0c121a;border:1px solid var(--line);border-radius:8px;
|
|
238
|
+
font:11.5px/1.65 var(--mono);color:#aeb9c5;white-space:pre-wrap;overflow-wrap:anywhere;tab-size:2}
|
|
239
|
+
.json .k{color:#c9bdf5}.json .s{color:var(--green)}.json .n{color:var(--amber)}.json .b{color:var(--blue)}.json .z{color:#7d899b}
|
|
240
|
+
.close{width:32px;height:32px;display:grid;place-items:center;flex-shrink:0;border-radius:7px;border:1px solid #2e3946;
|
|
241
|
+
background:#161e28;color:#c3cdd9}
|
|
242
|
+
.close:hover{border-color:#6a7b70;background:#1e2a30}
|
|
243
|
+
|
|
244
|
+
/* key form */
|
|
245
|
+
.login{position:fixed;inset:0;z-index:10;display:grid;place-items:center;padding:20px;background:rgba(8,11,16,.86);backdrop-filter:blur(6px)}
|
|
246
|
+
.login[hidden]{display:none}
|
|
247
|
+
.login form{width:min(440px,100%);padding:28px;border-radius:12px;border:1px solid var(--line-2);background:var(--panel);
|
|
248
|
+
box-shadow:0 30px 80px #0008}
|
|
249
|
+
.login h2{font:700 26px/1.15 var(--head);letter-spacing:-.8px;margin:14px 0 10px}
|
|
250
|
+
.login p{color:#9aa6b5;font-size:12px;line-height:1.7;margin-bottom:18px}
|
|
251
|
+
.login input{width:100%;padding:11px 12px;background:#0d131c;border:1px solid #2b3542;border-radius:7px;color:#dce2e9;
|
|
252
|
+
font-family:var(--mono);font-size:12px}
|
|
253
|
+
.login input:focus{border-color:#91b980;outline:none}
|
|
254
|
+
.login .row{display:flex;gap:10px;margin-top:12px}
|
|
255
|
+
.login .row .btn{flex:1;padding:11px 14px}
|
|
256
|
+
.login .err{color:var(--red);font-size:12px;min-height:18px;margin-top:10px}
|
|
257
|
+
|
|
258
|
+
@media (max-width:1180px){
|
|
259
|
+
.metrics{grid-template-columns:repeat(3,minmax(0,1fr))}
|
|
260
|
+
.topbar nav a span{display:none}
|
|
261
|
+
.config{grid-template-columns:1fr}.facts{border-right:0;border-bottom:1px solid var(--line)}
|
|
262
|
+
.opts-col{contain:none}.opts{flex:none;max-height:520px}
|
|
263
|
+
}
|
|
264
|
+
@media (max-width:900px){
|
|
265
|
+
.hero{grid-template-columns:1fr;gap:22px;align-items:start}
|
|
266
|
+
.grid-2,.grid-tel{grid-template-columns:1fr}
|
|
267
|
+
}
|
|
268
|
+
@media (max-width:760px){
|
|
269
|
+
html{scroll-padding-top:120px}
|
|
270
|
+
.topbar{height:auto;padding:12px 16px 0;flex-wrap:wrap;gap:12px}
|
|
271
|
+
.brand-divider,.brand-caption{display:none}
|
|
272
|
+
.topbar nav{order:3;width:calc(100% + 32px);margin:0 -16px;padding:0 12px 10px;overflow-x:auto;height:auto;scrollbar-width:none}
|
|
273
|
+
.topbar nav::-webkit-scrollbar{display:none}
|
|
274
|
+
.topbar nav a span{display:inline}
|
|
275
|
+
.header-right{gap:8px}
|
|
276
|
+
.header-right .btn{padding:7px 10px}
|
|
277
|
+
.header-right .btn .lbl{display:none}
|
|
278
|
+
main{padding:0 16px 28px}
|
|
279
|
+
.hero{padding:24px 0 20px}
|
|
280
|
+
.hero h1{letter-spacing:-1.2px}
|
|
281
|
+
.lede{font-size:13px}
|
|
282
|
+
.metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
|
|
283
|
+
.metric{padding:14px 14px 16px}
|
|
284
|
+
.metric-value{font-size:25px}
|
|
285
|
+
.metric-label .extra{display:none}
|
|
286
|
+
.metric:last-child{grid-column:1/-1}
|
|
287
|
+
.grid-2,.grid-tel{gap:12px}
|
|
288
|
+
.section-header{padding:13px 14px;flex-wrap:wrap;row-gap:6px}
|
|
289
|
+
.section-header .note{white-space:normal}
|
|
290
|
+
.body{padding:14px}
|
|
291
|
+
th,td{padding:9px 14px}
|
|
292
|
+
.opts td{padding:8px 14px}
|
|
293
|
+
.facts dt,.facts dd{padding:8px 14px}
|
|
294
|
+
.facts dl{grid-template-columns:minmax(110px,auto) minmax(0,1fr)}
|
|
295
|
+
.opts-tools,.codes{padding:12px 14px}
|
|
296
|
+
.opts-tools{flex-wrap:wrap}
|
|
297
|
+
.session dt,.session dd{padding:9px 14px}
|
|
298
|
+
}
|
|
299
|
+
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}html{scroll-behavior:auto}}
|
|
300
|
+
</style>
|
|
301
|
+
</head>
|
|
302
|
+
<body>
|
|
303
|
+
<header class="topbar">
|
|
304
|
+
<div class="brand">
|
|
305
|
+
<span class="brand-mark" aria-hidden="true"><svg class="ic" viewBox="0 0 24 24"><circle cx="5.5" cy="12" r="2.3"/><circle cx="18.5" cy="5.5" r="2.3"/><circle cx="18.5" cy="18.5" r="2.3"/><path d="M7.7 11 16.3 6.6M7.7 13l8.6 4.4"/></svg></span>
|
|
306
|
+
<span class="brand-name">basal<b>.</b></span>
|
|
307
|
+
<span class="brand-divider"></span>
|
|
308
|
+
<span class="brand-caption">Inference<br>engine</span>
|
|
309
|
+
</div>
|
|
310
|
+
<nav aria-label="Sections">
|
|
311
|
+
<a href="#overview" class="active"><svg class="ic" viewBox="0 0 24 24"><rect x="3.5" y="3.5" width="7" height="7" rx="1.5"/><rect x="13.5" y="3.5" width="7" height="7" rx="1.5"/><rect x="3.5" y="13.5" width="7" height="7" rx="1.5"/><rect x="13.5" y="13.5" width="7" height="7" rx="1.5"/></svg><span>Overview</span></a>
|
|
312
|
+
<a href="#traffic"><svg class="ic" viewBox="0 0 24 24"><path d="M3 17l5-6 4 3 5-8 4 5"/></svg><span>Traffic</span></a>
|
|
313
|
+
<a href="#telemetry"><svg class="ic" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/><path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/></svg><span>Telemetry</span></a>
|
|
314
|
+
<a href="#configuration"><svg class="ic" viewBox="0 0 24 24"><path d="M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0"/><circle cx="16" cy="6" r="2"/><circle cx="10" cy="12" r="2"/><circle cx="18" cy="18" r="2"/></svg><span>Configuration</span></a>
|
|
315
|
+
<a href="#requests"><svg class="ic" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10"/></svg><span>Requests</span></a>
|
|
316
|
+
</nav>
|
|
317
|
+
<div class="header-right">
|
|
318
|
+
<div class="conn" id="conn" role="status"><i></i><span id="conn-text">Connecting</span></div>
|
|
319
|
+
<button class="btn" id="pause" type="button" title="Stop polling this server"><svg class="ic" viewBox="0 0 24 24"><path d="M9 5v14M15 5v14"/></svg><span class="lbl">Pause</span></button>
|
|
320
|
+
<button class="btn" id="reset" type="button" title="Count from now in this view (the server's stats are not changed)"><svg class="ic" viewBox="0 0 24 24"><path d="M4 12a8 8 0 1 0 2.4-5.7"/><path d="M4 4v4h4"/></svg><span class="lbl">Reset view</span></button>
|
|
321
|
+
</div>
|
|
322
|
+
</header>
|
|
323
|
+
|
|
324
|
+
<main>
|
|
325
|
+
<section class="hero" id="overview" aria-label="Status">
|
|
326
|
+
<div>
|
|
327
|
+
<div class="eyebrow"><span>Inference engine</span><span aria-hidden="true">·</span><span id="since">stats since start</span></div>
|
|
328
|
+
<h1><span id="model">basal-serve</span><br><span class="accent" id="headline">Connecting…</span></h1>
|
|
329
|
+
<p class="lede" id="lede">Live status of this server. Stats start at zero with every start and stay in its memory.</p>
|
|
330
|
+
<div class="tags" id="tags"></div>
|
|
331
|
+
</div>
|
|
332
|
+
<div class="panel session">
|
|
333
|
+
<dl id="session"></dl>
|
|
334
|
+
</div>
|
|
335
|
+
</section>
|
|
336
|
+
|
|
337
|
+
<div class="metrics" role="list">
|
|
338
|
+
<div class="panel metric" role="listitem">
|
|
339
|
+
<div class="metric-label"><svg class="ic" viewBox="0 0 24 24"><path d="M4 7h16M4 12h16M4 17h10"/></svg>Requests<span class="extra" id="m-req-scope">since start</span></div>
|
|
340
|
+
<div class="metric-value" id="m-req">—</div>
|
|
341
|
+
<div class="metric-detail" id="m-req-d"> </div>
|
|
342
|
+
<div class="progress"><span id="m-req-p"></span></div>
|
|
343
|
+
</div>
|
|
344
|
+
<div class="panel metric" role="listitem">
|
|
345
|
+
<div class="metric-label"><svg class="ic" viewBox="0 0 24 24"><path d="M3 17l5-6 4 3 5-8 4 5"/></svg>Throughput<span class="extra">last 10 s</span></div>
|
|
346
|
+
<div class="metric-value" id="m-rate">—</div>
|
|
347
|
+
<div class="metric-detail" id="m-rate-d"> </div>
|
|
348
|
+
</div>
|
|
349
|
+
<div class="panel metric" role="listitem">
|
|
350
|
+
<div class="metric-label"><svg class="ic" viewBox="0 0 24 24"><circle cx="12" cy="13" r="8"/><path d="M12 9v4l2.5 2.5M9.5 2.5h5"/></svg>Latency p50<span class="extra" id="m-lat-scope">since start</span></div>
|
|
351
|
+
<div class="metric-value" id="m-lat">—</div>
|
|
352
|
+
<div class="metric-detail" id="m-lat-d"> </div>
|
|
353
|
+
</div>
|
|
354
|
+
<div class="panel metric" role="listitem">
|
|
355
|
+
<div class="metric-label"><svg class="ic" viewBox="0 0 24 24"><path d="M12 3 3 8l9 5 9-5-9-5Z"/><path d="m3 13 9 5 9-5"/></svg>In flight<span class="extra">now</span></div>
|
|
356
|
+
<div class="metric-value" id="m-fl">—</div>
|
|
357
|
+
<div class="metric-detail" id="m-fl-d"> </div>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="panel metric" role="listitem">
|
|
360
|
+
<div class="metric-label"><svg class="ic" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/><path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/></svg>GPU<span class="extra" id="m-gpu-x"></span></div>
|
|
361
|
+
<div class="metric-value" id="m-gpu">—</div>
|
|
362
|
+
<div class="metric-detail" id="m-gpu-d"> </div>
|
|
363
|
+
<div class="progress"><span id="m-gpu-p"></span></div>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
<div id="traffic" class="grid-2">
|
|
368
|
+
<section class="panel">
|
|
369
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><path d="M3 17l5-6 4 3 5-8 4 5"/></svg>Throughput</h2><span class="note">requests / s · each poll</span></div>
|
|
370
|
+
<div class="body"><div class="chart" id="c-rate"></div><div class="chart-foot"><span id="c-rate-from">—</span><span>now</span></div></div>
|
|
371
|
+
</section>
|
|
372
|
+
<section class="panel">
|
|
373
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><circle cx="12" cy="13" r="8"/><path d="M12 9v4l2.5 2.5M9.5 2.5h5"/></svg>Latency</h2>
|
|
374
|
+
<div class="legend"><span><i style="background:var(--green)"></i>p50</span><span><i style="background:var(--purple)"></i>p95</span><span class="note">ms · last 10 s</span></div></div>
|
|
375
|
+
<div class="body"><div class="chart" id="c-lat"></div><div class="chart-foot"><span id="c-lat-from">—</span><span>now</span></div></div>
|
|
376
|
+
</section>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<div class="grid-2">
|
|
380
|
+
<section class="panel">
|
|
381
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><path d="M5 12h14M13 6l6 6-6 6"/></svg>Endpoints</h2><span class="note" id="ep-note">since start</span></div>
|
|
382
|
+
<div class="table-scroll"><table>
|
|
383
|
+
<thead><tr><th>Endpoint</th><th class="num">Requests</th><th class="num">Failed</th><th class="num">p50 ms</th><th class="num">p95 ms</th><th class="num">Mean ms</th></tr></thead>
|
|
384
|
+
<tbody id="endpoints"><tr><td colspan="6" class="empty-row">No decision requests yet.</td></tr></tbody>
|
|
385
|
+
</table></div>
|
|
386
|
+
<div class="codes" id="codes"><span class="label">Status codes</span><span class="muted">none yet</span></div>
|
|
387
|
+
</section>
|
|
388
|
+
<section class="panel">
|
|
389
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><ellipse cx="12" cy="6" rx="7" ry="3"/><path d="M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6M5 12v6c0 1.7 3.1 3 7 3s7-1.3 7-3v-6"/></svg>State cache</h2><span class="note" id="cache-note">—</span></div>
|
|
390
|
+
<div class="body" id="cache"></div>
|
|
391
|
+
</section>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<div id="telemetry" class="grid-tel">
|
|
395
|
+
<section class="panel">
|
|
396
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/><path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/></svg>GPUs</h2><span class="note" id="gpu-note">NVML · 1 s</span></div>
|
|
397
|
+
<div class="body" id="gpus"><div class="notice">Reading telemetry…</div></div>
|
|
398
|
+
</section>
|
|
399
|
+
<section class="panel">
|
|
400
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>Host</h2><span class="note">psutil · 1 s</span></div>
|
|
401
|
+
<div class="body" id="host"><div class="notice">Reading telemetry…</div></div>
|
|
402
|
+
</section>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<section class="panel section" id="configuration">
|
|
406
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><path d="M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12"/><circle cx="16" cy="6" r="2"/><circle cx="10" cy="12" r="2"/><circle cx="18" cy="18" r="2"/></svg>Configuration</h2><span class="note">as parsed at start-up · secrets redacted</span></div>
|
|
407
|
+
<div class="config">
|
|
408
|
+
<div class="facts"><dl id="facts"></dl></div>
|
|
409
|
+
<div class="opts-col">
|
|
410
|
+
<div class="opts-tools">
|
|
411
|
+
<input type="search" id="opt-filter" placeholder="Filter options" aria-label="Filter options" autocomplete="off" spellcheck="false">
|
|
412
|
+
<label class="toggle"><input type="checkbox" id="opt-changed"> Changed only</label>
|
|
413
|
+
<span class="count" id="opt-count">0</span>
|
|
414
|
+
</div>
|
|
415
|
+
<div class="opts"><table><thead><tr><th>Option</th><th>Value</th></tr></thead><tbody id="options"></tbody></table></div>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
</section>
|
|
419
|
+
|
|
420
|
+
<section class="panel section" id="requests">
|
|
421
|
+
<div class="section-header"><h2><svg class="ic" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10"/></svg>Recent requests <span class="count" id="req-count">0</span></h2>
|
|
422
|
+
<div class="req-tools"><button class="chip on" type="button" data-f="all">All</button><button class="chip" type="button" data-f="err">Errors</button></div></div>
|
|
423
|
+
<div class="table-scroll"><table>
|
|
424
|
+
<thead><tr><th>Time</th><th>Endpoint</th><th>Status</th><th class="num">Latency ms</th><th class="num">Questions</th><th class="num">Options</th></tr></thead>
|
|
425
|
+
<tbody id="recent"><tr><td colspan="6">No decision requests yet.</td></tr></tbody>
|
|
426
|
+
</table></div>
|
|
427
|
+
<div class="table-foot"><span id="req-foot">Metadata only: the request's text is never kept.</span><button class="text-btn" type="button" id="more">Show all</button></div>
|
|
428
|
+
</section>
|
|
429
|
+
|
|
430
|
+
<footer>
|
|
431
|
+
<span id="foot-version">basal-serve</span>
|
|
432
|
+
<span>Fonts: DM Sans (<a href="ui/fonts/OFL-DMSans.txt">OFL</a>) and Space Grotesk (<a href="ui/fonts/OFL-SpaceGrotesk.txt">OFL</a>)</span>
|
|
433
|
+
</footer>
|
|
434
|
+
</main>
|
|
435
|
+
|
|
436
|
+
<div class="drawer-bg" id="drawer-bg" hidden></div>
|
|
437
|
+
<aside class="drawer" id="drawer" hidden role="dialog" aria-modal="true" aria-labelledby="d-title">
|
|
438
|
+
<div class="drawer-head">
|
|
439
|
+
<div><div class="kicker" id="d-kicker">Request</div><h3 id="d-title">—</h3><div class="drawer-meta" id="d-meta"></div></div>
|
|
440
|
+
<button class="close" id="d-close" type="button" aria-label="Close"><svg class="ic" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
|
|
441
|
+
</div>
|
|
442
|
+
<div class="drawer-body" id="d-body"></div>
|
|
443
|
+
</aside>
|
|
444
|
+
|
|
445
|
+
<div class="login" id="login" hidden>
|
|
446
|
+
<form id="login-form" autocomplete="off">
|
|
447
|
+
<div class="kicker purple"><svg class="ic" viewBox="0 0 24 24"><rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>API key required</div>
|
|
448
|
+
<h2>Connect to this server</h2>
|
|
449
|
+
<p>This basal-serve was started with <code>--api-keys</code>. The key is kept in this tab only and sent only to this server, with each read of its state.</p>
|
|
450
|
+
<label for="key" class="toggle" style="margin-bottom:8px">API key</label>
|
|
451
|
+
<input id="key" type="password" spellcheck="false" autocomplete="off" required>
|
|
452
|
+
<div class="row"><button class="btn primary" type="submit">Connect</button></div>
|
|
453
|
+
<div class="err" id="login-err" role="alert"></div>
|
|
454
|
+
</form>
|
|
455
|
+
</div>
|
|
456
|
+
<noscript><p style="padding:20px">This page needs JavaScript to read the server's state.</p></noscript>
|
|
457
|
+
|
|
458
|
+
<script>
|
|
459
|
+
(() => {
|
|
460
|
+
'use strict';
|
|
461
|
+
const $ = id => document.getElementById(id);
|
|
462
|
+
const STORE = 'basal-ui-key', POINTS = 300;
|
|
463
|
+
const S = {openId: null, detail: null, key: '', paused: false, hist: [], prev: null, session: null, base: null, cfgSession: null, cfg: null,
|
|
464
|
+
showAll: false, errorsOnly: false, timer: 0, last: null};
|
|
465
|
+
try { S.key = sessionStorage.getItem(STORE) || ''; } catch (e) { /* storage blocked: ask each time */ }
|
|
466
|
+
|
|
467
|
+
const esc = v => String(v).replace(/[&<>"']/g, c => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''})[c]);
|
|
468
|
+
const nf = new Intl.NumberFormat('en-US');
|
|
469
|
+
const int = n => n == null ? '—' : nf.format(Math.round(n));
|
|
470
|
+
const dec = (v, d) => v == null ? '—' : v < 10 ? v.toFixed(d == null ? 2 : d) : v < 100 ? v.toFixed(1) : nf.format(Math.round(v));
|
|
471
|
+
const pct = v => v == null ? '—' : Math.round(v) + '%';
|
|
472
|
+
const gib = b => b == null ? '—' : b >= 2 ** 30 ? (b / 2 ** 30).toFixed(1) + ' GiB' : (b / 2 ** 20).toFixed(0) + ' MiB';
|
|
473
|
+
const pad = n => String(n).padStart(2, '0');
|
|
474
|
+
const clock = t => { const d = new Date(t * 1000); return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`; };
|
|
475
|
+
const clockMs = t => clock(t) + '.' + String(Math.floor((t % 1) * 1000)).padStart(3, '0');
|
|
476
|
+
const dur = s => {
|
|
477
|
+
if (s == null) return '—';
|
|
478
|
+
s = Math.floor(s);
|
|
479
|
+
const d = Math.floor(s / 86400), h = Math.floor(s % 86400 / 3600), m = Math.floor(s % 3600 / 60);
|
|
480
|
+
return d ? `${d} d ${h} h` : h ? `${h} h ${m} min` : m ? `${m} min ${s % 60} s` : `${s} s`;
|
|
481
|
+
};
|
|
482
|
+
const flag = k => '--' + k.replace(/_/g, '-');
|
|
483
|
+
const val = v => v == null ? 'none' : typeof v === 'boolean' ? (v ? 'on' : 'off') : Array.isArray(v) ? v.join(' ') : String(v);
|
|
484
|
+
const width = (el, f) => { el.style.width = Math.max(0, Math.min(100, f * 100)).toFixed(1) + '%'; };
|
|
485
|
+
const set = (id, text) => { const el = $(id); if (el.textContent !== text) el.textContent = text; };
|
|
486
|
+
const setHTML = (id, html) => { const el = $(id); if (el.innerHTML !== html) el.innerHTML = html; };
|
|
487
|
+
const badge = c => `<span class="badge${c >= 500 ? ' err' : c >= 400 ? ' warn' : ''}">${esc(c)}</span>`;
|
|
488
|
+
|
|
489
|
+
function conn(kind, text) { $('conn').className = 'conn ' + kind; set('conn-text', text); }
|
|
490
|
+
function later(ms) { clearTimeout(S.timer); if (!S.paused) S.timer = setTimeout(poll, ms || 1000); }
|
|
491
|
+
|
|
492
|
+
async function poll() {
|
|
493
|
+
let r;
|
|
494
|
+
try {
|
|
495
|
+
r = await fetch('ui/state', {cache: 'no-store', headers: S.key ? {Authorization: 'Bearer ' + S.key} : {}});
|
|
496
|
+
} catch (e) { conn('offline', 'Unreachable'); return later(2000); }
|
|
497
|
+
if (r.status === 401) { conn('locked', 'Key needed'); return login(S.key ? 'This key was not accepted.' : ''); }
|
|
498
|
+
if (r.status === 503) { conn('offline', 'Starting'); return later(3000); }
|
|
499
|
+
if (!r.ok) { conn('offline', 'HTTP ' + r.status); return later(2000); }
|
|
500
|
+
let s;
|
|
501
|
+
try { s = await r.json(); } catch (e) { conn('offline', 'Bad reply'); return later(2000); }
|
|
502
|
+
if (!S.paused) conn('live', 'Live');
|
|
503
|
+
ingest(s);
|
|
504
|
+
render(s);
|
|
505
|
+
later(1000);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function login(msg) {
|
|
509
|
+
clearTimeout(S.timer);
|
|
510
|
+
$('login').hidden = false;
|
|
511
|
+
set('login-err', msg || '');
|
|
512
|
+
$('key').value = '';
|
|
513
|
+
$('key').focus();
|
|
514
|
+
}
|
|
515
|
+
$('login-form').addEventListener('submit', e => {
|
|
516
|
+
e.preventDefault();
|
|
517
|
+
S.key = $('key').value.trim();
|
|
518
|
+
try { sessionStorage.setItem(STORE, S.key); } catch (err) { /* kept for this page only */ }
|
|
519
|
+
$('login').hidden = true;
|
|
520
|
+
conn('', 'Connecting');
|
|
521
|
+
poll();
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
function ingest(s) {
|
|
525
|
+
if (S.session !== s.ready_at) { S.session = s.ready_at; S.hist = []; S.prev = null; S.base = null; resetChip(); }
|
|
526
|
+
const p = S.prev;
|
|
527
|
+
if (p && s.now > p.now) {
|
|
528
|
+
const dt = s.now - p.now;
|
|
529
|
+
const gpus = s.telemetry.gpus || [];
|
|
530
|
+
const util = gpus.length ? gpus.reduce((a, g) => a + (g.util || 0), 0) / gpus.length : null;
|
|
531
|
+
S.hist.push({t: s.now, rate: Math.max(0, s.traffic.requests - p.traffic.requests) / dt,
|
|
532
|
+
p50: s.traffic.w10.p50, p95: s.traffic.w10.p95, util, gpus: gpus.map(g => g.util)});
|
|
533
|
+
if (S.hist.length > POINTS) S.hist.shift();
|
|
534
|
+
}
|
|
535
|
+
if (!p || s.now > p.now) S.prev = s;
|
|
536
|
+
S.last = s;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function render(s) {
|
|
540
|
+
const st = s.status, tr = s.traffic, b = S.base;
|
|
541
|
+
document.title = `${st.model} · basal-serve`;
|
|
542
|
+
set('model', st.model);
|
|
543
|
+
const busy = st.running + st.queued;
|
|
544
|
+
const head = $('headline');
|
|
545
|
+
head.textContent = `${busy ? 'Serving' : 'Ready'} · ${st.mode}`;
|
|
546
|
+
head.className = 'accent';
|
|
547
|
+
set('since', b ? `view since ${clock(b.t)} · stats since ${clock(s.ready_at)}` : `stats since ${clock(s.ready_at)}`);
|
|
548
|
+
set('lede', `basal ${st.version} serving ${st.source}${st.revision ? ' @ ' + String(st.revision).slice(0, 12) : ''}. ` +
|
|
549
|
+
`Up ${dur(s.uptime)}; the numbers below start at zero with each start and live only in this server's memory.`);
|
|
550
|
+
const tags = [['green', st.state], ['', 'mode ' + st.mode], ['', 'basal ' + st.version]];
|
|
551
|
+
if (st.think && st.think !== 'off') tags.push(['purple', 'think ' + st.think]);
|
|
552
|
+
tags.push(st.auth ? ['purple', 'API keys on'] : ['', 'no API keys']);
|
|
553
|
+
setHTML('tags', tags.map(([c, t]) => `<span class="tag ${c}">${esc(t)}</span>`).join(''));
|
|
554
|
+
const facts = Object.fromEntries((s.config.facts || []));
|
|
555
|
+
const sess = [['Started', clock(s.started)], ['Ready', `${clock(s.ready_at)} (after ${dur(s.ready_at - s.started)})`],
|
|
556
|
+
['Uptime', dur(s.uptime)], ['Engine', facts.engine || '—'], ['Device', facts.device || '—'],
|
|
557
|
+
['Calibration', facts.calibration || '—']];
|
|
558
|
+
setHTML('session', sess.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join(''));
|
|
559
|
+
set('foot-version', `basal ${st.version} · polling ui/state every second · ${tr.ring.toLocaleString('en-US')} requests kept in memory`);
|
|
560
|
+
|
|
561
|
+
// cards
|
|
562
|
+
const req = tr.requests - (b ? b.requests : 0), failed = tr.failed - (b ? b.failed : 0);
|
|
563
|
+
set('m-req-scope', b ? 'since reset' : 'since start');
|
|
564
|
+
$('m-req').innerHTML = `${int(req)}`;
|
|
565
|
+
$('m-req-d').innerHTML = `<span${failed ? ' class="bad"' : ''}>${int(failed)} failed</span> · ${req ? ((1 - failed / req) * 100).toFixed(failed ? 2 : 0) : '100'}% ok`;
|
|
566
|
+
width($('m-req-p'), req ? 1 - failed / req : 0);
|
|
567
|
+
$('m-rate').innerHTML = `${dec(tr.rate10)}<small>req/s</small>`;
|
|
568
|
+
$('m-rate-d').innerHTML = `<b>${dec(tr.rate60)}</b> last min · <b>${dec(tr.requests / Math.max(s.uptime, 1e-9))}</b> since start`;
|
|
569
|
+
const L = b ? tr.w60 : tr.latency;
|
|
570
|
+
set('m-lat-scope', b ? 'last minute' : 'since start');
|
|
571
|
+
$('m-lat').innerHTML = L.p50 == null ? '—' : `${dec(L.p50)}<small>ms</small>`;
|
|
572
|
+
$('m-lat-d').innerHTML = L.p50 == null ? 'no requests yet' : `p95 <b>${dec(L.p95)}</b> · p99 <b>${dec(L.p99)}</b> ms`;
|
|
573
|
+
$('m-fl').innerHTML = `${int(st.running)}<small>running</small>`;
|
|
574
|
+
$('m-fl-d').innerHTML = `<b>${int(st.queued)}</b> queued for the engine`;
|
|
575
|
+
const gpus = s.telemetry.gpus || [];
|
|
576
|
+
if (gpus.length) {
|
|
577
|
+
const util = gpus.reduce((a, g) => a + (g.util || 0), 0) / gpus.length;
|
|
578
|
+
const used = gpus.reduce((a, g) => a + (g.mem_used || 0), 0), total = gpus.reduce((a, g) => a + (g.mem_total || 0), 0);
|
|
579
|
+
$('m-gpu').innerHTML = `${Math.round(util)}<small>% util</small>`;
|
|
580
|
+
$('m-gpu-d').innerHTML = `<b>${gib(used)}</b> of ${gib(total)}`;
|
|
581
|
+
set('m-gpu-x', gpus.length > 1 ? `${gpus.length} GPUs` : '');
|
|
582
|
+
width($('m-gpu-p'), util / 100);
|
|
583
|
+
} else {
|
|
584
|
+
$('m-gpu').innerHTML = '—';
|
|
585
|
+
set('m-gpu-d', s.telemetry.at ? 'no GPU telemetry' : 'reading…');
|
|
586
|
+
width($('m-gpu-p'), 0);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// charts
|
|
590
|
+
const h = S.hist;
|
|
591
|
+
const from = `−${dur(Math.max(h.length > 1 ? h[h.length - 1].t - h[0].t : 0, 60))}`;
|
|
592
|
+
set('c-rate-from', from); set('c-lat-from', from);
|
|
593
|
+
bars($('c-rate'), h.map(p => p.rate));
|
|
594
|
+
lines($('c-lat'), [[h.map(p => p.p95), 'var(--purple)'], [h.map(p => p.p50), 'var(--green)']], 'ms');
|
|
595
|
+
|
|
596
|
+
// endpoints and codes
|
|
597
|
+
set('ep-note', b ? 'counts since reset · ms since start' : 'since start');
|
|
598
|
+
const eps = tr.endpoints || [];
|
|
599
|
+
setHTML('endpoints', eps.length ? eps.map(e => {
|
|
600
|
+
const be = b && b.eps[e.endpoint] || {requests: 0, failed: 0};
|
|
601
|
+
const f = e.failed - be.failed;
|
|
602
|
+
return `<tr><td class="ep">${esc(e.endpoint)}</td><td class="num">${int(e.requests - be.requests)}</td>` +
|
|
603
|
+
`<td class="num">${f ? `<span class="badge err">${int(f)}</span>` : '0'}</td><td class="num">${dec(e.p50)}</td>` +
|
|
604
|
+
`<td class="num">${dec(e.p95)}</td><td class="num">${dec(e.mean)}</td></tr>`;
|
|
605
|
+
}).join('') : '<tr><td colspan="6">No decision requests yet.</td></tr>');
|
|
606
|
+
const codes = Object.entries(tr.codes || {}).map(([c, n]) => [c, n - (b && b.codes[c] || 0)]).filter(([, n]) => n > 0);
|
|
607
|
+
setHTML('codes', '<span class="label">Status codes</span>' + (codes.length ? codes.map(([c, n]) =>
|
|
608
|
+
`${badge(c)}<span class="mono" style="font-size:11px;color:#8b98a8;margin:0 8px 0 -2px;align-self:center">× ${int(n)}</span>`).join('')
|
|
609
|
+
: '<span style="color:#5f6e80;font-size:11px;align-self:center">none yet</span>'));
|
|
610
|
+
if (tr.seen < tr.requests - busy) set('ep-note', `${int(tr.seen)} of ${int(tr.requests)} requests seen`);
|
|
611
|
+
|
|
612
|
+
renderCache(s.cache);
|
|
613
|
+
renderGpus(s.telemetry);
|
|
614
|
+
renderHost(s.telemetry);
|
|
615
|
+
if (S.cfgSession !== s.ready_at) { S.cfgSession = s.ready_at; S.cfg = s.config; renderFacts(); renderOptions(); }
|
|
616
|
+
renderRecent(s.recent || []);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function nice(v) {
|
|
620
|
+
if (!(v > 0)) return 1;
|
|
621
|
+
const e = 10 ** Math.floor(Math.log10(v)), f = v / e;
|
|
622
|
+
return (f <= 1 ? 1 : f <= 2 ? 2 : f <= 2.5 ? 2.5 : f <= 5 ? 5 : 10) * e;
|
|
623
|
+
}
|
|
624
|
+
function grid(top, unit) {
|
|
625
|
+
return [0, .5, 1].map(f => `<span class="y" style="top:${(1 - f) * 100}%">${esc(dec(top * f, top < 5 ? 1 : 0))}${f === 1 && unit ? ' ' + unit : ''}</span>`).join('');
|
|
626
|
+
}
|
|
627
|
+
const W = 600, H = 150;
|
|
628
|
+
function bars(el, vals) {
|
|
629
|
+
if (vals.length < 2) { el.innerHTML = '<div class="empty">Collecting… the chart fills as this page polls.</div>'; return; }
|
|
630
|
+
const top = nice(Math.max(...vals) * 1.1), n = Math.max(vals.length, 60), bw = W / n;
|
|
631
|
+
let d = '';
|
|
632
|
+
vals.forEach((v, i) => {
|
|
633
|
+
const x = W - (vals.length - i) * bw, hh = Math.max(v > 0 ? 1.5 : 0, v / top * H);
|
|
634
|
+
if (hh > 0) d += `M${(x + bw * .15).toFixed(2)} ${H}V${(H - hh).toFixed(2)}H${(x + bw * .85).toFixed(2)}V${H}Z`;
|
|
635
|
+
});
|
|
636
|
+
el.innerHTML = `<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" aria-hidden="true">` + rules() +
|
|
637
|
+
`<path d="${d}" fill="var(--green)" opacity=".85"/></svg>` + grid(top, '/s');
|
|
638
|
+
}
|
|
639
|
+
function rules() {
|
|
640
|
+
return [0, .5, 1].map(f => `<line x1="0" x2="${W}" y1="${(H * f).toFixed(1)}" y2="${(H * f).toFixed(1)}" stroke="#202a35" stroke-width="1" vector-effect="non-scaling-stroke"${f < 1 ? ' stroke-dasharray="3 4"' : ''}/>`).join('');
|
|
641
|
+
}
|
|
642
|
+
function lines(el, series, unit) {
|
|
643
|
+
const all = series.flatMap(([v]) => v.filter(x => x != null));
|
|
644
|
+
if (all.length < 2) { el.innerHTML = '<div class="empty">Collecting… the chart fills as requests arrive.</div>'; return; }
|
|
645
|
+
const top = nice(Math.max(...all) * 1.1), n = Math.max(series[0][0].length, 60), step = W / (n - 1);
|
|
646
|
+
let svg = `<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" aria-hidden="true">` + rules();
|
|
647
|
+
series.forEach(([v, color], k) => {
|
|
648
|
+
let d = '', pen = false;
|
|
649
|
+
v.forEach((y, i) => {
|
|
650
|
+
if (y == null) { pen = false; return; }
|
|
651
|
+
const x = W - (v.length - 1 - i) * step, yy = H - Math.min(y / top, 1) * H;
|
|
652
|
+
d += `${pen ? 'L' : 'M'}${x.toFixed(2)} ${yy.toFixed(2)}`; pen = true;
|
|
653
|
+
});
|
|
654
|
+
if (k === series.length - 1 && d) {
|
|
655
|
+
const pts = v.map((y, i) => [W - (v.length - 1 - i) * step, y]).filter(([, y]) => y != null);
|
|
656
|
+
svg += `<path d="${d}L${pts[pts.length - 1][0].toFixed(2)} ${H}L${pts[0][0].toFixed(2)} ${H}Z" fill="${color}" opacity=".08"/>`;
|
|
657
|
+
}
|
|
658
|
+
svg += `<path d="${d}" fill="none" stroke="${color}" stroke-width="1.8" vector-effect="non-scaling-stroke" stroke-linejoin="round"/>`;
|
|
659
|
+
});
|
|
660
|
+
el.innerHTML = svg + '</svg>' + grid(top, unit);
|
|
661
|
+
}
|
|
662
|
+
function spark(vals, color) {
|
|
663
|
+
const v = vals.slice(-90);
|
|
664
|
+
if (v.filter(x => x != null).length < 2) return '';
|
|
665
|
+
const w = 300, h = 34, step = w / (Math.max(v.length, 30) - 1);
|
|
666
|
+
let d = '', pen = false;
|
|
667
|
+
v.forEach((y, i) => {
|
|
668
|
+
if (y == null) { pen = false; return; }
|
|
669
|
+
d += `${pen ? 'L' : 'M'}${(w - (v.length - 1 - i) * step).toFixed(1)} ${(h - y / 100 * (h - 2) - 1).toFixed(1)}`; pen = true;
|
|
670
|
+
});
|
|
671
|
+
return `<svg viewBox="0 0 ${w} ${h}" preserveAspectRatio="none" aria-hidden="true"><path d="${d}" fill="none" stroke="${color}" stroke-width="1.5" vector-effect="non-scaling-stroke"/></svg>`;
|
|
672
|
+
}
|
|
673
|
+
const meter = (label, value, frac, cls) => `<div class="meter"><div class="meter-top"><span>${esc(label)}</span><b>${esc(value)}</b></div>` +
|
|
674
|
+
`<div class="bar ${cls || ''}"><span style="width:${(Math.max(0, Math.min(1, frac || 0)) * 100).toFixed(1)}%"></span></div></div>`;
|
|
675
|
+
const stat = (label, value, unit) => `<div class="stat"><span>${esc(label)}</span><b>${esc(value)}${unit ? `<small>${esc(unit)}</small>` : ''}</b></div>`;
|
|
676
|
+
|
|
677
|
+
function renderCache(c) {
|
|
678
|
+
if (!c) {
|
|
679
|
+
set('cache-note', 'off');
|
|
680
|
+
setHTML('cache', '<div class="notice">No state cache on this server. Start it with <code>--state-cache-gb N</code> to keep computed states across requests over the same text; its entries, hits and evictions show here.</div>');
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const looks = c.hits + c.misses;
|
|
684
|
+
set('cache-note', `${int(c.entries)} states`);
|
|
685
|
+
setHTML('cache', `<div class="stats">${stat('Hit rate', looks ? (c.hits / looks * 100).toFixed(1) : '—', looks ? '%' : '')}` +
|
|
686
|
+
`${stat('Entries', int(c.entries))}${stat('Hits', int(c.hits))}${stat('Misses', int(c.misses))}` +
|
|
687
|
+
`${stat('Prefix hits', int(c.prefix_hits))}${stat('Evictions', int(c.evictions))}</div>` +
|
|
688
|
+
meter('Memory', `${gib(c.used_bytes)} of ${gib(c.budget_bytes)}`, c.used_bytes / c.budget_bytes, 'purple'));
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function renderGpus(t) {
|
|
692
|
+
const gpus = t.gpus || [];
|
|
693
|
+
if (!gpus.length) {
|
|
694
|
+
set('gpu-note', t.at ? 'not available' : 'starting');
|
|
695
|
+
setHTML('gpus', `<div class="notice">${esc(t.gpu_note || (t.at ? 'No GPU found by NVML.' : 'Reading telemetry…'))}</div>`);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
set('gpu-note', `NVML · ${clock(t.at)}`);
|
|
699
|
+
setHTML('gpus', '<div class="gpus">' + gpus.map((g, i) => {
|
|
700
|
+
const mem = g.mem_total ? g.mem_used / g.mem_total : 0, pw = g.power_limit ? g.power / g.power_limit : 0;
|
|
701
|
+
const phys = [g.nvml_index != null ? `GPU ${g.nvml_index}` : '', g.pci || ''].filter(Boolean).join(' · ');
|
|
702
|
+
return `<div class="gpu"><div class="gpu-head"><div style="min-width:0"><strong>${esc(g.name || 'GPU')}</strong>` +
|
|
703
|
+
(phys ? `<div class="gpu-id" title="the physical GPU (NVML index, PCI bus id)">${esc(phys)}</div>` : '') +
|
|
704
|
+
`</div><span class="tag" title="this server's view of it">cuda:${esc(g.index)}</span></div>` +
|
|
705
|
+
meter('Utilisation', pct(g.util), (g.util || 0) / 100) +
|
|
706
|
+
meter('Memory', `${gib(g.mem_used)} of ${gib(g.mem_total)}${g.mem_own ? ` · this server ${gib(g.mem_own)}` : ''}`, mem, 'purple') +
|
|
707
|
+
meter('Power', g.power == null ? '—' : `${Math.round(g.power)} of ${Math.round(g.power_limit || 0)} W`, pw, pw > .9 ? 'amber' : '') +
|
|
708
|
+
`<div class="gpu-facts"><span>temp <b>${g.temp == null ? '—' : g.temp + ' °C'}</b></span><span>mem bus <b>${pct(g.mem_util)}</b></span>` +
|
|
709
|
+
`<span>SM <b>${g.sm_clock == null ? '—' : int(g.sm_clock) + ' MHz'}</b></span></div>` +
|
|
710
|
+
`<div class="spark">${spark(S.hist.map(p => p.gpus[i]), 'var(--green)')}</div></div>`;
|
|
711
|
+
}).join('') + '</div>');
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function renderHost(t) {
|
|
715
|
+
const h = t.host || {};
|
|
716
|
+
let html = '';
|
|
717
|
+
if (h.cpu != null) html += meter('CPU', `${pct(h.cpu)} of ${h.cpus} cores`, h.cpu / 100);
|
|
718
|
+
if (h.ram_total) html += meter('Memory', `${gib(h.ram_used)} of ${gib(h.ram_total)}`, h.ram_used / h.ram_total, 'purple');
|
|
719
|
+
html += '<div class="stats" style="margin-top:16px">' +
|
|
720
|
+
stat('Load', h.load ? h.load.map(x => x.toFixed(2)).join(' ') : '—') + stat('Cores', h.cpus == null ? '—' : String(h.cpus)) +
|
|
721
|
+
(h.cpu != null ? stat('Server RSS', gib(h.rss)) + stat('Server CPU', pct(h.proc_cpu)) + stat('Threads', int(h.threads)) +
|
|
722
|
+
stat('Sampled', clock(t.at)) : '') + '</div>';
|
|
723
|
+
if (t.host_note) html += `<div class="notice" style="margin-top:14px">${esc(t.host_note)}</div>`;
|
|
724
|
+
setHTML('host', t.at ? html : '<div class="notice">Reading telemetry…</div>');
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function renderFacts() {
|
|
728
|
+
setHTML('facts', (S.cfg.facts || []).map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(val(v))}</dd>`).join(''));
|
|
729
|
+
}
|
|
730
|
+
function renderOptions() {
|
|
731
|
+
if (!S.cfg) return;
|
|
732
|
+
const q = $('opt-filter').value.trim().toLowerCase(), only = $('opt-changed').checked;
|
|
733
|
+
const rows = (S.cfg.options || []).filter(([k, v, ch]) => (!only || ch) && (!q || flag(k).includes(q) || val(v).toLowerCase().includes(q)));
|
|
734
|
+
set('opt-count', String(rows.length));
|
|
735
|
+
setHTML('options', rows.length ? rows.map(([k, v, ch]) => `<tr class="${ch ? 'changed' : ''}"><td class="k">${esc(flag(k))}</td><td class="v">${esc(val(v))}</td></tr>`).join('')
|
|
736
|
+
: '<tr><td colspan="2">No option matches.</td></tr>');
|
|
737
|
+
}
|
|
738
|
+
$('opt-filter').addEventListener('input', renderOptions);
|
|
739
|
+
$('opt-changed').addEventListener('change', renderOptions);
|
|
740
|
+
|
|
741
|
+
function renderRecent(rows) {
|
|
742
|
+
if (S.errorsOnly) rows = rows.filter(r => r[2] >= 400);
|
|
743
|
+
set('req-count', String(rows.length));
|
|
744
|
+
const shown = S.showAll ? rows : rows.slice(0, 25);
|
|
745
|
+
$('more').hidden = rows.length <= 25;
|
|
746
|
+
set('more', S.showAll ? 'Show 25' : `Show all ${rows.length}`);
|
|
747
|
+
const full = S.last && S.last.status.ui === 'full';
|
|
748
|
+
set('req-foot', full ? 'Click a row for its request and answer (--ui full keeps the last 200 in this server\'s memory).'
|
|
749
|
+
: 'Metadata only: the request\'s text is never kept.');
|
|
750
|
+
setHTML('recent', shown.length ? shown.map(r => `<tr${full && r[6] != null ? ` class="open${r[6] === S.openId ? ' sel' : ''}" data-id="${esc(r[6])}" tabindex="0"` : ''}><td class="t">${clockMs(r[0])}</td><td class="ep">${esc(r[1])}</td>` +
|
|
751
|
+
`<td>${badge(r[2])}</td><td class="num">${dec(r[3])}</td><td class="num">${r[4] == null ? '—' : int(r[4])}</td>` +
|
|
752
|
+
`<td class="num">${r[5] == null ? '—' : int(r[5])}</td></tr>`).join('')
|
|
753
|
+
: `<tr><td colspan="6">${S.errorsOnly ? 'No failed requests among the recent ones.' : 'No decision requests yet.'}</td></tr>`);
|
|
754
|
+
}
|
|
755
|
+
$('more').addEventListener('click', () => { S.showAll = !S.showAll; if (S.last) renderRecent(S.last.recent || []); });
|
|
756
|
+
|
|
757
|
+
// --ui full: a request and its answer, fetched when a row is opened
|
|
758
|
+
function trunc(v) {
|
|
759
|
+
if (typeof v === 'string' && v.length > 4000) return v.slice(0, 4000) + `… [${nf.format(v.length)} characters]`;
|
|
760
|
+
if (Array.isArray(v)) return v.map(trunc);
|
|
761
|
+
if (v && typeof v === 'object') return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, trunc(x)]));
|
|
762
|
+
return v;
|
|
763
|
+
}
|
|
764
|
+
function hl(v) {
|
|
765
|
+
const s = JSON.stringify(trunc(v), null, 2) ?? 'null';
|
|
766
|
+
const re = /("(?:\\.|[^"\\])*")(\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g;
|
|
767
|
+
let out = '', last = 0, m;
|
|
768
|
+
while ((m = re.exec(s))) {
|
|
769
|
+
const t = m[0];
|
|
770
|
+
out += esc(s.slice(last, m.index)) + (m[1] ? (m[2] ? `<span class="k">${esc(m[1])}</span>${esc(m[2])}` : `<span class="s">${esc(t)}</span>`)
|
|
771
|
+
: t === 'null' ? '<span class="z">null</span>' : t === 'true' || t === 'false' ? `<span class="b">${t}</span>` : `<span class="n">${t}</span>`);
|
|
772
|
+
last = re.lastIndex;
|
|
773
|
+
}
|
|
774
|
+
return out + esc(s.slice(last));
|
|
775
|
+
}
|
|
776
|
+
function section(title, id, v) {
|
|
777
|
+
return `<div class="drawer-sec"><div class="row"><span class="kicker${title === 'Error' ? '' : ' purple'}" style="${title === 'Error' ? 'color:var(--red)' : ''}">${esc(title)}</span>` +
|
|
778
|
+
`<button class="text-btn" type="button" data-copy="${id}">Copy JSON</button></div><pre class="json">${hl(v)}</pre></div>`;
|
|
779
|
+
}
|
|
780
|
+
function closeReq() {
|
|
781
|
+
$('drawer').hidden = $('drawer-bg').hidden = true;
|
|
782
|
+
S.openId = null; S.detail = null;
|
|
783
|
+
if (S.last) renderRecent(S.last.recent || []);
|
|
784
|
+
}
|
|
785
|
+
async function openReq(id) {
|
|
786
|
+
S.openId = id; S.detail = null;
|
|
787
|
+
$('drawer').hidden = $('drawer-bg').hidden = false;
|
|
788
|
+
set('d-kicker', `Request #${id}`); set('d-title', 'Loading…'); setHTML('d-meta', ''); setHTML('d-body', '');
|
|
789
|
+
if (S.last) renderRecent(S.last.recent || []);
|
|
790
|
+
$('d-close').focus();
|
|
791
|
+
let r;
|
|
792
|
+
try { r = await fetch(`ui/request/${encodeURIComponent(id)}`, {cache: 'no-store', headers: S.key ? {Authorization: 'Bearer ' + S.key} : {}}); }
|
|
793
|
+
catch (e) { set('d-title', 'The server did not answer.'); return; }
|
|
794
|
+
if (S.openId !== id) return;
|
|
795
|
+
if (r.status === 401) { closeReq(); return login('This key was not accepted.'); }
|
|
796
|
+
if (r.status === 404) {
|
|
797
|
+
set('d-title', 'No longer kept');
|
|
798
|
+
setHTML('d-body', '<div class="notice" style="margin-top:18px">--ui full keeps the last 200 requests; this one has been replaced by newer ones.</div>');
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
if (!r.ok) { set('d-title', 'HTTP ' + r.status); return; }
|
|
802
|
+
const d = await r.json();
|
|
803
|
+
S.detail = d;
|
|
804
|
+
set('d-title', d.endpoint);
|
|
805
|
+
setHTML('d-meta', `${badge(d.status)}<span>${dec(d.ms)} ms</span><span>${clockMs(d.time)}</span>` +
|
|
806
|
+
(d.questions != null ? `<span>${int(d.questions)} question${d.questions === 1 ? '' : 's'} · ${int(d.options)} options</span>` : ''));
|
|
807
|
+
setHTML('d-body', section('Request', 'request', d.request) + section(d.status >= 400 ? 'Error' : 'Answer', 'answer', d.answer));
|
|
808
|
+
}
|
|
809
|
+
$('recent').addEventListener('click', e => { const tr = e.target.closest('tr[data-id]'); if (tr) openReq(Number(tr.dataset.id)); });
|
|
810
|
+
$('recent').addEventListener('keydown', e => {
|
|
811
|
+
const tr = e.target.closest('tr[data-id]');
|
|
812
|
+
if (tr && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); openReq(Number(tr.dataset.id)); }
|
|
813
|
+
});
|
|
814
|
+
$('d-close').addEventListener('click', closeReq);
|
|
815
|
+
$('drawer-bg').addEventListener('click', closeReq);
|
|
816
|
+
document.addEventListener('keydown', e => { if (e.key === 'Escape' && !$('drawer').hidden) closeReq(); });
|
|
817
|
+
$('d-body').addEventListener('click', e => {
|
|
818
|
+
const b = e.target.closest('[data-copy]');
|
|
819
|
+
if (!b || !S.detail) return;
|
|
820
|
+
const text = JSON.stringify(S.detail[b.dataset.copy], null, 2);
|
|
821
|
+
const done = () => { b.textContent = 'Copied'; setTimeout(() => { b.textContent = 'Copy JSON'; }, 1200); };
|
|
822
|
+
if (navigator.clipboard) navigator.clipboard.writeText(text).then(done, () => { b.textContent = 'Copy failed'; });
|
|
823
|
+
});
|
|
824
|
+
document.querySelectorAll('.req-tools .chip').forEach(b => b.addEventListener('click', () => {
|
|
825
|
+
S.errorsOnly = b.dataset.f === 'err';
|
|
826
|
+
document.querySelectorAll('.req-tools .chip').forEach(x => x.classList.toggle('on', x === b));
|
|
827
|
+
if (S.last) renderRecent(S.last.recent || []);
|
|
828
|
+
}));
|
|
829
|
+
|
|
830
|
+
function resetChip() { $('reset').classList.toggle('primary', !!S.base); }
|
|
831
|
+
$('reset').addEventListener('click', () => {
|
|
832
|
+
const s = S.last;
|
|
833
|
+
if (!s) return;
|
|
834
|
+
if (S.base) { S.base = null; } else {
|
|
835
|
+
S.base = {t: s.now, requests: s.traffic.requests, failed: s.traffic.failed, codes: {...s.traffic.codes},
|
|
836
|
+
eps: Object.fromEntries((s.traffic.endpoints || []).map(e => [e.endpoint, {requests: e.requests, failed: e.failed}]))};
|
|
837
|
+
S.hist = [];
|
|
838
|
+
}
|
|
839
|
+
$('reset').querySelector('.lbl').textContent = S.base ? 'Since start' : 'Reset view';
|
|
840
|
+
resetChip();
|
|
841
|
+
render(s);
|
|
842
|
+
});
|
|
843
|
+
$('pause').addEventListener('click', () => {
|
|
844
|
+
S.paused = !S.paused;
|
|
845
|
+
$('pause').querySelector('.lbl').textContent = S.paused ? 'Resume' : 'Pause';
|
|
846
|
+
$('pause').querySelector('svg').innerHTML = S.paused ? '<path d="M7 5l12 7-12 7z"/>' : '<path d="M9 5v14M15 5v14"/>';
|
|
847
|
+
if (S.paused) { clearTimeout(S.timer); conn('', 'Paused'); } else { conn('', 'Connecting'); poll(); }
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
if ('IntersectionObserver' in window) {
|
|
851
|
+
const links = [...document.querySelectorAll('.topbar nav a')];
|
|
852
|
+
const io = new IntersectionObserver(es => es.forEach(e => {
|
|
853
|
+
if (e.isIntersecting) links.forEach(a => a.classList.toggle('active', a.getAttribute('href') === '#' + e.target.id));
|
|
854
|
+
}), {rootMargin: '-30% 0px -60% 0px'});
|
|
855
|
+
['overview', 'traffic', 'telemetry', 'configuration', 'requests'].forEach(id => io.observe($(id)));
|
|
856
|
+
}
|
|
857
|
+
poll();
|
|
858
|
+
})();
|
|
859
|
+
</script>
|
|
860
|
+
</body>
|
|
861
|
+
</html>
|