dsh-connect-minimaxcode 0.4.0 → 0.4.1

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
@@ -186,14 +186,14 @@ Content-Type: application/json
186
186
 
187
187
  ### 积分会过期吗?会
188
188
 
189
- 积分不是一池子,而是**按笔发放的批次**,每批有自己的到期日。客户端每天发一批,每批大约在**发放后 29 天**到期,于是形成一条逐日错开的 30 天阶梯:
189
+ 积分不是一池子,而是**按笔发放的批次**,每批有自己的到期日。客户端每天发一批,每批在**发放日 + 30 个自然日**到期(按账户所在时区,当日 00:00 失效),于是形成一条逐日错开的 30 天阶梯:
190
190
 
191
191
  ```
192
- GET https://agent.minimax.cn/minimax-cloud/api/v1/credit/details?page=1&page_size=100
193
- → details[] { granted_amount, remaining_amount, consumed_amount, granted_at_ms, expire_at_ms }
192
+ GET https://agent.minimax.cn/minimax-cloud/api/v1/credit/details?page_number=1&page_size=100
193
+ → details[] { granted_amount, remaining_amount, consumed_amount, granted_at_ms, expire_at_ms, credit_type }
194
194
  ```
195
195
 
196
- 实测本机 23 笔:09-20 发的在 10-19 到期,09-21 发的在 10-20 到期……另有一笔 08-25 发的在 **2027-08-25** 到期(一年期批次)。
196
+ 实测本机 23 笔:09-20 发的在 10-20 到期、09-21 发的在 10-21 到期……另有一笔 08-25 发的在 2027-08-25 到期(一年期批次,`credit_type` 1=购买 / 2=签到)。**到期日一律读 `expire_at_ms`**,不写死天数——至少存在 30 天与 365 天两种制式。
197
197
 
198
198
  插件据此在**插件页面**(设置 → 插件 → DSH Connect MiniMax Code)与输入框下方的胶囊里给出:
199
199
 
@@ -202,9 +202,11 @@ GET https://agent.minimax.cn/minimax-cloud/api/v1/credit/details?page=1&page_siz
202
202
  - 接下来几笔**到期批次**的清单(日期 + 金额)
203
203
  - 余额条与本机消耗(token 数、等效金额)
204
204
 
205
- 只统计**仍有余额**的批次:已发放但用光的批次到期时并没有东西可损失,把它算进去会让每个账号都看起来"快过期了"。
205
+ 只统计**仍有余额**的批次:已发放但用光的批次到期时并没有东西可损失,把它算进去会让每个账号都看起来"快过期了"。积分的消耗近似先进先出,所以**"7 天内到期"的金额常常是 0**(快到期的那些基本都已被用完),因此界面同时给出**最早到期时间**,那才是真正有意义的信号。
206
206
 
207
- > 台账的 `remaining_amount` 合计与余额接口的 `total_remaining_amount` 会**略有出入**(实测差 0.006,浮点累加所致;两次采样之间余额本身也会变)。插件以**余额接口**显示总额,台账只用来回答"什么时候过期"。
207
+ > 过期不会把批次里的 `remaining_amount` 清零(实测会留下 -0.31 这样的负值残留),而是把过期批次**排除在余额之外**;所以总额以余额接口为准。
208
+ >
209
+ > 台账的 `remaining_amount` 合计与余额接口的 `total_remaining_amount` 在**静止期逐位相等**;两次采样之间看到的差异,是账户在这段时间里被真实消耗掉的量。
208
210
 
209
211
  ### 消耗怎么算
210
212
 
package/lib/index.d.ts CHANGED
@@ -312,8 +312,9 @@ interface CreditSnapshot {
312
312
  * One grant of credits.
313
313
  *
314
314
  * Credits are granted in lots, and each lot carries its own expiry: the
315
- * desktop app grants credits daily, and every lot falls due about a month
316
- * later on a day of its own. Credits in a lot are lost when that day arrives.
315
+ * desktop app grants credits daily, and a lot falls due thirty calendar days
316
+ * after the day it was granted, at midnight in the account's own timezone.
317
+ * Credits in a lot are lost when that moment arrives.
317
318
  */
318
319
  interface CreditLot {
319
320
  /** How much this lot was granted. */
package/lib/index.js CHANGED
@@ -994,9 +994,12 @@ function parseCreditLots(document) {
994
994
  /**
995
995
  * Fetch the credit ledger.
996
996
  *
997
- * The ledger is paginated, so every page is read. The number of pages comes
998
- * from the account's own `total_count` rather than from a guess, and a lot
999
- * count that stops growing ends the walk.
997
+ * The ledger is paginated, and the page parameter is `page_number` — `page`
998
+ * is accepted and then ignored, which would make every page return the same
999
+ * rows. The page size is capped upstream at 100.
1000
+ *
1001
+ * The default view already excludes expired grants, which is what this wants:
1002
+ * a grant that expired has nothing left to lose.
1000
1003
  */
1001
1004
  async function fetchCreditLots(credential, region, fetchImpl = fetch) {
1002
1005
  const pageSize = 100;
@@ -1004,14 +1007,16 @@ async function fetchCreditLots(credential, region, fetchImpl = fetch) {
1004
1007
  let page = 1;
1005
1008
  let total = Number.POSITIVE_INFINITY;
1006
1009
  while (lots.length < total && page <= 50) {
1007
- const response = await fetchImpl(`${MINIMAX_ACCOUNT_HOSTS[region]}${CREDIT_DETAILS_PATH}?page=${page}&page_size=${pageSize}`, { headers: { authorization: `Bearer ${credential.token}` } });
1010
+ const response = await fetchImpl(`${MINIMAX_ACCOUNT_HOSTS[region]}${CREDIT_DETAILS_PATH}?page_number=${page}&page_size=${pageSize}`, { headers: { authorization: `Bearer ${credential.token}` } });
1008
1011
  if (!response.ok) throw new Error(`credit ledger request failed: HTTP ${response.status}`);
1009
1012
  const document = await response.json();
1010
1013
  const batch = parseCreditLots(document);
1014
+ const before = lots.length;
1011
1015
  lots.push(...batch);
1012
1016
  const count = toNumber(document.total_count);
1013
1017
  if (count !== void 0) total = count;
1014
1018
  if (batch.length < pageSize) break;
1019
+ if (lots.length === before) break;
1015
1020
  page += 1;
1016
1021
  }
1017
1022
  return lots;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-minimaxcode",
3
3
  "displayName": "DSH Connect MiniMax Code",
4
4
  "description": "把本机已登录的 MiniMax Code 桌面 App 的模型接入 DeepSeek Harness:复用其登录态,提供 Anthropic Messages 兼容接入、动态模型目录与积分余额/到期提示。",
5
- "version": "0.4.0",
5
+ "version": "0.4.1",
6
6
  "author": "JeffTsuiCUG",
7
7
  "license": "MIT",
8
8
  "private": false,