minimax-status 1.1.10 → 1.1.11

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 CHANGED
@@ -5,19 +5,19 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![VSCode Extension](https://img.shields.io/badge/VSCode-MiniMax-blue?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode)
7
7
 
8
- MiniMax coding-plan 使用状态监控工具,支持 CLI 命令和 Claude Code 状态栏集成。
8
+ MiniMax Token-Plan 使用状态监控工具,支持 CLI 命令和 Claude Code 状态栏集成。
9
9
 
10
10
  ## 版本
11
11
 
12
12
  | 插件 | 版本 | 安装方式 |
13
13
  |------|------|----------|
14
- | **CLI** | 1.1.9 | `npm install -g minimax-status` |
15
- | **VSCode** | 1.2.6 | [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode) 或 [下载 VSIX](https://github.com/JochenYang/minimax-status/releases) |
14
+ | **CLI** | 1.1.11 | `npm install -g minimax-status` |
15
+ | **VSCode** | 1.2.7 | [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode) 或 [下载 VSIX](https://github.com/JochenYang/minimax-status/releases) |
16
16
  | **OpenClaw** | - | 参考 `openclaw/minimax-usage/` 目录 |
17
17
 
18
18
  ## 特性
19
19
 
20
- - ✅ **实时状态监控**: 显示 MiniMax coding-plan 使用额度、剩余次数、重置时间
20
+ - ✅ **实时状态监控**: 显示 MiniMax Token-Plan 使用额度、剩余次数、重置时间
21
21
  - ✅ **上下文窗口跟踪**: 智能解析转录文件,准确显示当前会话的上下文使用量
22
22
  - ✅ **多种显示模式**: 详细模式、紧凑模式、持续状态栏
23
23
  - ✅ **Claude Code 集成**: 可在 Claude Code 底部状态栏显示
@@ -413,4 +413,4 @@ MIT License - 详见 [LICENSE](LICENSE) 文件
413
413
 
414
414
  ---
415
415
 
416
- **注意**: 本工具仅用于监控 MiniMax coding-plan 用量使用状态,不存储或传输任何用户数据。
416
+ **注意**: 本工具仅用于监控 MiniMax Token-Plan 用量使用状态,不存储或传输任何用户数据。
package/cli/api.js CHANGED
@@ -173,10 +173,11 @@ class MinimaxAPI {
173
173
 
174
174
  /**
175
175
  * Fetch all billing records with pagination
176
- * @param {number} maxPages - Maximum number of pages to fetch
176
+ * @param {number} maxPages - Maximum number of pages to fetch (default 100)
177
+ * @param {number} minStartTime - Optional: stop fetching when records are older than this time (ms)
177
178
  * @returns {Promise<Array>} All billing records
178
179
  */
179
- async getAllBillingRecords(maxPages = 10) {
180
+ async getAllBillingRecords(maxPages = 100, minStartTime = 0) {
180
181
  const allRecords = [];
181
182
 
182
183
  for (let page = 1; page <= maxPages; page++) {
@@ -190,6 +191,15 @@ class MinimaxAPI {
190
191
 
191
192
  allRecords.push(...records);
192
193
 
194
+ // 如果传入了时间范围,检查是否需要继续获取
195
+ if (minStartTime > 0) {
196
+ const lastRecord = records[records.length - 1];
197
+ const lastRecordTime = (lastRecord.created_at || 0) * 1000;
198
+ if (lastRecordTime < minStartTime) {
199
+ break;
200
+ }
201
+ }
202
+
193
203
  if (records.length < 100) {
194
204
  break;
195
205
  }
package/cli/index.js CHANGED
@@ -118,24 +118,12 @@ program
118
118
  // 获取账单数据用于消耗统计
119
119
  let usageStats = null;
120
120
  try {
121
- const billingRecords = await api.getAllBillingRecords(10);
121
+ // 按自然月统计当月消耗
122
+ const now = new Date();
123
+ const monthStart = new Date(now.getFullYear(), now.getMonth(), 1, 0, 0, 0, 0).getTime();
124
+ const billingRecords = await api.getAllBillingRecords(100, monthStart);
122
125
  if (billingRecords.length > 0) {
123
- // 计算套餐开始时间:到期时间往前推1个月
124
- let planStartTime = 0;
125
- if (subscriptionData &&
126
- subscriptionData.current_subscribe &&
127
- subscriptionData.current_subscribe.current_subscribe_end_time) {
128
- const expiryDateStr = subscriptionData.current_subscribe.current_subscribe_end_time;
129
- const [month, day, year] = expiryDateStr.split('/').map(Number);
130
- planStartTime = new Date(year, month - 2, day).getTime();
131
- }
132
-
133
- const now = Date.now();
134
- usageStats = api.calculateUsageStats(
135
- billingRecords,
136
- planStartTime > 0 ? planStartTime : 0,
137
- now
138
- );
126
+ usageStats = api.calculateUsageStats(billingRecords, monthStart, now.getTime());
139
127
  }
140
128
  } catch (billingError) {
141
129
  // 账单数据获取失败不影响主要功能
package/cli/status.js CHANGED
@@ -49,7 +49,7 @@ class StatusBar {
49
49
 
50
50
  lines.push(formatLine('昨日消耗: ', this.usageStats.lastDayUsage));
51
51
  lines.push(formatLine('近7天消耗: ', this.usageStats.weeklyUsage));
52
- lines.push(formatLine('套餐总消耗: ', this.usageStats.planTotalUsage));
52
+ lines.push(formatLine('当月消耗: ', this.usageStats.planTotalUsage));
53
53
 
54
54
  return lines.join('\n');
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimax-status",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "MiniMax Claude Code 使用状态监控工具",
5
5
  "bin": {
6
6
  "minimax-status": "cli/index.js",