minimax-status 1.0.6 → 1.0.7

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/cli/example.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ // 示例数据,展示工具的功能
4
+ const StatusBar = require('./status');
5
+ const chalk = require('chalk');
6
+
7
+ // 模拟 API 数据
8
+ const mockApiData = {
9
+ model_remains: [{
10
+ start_time: 1763863200000, // 10:00 UTC+8
11
+ end_time: 1763881200000, // 15:00 UTC+8
12
+ remains_time: 5160754, // 剩余时间(毫秒)
13
+ current_interval_total_count: 4500, // 总次数
14
+ current_interval_usage_count: 3307, // 已使用次数
15
+ model_name: "MiniMax-M2"
16
+ }],
17
+ base_resp: {
18
+ status_code: 0,
19
+ status_msg: "success"
20
+ }
21
+ };
22
+
23
+ // 模拟 API 类
24
+ class MockAPI {
25
+ parseUsageData(apiData) {
26
+ const modelData = apiData.model_remains[0];
27
+ const startTime = new Date(modelData.start_time);
28
+ const endTime = new Date(modelData.end_time);
29
+
30
+ const remainingMs = modelData.remains_time;
31
+ const hours = Math.floor(remainingMs / (1000 * 60 * 60));
32
+ const minutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60));
33
+
34
+ // Calculate counts
35
+ // 注意:current_interval_usage_count 实际是剩余次数,不是已用次数
36
+ const remainingCount = modelData.current_interval_usage_count;
37
+ const usedCount = modelData.current_interval_total_count - remainingCount;
38
+
39
+ // Calculate percentage - 基于已使用次数的百分比
40
+ const usedPercentage = Math.round((usedCount / modelData.current_interval_total_count) * 100);
41
+
42
+ return {
43
+ modelName: modelData.model_name,
44
+ timeWindow: {
45
+ start: startTime.toLocaleTimeString('zh-CN', {
46
+ hour: '2-digit',
47
+ minute: '2-digit',
48
+ timeZone: 'Asia/Shanghai',
49
+ hour12: false
50
+ }),
51
+ end: endTime.toLocaleTimeString('zh-CN', {
52
+ hour: '2-digit',
53
+ minute: '2-digit',
54
+ timeZone: 'Asia/Shanghai',
55
+ hour12: false
56
+ }),
57
+ timezone: 'UTC+8'
58
+ },
59
+ remaining: {
60
+ hours,
61
+ minutes,
62
+ text: hours > 0 ? `${hours} 小时 ${minutes} 分钟后重置` : `${minutes} 分钟后重置`
63
+ },
64
+ usage: {
65
+ used: remainingCount,
66
+ total: modelData.current_interval_total_count,
67
+ percentage: usedPercentage
68
+ }
69
+ };
70
+ }
71
+ }
72
+
73
+ // 运行示例
74
+ const api = new MockAPI();
75
+ const usageData = api.parseUsageData(mockApiData);
76
+ const statusBar = new StatusBar(usageData);
77
+
78
+ console.log('=== MiniMax Claude Code 状态栏示例 ===\n');
79
+ console.log(statusBar.render());
80
+ console.log('\n=== 紧凑模式示例 ===\n');
81
+ console.log(statusBar.renderCompact());
82
+ console.log('\n');
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "minimax-status",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "MiniMax Claude Code 使用状态监控工具",
5
5
  "bin": {
6
6
  "minimax-status": "cli/index.js",
7
7
  "minimax": "cli/index.js"
8
8
  },
