groove-dev 0.27.67 → 0.27.69

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.
Files changed (42) hide show
  1. package/node_modules/@groove-dev/cli/package.json +1 -1
  2. package/node_modules/@groove-dev/daemon/package.json +1 -1
  3. package/node_modules/@groove-dev/daemon/src/api.js +137 -3
  4. package/node_modules/@groove-dev/daemon/src/process.js +11 -5
  5. package/node_modules/@groove-dev/daemon/src/tunnel-manager.js +19 -1
  6. package/node_modules/@groove-dev/gui/dist/assets/index-DhnTm_1P.js +8614 -0
  7. package/node_modules/@groove-dev/gui/dist/assets/index-oQ0ejlfH.css +1 -0
  8. package/node_modules/@groove-dev/gui/dist/index.html +2 -2
  9. package/node_modules/@groove-dev/gui/package.json +1 -1
  10. package/node_modules/@groove-dev/gui/src/app.jsx +23 -0
  11. package/node_modules/@groove-dev/gui/src/components/agents/folder-browser.jsx +23 -5
  12. package/node_modules/@groove-dev/gui/src/components/network/activity-chart.jsx +208 -124
  13. package/node_modules/@groove-dev/gui/src/components/network/compute-header.jsx +12 -1
  14. package/node_modules/@groove-dev/gui/src/components/network/identity-bar.jsx +4 -40
  15. package/node_modules/@groove-dev/gui/src/components/network/performance-dashboard.jsx +600 -0
  16. package/node_modules/@groove-dev/gui/src/components/network/token-waterfall.jsx +111 -0
  17. package/node_modules/@groove-dev/gui/src/stores/groove.js +60 -0
  18. package/node_modules/@groove-dev/gui/src/views/network.jsx +6 -0
  19. package/package.json +1 -1
  20. package/packages/cli/package.json +1 -1
  21. package/packages/daemon/package.json +1 -1
  22. package/packages/daemon/src/api.js +137 -3
  23. package/packages/daemon/src/process.js +11 -5
  24. package/packages/daemon/src/tunnel-manager.js +19 -1
  25. package/packages/gui/dist/assets/index-DhnTm_1P.js +8614 -0
  26. package/packages/gui/dist/assets/index-oQ0ejlfH.css +1 -0
  27. package/packages/gui/dist/index.html +2 -2
  28. package/packages/gui/package.json +1 -1
  29. package/packages/gui/src/app.jsx +23 -0
  30. package/packages/gui/src/components/agents/folder-browser.jsx +23 -5
  31. package/packages/gui/src/components/network/activity-chart.jsx +208 -124
  32. package/packages/gui/src/components/network/compute-header.jsx +12 -1
  33. package/packages/gui/src/components/network/identity-bar.jsx +4 -40
  34. package/packages/gui/src/components/network/performance-dashboard.jsx +600 -0
  35. package/packages/gui/src/components/network/token-waterfall.jsx +111 -0
  36. package/packages/gui/src/stores/groove.js +60 -0
  37. package/packages/gui/src/views/network.jsx +6 -0
  38. package/spash-page.png +0 -0
  39. package/node_modules/@groove-dev/gui/dist/assets/index-MPNqazCA.js +0 -8614
  40. package/node_modules/@groove-dev/gui/dist/assets/index-YeunozTU.css +0 -1
  41. package/packages/gui/dist/assets/index-MPNqazCA.js +0 -8614
  42. package/packages/gui/dist/assets/index-YeunozTU.css +0 -1
