@polderlabs/bizar 4.4.11 → 4.4.13

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.
@@ -0,0 +1,133 @@
1
+ /**
2
+ * src/server/routes/minimax.mjs
3
+ *
4
+ * v4.5.0 — REST surface for the MiniMax Token Plan integration.
5
+ *
6
+ * Endpoints:
7
+ * GET /api/minimax/status — current key + cached remains summary
8
+ * GET /api/minimax/remains — full remains snapshot (5h + weekly per model)
9
+ * POST /api/minimax/remains/refresh — force re-fetch from the API
10
+ * POST /api/minimax/test — smoke-test the key with a one-shot chat call
11
+ * GET /api/minimax/cache — read the on-disk cache file (for debugging)
12
+ * DELETE /api/minimax/cache — clear cache
13
+ * POST /api/minimax/onboarding — onboarding wizard state (dismissed, hiddenModels)
14
+ * POST /api/minimax/onboarding/save-key — write the user's key to opencode's
15
+ * auth.json (the canonical place)
16
+ *
17
+ * The MiniMax key is read from opencode's auth store, NOT from
18
+ * settings.json. The dashboard's onboarding wizard writes the key
19
+ * directly to ~/.local/share/opencode/auth.json so opencode itself
20
+ * can pick it up — that way the user only enters the key once.
21
+ */
22
+ import { Router } from 'express';
23
+ import {
24
+ fetchRemains,
25
+ chatCompletion,
26
+ readCachedRemains,
27
+ clearRemainsCache,
28
+ getStatus,
29
+ writeAuthFile,
30
+ writeOnboarding,
31
+ readOnboarding,
32
+ maskKey,
33
+ KNOWN_MODELS,
34
+ } from '../minimax.mjs';
35
+ import { wrap } from './_shared.mjs';
36
+
37
+ /**
38
+ * @param {object} deps
39
+ * @param {object} deps.state
40
+ * @param {Function} deps.broadcast
41
+ * @returns {import('express').Router}
42
+ */
43
+ export function createMinimaxRouter({ state, broadcast }) {
44
+ const router = Router();
45
+
46
+ // GET / — health + config summary
47
+ router.get('/minimax/status', wrap(async (_req, res) => {
48
+ res.json(getStatus());
49
+ }));
50
+
51
+ // GET /onboarding — wizard state (dismissed?, hidden models)
52
+ router.get('/minimax/onboarding', wrap(async (_req, res) => {
53
+ res.json(readOnboarding());
54
+ }));
55
+
56
+ // POST /onboarding — update wizard state
57
+ router.post('/minimax/onboarding', wrap(async (req, res) => {
58
+ const patch = req.body || {};
59
+ const next = writeOnboarding(patch);
60
+ res.json(next);
61
+ }));
62
+
63
+ // POST /onboarding/save-key — write the key to opencode's auth.json
64
+ router.post('/minimax/onboarding/save-key', wrap(async (req, res) => {
65
+ const { key, groupId } = req.body || {};
66
+ if (typeof key !== 'string' || !key.trim()) {
67
+ res.status(400).json({ ok: false, error: 'no_key', message: 'Key is required' });
68
+ return;
69
+ }
70
+ try {
71
+ const path = writeAuthFile(key.trim(), groupId || 'default');
72
+ // Clear the remains cache so the next load picks up the new key.
73
+ clearRemainsCache();
74
+ // Mark the onboarding as dismissed (user has the key now).
75
+ writeOnboarding({ dismissedAt: Date.now() });
76
+ if (broadcast) {
77
+ broadcast({ type: 'minimax:configured', source: 'auth.json' });
78
+ }
79
+ res.json({ ok: true, path, apiKeyHint: maskKey(key) });
80
+ } catch (err) {
81
+ res.status(500).json({ ok: false, error: 'write_failed', message: err.message });
82
+ }
83
+ }));
84
+
85
+ // GET /remains — current snapshot (cache-or-fetch)
86
+ router.get('/minimax/remains', wrap(async (_req, res) => {
87
+ const result = await fetchRemains();
88
+ if (broadcast && result.ok) {
89
+ broadcast({ type: 'minimax:remains', remains: result });
90
+ }
91
+ res.json(result);
92
+ }));
93
+
94
+ // POST /remains/refresh — force re-fetch (bypass cache TTL)
95
+ router.post('/minimax/remains/refresh', wrap(async (_req, res) => {
96
+ const result = await fetchRemains({ force: true });
97
+ if (broadcast && result.ok) {
98
+ broadcast({ type: 'minimax:remains:refreshed', remains: result });
99
+ }
100
+ res.json(result);
101
+ }));
102
+
103
+ // POST /test — smoke-test the key with a chat completion
104
+ router.post('/minimax/test', wrap(async (req, res) => {
105
+ const body = req.body || {};
106
+ const prompt = typeof body.prompt === 'string' && body.prompt.trim()
107
+ ? body.prompt
108
+ : 'Reply with the single word: ok';
109
+ const model = typeof body.model === 'string' && body.model.trim()
110
+ ? body.model.trim()
111
+ : 'MiniMax-M3';
112
+ const result = await chatCompletion({
113
+ prompt,
114
+ model,
115
+ maxTokens: typeof body.maxTokens === 'number' ? body.maxTokens : 32,
116
+ });
117
+ res.json(result);
118
+ }));
119
+
120
+ // GET /cache — read the on-disk cache (debugging)
121
+ router.get('/minimax/cache', wrap(async (_req, res) => {
122
+ res.json(readCachedRemains() || null);
123
+ }));
124
+
125
+ // DELETE /cache — clear cache
126
+ router.delete('/minimax/cache', wrap(async (_req, res) => {
127
+ clearRemainsCache();
128
+ if (broadcast) broadcast({ type: 'minimax:cache:cleared' });
129
+ res.json({ ok: true });
130
+ }));
131
+
132
+ return router;
133
+ }
@@ -35,6 +35,7 @@ import { ModView, type ModView as ModViewType } from './views/ModView';
35
35
  import { Schedules } from './views/Schedules';
