minimax-status 1.2.4 → 1.2.5
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.
- package/README.md +224 -512
- package/cli/CHANGELOG.md +19 -0
- package/cli/api.js +52 -35
- package/cli/renderer.js +6 -4
- package/cli/status.js +39 -28
- package/cli/statusbar.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,512 +1,224 @@
|
|
|
1
|
-
# MiniMax StatusBar
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/minimax-status)
|
|
4
|
-
[](https://www.npmjs.com/package/minimax-status)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode)
|
|
7
|
-
|
|
8
|
-
MiniMax Token-Plan
|
|
9
|
-
|
|
10
|
-
## 版本
|
|
11
|
-
|
|
12
|
-
| 插件
|
|
13
|
-
|
|
14
|
-
| **CLI**
|
|
15
|
-
| **VSCode** | 1.
|
|
16
|
-
|
|
17
|
-
## 特性
|
|
18
|
-
|
|
19
|
-
- ✅
|
|
20
|
-
- ✅
|
|
21
|
-
- ✅
|
|
22
|
-
- ✅
|
|
23
|
-
- ✅
|
|
24
|
-
- ✅
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
minimax
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
###
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
##
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
2. **配置 Droid**:
|
|
228
|
-
|
|
229
|
-
编辑 `~/.factory/settings.json`:
|
|
230
|
-
|
|
231
|
-
```json
|
|
232
|
-
{
|
|
233
|
-
"statusLine": {
|
|
234
|
-
"type": "command",
|
|
235
|
-
"command": "minimax droid-statusline"
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
3. **重启 Droid**
|
|
241
|
-
|
|
242
|
-
集成成功后,底部状态栏将显示:
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
cli main * MiniMax-M3[1M][1m] 25% · 249.5k 5h 41% · W 6% 2h59m 剩291天
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
显示格式:`目录 ❯ 分支 ❯ 模型 ❯ 上下文窗口% · token ❯ 5h限额% · 周限额% ❯ 5h倒计时 ❯ 到期天数`
|
|
249
|
-
|
|
250
|
-
**颜色说明**:
|
|
251
|
-
|
|
252
|
-
- **使用量**: ≥85%红色 | 60-85%黄色 | <60%绿色
|
|
253
|
-
- **到期时间**: ≤3天红色 | ≤7天黄色 | >7天绿色
|
|
254
|
-
|
|
255
|
-
## 显示示例
|
|
256
|
-
|
|
257
|
-
### 详细模式
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
┌──────────────────────────────────────────────────────┐
|
|
261
|
-
│ MiniMax Claude Code 使用状态 │
|
|
262
|
-
│ │
|
|
263
|
-
│ 剩余时间: 3 小时 17 分钟后重置 │
|
|
264
|
-
│ │
|
|
265
|
-
│ 已用额度: █████████░░░░░░░░░░░░░░░░░░ 33% │
|
|
266
|
-
│ │
|
|
267
|
-
│ 周限额: ░░░░░░░░░░░░░░░ 5% │
|
|
268
|
-
│ 重置: 6 天 12 小时后重置 │
|
|
269
|
-
│ 套餐到期: 03/19/2027 (还剩 291 天) │
|
|
270
|
-
│ │
|
|
271
|
-
│ Token 消耗统计 │
|
|
272
|
-
│ 昨日消耗: 766.3万 │
|
|
273
|
-
│ 近7天消耗: 1039.9万 │
|
|
274
|
-
│ 当月消耗: 0 │
|
|
275
|
-
│ │
|
|
276
|
-
│ 所有模型额度 │
|
|
277
|
-
│ general 33% — OK │
|
|
278
|
-
│ video 0% 0/3 OK │
|
|
279
|
-
│ ... │
|
|
280
|
-
│ │
|
|
281
|
-
│ 状态: 正常使用 │
|
|
282
|
-
└──────────────────────────────────────────────────────┘
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
> 自 1.2.2 起:移除"当前模型"和"时间窗口"行(冗余信息),去除 emoji(`📊` `📋` `✓` `⚡` `⛔`),`total=0` 时不显示 `(X/Y)` 段。
|
|
286
|
-
|
|
287
|
-
### 紧凑模式
|
|
288
|
-
|
|
289
|
-
```
|
|
290
|
-
general 33% 3h17m W 5% 剩291天
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
> 紧凑模式直接调用 `minimax status --compact`。字段顺序:`已用% 倒计时 周限额% 剩N天`。
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### 持续状态栏模式
|
|
297
|
-
|
|
298
|
-
```
|
|
299
|
-
OK MiniMax 状态栏已启动
|
|
300
|
-
按 Ctrl+C 退出
|
|
301
|
-
|
|
302
|
-
[general 27% 1h26m W 5%
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
## 截图演示
|
|
306
|
-
|
|
307
|
-
### Claude Code 集成
|
|
308
|
-
|
|
309
|
-

|
|
310
|
-
|
|
311
|
-
### Droid 集成
|
|
312
|
-
|
|
313
|
-

|
|
314
|
-
|
|
315
|
-
## 命令说明
|
|
316
|
-
|
|
317
|
-
| 命令 | 描述 | 示例 |
|
|
318
|
-
| --------------------- | ------------------------------------------- | ----------------------------- |
|
|
319
|
-
| `minimax auth` | 设置认证凭据(只需要 token,不需要 groupId) | `minimax auth <token>` |
|
|
320
|
-
| `minimax status` | 显示当前使用状态(支持 --compact、--watch) | `minimax status` |
|
|
321
|
-
| `minimax list` | 列出所有模型用量 | `minimax list` |
|
|
322
|
-
| `minimax health` | 检查配置和连接状态 | `minimax health` |
|
|
323
|
-
| `minimax bar` | 终端底部持续状态栏 | `minimax bar` |
|
|
324
|
-
| `minimax statusline` | Claude Code 状态栏集成 | 用于 Claude Code 配置 |
|
|
325
|
-
| `minimax droid-statusline` | Droid 状态栏集成 | 用于 Droid 配置 |
|
|
326
|
-
|
|
327
|
-
## 状态说明
|
|
328
|
-
|
|
329
|
-
### 显示元素
|
|
330
|
-
|
|
331
|
-
| 元素 | 说明 |
|
|
332
|
-
| ------ | ---------------------------------- |
|
|
333
|
-
| 目录 | 当前工作目录 |
|
|
334
|
-
| 分支 | Git 分支名称(含未提交状态) |
|
|
335
|
-
| 模型 | MiniMax 模型名称(实时) |
|
|
336
|
-
| 上下文 | 上下文窗口使用 % + tokens |
|
|
337
|
-
| 5h 限额 | 5h 限额使用 %(即使 total=0 也显示)|
|
|
338
|
-
| 周限额 | 周配额使用情况,∞ 表示无限制 |
|
|
339
|
-
| 倒计时 | 5h 限额重置倒计时 |
|
|
340
|
-
| 到期 | 订阅到期时间(颜色动态变化) |
|
|
341
|
-
|
|
342
|
-
### 颜色规则
|
|
343
|
-
|
|
344
|
-
| 场景 | 颜色 | 说明 |
|
|
345
|
-
| ------------- | ---- | -------- |
|
|
346
|
-
| 5h 限额 ≥85% | 红色 | 危险状态 |
|
|
347
|
-
| 5h 限额 60-85% | 黄色 | 注意使用 |
|
|
348
|
-
| 5h 限额 <60% | 绿色 | 正常使用 |
|
|
349
|
-
| 上下文 ≥85% | 红色 | 危险状态 |
|
|
350
|
-
| 上下文 60-85% | 黄色 | 注意使用 |
|
|
351
|
-
| 上下文 <60% | 绿色 | 正常使用 |
|
|
352
|
-
| 到期 ≤ 3天 | 红色 | 即将到期 |
|
|
353
|
-
| 到期 ≤ 7天 | 黄色 | 即将到期 |
|
|
354
|
-
| 到期 > 7天 | 绿色 | 订阅正常 |
|
|
355
|
-
|
|
356
|
-
## VSCode 扩展说明
|
|
357
|
-
|
|
358
|
-
自 1.4.0 起,VSCode 扩展 Tooltip 改用**套餐卡**布局(跟官网 platform.minimaxi.com/console/usage 一致),不再用统一表格。
|
|
359
|
-
|
|
360
|
-
### 套餐卡布局
|
|
361
|
-
|
|
362
|
-
每张套餐独立卡片:
|
|
363
|
-
|
|
364
|
-
```
|
|
365
|
-
MINIMAX · 配额面板 周期: 2026-06-01 — 2026-06-07
|
|
366
|
-
─────────────────────────────────────────
|
|
367
|
-
|
|
368
|
-
▍ 5h 限额 · 4h 12m 后重置
|
|
369
|
-
▰▰▰░░░░░░░░░░░░░ 18%
|
|
370
|
-
|
|
371
|
-
▍ 周限额 · 6天 12h 后重置
|
|
372
|
-
▰░░░░░░░░░░░░░░░ 3%
|
|
373
|
-
|
|
374
|
-
▍ 视频赠送 · 13h 18m 后重置
|
|
375
|
-
░░░░░░░░░░░░░░░░ 0% 0/3
|
|
376
|
-
|
|
377
|
-
─────────────────────────────────────────
|
|
378
|
-
Token 消耗
|
|
379
|
-
昨日消耗 近 7 天 当月消耗
|
|
380
|
-
766.3万 1039.9万 0
|
|
381
|
-
─────────────────────────────────────────
|
|
382
|
-
到期 291天 · 更新于 11:09:40 · 点击刷新
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
> **进度条字符** `▰` `▱` (U+25B0 / U+25B1):在中文 fallback 字体(Microsoft YaHei)下渲染为斜方块纹理。在 Cascadia Code / Consolas 等宽字体下渲染为实心方块。
|
|
386
|
-
|
|
387
|
-
### 套餐卡字段
|
|
388
|
-
|
|
389
|
-
| 套餐 | 数据来源 | 示例 |
|
|
390
|
-
|------|----------|------|
|
|
391
|
-
| 5h 限额 | `general` 模型 `current_interval_*` | `▰▰▰░░░ 18%` |
|
|
392
|
-
| 周限额 | `general` 模型 `current_weekly_*` | `▰░░░░░ 3%` |
|
|
393
|
-
| 视频赠送 | `video` 模型 `current_interval_*` | `░░░░░░ 0% 0/3` |
|
|
394
|
-
| Hailuo | `Hailuo-*` 模型 | `▰▰░░░░░ 33% 1/3` |
|
|
395
|
-
| music | `music-*` 模型 | `░░░░░░ 0% 0/10` |
|
|
396
|
-
| image | `image-*` 模型 | `░░░░░░ 0% 0/20` |
|
|
397
|
-
| speech | `speech-*` 模型 | `░░░░░░ 0% 0/100` |
|
|
398
|
-
|
|
399
|
-
> **多模型数据过滤规则**:保留有 `remaining_percent` 数据的模型(即使 `total=0`)。`status != 1` 的模型视为废弃,不显示。
|
|
400
|
-
|
|
401
|
-
### 已知限制:积分余额不在 VSCode 中显示
|
|
402
|
-
|
|
403
|
-
MiniMax 官方积分余额接口(`/backend/account/token_plan_credit`)**仅支持 Cookie 鉴权**:
|
|
404
|
-
|
|
405
|
-
- ✅ 浏览器(带 Cookie):能调通
|
|
406
|
-
- ❌ VSCode 扩展(纯后端 Bearer sk-cp-...):401 not login
|
|
407
|
-
|
|
408
|
-
如需查看积分余额,请前往 [platform.minimaxi.com/console/usage](https://platform.minimaxi.com/console/usage)。本工具**未实现**积分余额的本地展示,**因为**让用户在 VSCode 设置里手动粘贴 Cookie 字符串得不偿失。
|
|
409
|
-
|
|
410
|
-
## 配置文件
|
|
411
|
-
|
|
412
|
-
### 默认位置
|
|
413
|
-
|
|
414
|
-
- 独立配置文件: `~/.minimax-config.json`
|
|
415
|
-
|
|
416
|
-
### 配置示例
|
|
417
|
-
|
|
418
|
-
```json
|
|
419
|
-
{
|
|
420
|
-
"token": "your_access_token_here"
|
|
421
|
-
}
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Claude Code 配置
|
|
425
|
-
|
|
426
|
-
Claude Code 只需要配置状态栏命令:
|
|
427
|
-
|
|
428
|
-
```json
|
|
429
|
-
// ~/.claude/settings.json
|
|
430
|
-
{
|
|
431
|
-
"statusLine": {
|
|
432
|
-
"type": "command",
|
|
433
|
-
"command": "minimax statusline"
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### 安全说明
|
|
439
|
-
|
|
440
|
-
凭据仅存储在本地,不会上传到任何服务器。
|
|
441
|
-
|
|
442
|
-
## 故障排除
|
|
443
|
-
|
|
444
|
-
### 命令未找到
|
|
445
|
-
|
|
446
|
-
```bash
|
|
447
|
-
# 确保已全局安装
|
|
448
|
-
npm install -g minimax-status
|
|
449
|
-
|
|
450
|
-
# 重新打开终端
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### 认证失败
|
|
454
|
-
|
|
455
|
-
```bash
|
|
456
|
-
# 检查令牌
|
|
457
|
-
minimax status
|
|
458
|
-
|
|
459
|
-
# 重新设置认证
|
|
460
|
-
minimax auth <new_token>
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### 状态栏不显示
|
|
464
|
-
|
|
465
|
-
1. 检查 Claude Code 配置
|
|
466
|
-
2. 重启 Claude Code
|
|
467
|
-
3. 手动测试: `minimax statusline`
|
|
468
|
-
|
|
469
|
-
## 开发
|
|
470
|
-
|
|
471
|
-
### 构建项目
|
|
472
|
-
|
|
473
|
-
```bash
|
|
474
|
-
git clone <repository>
|
|
475
|
-
cd minimax-status
|
|
476
|
-
npm install
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
### 测试
|
|
480
|
-
|
|
481
|
-
```bash
|
|
482
|
-
# 运行示例
|
|
483
|
-
node cli/example.js
|
|
484
|
-
|
|
485
|
-
# 测试 CLI 命令
|
|
486
|
-
node cli/index.js status
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
## 许可证
|
|
490
|
-
|
|
491
|
-
MIT License - 详见 [LICENSE](LICENSE) 文件
|
|
492
|
-
|
|
493
|
-
## 贡献
|
|
494
|
-
|
|
495
|
-
欢迎提交 Issue 和 Pull Request!
|
|
496
|
-
|
|
497
|
-
## 导航
|
|
498
|
-
|
|
499
|
-
| 客户端 | 路径 | 说明 |
|
|
500
|
-
|--------|------|------|
|
|
501
|
-
| **CLI** | [`cli/`](cli/) | 命令行工具,npm 全局包 |
|
|
502
|
-
| **VSCode** | [`vscode-extension/`](vscode-extension/) | VSCode 状态栏集成 |
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
## 相关链接
|
|
507
|
-
|
|
508
|
-
- [MiniMax 开放平台](https://platform.minimaxi.com/)
|
|
509
|
-
|
|
510
|
-
---
|
|
511
|
-
|
|
512
|
-
**注意**: 本工具仅用于监控 MiniMax Token-Plan 用量使用状态,不存储或传输任何用户数据。
|
|
1
|
+
# MiniMax StatusBar
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/minimax-status)
|
|
4
|
+
[](https://www.npmjs.com/package/minimax-status)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode)
|
|
7
|
+
|
|
8
|
+
MiniMax Token-Plan 用量监控工具,支持 CLI 和 Claude Code / Droid 状态栏集成。
|
|
9
|
+
|
|
10
|
+
## 版本
|
|
11
|
+
|
|
12
|
+
| 插件 | 版本 | 安装方式 |
|
|
13
|
+
|------------|-------|------------------------------------------------------------------------------------------------------------|
|
|
14
|
+
| **CLI** | 1.2.5 | `npm install -g minimax-status` |
|
|
15
|
+
| **VSCode** | 1.5.0 | [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode) |
|
|
16
|
+
|
|
17
|
+
## 特性
|
|
18
|
+
|
|
19
|
+
- ✅ **套餐卡显示**(VSCode Tooltip)— 5h 限额 / 周限额 / 视频赠送 / Hailuo / music / image / speech 各自独立卡片,跟官网 platform.minimaxi.com/console/usage 一致
|
|
20
|
+
- ✅ **剩余%语义**(VSCode 1.5.0+ / CLI 1.2.5+)— 所有显示都按"剩余%",避免歧义(剩得多绿、剩得少红)
|
|
21
|
+
- ✅ **Claude Code / Droid 集成** — 状态栏实时显示用量,powerline 风格
|
|
22
|
+
- ✅ **CLI 多种模式** — 详细 / 紧凑 / 持续监控
|
|
23
|
+
- ✅ **上下文窗口跟踪** — Claude Code 实时上下文用量
|
|
24
|
+
- ✅ **Token 消耗统计** — 昨日 / 近 7 天 / 当月
|
|
25
|
+
|
|
26
|
+
> 自 VSCode 1.5.0 / CLI 1.2.5 起,所有用量数据按"剩余%"显示,跟 MiniMax 官方 platform.minimaxi.com/console/usage 平台一致。
|
|
27
|
+
|
|
28
|
+
## 快速开始
|
|
29
|
+
|
|
30
|
+
### 1. 安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g minimax-status
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. 更新(已安装用户)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm update -g minimax-status
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. 配置认证
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
minimax auth <token>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
配置信息保存在 `~/.minimax-config.json`。自 1.2.6 起 CLI 不需要 GroupId(用量接口从 token JWT 自动解析)。
|
|
49
|
+
|
|
50
|
+
获取令牌:访问 [MiniMax 开放平台](https://platform.minimaxi.com/console/plan) → 套餐详情 → 创建或获取复制 API Key。
|
|
51
|
+
|
|
52
|
+
### 4. 查看状态
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
minimax status # 详细模式
|
|
56
|
+
minimax status --compact # 紧凑模式
|
|
57
|
+
minimax status --watch # 持续监控
|
|
58
|
+
minimax list # 所有模型
|
|
59
|
+
minimax health # 配置和连接检查
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Claude Code 集成
|
|
63
|
+
|
|
64
|
+
编辑 `~/.claude/settings.json`:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"statusLine": {
|
|
69
|
+
"type": "command",
|
|
70
|
+
"command": "minimax statusline"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
重启 Claude Code 后,状态栏会显示:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
cli main * MiniMax-M3[1M] 25% · 249.5k 5h 41% · W 94% 2h59m 剩291天
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
字段说明:
|
|
82
|
+
|
|
83
|
+
| 字段 | 示例 | 含义 |
|
|
84
|
+
|--------------------|-------------------------------------|-----------------------------------------------------------|
|
|
85
|
+
| 目录 / 分支 / 模型 | `cli` / `main *` / `MiniMax-M3[1M]` | 工作目录 / Git 分支 / 实时模型 |
|
|
86
|
+
| 上下文 | `25% · 249.5k` | 当前会话上下文使用 % + token 数 |
|
|
87
|
+
| 5h 剩余 | `5h 41% · W 94%` | 5h 限额剩余 % + 周限额剩余 %(绿色 = 充裕,红色 = 即将用完) |
|
|
88
|
+
| 倒计时 | `2h59m` | 5h 限额重置倒计时 |
|
|
89
|
+
| 到期 | `剩291天` | 套餐到期剩余天数 |
|
|
90
|
+
|
|
91
|
+
## Droid 集成
|
|
92
|
+
|
|
93
|
+
跟 Claude Code 一样,编辑 `~/.factory/settings.json`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"statusLine": {
|
|
98
|
+
"type": "command",
|
|
99
|
+
"command": "minimax droid-statusline"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## VSCode 扩展
|
|
105
|
+
|
|
106
|
+
### 安装
|
|
107
|
+
|
|
108
|
+
- 扩展市场搜索 "MiniMax Status" 一键安装
|
|
109
|
+
- 或下载 `.vsix`:[GitHub Releases](https://github.com/JochenYang/minimax-status/releases)
|
|
110
|
+
|
|
111
|
+
### Tooltip 套餐卡布局
|
|
112
|
+
|
|
113
|
+
VSCode 扩展 hover 时显示套餐卡(每套餐独立卡片):
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
MINIMAX · 配额面板 周期: 2026-06-01 — 2026-06-07
|
|
117
|
+
|
|
118
|
+
▍ 5h 剩余 · 4h 12m 后重置
|
|
119
|
+
▰▰▰░░░░░░░░░░░░░ 18%
|
|
120
|
+
|
|
121
|
+
▍ 周剩余 · 6天 12h 后重置
|
|
122
|
+
▰░░░░░░░░░░░░░░░ 94%
|
|
123
|
+
|
|
124
|
+
▍ 视频赠送 · 13h 18m 后重置
|
|
125
|
+
░░░░░░░░░░░░░░░░ 100% 3/3 剩余
|
|
126
|
+
|
|
127
|
+
─────────
|
|
128
|
+
Token 消耗
|
|
129
|
+
昨日消耗 近 7 天 当月消耗
|
|
130
|
+
766.3万 1039.9万 0
|
|
131
|
+
─────────
|
|
132
|
+
到期 291天 · 更新于 11:09:40 · 点击刷新
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
字段说明:
|
|
136
|
+
|
|
137
|
+
- **套餐标签**(行 1):套餐名 + `X/Y 剩余`(总配额和剩余次数)+ 重置时间
|
|
138
|
+
- **进度条 + 百分比**(行 2):按"剩余%"显示(剩 ≥60% 绿、剩 30-60% 橙、剩 <30% 红)
|
|
139
|
+
- 套餐类型:5h 限额 / 周限额 / 视频赠送 / Hailuo / music / image / speech
|
|
140
|
+
|
|
141
|
+
### VSCode 状态栏
|
|
142
|
+
|
|
143
|
+
`5h 5% · 周剩 94% · 剩291天` — 5h 已用% + 周剩余% + 套餐到期天数。
|
|
144
|
+
|
|
145
|
+
## CLI 显示示例
|
|
146
|
+
|
|
147
|
+
### 详细模式
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
┌──────────────────────────────────────────────────────┐
|
|
151
|
+
│ MiniMax Claude Code 使用状态 │
|
|
152
|
+
│ │
|
|
153
|
+
│ 剩余时间: 4 小时 48 分钟后重置 │
|
|
154
|
+
│ │
|
|
155
|
+
│ 5h 剩余: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 97% │
|
|
156
|
+
│ │
|
|
157
|
+
│ 周剩余: ░░░░░░░░░░░░░░░ 100% · 5天 23小时后重置 │
|
|
158
|
+
│ │
|
|
159
|
+
│ 套餐到期: 03/19/2027 (还剩 290 天) │
|
|
160
|
+
│ │
|
|
161
|
+
│ Token 消耗统计 │
|
|
162
|
+
│ 昨日消耗: 0 │
|
|
163
|
+
│ 近7天消耗: 1039.9万 │
|
|
164
|
+
│ 当月消耗: 0 │
|
|
165
|
+
│ │
|
|
166
|
+
│ 所有模型额度 │
|
|
167
|
+
│ general 98% — OK │
|
|
168
|
+
│ video 100% 3/3 OK │
|
|
169
|
+
│ │
|
|
170
|
+
│ 状态: 正常使用 │
|
|
171
|
+
└──────────────────────────────────────────────────────┘
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- 5h 限额 / 周限额 全部按"剩余%"显示(跟平台官网一致)
|
|
175
|
+
- 视频赠送等小额度套餐:`3/3 剩余`(剩余 3 / 总额 3)
|
|
176
|
+
|
|
177
|
+
### 紧凑模式
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
general 98% 4h48m W 100% 剩290天
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 持续监控
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
OK MiniMax 状态栏已启动
|
|
187
|
+
按 Ctrl+C 退出
|
|
188
|
+
|
|
189
|
+
general 27% 1h26m W 5%
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 命令说明
|
|
193
|
+
|
|
194
|
+
| 命令 | 描述 |
|
|
195
|
+
|----------------------------|------------------------------------------------|
|
|
196
|
+
| `minimax auth <token>` | 设置认证凭据(只需要 token) |
|
|
197
|
+
| `minimax status` | 显示详细使用状态(支持 `--compact` / `--watch`) |
|
|
198
|
+
| `minimax list` | 列出所有模型用量 |
|
|
199
|
+
| `minimax health` | 检查配置和连接(配置文件、Token、API 连接) |
|
|
200
|
+
| `minimax bar` | 终端底部持续状态栏 |
|
|
201
|
+
| `minimax statusline` | Claude Code 状态栏集成 |
|
|
202
|
+
| `minimax droid-statusline` | Droid 状态栏集成 |
|
|
203
|
+
|
|
204
|
+
## 颜色规则
|
|
205
|
+
|
|
206
|
+
CLI 端按"剩余%"判断颜色(剩 ≥60% 绿、剩 30-60% 橙、剩 <30% 红),跟 platform.minimaxi.com/console/usage 平台一致。
|
|
207
|
+
|
|
208
|
+
VSCode 状态栏按"已用%"判断(已用 <60% 绿、<85% 橙、≥85% 红),符合"用得少=充裕"直觉。
|
|
209
|
+
|
|
210
|
+
## 已知限制
|
|
211
|
+
|
|
212
|
+
**积分余额(充值/赠送)**不在本工具中显示。MiniMax 官方积分接口(`/backend/account/token_plan_credit`)仅支持 Cookie 鉴权,纯后端工具(VSCode 扩展 / CLI)无法调用。如需查看请前往 [platform.minimaxi.com](https://platform.minimaxi.com/console/usage)。
|
|
213
|
+
|
|
214
|
+
## 故障排除
|
|
215
|
+
|
|
216
|
+
**状态栏不显示**:检查 Claude Code / Droid 配置 → 重启 → 手动测试 `minimax statusline`
|
|
217
|
+
|
|
218
|
+
**认证失败**:`minimax status` 看错误信息 → `minimax auth <new_token>` 重新设置
|
|
219
|
+
|
|
220
|
+
**命令未找到**:`npm install -g minimax-status` 重装
|
|
221
|
+
|
|
222
|
+
## 许可证
|
|
223
|
+
|
|
224
|
+
MIT - 详见 [LICENSE](LICENSE) 文件
|
package/cli/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
## [1.2.5] - 2026-06-01
|
|
4
|
+
|
|
5
|
+
### 优化
|
|
6
|
+
|
|
7
|
+
- **CLI 状态显示统一为"剩余"语义**(跟平台官网 platform.minimaxi.com/console/usage 对齐):
|
|
8
|
+
- 5h 限额 / 周限额 字段全部按"剩余%"显示,跟平台官网一致
|
|
9
|
+
- 主面板"已用额度"标签改为"5h 剩余","周限额"改为"周剩余"
|
|
10
|
+
- 视频赠送等小额度套餐副文本显示"X/Y 剩余"(之前显示"已用/总额",**反**了)
|
|
11
|
+
- 状态颜色按"剩余%"映射:剩 ≥60% 绿 / 剩 <60% 橙 / 剩 <30% 红
|
|
12
|
+
- **进度条按"已用%"填充**(剩得多→填得少),颜色按"剩余%"判断
|
|
13
|
+
- 之前 1.2.2 改动错误地按"已用%"显示(`100 - remaining_percent`),这次**纠正字段语义**直接用 `remaining_percent`
|
|
14
|
+
|
|
15
|
+
## [1.2.4] - 2026-05-31
|
|
16
|
+
|
|
17
|
+
### 修复
|
|
18
|
+
|
|
19
|
+
- `minimax health` 移除 GroupID 字段检查(避免 1.2.6 后 GroupId 不再需要但仍报错"未配置"假阳性)
|
package/cli/api.js
CHANGED
|
@@ -297,32 +297,39 @@ class MinimaxAPI {
|
|
|
297
297
|
const endTime = new Date(modelData.end_time);
|
|
298
298
|
|
|
299
299
|
// Calculate counts
|
|
300
|
-
// ⚠
|
|
301
|
-
//
|
|
302
|
-
//
|
|
300
|
+
// ⚠ 1.2.5 字段语义修正:跟 vscode 1.2.5 对齐,`*_remaining_percent` 字面就是"剩余%"。
|
|
301
|
+
// 直接用 `remaining_percent` 当"剩余%"显示,不再反转算"已用%"。
|
|
302
|
+
// 进度条颜色按"剩余%"映射(剩 ≥60% 绿、30-60% 黄、<30% 红)。
|
|
303
|
+
// 副文本 "X/Y 剩余" 基于 `total × (remainingPercent/100)` 算剩余次数。
|
|
303
304
|
const totalCount = modelData.current_interval_total_count;
|
|
304
305
|
const remainingPct = modelData.current_interval_remaining_percent;
|
|
305
|
-
const
|
|
306
|
-
? Math.round(
|
|
307
|
-
:
|
|
308
|
-
|
|
309
|
-
const remainingCount = totalCount
|
|
306
|
+
const percentage = remainingPct !== undefined && remainingPct !== null
|
|
307
|
+
? Math.round(remainingPct)
|
|
308
|
+
: null;
|
|
309
|
+
// 剩余次数 = total × (remainingPercent / 100)
|
|
310
|
+
const remainingCount = (totalCount > 0 && percentage !== null)
|
|
311
|
+
? Math.round((totalCount * percentage) / 100)
|
|
312
|
+
: 0;
|
|
313
|
+
// 保留 usedCount 字段名(向后兼容),但语义是"剩余次数"
|
|
314
|
+
const usedCount = remainingCount;
|
|
310
315
|
|
|
311
316
|
// Calculate remaining time in human-readable format
|
|
312
317
|
const remainingMs = modelData.remains_time;
|
|
313
318
|
const hours = Math.floor(remainingMs / (1000 * 60 * 60));
|
|
314
319
|
const minutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60));
|
|
315
320
|
|
|
316
|
-
// Calculate weekly usage data —
|
|
317
|
-
const weeklyUsed = modelData.current_weekly_usage_count;
|
|
321
|
+
// Calculate weekly usage data — 同样直接用 remaining_percent 字面
|
|
318
322
|
const weeklyTotal = modelData.current_weekly_total_count;
|
|
319
323
|
const weeklyRemainingPct = modelData.current_weekly_remaining_percent;
|
|
320
324
|
const weeklyPercentage = weeklyRemainingPct !== undefined && weeklyRemainingPct !== null
|
|
321
|
-
? Math.round(
|
|
322
|
-
:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
325
|
+
? Math.round(weeklyRemainingPct)
|
|
326
|
+
: null;
|
|
327
|
+
const weeklyRemainingCount = (weeklyTotal > 0 && weeklyPercentage !== null)
|
|
328
|
+
? Math.round((weeklyTotal * weeklyPercentage) / 100)
|
|
329
|
+
: 0;
|
|
330
|
+
// 字段名保留 weeklyUsed,但语义是"剩余次数"
|
|
331
|
+
const weeklyUsed = weeklyRemainingCount;
|
|
332
|
+
// ⚠ "无周限"判定:周总额=0 **且** remaining_percent 也没返回(极少见)
|
|
326
333
|
const weeklyUnlimited = weeklyTotal === 0 && (modelData.current_weekly_remaining_percent == null);
|
|
327
334
|
const weeklyRemainingMs = modelData.weekly_remains_time;
|
|
328
335
|
const weeklyDays = Math.floor(weeklyRemainingMs / (1000 * 60 * 60 * 24));
|
|
@@ -394,15 +401,17 @@ class MinimaxAPI {
|
|
|
394
401
|
: `${minutes} 分钟后重置`,
|
|
395
402
|
},
|
|
396
403
|
usage: {
|
|
397
|
-
|
|
404
|
+
// ⚠ 1.2.5 字段语义修正:`usage.percentage` 现在是"剩余%"(不是"已用%")
|
|
405
|
+
used: usedCount, // 字段名保留(向后兼容),语义是"剩余次数"
|
|
398
406
|
remaining: remainingCount,
|
|
399
407
|
total: modelData.current_interval_total_count,
|
|
400
|
-
percentage:
|
|
408
|
+
percentage: percentage, // "剩余%"(100-remaining_percent 反转算的)
|
|
401
409
|
},
|
|
402
410
|
weekly: {
|
|
403
|
-
|
|
411
|
+
// ⚠ 1.2.5 字段语义修正:`weekly.percentage` 现在是"剩余%"
|
|
412
|
+
used: weeklyUsed, // 字段名保留(向后兼容),语义是"剩余次数"
|
|
404
413
|
total: weeklyTotal,
|
|
405
|
-
percentage: weeklyPercentage,
|
|
414
|
+
percentage: weeklyPercentage, // "剩余%"
|
|
406
415
|
days: weeklyDays,
|
|
407
416
|
hours: weeklyHours,
|
|
408
417
|
unlimited: weeklyUnlimited,
|
|
@@ -426,35 +435,43 @@ class MinimaxAPI {
|
|
|
426
435
|
}
|
|
427
436
|
|
|
428
437
|
return apiData.model_remains.map(modelData => {
|
|
438
|
+
// ⚠ 1.2.5 字段语义修正:`percentage` 现在是"剩余%"(直接用 `remaining_percent`,不反转)
|
|
429
439
|
const totalCount = modelData.current_interval_total_count;
|
|
430
|
-
// ⚠ 新接口 usage_count 在 video 上语义不一致;用 usedPercentage 反算 used
|
|
431
|
-
// 跟官网一致:video total=3, used%=0 → used=0, remaining=3("3/3 剩余")
|
|
432
440
|
const remainingPct = modelData.current_interval_remaining_percent;
|
|
433
|
-
const
|
|
434
|
-
? Math.round(
|
|
435
|
-
:
|
|
436
|
-
|
|
437
|
-
const remainingCount = totalCount
|
|
438
|
-
|
|
439
|
-
|
|
441
|
+
const percentage = remainingPct !== undefined && remainingPct !== null
|
|
442
|
+
? Math.round(remainingPct)
|
|
443
|
+
: null;
|
|
444
|
+
// 剩余次数 = total × (remainingPercent / 100)
|
|
445
|
+
const remainingCount = (totalCount > 0 && percentage !== null)
|
|
446
|
+
? Math.round((totalCount * percentage) / 100)
|
|
447
|
+
: 0;
|
|
448
|
+
// 保留 used 字段名(向后兼容),但语义是"剩余次数"
|
|
449
|
+
const usedCount = remainingCount;
|
|
450
|
+
|
|
451
|
+
// Weekly data — 同样直接用 remaining_percent 字面(不反转)
|
|
440
452
|
const weeklyTotal = modelData.current_weekly_total_count || 0;
|
|
441
|
-
const weeklyUsed = modelData.current_weekly_usage_count || 0;
|
|
442
|
-
const weeklyRemainingCount = weeklyTotal - weeklyUsed;
|
|
443
453
|
const weeklyRemainingPct = modelData.current_weekly_remaining_percent;
|
|
444
454
|
const weeklyPercentage = weeklyRemainingPct !== undefined && weeklyRemainingPct !== null
|
|
445
|
-
? Math.round(
|
|
446
|
-
:
|
|
455
|
+
? Math.round(weeklyRemainingPct)
|
|
456
|
+
: null;
|
|
457
|
+
// 剩余次数 = weeklyTotal × (remainingPercent / 100)
|
|
458
|
+
const weeklyRemainingCount = (weeklyTotal > 0 && weeklyPercentage !== null)
|
|
459
|
+
? Math.round((weeklyTotal * weeklyPercentage) / 100)
|
|
460
|
+
: 0;
|
|
461
|
+
// 字段名保留 weeklyUsed,但语义是"剩余次数"
|
|
462
|
+
const weeklyUsed = weeklyRemainingCount;
|
|
447
463
|
// Bug fix: 同 parseUsageData — 真正"无限"是 total=0 且 remaining_percent 也没
|
|
448
464
|
const weeklyUnlimited = weeklyTotal === 0 && (modelData.current_weekly_remaining_percent == null);
|
|
449
465
|
|
|
450
466
|
return {
|
|
451
467
|
name: modelData.model_name,
|
|
452
|
-
|
|
468
|
+
// ⚠ 1.2.5 字段语义修正:`percentage` 现在是"剩余%"
|
|
469
|
+
used: usedCount, // 字段名保留(向后兼容),语义是"剩余次数"
|
|
453
470
|
remaining: remainingCount,
|
|
454
471
|
total: totalCount,
|
|
455
|
-
percentage:
|
|
472
|
+
percentage: percentage, // "剩余%"
|
|
456
473
|
unlimited: weeklyUnlimited,
|
|
457
|
-
weeklyPercentage,
|
|
474
|
+
weeklyPercentage, // "剩余%"
|
|
458
475
|
weeklyTotal,
|
|
459
476
|
weeklyRemainingCount,
|
|
460
477
|
};
|
package/cli/renderer.js
CHANGED
|
@@ -101,20 +101,22 @@ class Renderer {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// 5h 限额 block — 总是显示(即使 total=0 也要显示百分比 + 5h 前缀)
|
|
104
|
-
// ⚠
|
|
104
|
+
// ⚠ 1.2.5 字段语义修正:`usage.percentage` 现在是"剩余%"(不是"已用%")
|
|
105
|
+
// 颜色按"剩余%"映射:剩 <30% 红 / 剩 <60% 橙 / 剩 ≥60% 绿
|
|
105
106
|
if (usage && usage.percentage !== undefined && usage.percentage !== null) {
|
|
106
107
|
let bg = '#065F46'; // safe (Emerald 800 - dark enough for white text)
|
|
107
|
-
if (
|
|
108
|
-
else if (
|
|
108
|
+
if (usage.percentage < 30) bg = '#991B1B'; // danger (Red 800)
|
|
109
|
+
else if (usage.percentage < 60) bg = '#9A3412'; // warn (Orange 800)
|
|
109
110
|
|
|
110
111
|
// total=0 时不显示 (X/Y) 段
|
|
111
112
|
const usedTotalSuffix = usage.total > 0 ? ` (${usage.remaining}/${usage.total})` : '';
|
|
112
|
-
let usageText = ` 5h ${
|
|
113
|
+
let usageText = ` 5h ${usage.percentage}%${usedTotalSuffix} `;
|
|
113
114
|
|
|
114
115
|
if (weekly) {
|
|
115
116
|
if (weekly.unlimited) {
|
|
116
117
|
usageText += `· W ∞ `;
|
|
117
118
|
} else {
|
|
119
|
+
// 1.2.5:`weekly.percentage` 现在是"剩余%"
|
|
118
120
|
usageText += `· W ${weekly.percentage}% `;
|
|
119
121
|
}
|
|
120
122
|
}
|
package/cli/status.js
CHANGED
|
@@ -77,17 +77,18 @@ class StatusBar {
|
|
|
77
77
|
return name.length > 15 ? name.substring(0, 12) + '...' : name;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
//
|
|
80
|
+
// 获取状态颜色(按"剩余%"映射 — 1.2.5)
|
|
81
|
+
// 剩 <30% 红 / 剩 <60% 橙 / 剩 ≥60% 绿
|
|
81
82
|
const getStatusColor = (percentage) => {
|
|
82
|
-
if (percentage
|
|
83
|
-
if (percentage
|
|
83
|
+
if (percentage < 30) return chalk.hex('#EF4444');
|
|
84
|
+
if (percentage < 60) return chalk.hex('#F59E0B');
|
|
84
85
|
return chalk.hex('#10B981');
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
// 显示状态
|
|
88
89
|
const getStatusText = (percentage) => {
|
|
89
|
-
if (percentage
|
|
90
|
-
if (percentage
|
|
90
|
+
if (percentage < 30) return 'X';
|
|
91
|
+
if (percentage < 60) return '!';
|
|
91
92
|
return 'OK';
|
|
92
93
|
};
|
|
93
94
|
|
|
@@ -97,7 +98,7 @@ class StatusBar {
|
|
|
97
98
|
const color = getStatusColor(model.percentage);
|
|
98
99
|
const status = getStatusText(model.percentage);
|
|
99
100
|
const pct = `${model.percentage}%`;
|
|
100
|
-
//
|
|
101
|
+
// 1.2.5:标签"剩余/总额"(语义是"剩余次数/总额")
|
|
101
102
|
const usedTotal = model.total > 0 ? `${model.used}/${model.total}` : '—';
|
|
102
103
|
|
|
103
104
|
lines.push(` ${color(short.padEnd(15))} ${color(pct.padEnd(5))} ${color(usedTotal.padEnd(12))} ${color(status)}`);
|
|
@@ -129,11 +130,15 @@ class StatusBar {
|
|
|
129
130
|
const { modelName, timeWindow, remaining, usage, weekly, expiry } = this.data;
|
|
130
131
|
|
|
131
132
|
// Calculate progress bar width
|
|
133
|
+
// ⚠ 1.2.5 字段语义修正:`usage.percentage` 现在是"剩余%"。进度条按"剩余%"画:
|
|
134
|
+
// filled = (1 - 剩余/100) * width,即"已用%"对应填充。
|
|
132
135
|
const width = 30;
|
|
133
|
-
const
|
|
136
|
+
const usedPct = 100 - usage.percentage;
|
|
137
|
+
const filled = Math.floor((usedPct / 100) * width);
|
|
134
138
|
const empty = width - filled;
|
|
135
139
|
|
|
136
|
-
// Create progress bar with colors based on
|
|
140
|
+
// Create progress bar with colors based on remaining percentage
|
|
141
|
+
// 剩 ≥60% 绿 / 剩 <60% 橙 / 剩 <30% 红
|
|
137
142
|
const progressBar = this.createProgressBar(filled, empty, usage.percentage);
|
|
138
143
|
|
|
139
144
|
// 构建内容行
|
|
@@ -149,8 +154,8 @@ class StatusBar {
|
|
|
149
154
|
|
|
150
155
|
contentLines.push('');
|
|
151
156
|
|
|
152
|
-
//
|
|
153
|
-
contentLines.push(`${chalk.cyan('
|
|
157
|
+
// 5h 剩余百分比与进度条(按"剩余%"语义)
|
|
158
|
+
contentLines.push(`${chalk.cyan('5h 剩余:')} ${progressBar} ${usage.percentage}%`);
|
|
154
159
|
|
|
155
160
|
// 剩余次数(total=0 时不显示)
|
|
156
161
|
if (usage.total > 0) {
|
|
@@ -162,20 +167,24 @@ class StatusBar {
|
|
|
162
167
|
contentLines.push('');
|
|
163
168
|
if (weekly.unlimited) {
|
|
164
169
|
// 不受限制
|
|
165
|
-
contentLines.push(`${chalk.cyan('
|
|
170
|
+
contentLines.push(`${chalk.cyan('周剩余:')} ${chalk.hex('#10B981')('不受限制')}`);
|
|
166
171
|
} else {
|
|
167
172
|
// 有限制,显示具体数据
|
|
168
|
-
|
|
169
|
-
const
|
|
173
|
+
// ⚠ 1.2.5:`weekly.percentage` 现在是"剩余%",颜色按剩余%映射
|
|
174
|
+
const weeklyRemainingPct = weekly.percentage;
|
|
175
|
+
const weeklyColor = weeklyRemainingPct < 30 ? chalk.hex('#EF4444') : weeklyRemainingPct < 60 ? chalk.hex('#F59E0B') : chalk.hex('#10B981');
|
|
176
|
+
// 进度条按"已用%"画(剩得多→填得少)
|
|
177
|
+
const weeklyUsedPct = 100 - weeklyRemainingPct;
|
|
170
178
|
const weeklyProgress = this.createProgressBar(
|
|
171
|
-
Math.floor((
|
|
172
|
-
15 - Math.floor((
|
|
173
|
-
|
|
179
|
+
Math.floor((weeklyUsedPct / 100) * 15),
|
|
180
|
+
15 - Math.floor((weeklyUsedPct / 100) * 15),
|
|
181
|
+
weeklyRemainingPct
|
|
174
182
|
);
|
|
175
|
-
// total=0 时不显示 (X/Y)
|
|
183
|
+
// total=0 时不显示 (X/Y);重置时间作为副文本**同行**(跟 5h 风格一致)
|
|
176
184
|
const weeklyUsedTotal = weekly.total > 0 ? ` (${weekly.used}/${weekly.total})` : '';
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
// 副文本不染色(用默认前景色,跟进度条"未填充"色一致;主人反馈不要灰色)
|
|
186
|
+
const weeklyResetSuffix = ` · ${weekly.text}`;
|
|
187
|
+
contentLines.push(`${chalk.cyan('周剩余:')} ${weeklyColor(weeklyProgress)} ${weeklyColor(weekly.percentage + '%')}${weeklyUsedTotal}${weeklyResetSuffix}`);
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
190
|
|
|
@@ -218,10 +227,11 @@ class StatusBar {
|
|
|
218
227
|
const remainingBar = '░'.repeat(empty);
|
|
219
228
|
const bar = `${usedBar}${remainingBar}`;
|
|
220
229
|
|
|
221
|
-
//
|
|
222
|
-
|
|
230
|
+
// ⚠ 1.2.5 字段语义修正:`percentage` 现在是"剩余%",颜色按"剩余%"映射
|
|
231
|
+
// 剩 <30% 红(即将用完警告)/ 剩 <60% 橙(注意使用)/ 剩 ≥60% 绿(正常使用)
|
|
232
|
+
if (percentage < 30) {
|
|
223
233
|
return chalk.hex('#EF4444')(bar);
|
|
224
|
-
} else if (percentage
|
|
234
|
+
} else if (percentage < 60) {
|
|
225
235
|
return chalk.hex('#F59E0B')(bar);
|
|
226
236
|
} else {
|
|
227
237
|
return chalk.hex('#10B981')(bar);
|
|
@@ -247,10 +257,11 @@ class StatusBar {
|
|
|
247
257
|
}
|
|
248
258
|
|
|
249
259
|
getStatus(percentage) {
|
|
250
|
-
//
|
|
251
|
-
|
|
260
|
+
// ⚠ 1.2.5 字段语义修正:`percentage` 现在是"剩余%",状态按"剩余%"判断
|
|
261
|
+
// 剩 <30% 即将用完 / 剩 <60% 注意使用 / 剩 ≥60% 正常使用
|
|
262
|
+
if (percentage < 30) {
|
|
252
263
|
return '即将用完';
|
|
253
|
-
} else if (percentage
|
|
264
|
+
} else if (percentage < 60) {
|
|
254
265
|
return '注意使用';
|
|
255
266
|
} else {
|
|
256
267
|
return '正常使用';
|
|
@@ -261,11 +272,11 @@ class StatusBar {
|
|
|
261
272
|
const { usage, remaining, modelName, expiry } = this.data;
|
|
262
273
|
const status = this.getStatus(usage.percentage);
|
|
263
274
|
|
|
264
|
-
//
|
|
275
|
+
// ⚠ 1.2.5:颜色按"剩余%"映射(剩 <30 红、剩 <60 橙、剩 ≥60 绿)
|
|
265
276
|
let color;
|
|
266
|
-
if (usage.percentage
|
|
277
|
+
if (usage.percentage < 30) {
|
|
267
278
|
color = chalk.hex('#EF4444');
|
|
268
|
-
} else if (usage.percentage
|
|
279
|
+
} else if (usage.percentage < 60) {
|
|
269
280
|
color = chalk.hex('#F59E0B');
|
|
270
281
|
} else {
|
|
271
282
|
color = chalk.hex('#10B981');
|
package/cli/statusbar.js
CHANGED
|
@@ -11,13 +11,14 @@ class StatusBar {
|
|
|
11
11
|
|
|
12
12
|
render() {
|
|
13
13
|
const { usage, remaining, weekly, expiry } = this.data;
|
|
14
|
+
// ⚠ 1.2.5 字段语义修正:`usage.percentage` 现在是"剩余%"(不是"已用%")
|
|
14
15
|
const percentage = usage.percentage;
|
|
15
16
|
|
|
16
|
-
//
|
|
17
|
+
// 基于"剩余%"判断颜色:剩得多绿、剩得少红
|
|
17
18
|
let color = chalk.green;
|
|
18
|
-
if (percentage
|
|
19
|
+
if (percentage < 30) {
|
|
19
20
|
color = chalk.red;
|
|
20
|
-
} else if (percentage
|
|
21
|
+
} else if (percentage < 60) {
|
|
21
22
|
color = chalk.yellow;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -33,7 +34,8 @@ class StatusBar {
|
|
|
33
34
|
if (weekly.unlimited) {
|
|
34
35
|
weeklyStr = ` ${chalk.blue('W')} ∞`;
|
|
35
36
|
} else {
|
|
36
|
-
|
|
37
|
+
// ⚠ 1.2.5:`weekly.percentage` 现在是"剩余%",颜色按剩余%映射
|
|
38
|
+
const weeklyColor = weekly.percentage < 30 ? chalk.red : weekly.percentage < 60 ? chalk.yellow : chalk.green;
|
|
37
39
|
// total=0 时不显示 (X/Y)
|
|
38
40
|
const weeklySuffix = weekly.total > 0 ? ` (${weekly.used}/${weekly.total})` : '';
|
|
39
41
|
weeklyStr = ` ${chalk.blue('W')} ${weeklyColor(weekly.percentage + '%')}${weeklySuffix}`;
|