9
+ "files": [
10
+ "cli/",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
9
14
  "scripts": {
10
15
  "test": "echo \"Error: no test specified\" && exit 1"
11
16
  },
@@ -1,58 +0,0 @@
1
- name: Build and Release VSCode Extension
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- paths:
7
- - 'vscode-extension/**'
8
- - '.github/workflows/build-vscode-extension.yml'
9
- workflow_dispatch:
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - name: Checkout code
17
- uses: actions/checkout@v4
18
-
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: '20'
23
- cache: 'npm'
24
- cache-dependency-path: 'vscode-extension/package-lock.json'
25
-
26
- - name: Install dependencies
27
- working-directory: ./vscode-extension
28
- run: npm ci
29
-
30
- # - name: Run tests
31
- # working-directory: ./vscode-extension
32
- # run: npm test
33
- # Note: Tests temporarily disabled due to missing mocha dependency
34
-
35
- - name: Build VSIX
36
- working-directory: ./vscode-extension
37
- run: npx vsce package --allow-missing-repository
38
-
39
- - name: Get version
40
- id: version
41
- working-directory: ./vscode-extension
42
- run: |
43
- VERSION=$(node -p "require('./package.json').version")
44
- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
45
- echo "Version: $VERSION"
46
-
47
- - name: Upload VSIX artifact
48
- uses: actions/upload-artifact@v4
49
- with:
50
- name: minimax-status-vscode-${{ steps.version.outputs.VERSION }}
51
- path: vscode-extension/minimax-status-vscode-${{ steps.version.outputs.VERSION }}.vsix
52
- retention-days: 30
53
-
54
- - name: Display download info
55
- run: |
56
- echo "VSIX file built successfully!"
57
- echo "Download from Actions tab or artifact:"
58
- echo "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
@@ -1,18 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true,
5
- "node": true,
6
- "mocha": true
7
- },
8
- "extends": "eslint:recommended",
9
- "parserOptions": {
10
- "ecmaVersion": "latest",
11
- "sourceType": "module"
12
- },
13
- "globals": {
14
- "suite": "readonly",
15
- "test": "readonly"
16
- },
17
- "rules": {}
18
- }
@@ -1,9 +0,0 @@
1
- .vscode/**
2
- .vscode-test/**
3
- **/*.map
4
- **/*.vsix
5
- test/**
6
- .gitignore
7
- .eslintrc.json
8
- .npmrc
9
- .vsce ignore
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Jochen Yang
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,184 +0,0 @@
1
- # MiniMax Status - VS Code 扩展
2
-
3
- MiniMax coding-plan 使用状态监控 VS Code 扩展,在底部状态栏实时显示你的使用额度。
4
-
5
- ## 功能特性
6
-
7
- - ✅ **实时状态栏显示** - 在 VS Code 底部状态栏显示当前使用状态
8
- - ✅ **多信息展示** - 显示目录、模型、使用率、剩余次数、上下文窗口
9
- - ✅ **智能颜色提示** - 根据使用率自动变色(绿色/黄色/红色)
10
- - ✅ **可配置设置** - 支持自定义刷新间隔和显示选项
11
- - ✅ **悬停提示** - 鼠标悬停查看详细信息
12
-
13
- ## 安装扩展
14
-
15
- ### 方法一:从 VS Code 市场安装(推荐)
16
-
17
- 1. 打开 VS Code
18
- 2. 进入扩展商店(`Ctrl+Shift+X`)
19
- 3. 搜索 "MiniMax Status"
20
- 4. 点击安装
21
-
22
- ### 方法二:手动安装 VSIX 文件
23
-
24
- 如果您无法通过市场安装,可以手动下载 VSIX 文件:
25
-
26
- 1. 在 VS Code 中按 `Ctrl+Shift+P`
27
- 2. 输入 "Extensions: Install from VSIX..."
28
- 3. 选择下载的 `.vsix` 文件
29
-
30
- ### 从源码构建
31
-
32
- 1. 克隆本仓库:`git clone https://github.com/JochenYang/minimax-status.git`
33
- 2. 进入扩展目录:`cd vscode-extension`
34
- 3. 安装依赖:`npm install`
35
- 4. 打包扩展:`npm run package`
36
- 5. 在 VS Code 中安装生成的 `.vsix` 文件
37
-
38
- ## 快速开始
39
-
40
- ### 1. 配置认证信息
41
-
42
- 安装后,你需要配置 MiniMax 的访问令牌:
43
-
44
- 1. 使用命令 "MiniMax Status: 配置向导" 打开设置界面
45
- 2. 或点击状态栏的"需要配置"按钮
46
-
47
- #### 必需配置
48
-
49
- - **MiniMax API Key**: 你的 API 访问令牌
50
- - **MiniMax GroupID**: 你的组 ID
51
-
52
- #### 可选配置
53
-
54
- - **刷新间隔**: 默认 30 秒(建议 10-30 秒)
55
- - **显示提示**: 默认开启(鼠标悬停显示详细信息)
56
-
57
- ### 2. 获取认证信息
58
-
59
- #### 获取 API Key
60
-
61
- 1. 访问 [MiniMax 开放平台](https://platform.minimaxi.com/user-center/payment/coding-plan)
62
- 2. 登录你的账户
63
- 3. 进入 "Coding Plan" 页面
64
- 4. 创建或获取 API Key
65
-
66
- #### 获取 GroupID
67
-
68
- 1. 在用户中心或账户信息页面
69
- 2. 复制你的 **GroupID**
70
-
71
- ### 3. 查看状态栏
72
-
73
- 配置完成后,VS Code 底部状态栏将显示:
74
-
75
- ```
76
- ⏰ MiniMax-M2 8%
77
- ```
78
-
79
- ### 4. 鼠标悬停查看详情
80
-
81
- 将鼠标悬停在状态栏上,可查看详细的使用信息:
82
-
83
- - 当前模型
84
- - 使用进度
85
- - 剩余时间
86
- - 上下文窗口大小
87
-
88
- ## 状态说明
89
-
90
- ### 颜色编码
91
-
92
- - 🟢 **绿色(< 60%)**: 正常使用
93
- - 🟡 **黄色(60-85%)**: 注意使用
94
- - 🔴 **红色(≥ 85%)**: 接近限制
95
-
96
- ### 状态图标
97
-
98
- - ✓ 正常状态
99
- - ⚡ 注意使用
100
- - ⚠ 危险状态(即将达到限制)
101
-
102
- ## 显示信息说明
103
-
104
- VSCode 扩展在状态栏显示的格式:
105
-
106
- ### 状态栏文字
107
- ```
108
- ⏰ MiniMax-M2 15%
109
- ```
110
-
111
- - **⏰**: 时钟图标,表示状态
112
- - **MiniMax-M2**: 当前模型名称
113
- - **15%**: 已使用额度百分比
114
-
115
- ### 颜色编码
116
-
117
- - 🟢 **绿色** (0-59%): 使用正常
118
- - 🟡 **黄色** (60-84%): 注意使用
119
- - 🔴 **红色** (85%+): 接近限额
120
-
121
- ### 悬停提示详情
122
-
123
- 将鼠标悬停在状态栏上,查看详细信息:
124
- ```
125
- 模型: MiniMax-M2
126
- 使用进度: 15% (675/4500)
127
- 剩余时间: 4 小时 20 分钟后重置
128
- 时间窗口: 00:00-05:00(UTC+8)
129
-
130
- 点击刷新状态
131
- ```
132
-
133
- ## 常见问题
134
-
135
- ### Q: 状态栏不显示?
136
-
137
- **A**: 请检查:
138
-
139
- 1. 是否已正确配置 Token 和 GroupId
140
- 2. 扩展是否已激活(重启 VS Code)
141
- 3. 网络连接是否正常
142
-
143
- ### Q: 显示 "未配置" 或 "错误"?
144
-
145
- **A**:
146
-
147
- 1. 检查 Token 是否正确(应以 `sk-` 开头)
148
- 2. 检查 GroupId 是否正确
149
- 3. 确认 MiniMax 账户有足够的额度
150
-
151
- ### Q: 状态更新不及时?
152
-
153
- **A**:
154
-
155
- 1. 调整设置中的 "刷新间隔"(建议 10-30 秒)
156
- 2. 重启 VS Code
157
- 3. 手动触发:按 `Ctrl+Shift+P` → 输入 "MiniMax Status: Refresh"
158
-
159
- ### Q: 如何卸载扩展?
160
-
161
- **A**:
162
-
163
- 1. 按 `Ctrl+Shift+X` 打开扩展商店
164
- 2. 找到 "MiniMax Status"
165
- 3. 点击 "卸载"
166
-
167
- ## 设置选项
168
-
169
- ### 完整设置列表
170
-
171
- 在 VS Code 设置中搜索 "MiniMax Status":
172
-
173
- - **minimaxStatus.token**: MiniMax 访问令牌
174
- - **minimaxStatus.groupId**: MiniMax Group ID
175
- - **minimaxStatus.refreshInterval**: 刷新间隔(秒,范围 5-300)
176
- - **minimaxStatus.showTooltip**: 是否显示详细提示信息(布尔值)
177
-
178
- ## 相关链接
179
-
180
- - [MiniMax 开放平台](https://platform.minimaxi.com/)
181
-
182
- ---
183
-
184
- **注意**: 本扩展仅用于显示 MiniMax Claude Code 使用状态,不存储或传输任何用户数据。认证信息仅保存在本地 VS Code 设置中。
@@ -1,98 +0,0 @@
1
- const axios = require('axios');
2
- const vscode = require('vscode');
3
-
4
- class MinimaxAPI {
5
- constructor(context) {
6
- this.context = context;
7
- this.token = null;
8
- this.groupId = null;
9
- this.loadConfig();
10
- }
11
-
12
- loadConfig() {
13
- const config = vscode.workspace.getConfiguration('minimaxStatus');
14
- this.token = config.get('token');
15
- this.groupId = config.get('groupId');
16
- }
17
-
18
- async getUsageStatus() {
19
- if (!this.token || !this.groupId) {
20
- throw new Error('请在设置中配置 MiniMax 访问令牌和组 ID');
21
- }
22
-
23
- try {
24
- const response = await axios.get(
25
- `https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains`,
26
- {
27
- params: { GroupId: this.groupId },
28
- headers: {
29
- 'Authorization': `Bearer ${this.token}`,
30
- 'Accept': 'application/json'
31
- }
32
- }
33
- );
34
-
35
- return response.data;
36
- } catch (error) {
37
- if (error.response?.status === 401) {
38
- throw new Error('无效的令牌或未授权。请检查您的凭据。');
39
- }
40
- throw new Error(`API 请求失败: ${error.message}`);
41
- }
42
- }
43
-
44
- parseUsageData(apiData) {
45
- if (!apiData.model_remains || apiData.model_remains.length === 0) {
46
- throw new Error('没有可用的使用数据');
47
- }
48
-
49
- const modelData = apiData.model_remains[0];
50
- const startTime = new Date(modelData.start_time);
51
- const endTime = new Date(modelData.end_time);
52
-
53
- // Calculate used percentage based on usage count
54
- const used = modelData.current_interval_total_count - modelData.current_interval_usage_count;
55
- const total = modelData.current_interval_total_count;
56
- const usedPercentage = Math.round((used / total) * 100);
57
-
58
- // Calculate remaining time
59
- const remainingMs = modelData.remains_time;
60
- const hours = Math.floor(remainingMs / (1000 * 60 * 60));
61
- const minutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60));
62
-
63
- return {
64
- modelName: modelData.model_name,
65
- timeWindow: {
66
- start: startTime.toLocaleTimeString('zh-CN', {
67
- hour: '2-digit',
68
- minute: '2-digit',
69
- timeZone: 'Asia/Shanghai',
70
- hour12: false
71
- }),
72
- end: endTime.toLocaleTimeString('zh-CN', {
73
- hour: '2-digit',
74
- minute: '2-digit',
75
- timeZone: 'Asia/Shanghai',
76
- hour12: false
77
- }),
78
- timezone: 'UTC+8'
79
- },
80
- remaining: {
81
- hours,
82
- minutes,
83
- text: hours > 0 ? `${hours} 小时 ${minutes} 分钟后重置` : `${minutes} 分钟后重置`
84
- },
85
- usage: {
86
- used: modelData.current_interval_total_count - modelData.current_interval_usage_count,
87
- total: modelData.current_interval_total_count,
88
- percentage: usedPercentage
89
- }
90
- };
91
- }
92
-
93
- refreshConfig() {
94
- this.loadConfig();
95
- }
96
- }
97
-
98
- module.exports = MinimaxAPI;