36
36
  import { Skills } from './views/Skills';
37
37
  import { History } from './views/History';
38
+ import { MiniMaxUsage } from './views/MiniMaxUsage';
38
39
  import { BackgroundAgents } from './views/BackgroundAgents';
39
40
  import { Spinner } from './components/Spinner';
40
41
  import { Button } from './components/Button';
@@ -75,6 +76,7 @@ const VIEW_MAP: Record<string, (p: ViewProps) => React.ReactNode> = {
75
76
  schedules: Schedules,
76
77
  skills: Skills,
77
78
  history: History,
79
+ minimax: MiniMaxUsage,
78
80
  };
79
81
 
80
82
  const VERSION = 'v3.21.0';
@@ -21,6 +21,7 @@ import {
21
21
  Sparkles,
22
22
  Activity,
23
23
  Radio,
24
+ Coins,
24
25
  type LucideIcon,
25
26
  } from 'lucide-react';
26
27
  import { cn } from '../lib/utils';
@@ -48,6 +49,7 @@ export const TABS: TabDef[] = [
48
49
  { id: 'mods', label: 'Mods', icon: Puzzle },
49
50
  { id: 'schedules', label: 'Schedules', icon: Clock },
50
51
  { id: 'history', label: 'History', icon: HistoryIcon },
52
+ { id: 'minimax', label: 'Usage', icon: Coins },
51
53
  { id: 'config', label: 'Config', icon: Settings2 },
52
54
  { id: 'settings', label: 'Settings', icon: Sliders },
53
55
  ];
@@ -265,6 +265,18 @@ export type Settings = {
265
265
  };
266
266
  // v3.21.0 — System LLM calls (auto-title, enhance-prompt, summarization).
267
267
  systemLlm?: SystemLlmConfig;
268
+ // v4.5.0 — MiniMax Token Plan integration. `apiKey` is the user's
269
+ // Subscription Key (NOT a pay-as-you-go API key). `groupId` is usually
270
+ // 'default' for an individual team. `baseUrl` is the Token Plan host
271
+ // (the remains endpoint lives on www.*, not api.*). `chatBaseUrl` is
272
+ // the chat-completions host (api.*/v1).
273
+ minimax?: {
274
+ enabled: boolean;
275
+ apiKey: string;
276
+ groupId: string;
277
+ baseUrl: string;
278
+ chatBaseUrl: string;
279
+ };
268
280
  };