@@ -12,6 +12,7 @@ function shortAddr(addr) {
12
12
 
13
13
  export const ActivityChart = memo(function ActivityChart() {
14
14
  const snapshots = useGrooveStore((s) => s.networkSnapshots);
15
+ const perfSnapshots = useGrooveStore((s) => s.networkPerfSnapshots);
15
16
  const nodes = useGrooveStore((s) => s.networkStatus.nodes || []);
16
17
  const ownNodeId = useGrooveStore((s) => s.networkNode.nodeId);
17
18
 
@@ -19,6 +20,7 @@ export const ActivityChart = memo(function ActivityChart() {
19
20
  const canvasRef = useRef(null);
20
21
  const [size, setSize] = useState({ width: 0, height: 0 });
21
22
  const [hover, setHover] = useState(null);
23
+ const [mode, setMode] = useState('sessions');
22
24
 
23
25
  const { width, height } = size;
24
26
  const pad = { top: 28, right: 12, bottom: 8, left: 12 };
@@ -26,9 +28,13 @@ export const ActivityChart = memo(function ActivityChart() {
26
28
  const h = Math.max(height - pad.top - pad.bottom, 0);
27
29
 
28
30
  const chartData = useMemo(() => {
31
+ if (mode === 'performance') {
32
+ if (!perfSnapshots || perfSnapshots.length < 2) return [];
33
+ return perfSnapshots;
34
+ }
29
35
  if (!snapshots || snapshots.length < 2) return [];
30
36
  return snapshots;
31
- }, [snapshots]);
37
+ }, [snapshots, perfSnapshots, mode]);
32
38
 
33
39
  useEffect(() => {
34
40
  const el = containerRef.current;
@@ -64,146 +70,224 @@ export const ActivityChart = memo(function ActivityChart() {
64
70
  ctx.scale(dpr, dpr);
65
71
  ctx.clearRect(0, 0, width, height);
66
72
 
67
- const globalSessions = chartData.map((d) => d.globalSessions);
68
- const mySessions = chartData.map((d) => d.mySessions);
69
- const maxVal = Math.max(...globalSessions, ...mySessions, 1);
73
+ const isPerfMode = mode === 'performance';
74
+
75
+ if (isPerfMode) {
76
+ // Performance mode: plot TPS
77
+ const tpsVals = chartData.map((d) => d.tps || 0);
78
+ const maxVal = Math.max(...tpsVals, 1);
79
+
80
+ const xAt = (i) => pad.left + (i / Math.max(chartData.length - 1, 1)) * w;
81
+ const yAt = (v) => pad.top + h - (v / maxVal) * h;
70
82
 
71
- const xAt = (i) => pad.left + (i / Math.max(chartData.length - 1, 1)) * w;
72
- const yAt = (v) => pad.top + h - (v / maxVal) * h;
83
+ // Grid
84
+ ctx.setLineDash([2, 4]);
85
+ ctx.strokeStyle = hexAlpha(HEX.text4, 0.2);
86
+ ctx.lineWidth = 1;
87
+ for (let gi = 1; gi <= 3; gi++) {
88
+ const gy = pad.top + (h / 4) * gi;
89
+ ctx.beginPath(); ctx.moveTo(pad.left, gy); ctx.lineTo(pad.left + w, gy); ctx.stroke();
90
+ }
91
+ ctx.setLineDash([]);
73
92
 
74
- // Horizontal grid lines
75
- ctx.setLineDash([2, 4]);
76
- ctx.strokeStyle = hexAlpha(HEX.text4, 0.2);
77
- ctx.lineWidth = 1;
78
- for (let i = 1; i <= 3; i++) {
79
- const y = pad.top + (h / 4) * i;
93
+ ctx.font = "9px 'JetBrains Mono Variable', monospace";
94
+ ctx.textAlign = 'left';
95
+ ctx.fillStyle = hexAlpha(HEX.text3, 0.5);
96
+ ctx.fillText(`${maxVal.toFixed(1)} t/s`, pad.left + 4, pad.top + 10);
97
+
98
+ // Fill
80
99
  ctx.beginPath();
81
- ctx.moveTo(pad.left, y);
82
- ctx.lineTo(pad.left + w, y);
83
- ctx.stroke();
84
- }
85
- ctx.setLineDash([]);
86
-
87
- // Y-axis labels
88
- ctx.font = "9px 'JetBrains Mono Variable', monospace";
89
- ctx.textAlign = 'left';
90
- ctx.fillStyle = hexAlpha(HEX.text3, 0.5);
91
- ctx.fillText(String(maxVal), pad.left + 4, pad.top + 10);
92
- ctx.fillText(String(Math.round(maxVal / 2)), pad.left + 4, pad.top + h / 2 + 4);
93
-
94
- // Network line — gradient fill
95
- ctx.beginPath();
96
- ctx.moveTo(pad.left, pad.top + h);
97
- for (let i = 0; i < chartData.length; i++) {
98
- ctx.lineTo(xAt(i), yAt(globalSessions[i]));
99
- }
100
- ctx.lineTo(xAt(chartData.length - 1), pad.top + h);
101
- ctx.closePath();
102
- const grad = ctx.createLinearGradient(0, pad.top, 0, pad.top + h);
103
- grad.addColorStop(0, hexAlpha(HEX.purple, 0.2));
104
- grad.addColorStop(0.7, hexAlpha(HEX.purple, 0.04));
105
- grad.addColorStop(1, hexAlpha(HEX.purple, 0));
106
- ctx.fillStyle = grad;
107
- ctx.fill();
108
-
109
- // Network line — stroke
110
- ctx.beginPath();
111
- ctx.strokeStyle = HEX.purple;
112
- ctx.lineWidth = 1.5;
113
- ctx.lineJoin = 'round';
114
- for (let i = 0; i < chartData.length; i++) {
115
- const x = xAt(i);
116
- const y = yAt(globalSessions[i]);
117
- i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
118
- }
119
- ctx.stroke();
120
-
121
- // Your Node line — stroke only
122
- ctx.beginPath();
123
- ctx.strokeStyle = HEX.accent;
124
- ctx.lineWidth = 1.5;
125
- ctx.lineJoin = 'round';
126
- for (let i = 0; i < chartData.length; i++) {
127
- const x = xAt(i);
128
- const y = yAt(mySessions[i]);
129
- i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
130
- }
131
- ctx.stroke();
132
-
133
- // Inline legend (top-right)
134
- ctx.font = "9px 'Inter Variable', sans-serif";
135
- ctx.textAlign = 'right';
136
- let rx = width - pad.right - 4;
137
- const ly = 14;
138
-
139
- ctx.fillStyle = HEX.accent;
140
- ctx.fillText('Your Node', rx, ly);
141
- rx -= ctx.measureText('Your Node').width + 4;
142
- ctx.beginPath(); ctx.arc(rx, ly - 3, 2.5, 0, Math.PI * 2); ctx.fill();
143
- rx -= 14;
144
-
145
- ctx.fillStyle = HEX.purple;
146
- ctx.fillText('Network', rx, ly);
147
- rx -= ctx.measureText('Network').width + 4;
148
- ctx.beginPath(); ctx.arc(rx, ly - 3, 2.5, 0, Math.PI * 2); ctx.fill();
149
-
150
- // Hover
151
- if (hover && hover.index >= 0 && hover.index < chartData.length) {
152
- const hx = hover.x;
153
- const d = chartData[hover.index];
154
-
155
- // Crosshair
100
+ ctx.moveTo(pad.left, pad.top + h);
101
+ for (let i = 0; i < chartData.length; i++) ctx.lineTo(xAt(i), yAt(tpsVals[i]));
102
+ ctx.lineTo(xAt(chartData.length - 1), pad.top + h);
103
+ ctx.closePath();
104
+ const grad = ctx.createLinearGradient(0, pad.top, 0, pad.top + h);
105
+ grad.addColorStop(0, hexAlpha(HEX.accent, 0.2));
106
+ grad.addColorStop(0.7, hexAlpha(HEX.accent, 0.04));
107
+ grad.addColorStop(1, hexAlpha(HEX.accent, 0));
108
+ ctx.fillStyle = grad;
109
+ ctx.fill();
110
+
111
+ // Line
156
112
  ctx.beginPath();
157
- ctx.moveTo(hx, pad.top);
158
- ctx.lineTo(hx, pad.top + h);
159
- ctx.strokeStyle = hexAlpha(HEX.text1, 0.15);
160
- ctx.lineWidth = 1;
113
+ ctx.strokeStyle = HEX.accent;
114
+ ctx.lineWidth = 1.5;
115
+ ctx.lineJoin = 'round';
116
+ for (let i = 0; i < chartData.length; i++) {
117
+ i === 0 ? ctx.moveTo(xAt(i), yAt(tpsVals[i])) : ctx.lineTo(xAt(i), yAt(tpsVals[i]));
118
+ }
161
119
  ctx.stroke();
162
120
 
163
- // Dots
164
- ctx.beginPath(); ctx.arc(hx, yAt(d.globalSessions), 3, 0, Math.PI * 2);
165
- ctx.fillStyle = HEX.purple; ctx.fill();
166
- ctx.beginPath(); ctx.arc(hx, yAt(d.mySessions), 3, 0, Math.PI * 2);
167
- ctx.fillStyle = HEX.accent; ctx.fill();
168
-
169
- // Tooltip
170
- const lines = [
171
- { label: 'Network', value: String(d.globalSessions), color: HEX.purple },
172
- { label: 'Your Node', value: String(d.mySessions), color: HEX.accent },
173
- { label: 'Nodes', value: String(d.nodeCount), color: HEX.text2 },
174
- ];
175
- const tooltipW = 104;
176
- const tooltipH = lines.length * 16 + 12;
177
- let tx = hx + 12;
178
- if (tx + tooltipW > width - 8) tx = hx - tooltipW - 12;
179
- const ty = Math.max(pad.top, yAt(d.globalSessions) - tooltipH / 2);
180
-
181
- ctx.fillStyle = hexAlpha(HEX.surface0, 0.92);
182
- ctx.beginPath(); ctx.roundRect(tx, ty, tooltipW, tooltipH, 4); ctx.fill();
121
+ // Legend
122
+ ctx.font = "9px 'Inter Variable', sans-serif";
123
+ ctx.textAlign = 'right';
124
+ ctx.fillStyle = HEX.accent;
125
+ ctx.fillText('TPS', width - pad.right - 4, 14);
126
+
127
+ // Hover
128
+ if (hover && hover.index >= 0 && hover.index < chartData.length) {
129
+ const hx = hover.x;
130
+ const d = chartData[hover.index];
131
+ ctx.beginPath(); ctx.moveTo(hx, pad.top); ctx.lineTo(hx, pad.top + h);
132
+ ctx.strokeStyle = hexAlpha(HEX.text1, 0.15); ctx.lineWidth = 1; ctx.stroke();
133
+ ctx.beginPath(); ctx.arc(hx, yAt(d.tps || 0), 3, 0, Math.PI * 2);
134
+ ctx.fillStyle = HEX.accent; ctx.fill();
135
+
136
+ const tooltipW = 90;
137
+ const tooltipH = 28;
138
+ let tx = hx + 12;
139
+ if (tx + tooltipW > width - 8) tx = hx - tooltipW - 12;
140
+ const ty = Math.max(pad.top, yAt(d.tps || 0) - tooltipH / 2);
141
+ ctx.fillStyle = hexAlpha(HEX.surface0, 0.92);
142
+ ctx.beginPath(); ctx.roundRect(tx, ty, tooltipW, tooltipH, 4); ctx.fill();
143
+ ctx.strokeStyle = hexAlpha(HEX.text4, 0.2); ctx.lineWidth = 1; ctx.stroke();
144
+ ctx.font = "9px 'JetBrains Mono Variable', monospace";
145
+ ctx.textAlign = 'center';
146
+ ctx.fillStyle = HEX.text0;
147
+ ctx.fillText(`${(d.tps || 0).toFixed(1)} t/s`, tx + tooltipW / 2, ty + 17);
148
+ }
149
+ } else {
150
+ // Sessions mode (original)
151
+ const globalSessions = chartData.map((d) => d.globalSessions);
152
+ const mySessions = chartData.map((d) => d.mySessions);
153
+ const maxVal = Math.max(...globalSessions, ...mySessions, 1);
154
+
155
+ const xAt = (i) => pad.left + (i / Math.max(chartData.length - 1, 1)) * w;
156
+ const yAt = (v) => pad.top + h - (v / maxVal) * h;
157
+
158
+ ctx.setLineDash([2, 4]);
183
159
  ctx.strokeStyle = hexAlpha(HEX.text4, 0.2);
184
- ctx.lineWidth = 1; ctx.stroke();
160
+ ctx.lineWidth = 1;
161
+ for (let gi = 1; gi <= 3; gi++) {
162
+ const gy = pad.top + (h / 4) * gi;
163
+ ctx.beginPath(); ctx.moveTo(pad.left, gy); ctx.lineTo(pad.left + w, gy); ctx.stroke();
164
+ }
165
+ ctx.setLineDash([]);
185
166
 
167
+ ctx.font = "9px 'JetBrains Mono Variable', monospace";
186
168
  ctx.textAlign = 'left';
187
- lines.forEach((line, i) => {
188
- const rowY = ty + 14 + i * 16;
189
- ctx.beginPath(); ctx.arc(tx + 8, rowY - 3, 2, 0, Math.PI * 2);
190
- ctx.fillStyle = line.color; ctx.fill();
191
- ctx.font = "8px 'Inter Variable', sans-serif";
192
- ctx.fillStyle = HEX.text3; ctx.fillText(line.label, tx + 14, rowY);
193
- ctx.font = "9px 'JetBrains Mono Variable', monospace";
194
- ctx.fillStyle = HEX.text0; ctx.textAlign = 'right';
195
- ctx.fillText(line.value, tx + tooltipW - 8, rowY);
169
+ ctx.fillStyle = hexAlpha(HEX.text3, 0.5);
170
+ ctx.fillText(String(maxVal), pad.left + 4, pad.top + 10);
171
+ ctx.fillText(String(Math.round(maxVal / 2)), pad.left + 4, pad.top + h / 2 + 4);
172
+
173
+ // Network line gradient fill
174
+ ctx.beginPath();
175
+ ctx.moveTo(pad.left, pad.top + h);
176
+ for (let i = 0; i < chartData.length; i++) ctx.lineTo(xAt(i), yAt(globalSessions[i]));
177
+ ctx.lineTo(xAt(chartData.length - 1), pad.top + h);
178
+ ctx.closePath();
179
+ const grad = ctx.createLinearGradient(0, pad.top, 0, pad.top + h);
180
+ grad.addColorStop(0, hexAlpha(HEX.purple, 0.2));
181
+ grad.addColorStop(0.7, hexAlpha(HEX.purple, 0.04));
182
+ grad.addColorStop(1, hexAlpha(HEX.purple, 0));
183
+ ctx.fillStyle = grad;
184
+ ctx.fill();
185
+
186
+ ctx.beginPath();
187
+ ctx.strokeStyle = HEX.purple;
188
+ ctx.lineWidth = 1.5;
189
+ ctx.lineJoin = 'round';
190
+ for (let i = 0; i < chartData.length; i++) {
191
+ const x = xAt(i); const y = yAt(globalSessions[i]);
192
+ i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
193
+ }
194
+ ctx.stroke();
195
+
196
+ ctx.beginPath();
197
+ ctx.strokeStyle = HEX.accent;
198
+ ctx.lineWidth = 1.5;
199
+ ctx.lineJoin = 'round';
200
+ for (let i = 0; i < chartData.length; i++) {
201
+ const x = xAt(i); const y = yAt(mySessions[i]);
202
+ i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
203
+ }
204
+ ctx.stroke();
205
+
206
+ // Legend
207
+ ctx.font = "9px 'Inter Variable', sans-serif";
208
+ ctx.textAlign = 'right';
209
+ let rx = width - pad.right - 4;
210
+ const ly = 14;
211
+ ctx.fillStyle = HEX.accent;
212
+ ctx.fillText('Your Node', rx, ly);
213
+ rx -= ctx.measureText('Your Node').width + 4;
214
+ ctx.beginPath(); ctx.arc(rx, ly - 3, 2.5, 0, Math.PI * 2); ctx.fill();
215
+ rx -= 14;
216
+ ctx.fillStyle = HEX.purple;
217
+ ctx.fillText('Network', rx, ly);
218
+ rx -= ctx.measureText('Network').width + 4;
219
+ ctx.beginPath(); ctx.arc(rx, ly - 3, 2.5, 0, Math.PI * 2); ctx.fill();
220
+
221
+ // Hover
222
+ if (hover && hover.index >= 0 && hover.index < chartData.length) {
223
+ const hx = hover.x;
224
+ const d = chartData[hover.index];
225
+ ctx.beginPath(); ctx.moveTo(hx, pad.top); ctx.lineTo(hx, pad.top + h);
226
+ ctx.strokeStyle = hexAlpha(HEX.text1, 0.15); ctx.lineWidth = 1; ctx.stroke();
227
+ ctx.beginPath(); ctx.arc(hx, yAt(d.globalSessions), 3, 0, Math.PI * 2);
228
+ ctx.fillStyle = HEX.purple; ctx.fill();
229
+ ctx.beginPath(); ctx.arc(hx, yAt(d.mySessions), 3, 0, Math.PI * 2);
230
+ ctx.fillStyle = HEX.accent; ctx.fill();
231
+
232
+ const lines = [
233
+ { label: 'Network', value: String(d.globalSessions), color: HEX.purple },
234
+ { label: 'Your Node', value: String(d.mySessions), color: HEX.accent },
235
+ { label: 'Nodes', value: String(d.nodeCount), color: HEX.text2 },
236
+ ];
237
+ const tooltipW = 104;
238
+ const tooltipH = lines.length * 16 + 12;
239
+ let tx = hx + 12;
240
+ if (tx + tooltipW > width - 8) tx = hx - tooltipW - 12;
241
+ const ty = Math.max(pad.top, yAt(d.globalSessions) - tooltipH / 2);
242
+
243
+ ctx.fillStyle = hexAlpha(HEX.surface0, 0.92);
244
+ ctx.beginPath(); ctx.roundRect(tx, ty, tooltipW, tooltipH, 4); ctx.fill();
245
+ ctx.strokeStyle = hexAlpha(HEX.text4, 0.2); ctx.lineWidth = 1; ctx.stroke();
246
+
196
247
  ctx.textAlign = 'left';
197
- });
248
+ lines.forEach((line, li) => {
249
+ const rowY = ty + 14 + li * 16;
250
+ ctx.beginPath(); ctx.arc(tx + 8, rowY - 3, 2, 0, Math.PI * 2);
251
+ ctx.fillStyle = line.color; ctx.fill();
252
+ ctx.font = "8px 'Inter Variable', sans-serif";
253
+ ctx.fillStyle = HEX.text3; ctx.fillText(line.label, tx + 14, rowY);
254
+ ctx.font = "9px 'JetBrains Mono Variable', monospace";
255
+ ctx.fillStyle = HEX.text0; ctx.textAlign = 'right';
256
+ ctx.fillText(line.value, tx + tooltipW - 8, rowY);
257
+ ctx.textAlign = 'left';
258
+ });
259
+ }
198
260
  }
199
- }, [chartData, width, height, hover, w, h, pad]);
261
+ }, [chartData, width, height, hover, w, h, pad, mode]);
200
262
 
201
263
  const activeNodes = nodes.filter((n) => n.status === 'active');
202
264
 
203
265
  return (
204
266
  <div className="flex flex-col h-full">
205
267
  <div className="px-3 pt-2.5 pb-1 flex-shrink-0 flex items-center justify-between">
206
- <span className="text-2xs font-mono text-text-3 uppercase tracking-widest">Network Activity</span>
268
+ <div className="flex items-center gap-2">
269
+ <span className="text-2xs font-mono text-text-3 uppercase tracking-widest">Network Activity</span>
270
+ <div className="flex items-center bg-surface-2 rounded-full p-0.5">
271
+ <button
272
+ onClick={() => setMode('sessions')}
273
+ className={cn(
274
+ 'px-2 py-0.5 text-2xs font-mono rounded-full transition-colors',
275
+ mode === 'sessions' ? 'bg-surface-4 text-text-0' : 'text-text-3 hover:text-text-1',
276
+ )}
277
+ >
278
+ Sessions
279
+ </button>
280
+ <button
281
+ onClick={() => setMode('performance')}
282
+ className={cn(
283
+ 'px-2 py-0.5 text-2xs font-mono rounded-full transition-colors',
284
+ mode === 'performance' ? 'bg-surface-4 text-text-0' : 'text-text-3 hover:text-text-1',
285
+ )}
286
+ >
287
+ Perf
288
+ </button>
289
+ </div>
290
+ </div>
207
291
  <span className="text-2xs font-mono text-text-3 tabular-nums">{activeNodes.length} nodes</span>
208
292
  </div>
209
293
 
@@ -4,7 +4,7 @@ import { useGrooveStore } from '../../stores/groove';
4
4
  import { cn } from '../../lib/cn';
5
5
  import { HEX } from '../../lib/theme-hex';
6
6
  import { Tooltip } from '../ui/tooltip';
7
- import { HelpCircle } from 'lucide-react';
7
+ import { HelpCircle, Zap } from 'lucide-react';
8
8
 
9
9
  function fmtMbToGb(mb) {
10
10
  if (!mb) return '0';
@@ -60,6 +60,8 @@ export const ComputeHeader = memo(function ComputeHeader() {
60
60
  const compute = useGrooveStore((s) => s.networkCompute);
61
61
  const status = useGrooveStore((s) => s.networkStatus);
62
62
  const snapshots = useGrooveStore((s) => s.networkSnapshots);
63
+ const tokenTiming = useGrooveStore((s) => s.networkTokenTiming);
64
+ const perfSnaps = useGrooveStore((s) => s.networkPerfSnapshots);
63
65
  const nodes = status.nodes || [];
64
66
 
65
67
  const activeNodes = nodes.filter((n) => n.status === 'active');
@@ -102,6 +104,15 @@ export const ComputeHeader = memo(function ComputeHeader() {
102
104
  label: 'GPU UTIL', value: avgGpuUtil > 0 ? `${Math.round(avgGpuUtil)}%` : '--',
103
105
  color: gpuColor, hint: 'Average GPU utilization — green <50%, yellow 50-80%, red >80%',
104
106
  },
107
+ {
108
+ label: 'TPS', value: tokenTiming?.tps != null ? `${tokenTiming.tps.toFixed(1)} t/s` : '--',
109
+ color: HEX.accent, hint: 'Live tokens per second during inference',
110
+ sparkData: perfSnaps.length >= 2 ? perfSnaps.map((s) => ({ v: s.tps ?? 0 })) : undefined,
111
+ },
112
+ ...(tokenTiming?.ttft_ms != null ? [{
113
+ label: 'TTFT', value: `${(tokenTiming.ttft_ms / 1000).toFixed(2)}s`,
114
+ color: HEX.info, hint: 'Time to first token',
115
+ }] : []),
105
116
  ];
106
117
 
107
118
  return (
@@ -1,44 +1,21 @@
1
1
  // FSL-1.1-Apache-2.0 — see LICENSE
2
- import { memo, useState, useEffect, useCallback } from 'react';
2
+ import { memo, useState, useCallback } from 'react';
3
3
  import { useGrooveStore } from '../../stores/groove';
4
- import { cn } from '../../lib/cn';
5
4
  import { StatusDot } from '../ui/status-dot';
6
5
  import { Button } from '../ui/button';
7
6
  import { Tooltip } from '../ui/tooltip';
8
- import { fmtUptime } from '../../lib/format';
9
7
  import { Copy, Check, Wallet } from 'lucide-react';
10
8
 
11
- function shortAddr(addr) {
12
- if (!addr || typeof addr !== 'string') return '—';
13
- if (addr.length < 14) return addr;
14
- return `${addr.slice(0, 6)}…${addr.slice(-4)}`;
15
- }
16
-
17
9
  function nodeStatusMap(node) {
18
10
  if (node.active && node.status === 'connected') return 'running';
19
11
  if (node.status === 'connecting') return 'starting';
20
12
  return 'stopped';
21
13
  }
22
14
 
23
- function statusColor(status) {
24
- if (status === 'connected') return 'text-success';
25
- if (status === 'connecting') return 'text-warning';
26
- return 'text-danger';
27
- }
28
-
29
15
  export const IdentityBar = memo(function IdentityBar() {
30
16
  const node = useGrooveStore((s) => s.networkNode);
31
17
  const wallet = useGrooveStore((s) => s.networkWallet);
32
18
  const [copied, setCopied] = useState(false);
33
- const [uptime, setUptime] = useState(0);
34
-
35
- useEffect(() => {
36
- if (!node.startedAt) return;
37
- const tick = () => setUptime(Math.floor((Date.now() - node.startedAt) / 1000));
38
- tick();
39
- const id = setInterval(tick, 1000);
40
- return () => clearInterval(id);
41
- }, [node.startedAt]);
42
19
 
43
20
  const handleCopy = useCallback(async () => {
44
21
  if (!node.nodeId) return;
@@ -49,35 +26,22 @@ export const IdentityBar = memo(function IdentityBar() {
49
26
  } catch { /* clipboard blocked */ }
50
27
  }, [node.nodeId]);
51
28
 
52
- const connStatus = node.status || 'disconnected';
53
-
54
29
  return (
55
30
  <div className="flex items-center h-11 px-4 bg-surface-0 border-b border-border-subtle gap-3">
56
31
  {/* Left: node identity */}
57
- <div className="flex items-center gap-2">
32
+ <div className="flex items-center gap-2 flex-1 min-w-0">
58
33
  <StatusDot status={nodeStatusMap(node)} size="sm" />
59
- <code className="text-xs font-mono text-text-0">{shortAddr(node.nodeId)}</code>
34
+ <code className="text-xs font-mono text-text-0 truncate">{node.nodeId || '—'}</code>
60
35
  <Tooltip content={copied ? 'Copied' : 'Copy address'} side="bottom">
61
36
  <button
62
37
  onClick={handleCopy}
63
- className="h-6 w-6 inline-flex items-center justify-center rounded border border-border-subtle text-text-3 hover:text-accent hover:border-accent/40 cursor-pointer transition-colors"
38
+ className="h-6 w-6 inline-flex items-center justify-center rounded border border-border-subtle text-text-3 hover:text-accent hover:border-accent/40 cursor-pointer transition-colors flex-shrink-0"
64
39
  >
65
40
  {copied ? <Check size={10} /> : <Copy size={10} />}
66
41
  </button>
67
42
  </Tooltip>
68
43
  </div>
69
44
 
70
- {/* Center: status + uptime */}
71
- <div className="flex-1 flex items-center justify-center gap-3">
72
- <span className={cn('text-2xs uppercase tracking-widest font-sans', statusColor(connStatus))}>
73
- {connStatus === 'connected' ? 'Connected' : connStatus === 'connecting' ? 'Connecting' : 'Disconnected'}
74
- </span>
75
- <span className="w-1 h-1 rounded-full bg-text-4" />
76
- <span className="text-2xs font-mono text-text-3 tabular-nums">
77
- {fmtUptime(uptime)}
78
- </span>
79
- </div>
80
-
81
45
  {/* Right: token balance + wallet */}
82
46
  <div className="flex items-center gap-3">
83
47
  <span className="text-xs font-mono text-text-2">