minimax-status 1.1.9 → 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
@@ -3,15 +3,21 @@
3
3
  [![npm version](https://img.shields.io/npm/v/minimax-status.svg)](https://www.npmjs.com/package/minimax-status)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/minimax-status.svg)](https://www.npmjs.com/package/minimax-status)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![VSCode Extension Build](https://github.com/JochenYang/minimax-status/actions/workflows/build-vscode-extension.yml/badge.svg)](https://github.com/JochenYang/minimax-status/actions/workflows/build-vscode-extension.yml)
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
- ![MiniMax StatusBar](https://img.shields.io/badge/StatusBar-MiniMax-blue?style=flat-square)
10
+ ## 版本
11
+
12
+ | 插件 | 版本 | 安装方式 |
13
+ |------|------|----------|
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
+ | **OpenClaw** | - | 参考 `openclaw/minimax-usage/` 目录 |
11
17
 
12
18
  ## 特性
13
19
 
14
- - ✅ **实时状态监控**: 显示 MiniMax coding-plan 使用额度、剩余次数、重置时间
20
+ - ✅ **实时状态监控**: 显示 MiniMax Token-Plan 使用额度、剩余次数、重置时间
15
21
  - ✅ **上下文窗口跟踪**: 智能解析转录文件,准确显示当前会话的上下文使用量
16
22
  - ✅ **多种显示模式**: 详细模式、紧凑模式、持续状态栏
17
23
  - ✅ **Claude Code 集成**: 可在 Claude Code 底部状态栏显示
@@ -67,7 +73,12 @@ minimax status --watch
67
73
 
68
74
  ### 安装方式
69
75
 
70
- **方式一:下载 VSIX 文件**
76
+ **方式一:从 VSCode 市场安装(推荐)**
77
+
78
+ 1. 在 VSCode 中搜索 "MiniMax Status"
79
+ 2. 点击安装
80
+
81
+ **方式二:下载 VSIX 文件**
71
82
 
72
83
  1. 访问 [GitHub Releases](https://github.com/JochenYang/minimax-status/releases)
73
84
  2. 下载最新的 `.vsix` 文件
@@ -92,8 +103,6 @@ npm run package
92
103
  3. 输入您的 API Key
93
104
  4. 配置完成后,状态栏将显示实时使用状态
94
105
 
95
- > **注意**: 扩展尚未发布到 VSCode 市场,需要手动安装
96
-
97
106
  ## Claude Code 集成
98
107
 
99
108
  将 MiniMax 使用状态显示在 Claude Code 底部状态栏。
@@ -404,4 +413,4 @@ MIT License - 详见 [LICENSE](LICENSE) 文件
404
413
 
405
414
  ---
406
415
 
407
- **注意**: 本工具仅用于监控 MiniMax coding-plan 用量使用状态,不存储或传输任何用户数据。
416
+ **注意**: 本工具仅用于监控 MiniMax Token-Plan 用量使用状态,不存储或传输任何用户数据。
package/cli/api.js CHANGED
@@ -62,9 +62,9 @@ class MinimaxAPI {
62
62
  }
63
63
 
64
64
  async getUsageStatus(forceRefresh = false) {
65
- if (!this.token || !this.groupId) {
65
+ if (!this.token) {
66
66
  throw new Error(
67
- 'Missing credentials. Please run "minimax-status auth <token> <groupId>" first'
67
+ 'Missing credentials. Please run "minimax-status auth <token>" first'
68
68
  );
69
69
  }
70
70
 
@@ -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/cli/statusbar.js CHANGED
@@ -45,7 +45,7 @@ class TerminalStatusBar {
45
45
 
46
46
  if (!require('fs').existsSync(configPath)) {
47
47
  console.log(chalk.red('错误:未找到配置文件'));
48
- console.log(chalk.yellow('请先运行: minimax-status auth <token> <groupId>'));
48
+ console.log(chalk.yellow('请先运行: minimax-status auth <token>'));
49
49
  process.exit(1);
50
50
  }
51
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimax-status",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "MiniMax Claude Code 使用状态监控工具",
5
5
  "bin": {
6
6
  "minimax-status": "cli/index.js",