269
281
 
270
282
  export type SettingsResponse = {
@@ -8,6 +8,7 @@ import { MobileApp } from './MobileApp';
8
8
  import './styles/main.css';
9
9
  import './styles/mobile.css';
10
10
  import './styles/glyphs.css';
11
+ import './styles/minimax-usage.css';
11
12
 
12
13
  function Root() {
13
14
  const [isMobile, setIsMobile] = useState(() => {
@@ -0,0 +1,507 @@
1
+ /* ============================================================================
2
+ * src/web/styles/minimax-usage.css
3
+ *
4
+ * v4.5.0 — Styles for the MiniMax Token Plan usage dashboard.
5
+ *
6
+ * Scope: `.view-minimax-usage` and all child classes prefixed with
7
+ * `minimax-`. Reuses the dashboard's existing CSS variables
8
+ * (--accent, --bg-1, --bg-2, --border, --text, --text-muted, --success,
9
+ * --warning, --error) so the page inherits the rest of the design
10
+ * system automatically.
11
+ * ========================================================================== */
12
+
13
+ .view-minimax-usage {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 16px;
17
+ padding: 16px 20px 32px;
18
+ max-width: 1280px;
19
+ margin: 0 auto;
20
+ width: 100%;
21
+ }
22
+
23
+ /* ── header ────────────────────────────────────────────────────────────── */
24
+ .view-minimax-usage .view-header {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ align-items: flex-end;
28
+ gap: 16px;
29
+ flex-wrap: wrap;
30
+ }
31
+ .view-minimax-usage .view-header-titles { flex: 1 1 360px; min-width: 0; }
32
+ .view-minimax-usage .view-title {
33
+ display: flex;
34
+ align-items: center;
35
+ font-size: 22px;
36
+ font-weight: 600;
37
+ margin: 0 0 4px;
38
+ color: var(--text);
39
+ }
40
+ .view-minimax-usage .view-subtitle {
41
+ margin: 0;
42
+ color: var(--text-muted);
43
+ font-size: 13px;
44
+ }
45
+ .view-minimax-usage .view-subtitle code {
46
+ font-size: 12px;
47
+ padding: 1px 5px;
48
+ border-radius: 3px;
49
+ background: var(--bg-2);
50
+ color: var(--text);
51
+ }
52
+ .view-minimax-usage .view-header-actions { display: flex; gap: 8px; align-items: center; }
53
+
54
+ /* ── banner (warn / err) ───────────────────────────────────────────── */
55
+ .view-minimax-usage .banner {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 10px;
59
+ padding: 10px 14px;
60
+ border-radius: 8px;
61
+ font-size: 13px;
62
+ border: 1px solid transparent;
63
+ }
64
+ .view-minimax-usage .banner code {
65
+ font-size: 12px;
66
+ padding: 1px 5px;
67
+ border-radius: 3px;
68
+ background: rgba(0,0,0,0.18);
69
+ }
70
+ .view-minimax-usage .banner-warn {
71
+ background: rgba(217, 158, 38, 0.12);
72
+ border-color: rgba(217, 158, 38, 0.35);
73
+ color: var(--text);
74
+ }
75
+ .view-minimax-usage .banner-err {
76
+ background: rgba(248, 81, 73, 0.10);
77
+ border-color: rgba(248, 81, 73, 0.40);
78
+ color: var(--text);
79
+ }
80
+
81
+ /* ── stat row ──────────────────────────────────────────────────────── */
82
+ .view-minimax-usage .minimax-stats-row {
83
+ display: grid;
84
+ grid-template-columns: repeat(4, 1fr);
85
+ gap: 12px;
86
+ }
87
+ @media (max-width: 900px) {
88
+ .view-minimax-usage .minimax-stats-row { grid-template-columns: repeat(2, 1fr); }
89
+ }
90
+ .view-minimax-usage .stat {
91
+ background: var(--bg-1);
92
+ border: 1px solid var(--border);
93
+ border-radius: 8px;
94
+ padding: 12px 14px;
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: 2px;
98
+ }
99
+ .view-minimax-usage .stat-label {
100
+ font-size: 11px;
101
+ letter-spacing: 0.05em;
102
+ text-transform: uppercase;
103
+ color: var(--text-muted);
104
+ }
105
+ .view-minimax-usage .stat-value {
106
+ font-size: 18px;
107
+ font-weight: 600;
108
+ color: var(--text);
109
+ font-family: var(--font-mono, ui-monospace, monospace);
110
+ word-break: break-word;
111
+ }
112
+ .view-minimax-usage .stat-hint {
113
+ font-size: 11px;
114
+ color: var(--text-muted);
115
+ }
116
+
117
+ /* ── per-model quota grid ────────────────────────────────────────── */
118
+ .view-minimax-usage .minimax-models-grid {
119
+ display: grid;
120
+ grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
121
+ gap: 14px;
122
+ }
123
+ .view-minimax-usage .minimax-model-card { padding: 14px 16px; }
124
+ .view-minimax-usage .minimax-model-head {
125
+ display: flex;
126
+ justify-content: space-between;
127
+ align-items: center;
128
+ margin-bottom: 12px;
129
+ gap: 8px;
130
+ }
131
+ .view-minimax-usage .minimax-model-name {
132
+ font-size: 15px;
133
+ font-weight: 600;
134
+ color: var(--text);
135
+ font-family: var(--font-mono, ui-monospace, monospace);
136
+ }
137
+ .view-minimax-usage .minimax-model-status {
138
+ font-size: 11px;
139
+ color: var(--text-muted);
140
+ text-transform: lowercase;
141
+ letter-spacing: 0.02em;
142
+ }
143
+ .view-minimax-usage .minimax-model-status.is-warn { color: var(--warning, #d29922); }
144
+ .view-minimax-usage .minimax-model-status.is-ok { color: var(--success, #3fb950); }
145
+
146
+ /* ── quota rows inside a model card ─────────────────────────────── */
147
+ .view-minimax-usage .minimax-quota-rows {
148
+ display: flex;
149
+ flex-direction: column;
150
+ gap: 10px;
151
+ }
152
+ .view-minimax-usage .minimax-quota-row {
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 4px;
156
+ padding: 8px 10px;
157
+ border-radius: 6px;
158
+ background: rgba(255,255,255,0.02);
159
+ border: 1px solid var(--border);
160
+ }
161
+ .view-minimax-usage .minimax-quota-row.is-good { border-color: rgba(63, 185, 80, 0.25); }
162
+ .view-minimax-usage .minimax-quota-row.is-warn { border-color: rgba(217, 158, 38, 0.35); background: rgba(217, 158, 38, 0.05); }
163
+ .view-minimax-usage .minimax-quota-row.is-low { border-color: rgba(248, 81, 73, 0.45); background: rgba(248, 81, 73, 0.06); }
164
+
165
+ .view-minimax-usage .minimax-quota-head {
166
+ display: flex;
167
+ justify-content: space-between;
168
+ align-items: center;
169
+ font-size: 12px;
170
+ color: var(--text-muted);
171
+ }
172
+ .view-minimax-usage .minimax-quota-label {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ gap: 4px;
176
+ color: var(--text);
177
+ font-weight: 500;
178
+ }
179
+ .view-minimax-usage .minimax-quota-remaining {
180
+ font-family: var(--font-mono, ui-monospace, monospace);
181
+ font-weight: 600;
182
+ color: var(--text);
183
+ }
184
+ .view-minimax-usage .minimax-quota-row.is-good .minimax-quota-remaining { color: var(--success, #3fb950); }
185
+ .view-minimax-usage .minimax-quota-row.is-warn .minimax-quota-remaining { color: var(--warning, #d29922); }
186
+ .view-minimax-usage .minimax-quota-row.is-low .minimax-quota-remaining { color: var(--error, #f85149); }
187
+
188
+ .view-minimax-usage .minimax-bar {
189
+ position: relative;
190
+ height: 8px;
191
+ background: var(--bg-2);
192
+ border-radius: 4px;
193
+ overflow: hidden;
194
+ }
195
+ .view-minimax-usage .minimax-bar-fill {
196
+ height: 100%;
197
+ background: var(--accent);
198
+ transition: width 200ms ease-out;
199
+ }
200
+ .view-minimax-usage .minimax-quota-row.is-good .minimax-bar-fill { background: var(--success, #3fb950); }
201
+ .view-minimax-usage .minimax-quota-row.is-warn .minimax-bar-fill { background: var(--warning, #d29922); }
202
+ .view-minimax-usage .minimax-quota-row.is-low .minimax-bar-fill { background: var(--error, #f85149); }
203
+
204
+ .view-minimax-usage .minimax-quota-meta {
205
+ display: flex;
206
+ justify-content: space-between;
207
+ font-size: 11px;
208
+ color: var(--text-muted);
209
+ }
210
+ .view-minimax-usage .minimax-quota-meta strong {
211
+ color: var(--text);
212
+ font-weight: 600;
213
+ font-family: var(--font-mono, ui-monospace, monospace);
214
+ }
215
+
216
+ /* ── Onboarding wizard ─────────────────────────────────────────── */
217
+ .view-minimax-onboarding {
218
+ display: flex;
219
+ flex-direction: column;
220
+ gap: 16px;
221
+ padding: 16px 20px 32px;
222
+ max-width: 800px;
223
+ margin: 0 auto;
224
+ width: 100%;
225
+ }
226
+ .view-minimax-onboarding .minimax-wizard-stepper {
227
+ display: flex;
228
+ align-items: center;
229
+ justify-content: space-between;
230
+ gap: 6px;
231
+ padding: 12px 16px;
232
+ background: var(--bg-1);
233
+ border: 1px solid var(--border);
234
+ border-radius: 8px;
235
+ }
236
+ .view-minimax-onboarding .minimax-wizard-step {
237
+ display: flex;
238
+ align-items: center;
239
+ gap: 8px;
240
+ flex: 1;
241
+ font-size: 12px;
242
+ color: var(--text-muted);
243
+ }
244
+ .view-minimax-onboarding .minimax-wizard-step-bullet {
245
+ width: 24px;
246
+ height: 24px;
247
+ display: inline-flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ border-radius: 50%;
251
+ background: var(--bg-2);
252
+ border: 1px solid var(--border);
253
+ font-family: var(--font-mono, ui-monospace, monospace);
254
+ font-size: 11px;
255
+ color: var(--text);
256
+ flex-shrink: 0;
257
+ }
258
+ .view-minimax-onboarding .minimax-wizard-step.is-current .minimax-wizard-step-bullet {
259
+ background: var(--accent);
260
+ border-color: var(--accent);
261
+ color: #fff;
262
+ }
263
+ .view-minimax-onboarding .minimax-wizard-step.is-done .minimax-wizard-step-bullet {
264
+ background: var(--success, #3fb950);
265
+ border-color: var(--success, #3fb950);
266
+ color: #fff;
267
+ }
268
+ .view-minimax-onboarding .minimax-wizard-step.is-done { color: var(--success, #3fb950); }
269
+ .view-minimax-onboarding .minimax-wizard-step.is-current { color: var(--text); font-weight: 500; }
270
+ .view-minimax-onboarding .minimax-wizard-step-label { font-size: 12px; }
271
+ .view-minimax-onboarding .minimax-wizard-step.is-current .minimax-wizard-step-label {
272
+ font-weight: 500;
273
+ }
274
+ .view-minimax-onboarding .minimax-wizard-body {
275
+ padding: 4px 4px 0;
276
+ display: flex;
277
+ flex-direction: column;
278
+ gap: 12px;
279
+ }
280
+ .view-minimax-onboarding .minimax-wizard-title {
281
+ font-size: 16px;
282
+ font-weight: 600;
283
+ margin: 0;
284
+ color: var(--text);
285
+ display: flex;
286
+ align-items: center;
287
+ }
288
+ .view-minimax-onboarding .minimax-wizard-prose {
289
+ margin: 0;
290
+ color: var(--text-muted);
291
+ font-size: 13px;
292
+ line-height: 1.55;
293
+ }
294
+ .view-minimax-onboarding .minimax-wizard-prose code {
295
+ font-family: var(--font-mono, ui-monospace, monospace);
296
+ font-size: 12px;
297
+ padding: 1px 5px;
298
+ border-radius: 3px;
299
+ background: var(--bg-2);
300
+ color: var(--text);
301
+ }
302
+ .view-minimax-onboarding .minimax-wizard-prose--muted { font-size: 12px; opacity: 0.85; }
303
+ .view-minimax-onboarding .minimax-wizard-list {
304
+ margin: 0;
305
+ padding-left: 22px;
306
+ font-size: 13px;
307
+ color: var(--text-muted);
308
+ line-height: 1.6;
309
+ }
310
+ .view-minimax-onboarding .minimax-wizard-list li { margin-bottom: 4px; }
311
+ .view-minimax-onboarding .minimax-wizard-link {
312
+ color: var(--accent);
313
+ text-decoration: underline;
314
+ display: inline-flex;
315
+ align-items: center;
316
+ gap: 3px;
317
+ }
318
+ .view-minimax-onboarding .minimax-wizard-actions {
319
+ display: flex;
320
+ align-items: center;
321
+ gap: 8px;
322
+ margin-top: 8px;
323
+ flex-wrap: wrap;
324
+ }
325
+ .view-minimax-onboarding .minimax-wizard-error {
326
+ display: flex;
327
+ gap: 8px;
328
+ padding: 8px 10px;
329
+ border-radius: 6px;
330
+ background: rgba(248, 81, 73, 0.08);
331
+ border: 1px solid rgba(248, 81, 73, 0.30);
332
+ color: var(--text);
333
+ font-size: 12px;
334
+ }
335
+ .view-minimax-onboarding .minimax-wizard-footer {
336
+ display: flex;
337
+ align-items: center;
338
+ gap: 6px;
339
+ font-size: 11px;
340
+ color: var(--text-muted);
341
+ padding: 0 4px;
342
+ margin-top: 8px;
343
+ }
344
+ .view-minimax-onboarding .minimax-wizard-footer code {
345
+ font-family: var(--font-mono, ui-monospace, monospace);
346
+ font-size: 10px;
347
+ padding: 0 3px;
348
+ background: rgba(0,0,0,0.25);
349
+ border-radius: 2px;
350
+ }
351
+
352
+ /* ── Subscription Key card ──────────────────────────────────────── */
353
+ .view-minimax-usage .minimax-link {
354
+ color: var(--accent);
355
+ text-decoration: underline;
356
+ }
357
+ .view-minimax-usage .minimax-key-row {
358
+ display: flex;
359
+ align-items: center;
360
+ gap: 10px;
361
+ margin-top: 10px;
362
+ flex-wrap: wrap;
363
+ }
364
+ .view-minimax-usage .minimax-key-input-wrap {
365
+ position: relative;
366
+ flex: 1 1 320px;
367
+ display: flex;
368
+ align-items: center;
369
+ }
370
+ .view-minimax-usage .minimax-key-icon {
371
+ position: absolute;
372
+ left: 10px;
373
+ color: var(--text-muted);
374
+ pointer-events: none;
375
+ }
376
+ .view-minimax-usage .minimax-key-input {
377
+ width: 100%;
378
+ background: var(--bg-2);
379
+ border: 1px solid var(--border);
380
+ border-radius: 6px;
381
+ padding: 8px 36px 8px 32px;
382
+ color: var(--text);
383
+ font-family: var(--font-mono, ui-monospace, monospace);
384
+ font-size: 12px;
385
+ outline: none;
386
+ transition: border-color 120ms ease;
387
+ }
388
+ .view-minimax-usage .minimax-key-input:focus {
389
+ border-color: var(--accent);
390
+ }
391
+ .view-minimax-usage .minimax-key-input::placeholder {
392
+ color: var(--text-muted);
393
+ opacity: 0.7;
394
+ }
395
+ .view-minimax-usage .minimax-key-toggle {
396
+ position: absolute;
397
+ right: 6px;
398
+ width: 26px;
399
+ height: 26px;
400
+ display: inline-flex;
401
+ align-items: center;
402
+ justify-content: center;
403
+ background: transparent;
404
+ border: 0;
405
+ border-radius: 4px;
406
+ color: var(--text-muted);
407
+ cursor: pointer;
408
+ }
409
+ .view-minimax-usage .minimax-key-toggle:hover { color: var(--text); background: var(--bg-1); }
410
+ .view-minimax-usage .is-ok { color: var(--success, #3fb950); }
411
+ .view-minimax-usage .is-warn { color: var(--warning, #d29922); }
412
+
413
+ /* ── test prompt card ────────────────────────────────────────────── */
414
+ .view-minimax-usage .minimax-test-actions {
415
+ display: flex;
416
+ align-items: center;
417
+ gap: 12px;
418
+ flex-wrap: wrap;
419
+ margin-top: 8px;
420
+ }
421
+ .view-minimax-usage .minimax-test-prompt {
422
+ font-family: var(--font-mono, ui-monospace, monospace);
423
+ font-size: 12px;
424
+ color: var(--text-muted);
425
+ padding: 4px 8px;
426
+ background: var(--bg-2);
427
+ border-radius: 4px;
428
+ border: 1px solid var(--border);
429
+ }
430
+ .view-minimax-usage .minimax-test-result {
431
+ margin-top: 12px;
432
+ padding: 10px 12px;
433
+ border-radius: 6px;
434
+ display: flex;
435
+ gap: 10px;
436
+ align-items: flex-start;
437
+ font-size: 13px;
438
+ border: 1px solid transparent;
439
+ }
440
+ .view-minimax-usage .minimax-test-result.ok {
441
+ background: rgba(63, 185, 80, 0.08);
442
+ border-color: rgba(63, 185, 80, 0.30);
443
+ color: var(--text);
444
+ }
445
+ .view-minimax-usage .minimax-test-result.err {
446
+ background: rgba(248, 81, 73, 0.08);
447
+ border-color: rgba(248, 81, 73, 0.30);
448
+ color: var(--text);
449
+ }
450
+ .view-minimax-usage .minimax-test-body { flex: 1; min-width: 0; }
451
+ .view-minimax-usage .minimax-test-line { margin-bottom: 4px; }
452
+ .view-minimax-usage .minimax-test-line code {
453
+ font-size: 12px;
454
+ background: rgba(0,0,0,0.25);
455
+ padding: 0 4px;
456
+ border-radius: 3px;
457
+ }
458
+ .view-minimax-usage .minimax-test-content {
459
+ margin: 6px 0;
460
+ padding: 6px 8px;
461
+ background: var(--bg-2);
462
+ border-radius: 4px;
463
+ font-family: var(--font-mono, ui-monospace, monospace);
464
+ font-size: 12px;
465
+ }
466
+ .view-minimax-usage .minimax-test-usage {
467
+ font-size: 12px;
468
+ color: var(--text-muted);
469
+ }
470
+ .view-minimax-usage .minimax-test-usage code {
471
+ background: rgba(0,0,0,0.25);
472
+ padding: 0 4px;
473
+ border-radius: 3px;
474
+ font-size: 11px;
475
+ }
476
+ .view-minimax-usage .minimax-test-result pre {
477
+ margin: 0;
478
+ white-space: pre-wrap;
479
+ word-break: break-word;
480
+ font-family: var(--font-mono, ui-monospace, monospace);
481
+ font-size: 12px;
482
+ }
483
+
484
+ /* ── error card fallback ─────────────────────────────────────────── */
485
+ .view-minimax-usage .error-card {
486
+ display: flex;
487
+ align-items: flex-start;
488
+ gap: 12px;
489
+ padding: 14px 16px;
490
+ border-radius: 8px;
491
+ background: rgba(248, 81, 73, 0.06);
492
+ border: 1px solid rgba(248, 81, 73, 0.30);
493
+ color: var(--text);
494
+ }
495
+ .view-minimax-usage .error-card pre {
496
+ margin: 6px 0 0;
497
+ font-family: var(--font-mono, ui-monospace, monospace);
498
+ font-size: 12px;
499
+ white-space: pre-wrap;
500
+ }
501
+
502
+ /* ── spinner helper (in case global .spin doesn't cover all cases) ─── */
503
+ .view-minimax-usage .spin { animation: minimax-spin 900ms linear infinite; }
504
+ @keyframes minimax-spin {
505
+ from { transform: rotate(0deg); }
506
+ to { transform: rotate(360deg); }
507
+ }