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/router_ui.html
ADDED
|
@@ -0,0 +1,902 @@
|
|
|
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-router</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
|
+
/* router: replicas */
|
|
301
|
+
.sec-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0 14px;flex-wrap:wrap}
|
|
302
|
+
.sec-title h2{display:flex;align-items:center;gap:10px;font:600 13px/1.4 'DM Sans',sans-serif;color:#dfe5ec}
|
|
303
|
+
.sec-title h2 .ic{color:var(--muted)}
|
|
304
|
+
.sec-title .note{font:9px var(--mono);letter-spacing:.8px;color:#6c7b8d;text-transform:uppercase}
|
|
305
|
+
.reps{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:18px;margin-bottom:18px}
|
|
306
|
+
.rep{display:flex;flex-direction:column}
|
|
307
|
+
.rep-head{padding:14px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px;
|
|
308
|
+
border-bottom:1px solid var(--line);min-height:62px}
|
|
309
|
+
.rep-title{display:flex;align-items:center;gap:12px;min-width:0}
|
|
310
|
+
.rep-title strong{font:600 16px/1.2 var(--head);color:#e3e9ef;letter-spacing:-.3px;white-space:nowrap}
|
|
311
|
+
.rep-title .gpu-id{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
312
|
+
.rep-num{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;flex-shrink:0;font:600 13px var(--head);
|
|
313
|
+
color:#0d1710}
|
|
314
|
+
.rep-tags{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
|
|
315
|
+
.rep-model{padding:12px 18px 0;font:11px/1.6 var(--mono);color:#7d899b;overflow-wrap:anywhere}
|
|
316
|
+
.rep-model b{color:var(--soft);font-weight:400}
|
|
317
|
+
.rep .body{display:flex;flex-direction:column;gap:14px;flex:1}
|
|
318
|
+
.stats.four{grid-template-columns:repeat(4,minmax(0,1fr))}
|
|
319
|
+
.rep .gpu{background:#0e141c}
|
|
320
|
+
.rep .meter{margin:12px 0 2px}
|
|
321
|
+
.dot{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:8px;vertical-align:middle;flex-shrink:0}
|
|
322
|
+
.pools{display:flex;gap:5px;flex-wrap:wrap}
|
|
323
|
+
.features{display:flex;flex-wrap:wrap;gap:8px 22px;padding:14px 18px;border-top:1px solid var(--line);font-size:11px;
|
|
324
|
+
color:#8b98a8;align-items:center}
|
|
325
|
+
.features .label{font:9px var(--mono);letter-spacing:.8px;color:#6a7f91;text-transform:uppercase}
|
|
326
|
+
.features b{color:var(--soft);font-weight:500}
|
|
327
|
+
.login .row .btn.ghost{flex:0 0 auto}
|
|
328
|
+
.btn[hidden]{display:none}
|
|
329
|
+
@media (max-width:760px){
|
|
330
|
+
.stats.four{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
331
|
+
.rep-head{padding:13px 14px}
|
|
332
|
+
.rep-model{padding:12px 14px 0}
|
|
333
|
+
.features{padding:12px 14px}
|
|
334
|
+
}
|
|
335
|
+
</style>
|
|
336
|
+
</head>
|
|
337
|
+
<body>
|
|
338
|
+
<header class="topbar">
|
|
339
|
+
<div class="brand">
|
|
340
|
+
<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>
|
|
341
|
+
<span class="brand-name">basal<b>.</b></span>
|
|
342
|
+
<span class="brand-divider"></span>
|
|
343
|
+
<span class="brand-caption">Router<br>all replicas</span>
|
|
344
|
+
</div>
|
|
345
|
+
<nav aria-label="Sections">
|
|
346
|
+
<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>
|
|
347
|
+
<a href="#replicas"><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>Replicas</span></a>
|
|
348
|
+
<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>
|
|
349
|
+
<a href="#routing"><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>Routing</span></a>
|
|
350
|
+
<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>
|
|
351
|
+
<a href="#requests"><svg class="ic" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10"/></svg><span>Requests</span></a>
|
|
352
|
+
</nav>
|
|
353
|
+
<div class="header-right">
|
|
354
|
+
<div class="conn" id="conn" role="status"><i></i><span id="conn-text">Connecting</span></div>
|
|
355
|
+
<button class="btn" id="keybtn" type="button" hidden title="The API key the replicas ask for"><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><span class="lbl">API key</span></button>
|
|
356
|
+
<button class="btn" id="pause" type="button" title="Stop polling this router"><svg class="ic" viewBox="0 0 24 24"><path d="M9 5v14M15 5v14"/></svg><span class="lbl">Pause</span></button>
|
|
357
|
+
<button class="btn" id="reset" type="button" title="Count from now in this view (the router'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>
|
|
358
|
+
</div>
|
|
359
|
+
</header>
|
|
360
|
+
|
|
361
|
+
<main>
|
|
362
|
+
<section class="hero" id="overview" aria-label="Status">
|
|
363
|
+
<div>
|
|
364
|
+
<div class="eyebrow"><span>Router</span><span aria-hidden="true">·</span><span id="since">stats since start</span></div>
|
|
365
|
+
<h1><span id="model">basal-router</span><br><span class="accent" id="headline">Connecting…</span></h1>
|
|
366
|
+
<p class="lede" id="lede">Live status of this router and every replica behind it. The router's numbers start at zero with every start and stay in its memory.</p>
|
|
367
|
+
<div class="tags" id="tags"></div>
|
|
368
|
+
</div>
|
|
369
|
+
<div class="panel session">
|
|
370
|
+
<dl id="session"></dl>
|
|
371
|
+
</div>
|
|
372
|
+
</section>
|
|
373
|
+
|
|
374
|
+
<div class="metrics" role="list">
|
|
375
|
+
<div class="panel metric" role="listitem">
|
|
376
|
+
<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>
|
|
377
|
+
<div class="metric-value" id="m-req">—</div>
|
|
378
|
+
<div class="metric-detail" id="m-req-d"> </div>
|
|
379
|
+
<div class="progress"><span id="m-req-p"></span></div>
|
|
380
|
+
</div>
|
|
381
|
+
<div class="panel metric" role="listitem">
|
|
382
|
+
<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>
|
|
383
|
+
<div class="metric-value" id="m-rate">—</div>
|
|
384
|
+
<div class="metric-detail" id="m-rate-d"> </div>
|
|
385
|
+
</div>
|
|
386
|
+
<div class="panel metric" role="listitem">
|
|
387
|
+
<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>
|
|
388
|
+
<div class="metric-value" id="m-lat">—</div>
|
|
389
|
+
<div class="metric-detail" id="m-lat-d"> </div>
|
|
390
|
+
</div>
|
|
391
|
+
<div class="panel metric" role="listitem">
|
|
392
|
+
<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>
|
|
393
|
+
<div class="metric-value" id="m-fl">—</div>
|
|
394
|
+
<div class="metric-detail" id="m-fl-d"> </div>
|
|
395
|
+
</div>
|
|
396
|
+
<div class="panel metric" role="listitem">
|
|
397
|
+
<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>GPUs<span class="extra" id="m-gpu-x"></span></div>
|
|
398
|
+
<div class="metric-value" id="m-gpu">—</div>
|
|
399
|
+
<div class="metric-detail" id="m-gpu-d"> </div>
|
|
400
|
+
<div class="progress"><span id="m-gpu-p"></span></div>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
<section id="replicas" class="section" aria-label="Replicas">
|
|
405
|
+
<div class="sec-title"><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>Replicas <span class="count" id="rep-count">0</span></h2>
|
|
406
|
+
<span class="note">each replica's own state, read through the router</span></div>
|
|
407
|
+
<div class="reps" id="reps"><div class="panel body"><div class="notice">Reading the replicas…</div></div></div>
|
|
408
|
+
</section>
|
|
409
|
+
|
|
410
|
+
<div id="traffic" class="grid-2">
|
|
411
|
+
<section class="panel">
|
|
412
|
+
<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 by replica</h2><div class="legend" id="leg-rate"></div></div>
|
|
413
|
+
<div class="body"><div class="chart" id="c-rate"></div><div class="chart-foot"><span id="c-rate-from">—</span><span>requests / s through the router · now</span></div></div>
|
|
414
|
+
</section>
|
|
415
|
+
<section class="panel">
|
|
416
|
+
<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 through the router</h2>
|
|
417
|
+
<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>
|
|
418
|
+
<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>
|
|
419
|
+
</section>
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
<div class="grid-2">
|
|
423
|
+
<section class="panel">
|
|
424
|
+
<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>GPU utilisation by replica</h2><div class="legend" id="leg-gpu"></div></div>
|
|
425
|
+
<div class="body"><div class="chart" id="c-gpu"></div><div class="chart-foot"><span id="c-gpu-from">—</span><span>% · NVML on each replica · now</span></div></div>
|
|
426
|
+
</section>
|
|
427
|
+
<section class="panel">
|
|
428
|
+
<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">through the router · since start</span></div>
|
|
429
|
+
<div class="table-scroll"><table>
|
|
430
|
+
<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>
|
|
431
|
+
<tbody id="endpoints"><tr><td colspan="6">No decision requests yet.</td></tr></tbody>
|
|
432
|
+
</table></div>
|
|
433
|
+
<div class="codes" id="codes"><span class="label">Status codes</span><span class="muted">none yet</span></div>
|
|
434
|
+
</section>
|
|
435
|
+
</div>
|
|
436
|
+
|
|
437
|
+
<section class="panel section" id="routing">
|
|
438
|
+
<div class="section-header"><h2><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>Routing</h2><span class="note" id="route-note">the router's counters · since start</span></div>
|
|
439
|
+
<div class="table-scroll"><table>
|
|
440
|
+
<thead><tr><th>Replica</th><th>Pools</th><th>Ready</th><th class="num">In flight</th><th class="num">By state</th><th class="num">By load</th><th class="num">Share</th><th class="num">Failed</th><th class="num">p50 ms</th><th class="num">p95 ms</th></tr></thead>
|
|
441
|
+
<tbody id="routes"></tbody>
|
|
442
|
+
</table></div>
|
|
443
|
+
<div class="features" id="features"></div>
|
|
444
|
+
</section>
|
|
445
|
+
|
|
446
|
+
<section class="panel section" id="configuration">
|
|
447
|
+
<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">the router's, as parsed at start-up · secrets redacted</span></div>
|
|
448
|
+
<div class="config">
|
|
449
|
+
<div class="facts"><dl id="facts"></dl></div>
|
|
450
|
+
<div class="opts-col">
|
|
451
|
+
<div class="opts-tools">
|
|
452
|
+
<input type="search" id="opt-filter" placeholder="Filter options" aria-label="Filter options" autocomplete="off" spellcheck="false">
|
|
453
|
+
<label class="toggle"><input type="checkbox" id="opt-changed"> Changed only</label>
|
|
454
|
+
<span class="count" id="opt-count">0</span>
|
|
455
|
+
</div>
|
|
456
|
+
<div class="opts"><table><thead><tr><th>Option</th><th>Value</th></tr></thead><tbody id="options"></tbody></table></div>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
</section>
|
|
460
|
+
|
|
461
|
+
<section class="panel section" id="requests">
|
|
462
|
+
<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>
|
|
463
|
+
<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>
|
|
464
|
+
<div class="table-scroll"><table>
|
|
465
|
+
<thead><tr><th>Time</th><th>Endpoint</th><th>Status</th><th class="num">Latency ms</th><th>Replica</th><th>Routed by</th></tr></thead>
|
|
466
|
+
<tbody id="recent"><tr><td colspan="6">No decision requests yet.</td></tr></tbody>
|
|
467
|
+
</table></div>
|
|
468
|
+
<div class="table-foot"><span>Through the router, metadata only: the request's text is never kept.</span><button class="text-btn" type="button" id="more">Show all</button></div>
|
|
469
|
+
</section>
|
|
470
|
+
|
|
471
|
+
<footer>
|
|
472
|
+
<span id="foot-version">basal-router</span>
|
|
473
|
+
<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>
|
|
474
|
+
</footer>
|
|
475
|
+
</main>
|
|
476
|
+
|
|
477
|
+
<div class="login" id="login" hidden>
|
|
478
|
+
<form id="login-form" autocomplete="off">
|
|
479
|
+
<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</div>
|
|
480
|
+
<h2 id="login-title">The replicas ask for a key</h2>
|
|
481
|
+
<p>The router or the replicas behind it were started with <code>--api-keys</code>. The key is kept in this tab only and sent only to this router, which passes it on to the replicas when it reads their state, as it does for requests. Without a key the page shows the router's own numbers, unless the router itself asks for one.</p>
|
|
482
|
+
<label for="key" class="toggle" style="margin-bottom:8px">API key</label>
|
|
483
|
+
<input id="key" type="password" spellcheck="false" autocomplete="off">
|
|
484
|
+
<div class="row"><button class="btn primary" type="submit">Connect</button><button class="btn ghost" type="button" id="nokey">Without a key</button></div>
|
|
485
|
+
<div class="err" id="login-err" role="alert"></div>
|
|
486
|
+
</form>
|
|
487
|
+
</div>
|
|
488
|
+
<noscript><p style="padding:20px">This page needs JavaScript to read the router's state.</p></noscript>
|
|
489
|
+
|
|
490
|
+
<script>
|
|
491
|
+
(() => {
|
|
492
|
+
'use strict';
|
|
493
|
+
const $ = id => document.getElementById(id);
|
|
494
|
+
const STORE = 'basal-ui-key', POINTS = 300;
|
|
495
|
+
const COLORS = ['var(--green)', 'var(--purple)', 'var(--blue)', 'var(--amber)', 'var(--red)', '#d6dde6'];
|
|
496
|
+
const S = {key: '', asked: null, paused: false, hist: [], prev: null, session: null, base: null, cfgSession: null, cfg: null,
|
|
497
|
+
showAll: false, errorsOnly: false, timer: 0, last: null};
|
|
498
|
+
try { S.key = sessionStorage.getItem(STORE) || ''; } catch (e) { /* storage blocked: ask each time */ }
|
|
499
|
+
|
|
500
|
+
const esc = v => String(v).replace(/[&<>"']/g, c => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''})[c]);
|
|
501
|
+
const nf = new Intl.NumberFormat('en-US');
|
|
502
|
+
const int = n => n == null ? '—' : nf.format(Math.round(n));
|
|
503
|
+
const dec = (v, d) => v == null ? '—' : v < 10 ? v.toFixed(d == null ? 2 : d) : v < 100 ? v.toFixed(1) : nf.format(Math.round(v));
|
|
504
|
+
const pct = v => v == null ? '—' : Math.round(v) + '%';
|
|
505
|
+
const gib = b => b == null ? '—' : b >= 2 ** 30 ? (b / 2 ** 30).toFixed(1) + ' GiB' : (b / 2 ** 20).toFixed(0) + ' MiB';
|
|
506
|
+
const pad = n => String(n).padStart(2, '0');
|
|
507
|
+
const clock = t => { const d = new Date(t * 1000); return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`; };
|
|
508
|
+
const clockMs = t => clock(t) + '.' + String(Math.floor((t % 1) * 1000)).padStart(3, '0');
|
|
509
|
+
const dur = s => {
|
|
510
|
+
if (s == null) return '—';
|
|
511
|
+
s = Math.floor(s);
|
|
512
|
+
const d = Math.floor(s / 86400), h = Math.floor(s % 86400 / 3600), m = Math.floor(s % 3600 / 60);
|
|
513
|
+
return d ? `${d} d ${h} h` : h ? `${h} h ${m} min` : m ? `${m} min ${s % 60} s` : `${s} s`;
|
|
514
|
+
};
|
|
515
|
+
const flag = k => '--' + k.replace(/_/g, '-');
|
|
516
|
+
const val = v => v == null ? 'none' : typeof v === 'boolean' ? (v ? 'on' : 'off') : Array.isArray(v) ? v.map(x => Array.isArray(x) ? x.join(' ') : x).join(' · ') : String(v);
|
|
517
|
+
const width = (el, f) => { el.style.width = Math.max(0, Math.min(100, f * 100)).toFixed(1) + '%'; };
|
|
518
|
+
const set = (id, text) => { const el = $(id); if (el.textContent !== text) el.textContent = text; };
|
|
519
|
+
const setHTML = (id, html) => { const el = $(id); if (el.innerHTML !== html) el.innerHTML = html; };
|
|
520
|
+
const badge = c => `<span class="badge${c >= 500 ? ' err' : c >= 400 ? ' warn' : ''}">${esc(c)}</span>`;
|
|
521
|
+
const color = k => COLORS[k % COLORS.length];
|
|
522
|
+
const host = u => String(u).replace(/^[a-z]+:\/\//, '');
|
|
523
|
+
const pool = p => p === 'main' ? 'main' : p.replace(/^level:/, 'level ').replace(/^blend:/, 'blend ').replace(/^script:/, '');
|
|
524
|
+
const routed = x => x.routed.state + x.routed.load;
|
|
525
|
+
const gpusOf = x => x.state && x.state.telemetry && x.state.telemetry.gpus || [];
|
|
526
|
+
const mean = a => a.length ? a.reduce((p, v) => p + (v || 0), 0) / a.length : null;
|
|
527
|
+
|
|
528
|
+
function conn(kind, text) { $('conn').className = 'conn ' + kind; set('conn-text', text); }
|
|
529
|
+
function later(ms) { clearTimeout(S.timer); if (!S.paused) S.timer = setTimeout(poll, ms || 1000); }
|
|
530
|
+
|
|
531
|
+
async function poll() {
|
|
532
|
+
let r;
|
|
533
|
+
try {
|
|
534
|
+
r = await fetch('ui/state', {cache: 'no-store', headers: S.key ? {Authorization: 'Bearer ' + S.key} : {}});
|
|
535
|
+
} catch (e) { conn('offline', 'Unreachable'); return later(2000); }
|
|
536
|
+
if (r.status === 401) { // the router's own --api-keys: nothing to show without a key
|
|
537
|
+
conn('locked', 'Key needed'); $('keybtn').hidden = false;
|
|
538
|
+
return login(S.key ? 'The router did not accept this key.' : '', true);
|
|
539
|
+
}
|
|
540
|
+
if (!r.ok) { conn('offline', 'HTTP ' + r.status); return later(2000); }
|
|
541
|
+
let s;
|
|
542
|
+
try { s = await r.json(); } catch (e) { conn('offline', 'Bad reply'); return later(2000); }
|
|
543
|
+
if (!S.paused) conn('live', 'Live');
|
|
544
|
+
ingest(s);
|
|
545
|
+
render(s);
|
|
546
|
+
const locked = s.replicas.filter(x => x.ui === 'key');
|
|
547
|
+
$('keybtn').hidden = !locked.length && !S.key;
|
|
548
|
+
if (locked.length && S.asked !== S.key) {
|
|
549
|
+
S.asked = S.key;
|
|
550
|
+
login(S.key ? `Replica ${locked.map(x => x.index + 1).join(', ')} did not accept this key.` : '');
|
|
551
|
+
}
|
|
552
|
+
later(1000);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function login(msg, router) {
|
|
556
|
+
set('login-title', router ? 'The router asks for a key' : 'The replicas ask for a key');
|
|
557
|
+
$('login').hidden = false;
|
|
558
|
+
set('login-err', msg || '');
|
|
559
|
+
$('key').value = '';
|
|
560
|
+
$('key').focus();
|
|
561
|
+
}
|
|
562
|
+
$('login-form').addEventListener('submit', e => {
|
|
563
|
+
e.preventDefault();
|
|
564
|
+
S.key = $('key').value.trim();
|
|
565
|
+
try { sessionStorage.setItem(STORE, S.key); } catch (err) { /* kept for this page only */ }
|
|
566
|
+
$('login').hidden = true;
|
|
567
|
+
conn('', 'Connecting');
|
|
568
|
+
if (!S.paused) poll();
|
|
569
|
+
});
|
|
570
|
+
$('nokey').addEventListener('click', () => { $('login').hidden = true; });
|
|
571
|
+
$('keybtn').addEventListener('click', () => login(''));
|
|
572
|
+
|
|
573
|
+
function ingest(s) {
|
|
574
|
+
if (S.session !== s.started) { S.session = s.started; S.hist = []; S.prev = null; S.base = null; resetChip(); }
|
|
575
|
+
const p = S.prev;
|
|
576
|
+
if (p && s.now > p.now) {
|
|
577
|
+
const dt = s.now - p.now;
|
|
578
|
+
const reps = s.replicas.map((x, k) => {
|
|
579
|
+
const q = p.replicas[k] || x, g = gpusOf(x);
|
|
580
|
+
return {rate: Math.max(0, routed(x) - routed(q)) / dt, util: g.length ? mean(g.map(y => y.util)) : null, gpus: g.map(y => y.util)};
|
|
581
|
+
});
|
|
582
|
+
S.hist.push({t: s.now, rate: Math.max(0, s.traffic.requests - p.traffic.requests) / dt,
|
|
583
|
+
p50: s.traffic.w10.p50, p95: s.traffic.w10.p95, reps});
|
|
584
|
+
if (S.hist.length > POINTS) S.hist.shift();
|
|
585
|
+
}
|
|
586
|
+
if (!p || s.now > p.now) S.prev = s;
|
|
587
|
+
S.last = s;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function render(s) {
|
|
591
|
+
const rt = s.router, tr = s.traffic, b = S.base, reps = s.replicas;
|
|
592
|
+
const models = [...new Set(reps.filter(x => x.state).map(x => x.state.status.model))];
|
|
593
|
+
document.title = `${models.length === 1 ? models[0] + ' · ' : ''}basal-router`;
|
|
594
|
+
set('model', models.length === 1 ? models[0] : models.length ? `${models.length} models` : 'basal-router');
|
|
595
|
+
const head = $('headline');
|
|
596
|
+
head.textContent = `${rt.ready} of ${rt.replicas} replica${rt.replicas === 1 ? '' : 's'} ready`;
|
|
597
|
+
head.className = 'accent' + (rt.ready < rt.replicas ? ' warn' : '');
|
|
598
|
+
set('since', b ? `view since ${clock(b.t)} · stats since ${clock(s.started)}` : `stats since ${clock(s.started)}`);
|
|
599
|
+
set('lede', `basal ${s.version} routes each request to the replica its state is hashed to, with bounded load (factor ${rt.load_factor}). ` +
|
|
600
|
+
`Up ${dur(s.uptime)}; the router's numbers start at zero with each start and live only in its memory; each replica's panel is that replica's own state.`);
|
|
601
|
+
const f = s.features || {};
|
|
602
|
+
const tags = [[rt.ready ? 'green' : '', rt.ready ? 'ready' : 'starting'], ['', `${rt.replicas} replicas`], ['', 'basal ' + s.version]];
|
|
603
|
+
if (f.cascade) tags.push(['purple', `cascade · ${f.cascade.below.length + 1} levels`]);
|
|
604
|
+
if (f.blend) tags.push(['purple', `blend · ${f.blend.weights.length} models`]);
|
|
605
|
+
if (f.fallback) tags.push(['purple', 'LLM fallback']);
|
|
606
|
+
if (f.route) tags.push(['purple', 'routes by script']);
|
|
607
|
+
const withUi = reps.filter(x => x.ui === 'on').length;
|
|
608
|
+
tags.push(withUi === reps.length ? ['', 'every replica --ui on'] : ['', `${withUi} of ${reps.length} replicas with --ui`]);
|
|
609
|
+
setHTML('tags', tags.map(([c, t]) => `<span class="tag ${c}">${esc(t)}</span>`).join(''));
|
|
610
|
+
const gpus = reps.flatMap(gpusOf);
|
|
611
|
+
const names = [...new Set(gpus.map(g => g.name).filter(Boolean))];
|
|
612
|
+
const sess = [['Started', clock(s.started)], ['Uptime', dur(s.uptime)], ['Replicas', `${rt.ready} ready of ${rt.replicas}`],
|
|
613
|
+
['Models', models.length ? models.join(', ') : '—'],
|
|
614
|
+
['GPUs', gpus.length ? (names.length === 1 ? `${gpus.length} × ${names[0]}` : `${gpus.length}`) : '—'],
|
|
615
|
+
['Load factor', String(rt.load_factor)]];
|
|
616
|
+
setHTML('session', sess.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join(''));
|
|
617
|
+
set('foot-version', `basal ${s.version} · polling ui/state every second · the router keeps ${tr.ring.toLocaleString('en-US')} requests in memory`);
|
|
618
|
+
|
|
619
|
+
// cards
|
|
620
|
+
const req = tr.requests - (b ? b.requests : 0), failed = tr.failed - (b ? b.failed : 0);
|
|
621
|
+
set('m-req-scope', b ? 'since reset' : 'since start');
|
|
622
|
+
$('m-req').innerHTML = `${int(req)}`;
|
|
623
|
+
$('m-req-d').innerHTML = `<span${failed ? ' class="bad"' : ''}>${int(failed)} failed</span> · ${req ? ((1 - failed / req) * 100).toFixed(failed ? 2 : 0) : '100'}% ok`;
|
|
624
|
+
width($('m-req-p'), req ? 1 - failed / req : 0);
|
|
625
|
+
$('m-rate').innerHTML = `${dec(tr.rate10)}<small>req/s</small>`;
|
|
626
|
+
const last = S.hist[S.hist.length - 1];
|
|
627
|
+
$('m-rate-d').innerHTML = `<b>${dec(tr.rate60)}</b> last min` + (last && reps.length > 1 ? ` · per replica ${last.reps.map(r => `<b>${dec(r.rate)}</b>`).join(' · ')}` : '');
|
|
628
|
+
const L = b ? tr.w60 : tr.latency;
|
|
629
|
+
set('m-lat-scope', b ? 'last minute' : 'since start');
|
|
630
|
+
$('m-lat').innerHTML = L.p50 == null ? '—' : `${dec(L.p50)}<small>ms</small>`;
|
|
631
|
+
$('m-lat-d').innerHTML = L.p50 == null ? 'no requests yet' : `p95 <b>${dec(L.p95)}</b> · p99 <b>${dec(L.p99)}</b> ms`;
|
|
632
|
+
$('m-fl').innerHTML = `${int(rt.in_flight)}<small>requests</small>`;
|
|
633
|
+
$('m-fl-d').innerHTML = reps.length > 1 ? `per replica ${reps.map(x => `<b>${int(x.in_flight)}</b>`).join(' · ')}` : 'at the replica';
|
|
634
|
+
if (gpus.length) {
|
|
635
|
+
const util = mean(gpus.map(g => g.util));
|
|
636
|
+
const used = gpus.reduce((a, g) => a + (g.mem_used || 0), 0), total = gpus.reduce((a, g) => a + (g.mem_total || 0), 0);
|
|
637
|
+
$('m-gpu').innerHTML = `${Math.round(util)}<small>% util</small>`;
|
|
638
|
+
$('m-gpu-d').innerHTML = `<b>${gib(used)}</b> of ${gib(total)}`;
|
|
639
|
+
set('m-gpu-x', `${gpus.length} GPU${gpus.length === 1 ? '' : 's'}`);
|
|
640
|
+
width($('m-gpu-p'), util / 100);
|
|
641
|
+
} else {
|
|
642
|
+
$('m-gpu').innerHTML = '—';
|
|
643
|
+
set('m-gpu-d', withUi ? 'no GPU telemetry yet' : 'replicas without --ui');
|
|
644
|
+
set('m-gpu-x', '');
|
|
645
|
+
width($('m-gpu-p'), 0);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
renderReplicas(s);
|
|
649
|
+
|
|
650
|
+
// charts
|
|
651
|
+
const h = S.hist;
|
|
652
|
+
const from = `−${dur(Math.max(h.length > 1 ? h[h.length - 1].t - h[0].t : 0, 60))}`;
|
|
653
|
+
set('c-rate-from', from); set('c-lat-from', from); set('c-gpu-from', from);
|
|
654
|
+
const legend = reps.map((x, k) => `<span><i style="background:${color(k)}"></i>${k + 1}</span>`).join('');
|
|
655
|
+
setHTML('leg-rate', legend); setHTML('leg-gpu', legend);
|
|
656
|
+
stack($('c-rate'), reps.map((x, k) => [h.map(p => p.reps[k] ? p.reps[k].rate : 0), color(k)]));
|
|
657
|
+
lines($('c-lat'), [[h.map(p => p.p95), 'var(--purple)'], [h.map(p => p.p50), 'var(--green)']], 'ms');
|
|
658
|
+
if (gpus.length) lines($('c-gpu'), reps.map((x, k) => [h.map(p => p.reps[k] ? p.reps[k].util : null), color(k)]), '%', 100);
|
|
659
|
+
else $('c-gpu').innerHTML = `<div class="empty">${withUi ? 'Reading the replicas\' GPU telemetry…' : 'Start the replicas with --ui on to see their GPUs here.'}</div>`;
|
|
660
|
+
|
|
661
|
+
// endpoints and codes
|
|
662
|
+
set('ep-note', b ? 'counts since reset · ms since start' : 'through the router · since start');
|
|
663
|
+
const eps = tr.endpoints || [];
|
|
664
|
+
setHTML('endpoints', eps.length ? eps.map(e => {
|
|
665
|
+
const be = b && b.eps[e.endpoint] || {requests: 0, failed: 0};
|
|
666
|
+
const fl = e.failed - be.failed;
|
|
667
|
+
return `<tr><td class="ep">${esc(e.endpoint)}</td><td class="num">${int(e.requests - be.requests)}</td>` +
|
|
668
|
+
`<td class="num">${fl ? `<span class="badge err">${int(fl)}</span>` : '0'}</td><td class="num">${dec(e.p50)}</td>` +
|
|
669
|
+
`<td class="num">${dec(e.p95)}</td><td class="num">${dec(e.mean)}</td></tr>`;
|
|
670
|
+
}).join('') : '<tr><td colspan="6">No decision requests yet.</td></tr>');
|
|
671
|
+
const codes = Object.entries(tr.codes || {}).map(([c, n]) => [c, n - (b && b.codes[c] || 0)]).filter(([, n]) => n > 0);
|
|
672
|
+
setHTML('codes', '<span class="label">Status codes</span>' + (codes.length ? codes.map(([c, n]) =>
|
|
673
|
+
`${badge(c)}<span class="mono" style="font-size:11px;color:#8b98a8;margin:0 8px 0 -2px;align-self:center">× ${int(n)}</span>`).join('')
|
|
674
|
+
: '<span style="color:#5f6e80;font-size:11px;align-self:center">none yet</span>'));
|
|
675
|
+
if (tr.seen < tr.requests - rt.in_flight) set('ep-note', `${int(tr.seen)} of ${int(tr.requests)} requests seen`);
|
|
676
|
+
|
|
677
|
+
renderRouting(s);
|
|
678
|
+
if (S.cfgSession !== s.started) { S.cfgSession = s.started; S.cfg = s.config; renderFacts(); renderOptions(); }
|
|
679
|
+
renderRecent(s.recent || []);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
const readyBadge = x => x.ready ? '<span class="badge">ready</span>' : '<span class="badge warn">not ready</span>';
|
|
683
|
+
const UI_TAG = {on: ['green', '--ui on'], off: ['', 'no --ui'], key: ['purple', 'key needed'], 'not ready': ['', 'no state'],
|
|
684
|
+
unreachable: ['', 'unreachable'], error: ['', 'state error']};
|
|
685
|
+
function why(x) {
|
|
686
|
+
if (x.ui === 'off') return 'This replica runs without <code>--ui</code>: start it with <code>--ui on</code> (after <code>--</code> with <code>--gpus</code>) for its traffic, state cache and GPU panels. Above: what the router knows of it.';
|
|
687
|
+
if (x.ui === 'key') return 'This replica was started with <code>--api-keys</code>: give the key (API key, top right) to see its panels. Above: what the router knows of it.';
|
|
688
|
+
if (x.ui === 'not ready') return 'Not ready: its <code>/health</code> does not answer 200 (starting, or down). It gets no requests until it does.';
|
|
689
|
+
if (x.ui === 'unreachable') return `The router could not read its state (${esc(x.detail || 'no answer')}).`;
|
|
690
|
+
return `Its state could not be read (${esc(x.detail == null ? 'error' : typeof x.detail === 'number' ? 'HTTP ' + x.detail : x.detail)}).`;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
function renderReplicas(s) {
|
|
694
|
+
const reps = s.replicas, total = reps.reduce((a, x) => a + routed(x), 0), b = S.base;
|
|
695
|
+
set('rep-count', String(reps.length));
|
|
696
|
+
setHTML('reps', reps.map((x, k) => {
|
|
697
|
+
const st = x.state, c = color(k), [tc, tt] = UI_TAG[x.ui] || ['', x.ui];
|
|
698
|
+
const pools = x.pools.length === 1 && x.pools[0] === 'main' ? '' : ' · ' + x.pools.map(pool).join(', ');
|
|
699
|
+
const last = S.hist[S.hist.length - 1];
|
|
700
|
+
const rate = st ? st.traffic.rate10 : last && last.reps[k] ? last.reps[k].rate : null;
|
|
701
|
+
const lat = st ? st.traffic.latency.p50 : x.p50;
|
|
702
|
+
const r = routed(x) - (b && b.reps[k] ? routed(b.reps[k]) : 0), all = total - (b ? b.routed : 0);
|
|
703
|
+
let html = `<article class="panel rep"><div class="rep-head"><div class="rep-title"><span class="rep-num" style="background:${c}">${k + 1}</span>` +
|
|
704
|
+
`<div style="min-width:0"><strong>Replica ${k + 1}</strong><div class="gpu-id">${esc(host(x.url) + pools)}</div></div></div>` +
|
|
705
|
+
`<div class="rep-tags">${readyBadge(x)}<span class="tag ${tc}">${esc(tt)}</span></div></div>`;
|
|
706
|
+
if (st) {
|
|
707
|
+
const ss = st.status;
|
|
708
|
+
html += `<div class="rep-model"><b>${esc(ss.model)}</b> · ${esc(ss.mode)} · basal ${esc(ss.version)} · up ${esc(dur(st.uptime))}` +
|
|
709
|
+
` · <b>${int(ss.running)}</b> running · <b>${int(ss.queued)}</b> queued</div>`;
|
|
710
|
+
}
|
|
711
|
+
html += '<div class="body"><div class="stats four">' +
|
|
712
|
+
stat(st ? 'Throughput' : 'Via router', dec(rate), 'req/s') +
|
|
713
|
+
stat(st ? 'p50' : 'p50 via router', dec(lat), lat == null ? '' : 'ms') +
|
|
714
|
+
stat('In flight', int(x.in_flight)) +
|
|
715
|
+
stat('Routed', int(r), all ? Math.round(r / all * 100) + '%' : '') + '</div>';
|
|
716
|
+
if (st) {
|
|
717
|
+
const g = gpusOf(x), t = st.telemetry || {};
|
|
718
|
+
html += g.length ? g.map((y, j) => gpuCard(y, k, j)).join('')
|
|
719
|
+
: `<div class="notice">${esc(t.gpu_note || (t.at ? 'No GPU found by NVML.' : 'Reading telemetry…'))}</div>`;
|
|
720
|
+
const ca = st.cache;
|
|
721
|
+
if (ca) {
|
|
722
|
+
const looks = ca.hits + ca.misses;
|
|
723
|
+
html += meter('State cache', `${looks ? (ca.hits / looks * 100).toFixed(1) + '% hits · ' : ''}${int(ca.entries)} states · ${gib(ca.used_bytes)} of ${gib(ca.budget_bytes)}`,
|
|
724
|
+
ca.budget_bytes ? ca.used_bytes / ca.budget_bytes : 0, 'purple');
|
|
725
|
+
}
|
|
726
|
+
const tr = st.traffic;
|
|
727
|
+
html += `<div class="gpu-facts" style="margin-top:0"><span>requests <b>${int(tr.requests)}</b></span><span>failed <b>${int(tr.failed)}</b></span>` +
|
|
728
|
+
`<span>p95 <b>${dec(tr.latency.p95)} ms</b></span><span>last min <b>${dec(tr.rate60)}/s</b></span></div>`;
|
|
729
|
+
} else {
|
|
730
|
+
html += `<div class="notice">${why(x)}</div>`;
|
|
731
|
+
}
|
|
732
|
+
return html + '</div></article>';
|
|
733
|
+
}).join(''));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function gpuCard(g, k, j) {
|
|
737
|
+
const mem = g.mem_total ? g.mem_used / g.mem_total : 0, pw = g.power_limit ? g.power / g.power_limit : 0;
|
|
738
|
+
const phys = [g.nvml_index != null ? `GPU ${g.nvml_index}` : '', g.pci || ''].filter(Boolean).join(' · ');
|
|
739
|
+
return `<div class="gpu"><div class="gpu-head"><div style="min-width:0"><strong>${esc(g.name || 'GPU')}</strong>` +
|
|
740
|
+
(phys ? `<div class="gpu-id" title="the physical GPU (NVML index, PCI bus id)">${esc(phys)}</div>` : '') +
|
|
741
|
+
`</div><span class="tag" title="the replica's view of it">cuda:${esc(g.index)}</span></div>` +
|
|
742
|
+
meter('Utilisation', pct(g.util), (g.util || 0) / 100) +
|
|
743
|
+
meter('Memory', `${gib(g.mem_used)} of ${gib(g.mem_total)}${g.mem_own ? ` · replica ${gib(g.mem_own)}` : ''}`, mem, 'purple') +
|
|
744
|
+
meter('Power', g.power == null ? '—' : `${Math.round(g.power)} of ${Math.round(g.power_limit || 0)} W`, pw, pw > .9 ? 'amber' : '') +
|
|
745
|
+
`<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>` +
|
|
746
|
+
`<span>SM <b>${g.sm_clock == null ? '—' : int(g.sm_clock) + ' MHz'}</b></span></div>` +
|
|
747
|
+
`<div class="spark">${spark(S.hist.map(p => p.reps[k] ? p.reps[k].gpus[j] : null), color(k))}</div></div>`;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function renderRouting(s) {
|
|
751
|
+
const reps = s.replicas, b = S.base;
|
|
752
|
+
const sub = (x, k, f) => f(x) - (b && b.reps[k] ? f(b.reps[k]) : 0);
|
|
753
|
+
const total = reps.reduce((a, x, k) => a + sub(x, k, routed), 0);
|
|
754
|
+
set('route-note', b ? 'the router\'s counters · since reset' : 'the router\'s counters · since start');
|
|
755
|
+
setHTML('routes', reps.map((x, k) => {
|
|
756
|
+
const r = sub(x, k, routed), fl = sub(x, k, y => y.failed);
|
|
757
|
+
return `<tr><td class="ep"><span class="dot" style="background:${color(k)}"></span>${k + 1} · ${esc(host(x.url))}</td>` +
|
|
758
|
+
`<td><div class="pools">${x.pools.map(p => `<span class="tag">${esc(pool(p))}</span>`).join('')}</div></td><td>${readyBadge(x)}</td>` +
|
|
759
|
+
`<td class="num">${int(x.in_flight)}</td><td class="num">${int(sub(x, k, y => y.routed.state))}</td><td class="num">${int(sub(x, k, y => y.routed.load))}</td>` +
|
|
760
|
+
`<td class="num">${total ? (r / total * 100).toFixed(1) + '%' : '—'}</td><td class="num">${fl ? `<span class="badge err">${int(fl)}</span>` : '0'}</td>` +
|
|
761
|
+
`<td class="num">${dec(x.p50)}</td><td class="num">${dec(x.p95)}</td></tr>`;
|
|
762
|
+
}).join(''));
|
|
763
|
+
const f = s.features || {}, parts = [];
|
|
764
|
+
const kv = o => Object.entries(o).map(([k, v]) => `${esc(k)} <b>${int(v)}</b>`).join(' · ');
|
|
765
|
+
if (f.cascade) parts.push(`<span><span class="label">Cascade</span> below ${esc(f.cascade.below.join(' · '))}: first <b>${int(f.cascade.answered.first)}</b> · escalated <b>${int(f.cascade.answered.escalated)}</b>` +
|
|
766
|
+
(f.cascade.below.length > 1 ? ` · by level ${kv(f.cascade.levels)}` : '') + '</span>');
|
|
767
|
+
if (f.blend) parts.push(`<span><span class="label">Blend</span> weights ${esc(f.blend.weights.join(' · '))}: answers by models in the blend ${Object.keys(f.blend.blended).length ? kv(f.blend.blended) : '<b>0</b>'}</span>`);
|
|
768
|
+
if (f.fallback) parts.push(`<span><span class="label">LLM fallback</span> ${esc(f.fallback.model)} under ${esc(f.fallback.below)}: ${kv(f.fallback.results)}</span>`);
|
|
769
|
+
if (f.route) parts.push(`<span><span class="label">By script</span> ${esc(f.route.scripts.join(', '))} pools: ${Object.keys(f.route.requests).length ? kv(f.route.requests) : '<b>0</b> requests'}</span>`);
|
|
770
|
+
setHTML('features', parts.length ? parts.join('') : '<span class="label">Routing</span><span>by the state\'s hash with bounded load; no <code>--escalate</code>, <code>--blend</code>, <code>--fallback</code> or <code>--route</code></span>');
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function nice(v) {
|
|
774
|
+
if (!(v > 0)) return 1;
|
|
775
|
+
const e = 10 ** Math.floor(Math.log10(v)), f = v / e;
|
|
776
|
+
return (f <= 1 ? 1 : f <= 2 ? 2 : f <= 2.5 ? 2.5 : f <= 5 ? 5 : 10) * e;
|
|
777
|
+
}
|
|
778
|
+
function grid(top, unit) {
|
|
779
|
+
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('');
|
|
780
|
+
}
|
|
781
|
+
const W = 600, H = 150;
|
|
782
|
+
function rules() {
|
|
783
|
+
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('');
|
|
784
|
+
}
|
|
785
|
+
function stack(el, series) {
|
|
786
|
+
const len = series.length ? series[0][0].length : 0;
|
|
787
|
+
if (len < 2) { el.innerHTML = '<div class="empty">Collecting… the chart fills as this page polls.</div>'; return; }
|
|
788
|
+
const sums = series[0][0].map((_, i) => series.reduce((a, [v]) => a + (v[i] || 0), 0));
|
|
789
|
+
const top = nice(Math.max(...sums) * 1.1), n = Math.max(len, 60), bw = W / n, below = new Array(len).fill(0);
|
|
790
|
+
let svg = `<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" aria-hidden="true">` + rules();
|
|
791
|
+
series.forEach(([v, c]) => {
|
|
792
|
+
let d = '';
|
|
793
|
+
v.forEach((y, i) => {
|
|
794
|
+
const x = W - (len - i) * bw, y0 = H - below[i] / top * H, hh = (y || 0) / top * H;
|
|
795
|
+
if (hh > 0) d += `M${(x + bw * .15).toFixed(2)} ${y0.toFixed(2)}V${Math.max(0, y0 - Math.max(hh, 1)).toFixed(2)}H${(x + bw * .85).toFixed(2)}V${y0.toFixed(2)}Z`;
|
|
796
|
+
below[i] += y || 0;
|
|
797
|
+
});
|
|
798
|
+
svg += `<path d="${d}" fill="${c}" opacity=".85"/>`;
|
|
799
|
+
});
|
|
800
|
+
el.innerHTML = svg + '</svg>' + grid(top, '/s');
|
|
801
|
+
}
|
|
802
|
+
function lines(el, series, unit, fixed) {
|
|
803
|
+
const all = series.flatMap(([v]) => v.filter(x => x != null));
|
|
804
|
+
if (all.length < 2) { el.innerHTML = '<div class="empty">Collecting… the chart fills as requests arrive.</div>'; return; }
|
|
805
|
+
const top = fixed || nice(Math.max(...all) * 1.1), n = Math.max(series[0][0].length, 60), step = W / (n - 1);
|
|
806
|
+
let svg = `<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" aria-hidden="true">` + rules();
|
|
807
|
+
series.forEach(([v, c], k) => {
|
|
808
|
+
let d = '', pen = false;
|
|
809
|
+
v.forEach((y, i) => {
|
|
810
|
+
if (y == null) { pen = false; return; }
|
|
811
|
+
const x = W - (v.length - 1 - i) * step, yy = H - Math.min(y / top, 1) * H;
|
|
812
|
+
d += `${pen ? 'L' : 'M'}${x.toFixed(2)} ${yy.toFixed(2)}`; pen = true;
|
|
813
|
+
});
|
|
814
|
+
if (k === series.length - 1 && d && !fixed) {
|
|
815
|
+
const pts = v.map((y, i) => [W - (v.length - 1 - i) * step, y]).filter(([, y]) => y != null);
|
|
816
|
+
svg += `<path d="${d}L${pts[pts.length - 1][0].toFixed(2)} ${H}L${pts[0][0].toFixed(2)} ${H}Z" fill="${c}" opacity=".08"/>`;
|
|
817
|
+
}
|
|
818
|
+
svg += `<path d="${d}" fill="none" stroke="${c}" stroke-width="1.8" vector-effect="non-scaling-stroke" stroke-linejoin="round"/>`;
|
|
819
|
+
});
|
|
820
|
+
el.innerHTML = svg + '</svg>' + grid(top, unit);
|
|
821
|
+
}
|
|
822
|
+
function spark(vals, c) {
|
|
823
|
+
const v = vals.slice(-90);
|
|
824
|
+
if (v.filter(x => x != null).length < 2) return '';
|
|
825
|
+
const w = 300, h = 34, step = w / (Math.max(v.length, 30) - 1);
|
|
826
|
+
let d = '', pen = false;
|
|
827
|
+
v.forEach((y, i) => {
|
|
828
|
+
if (y == null) { pen = false; return; }
|
|
829
|
+
d += `${pen ? 'L' : 'M'}${(w - (v.length - 1 - i) * step).toFixed(1)} ${(h - y / 100 * (h - 2) - 1).toFixed(1)}`; pen = true;
|
|
830
|
+
});
|
|
831
|
+
return `<svg viewBox="0 0 ${w} ${h}" preserveAspectRatio="none" aria-hidden="true"><path d="${d}" fill="none" stroke="${c}" stroke-width="1.5" vector-effect="non-scaling-stroke"/></svg>`;
|
|
832
|
+
}
|
|
833
|
+
const meter = (label, value, frac, cls) => `<div class="meter"><div class="meter-top"><span>${esc(label)}</span><b>${esc(value)}</b></div>` +
|
|
834
|
+
`<div class="bar ${cls || ''}"><span style="width:${(Math.max(0, Math.min(1, frac || 0)) * 100).toFixed(1)}%"></span></div></div>`;
|
|
835
|
+
const stat = (label, value, unit) => `<div class="stat"><span>${esc(label)}</span><b>${esc(value)}${unit ? `<small>${esc(unit)}</small>` : ''}</b></div>`;
|
|
836
|
+
|
|
837
|
+
function renderFacts() {
|
|
838
|
+
setHTML('facts', (S.cfg.facts || []).map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(val(v))}</dd>`).join(''));
|
|
839
|
+
}
|
|
840
|
+
function renderOptions() {
|
|
841
|
+
if (!S.cfg) return;
|
|
842
|
+
const q = $('opt-filter').value.trim().toLowerCase(), only = $('opt-changed').checked;
|
|
843
|
+
const rows = (S.cfg.options || []).filter(([k, v, ch]) => (!only || ch) && (!q || flag(k).includes(q) || val(v).toLowerCase().includes(q)));
|
|
844
|
+
set('opt-count', String(rows.length));
|
|
845
|
+
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('')
|
|
846
|
+
: '<tr><td colspan="2">No option matches.</td></tr>');
|
|
847
|
+
}
|
|
848
|
+
$('opt-filter').addEventListener('input', renderOptions);
|
|
849
|
+
$('opt-changed').addEventListener('change', renderOptions);
|
|
850
|
+
|
|
851
|
+
function renderRecent(rows) {
|
|
852
|
+
if (S.errorsOnly) rows = rows.filter(r => r[2] >= 400);
|
|
853
|
+
set('req-count', String(rows.length));
|
|
854
|
+
const shown = S.showAll ? rows : rows.slice(0, 25);
|
|
855
|
+
$('more').hidden = rows.length <= 25;
|
|
856
|
+
set('more', S.showAll ? 'Show 25' : `Show all ${rows.length}`);
|
|
857
|
+
setHTML('recent', shown.length ? shown.map(r => `<tr><td class="t">${clockMs(r[0])}</td><td class="ep">${esc(r[1])}</td>` +
|
|
858
|
+
`<td>${badge(r[2])}</td><td class="num">${dec(r[3])}</td>` +
|
|
859
|
+
`<td>${r[4] == null ? '—' : `<span class="dot" style="background:${color(r[4])}"></span>${esc(r[4] + 1)}`}</td><td>${r[5] == null ? '—' : esc(r[5])}</td></tr>`).join('')
|
|
860
|
+
: `<tr><td colspan="6">${S.errorsOnly ? 'No failed requests among the recent ones.' : 'No decision requests yet.'}</td></tr>`);
|
|
861
|
+
}
|
|
862
|
+
$('more').addEventListener('click', () => { S.showAll = !S.showAll; if (S.last) renderRecent(S.last.recent || []); });
|
|
863
|
+
document.querySelectorAll('.req-tools .chip').forEach(b => b.addEventListener('click', () => {
|
|
864
|
+
S.errorsOnly = b.dataset.f === 'err';
|
|
865
|
+
document.querySelectorAll('.req-tools .chip').forEach(x => x.classList.toggle('on', x === b));
|
|
866
|
+
if (S.last) renderRecent(S.last.recent || []);
|
|
867
|
+
}));
|
|
868
|
+
|
|
869
|
+
function resetChip() { $('reset').classList.toggle('primary', !!S.base); }
|
|
870
|
+
$('reset').addEventListener('click', () => {
|
|
871
|
+
const s = S.last;
|
|
872
|
+
if (!s) return;
|
|
873
|
+
if (S.base) { S.base = null; } else {
|
|
874
|
+
S.base = {t: s.now, requests: s.traffic.requests, failed: s.traffic.failed, codes: {...s.traffic.codes},
|
|
875
|
+
eps: Object.fromEntries((s.traffic.endpoints || []).map(e => [e.endpoint, {requests: e.requests, failed: e.failed}])),
|
|
876
|
+
reps: s.replicas.map(x => ({routed: {...x.routed}, failed: x.failed})),
|
|
877
|
+
routed: s.replicas.reduce((a, x) => a + routed(x), 0)};
|
|
878
|
+
S.hist = [];
|
|
879
|
+
}
|
|
880
|
+
$('reset').querySelector('.lbl').textContent = S.base ? 'Since start' : 'Reset view';
|
|
881
|
+
resetChip();
|
|
882
|
+
render(s);
|
|
883
|
+
});
|
|
884
|
+
$('pause').addEventListener('click', () => {
|
|
885
|
+
S.paused = !S.paused;
|
|
886
|
+
$('pause').querySelector('.lbl').textContent = S.paused ? 'Resume' : 'Pause';
|
|
887
|
+
$('pause').querySelector('svg').innerHTML = S.paused ? '<path d="M7 5l12 7-12 7z"/>' : '<path d="M9 5v14M15 5v14"/>';
|
|
888
|
+
if (S.paused) { clearTimeout(S.timer); conn('', 'Paused'); } else { conn('', 'Connecting'); poll(); }
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
if ('IntersectionObserver' in window) {
|
|
892
|
+
const links = [...document.querySelectorAll('.topbar nav a')];
|
|
893
|
+
const io = new IntersectionObserver(es => es.forEach(e => {
|
|
894
|
+
if (e.isIntersecting) links.forEach(a => a.classList.toggle('active', a.getAttribute('href') === '#' + e.target.id));
|
|
895
|
+
}), {rootMargin: '-30% 0px -60% 0px'});
|
|
896
|
+
['overview', 'replicas', 'traffic', 'routing', 'configuration', 'requests'].forEach(id => io.observe($(id)));
|
|
897
|
+
}
|
|
898
|
+
poll();
|
|
899
|
+
})();
|
|
900
|
+
</script>
|
|
901
|
+
</body>
|
|
902
|
+
</html>
|