@eddyskywalker/dsh-chatgpt-subscription 0.9.0 → 0.9.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **修复 Kimi Code 设置卡片「过一段时间就报 `rejected the stored credential (401)`」**:这不是登录态过期,而是**卡片拿着一个已经过期的 access token 去查用量**,并把服务端的 401 读成了「凭据被拒绝」。
6
+ - **根因一:卡片从不刷新号池凭据**。`/status`、`/quota`、`/connection/test` 都把号池里的 credentials 原样交给 `fetchAccountQuota`,而它只在**没有**传入凭据时才会刷新——号池的刷新只发生在模型请求路径上(`getEffectiveAccount`)。Kimi 的 access token 只有 **900 秒**(实测本机凭据 `exp - iat = 900`),于是「15 分钟没发过 Kimi 消息」=「打开设置页必现 401」。实测本机两份存储:镜像里的 token 有效,号池里的 access token 已过期——正是这一条。
7
+ - **根因二:同一枚轮换 refresh token 被两条路径各自刷新**。单凭据文件是号池主账号的**镜像**,但目录加载会绕过号池去刷它(`loadProviderModels` → `ensureAccessToken(store)`,且 stale-while-revalidate 会在后台再刷一次)。Kimi 的 refresh token 轮换后旧的即作废,于是镜像先刷成功就把号池那份变成死令牌;适配器下次刷新拿到 `invalid_grant`,账号被标 `authStatus=expired` 移出轮换,而进程内的「已拒绝」墓碑只在**重新登录**时清除——必须重新登录才能恢复。官方 CLI 正是为同一问题加了跨进程文件锁。
8
+ - **修法**:号池新增 `getFreshCredential(accountId)`(按 id 取凭据、到期前刷新、写回池并镜像)与 `renewCredential(accountId)`(**无条件**续期);`AccountPoolCore` 两者共用一条 `credentialFor` 路径,失败分类与 `getEffectiveAccount` 一致(refresh 被判死刑才标记账号)。卡片三条路径全部改走它。
9
+ - **401 现在会先续期再判定**:`fetchAccountQuota` 收到 401 时用一次强制续期再重试一次,只有**第二次** 401 才是「重新登录」。单账号路径只在存储里仍是**同一枚** refresh token 时才续期——已被别人轮换过的令牌不再花掉。续期后的凭据会用于随后的 `/me` 与落盘,避免刚换到的新 token 立刻被旧 token 覆盖。
10
+ - **目录加载不再碰镜像**:`loadProviderModels` 新增 `credentialProvider` 接缝,适配器与路由在装了号池时传入号池的活跃凭据;带池时**完全不再回退**到单凭据文件,没有活跃账号时宁可返回空目录也不去轮换镜像里的令牌。无池部署行为不变(自刷新仍是它唯一的凭据来源)。
11
+ - **验证**:`tsc` 三个项目 0 错误;`npm test` **110 文件 / 1582 项通过、0 失败**(新增 9 条)。把源码 stash 回修复前,其中 6 条失败,确认断言不是空转。
12
+
5
13
  - **移除 Claude 线路的「合规告知 + 确认门禁」**:设置卡片顶部那段必须显式接受的告知、`/claude/api/consent` 路由、以及**主机侧门禁**全部删除。
6
14
  - **为什么必须整体删除而不是只删界面**:那条门禁不是纯 UI——它决定**适配器是否注册**,未接受时 `login`/`adopt`/`accounts`/`quota`/`connection/test`/`catalog/refresh`/`settings`(POST)/`login/input` 一律 403。**只删告知框会留下门禁、却再没有地方能确认它,等于把这条线路锁死。** 现在 `claimClaudeRoute` **无条件注册**(保留原有的路由争用处理:`try/catch` + `claudeConflict` 上报 + `llm/adapters-updated` 重新认领)。
7
15
  - **风险事实不变,只是不再要求点击**:Anthropic 现行条款仍明确不允许第三方应用提供 Claude.ai 登录、也不允许代用户经 Free/Pro/Max 凭据转发请求,本插件**仍未获任何授权或认可**。README 保留了如实说明,并写明「此前版本有确认步骤,现已移除;移除的只是那一步交互,不改变上述事实」。
package/README.md CHANGED
@@ -554,6 +554,7 @@ npm pack --dry-run
554
554
  | Kimi Code 报 502 `Upstream model provider is temporarily unavailable` | 上游模型供应商的瞬时故障,与账号、模型、凭据都无关:插件会按 DSH retry policy 自动重试(最多 3 次,并遵守上游 `Retry-After`);连续失败可稍后再试或换用同账号下其他模型 |
555
555
  | Kimi Code 报 429 `engine is currently overloaded` | 服务容量问题(工作日 14:00–17:00 高峰更常见),会自动退避重试;若响应里带 `error.type = exceeded_current_quota_error` 则属于配额耗尽,插件不会重试而是提示补充额度 |
556
556
  | Kimi Code 额度显示为空 | 卡片会同时给出失败原因(`/v1/usages` 的 401/403/5xx 文案),按提示处理后点「刷新用量」重试;确认用的是订阅账号——开放平台的 key 在这里不会被接受 |
557
+ | Kimi Code 报「rejected the stored credential (401). Sign in again…」但发消息却是好的 | 这是**过期 access token**,不是被拒的账号:Kimi 的 access token 只有 **15 分钟**,而设置卡片过去会把号池里存着的那个 token 直接拿去查用量,因此只要 15 分钟内没走过一次 Kimi 请求,卡片就必然拿到 401。现在卡片会先刷新再请求(401 还会触发一次强制续期),因此**不必重新登录**;若卡片仍提示重新登录,才是真的刷新令牌被拒,按提示处理即可 |
557
558
  | Kimi Code 账号一栏为空 | 账号身份取自 OAuth token 自身的 JWT 声明,套餐名取自 `/me`(`/usages` 自 2026-09 起不再返回 `user_level_name`)。重新登录或点「刷新用量」即可写入;若仍为空但显示「已登录」,点「测试连接」可确认凭据是否仍被接受 |
558
559
  | Claude 相关接口返回 403 | 403 现在是**同源校验**的结果(修改状态的路由只接受同源 JSON POST)。若出现在浏览器里,检查是否从其它来源发起了请求;插件已不再有任何"确认后才能用"的门禁 |
559
560
  | 授权后粘贴授权码报「请把 # 后面的部分一起复制」 | 手动流程需要 `<授权码>#<state>` **整段**。只粘贴授权码是不被接受的:用流程自己的 state 顶上会架空 state 参数、把粘贴框变成登录 CSRF 的入口,因此插件宁可报错也不猜 |
package/lib/index.js CHANGED
@@ -1172,6 +1172,67 @@ var AccountPoolCore = class {
1172
1172
  credentials: selected.credentials
1173
1173
  };
1174
1174
  }
1175
+ /**
1176
+ * Refresh one named account's credential for a caller that is not a metered
1177
+ * model request.
1178
+ *
1179
+ * The settings card is what this exists for. It addresses an account by id
1180
+ * rather than taking a rotation slot, and it used to hand the stored
1181
+ * credential to the provider unchanged; with a 15-minute access token that
1182
+ * meant a card opened more than a quarter of an hour after the last model
1183
+ * request sent an expired bearer to the usage endpoint and was answered with
1184
+ * 401 — "sign in again" for a credential that a plain refresh would have
1185
+ * renewed.
1186
+ *
1187
+ * Rotation bookkeeping is deliberately ignored, matching
1188
+ * {@link getCredentialAccount}: a cooldown or a pinned account describes
1189
+ * routing, not whether the credential can be read. A credential the provider
1190
+ * has already declared unusable is still refused, because refreshing it
1191
+ * cannot succeed.
1192
+ *
1193
+ * @param accountId - the pool account to read, or undefined for the primary.
1194
+ * @param fetchFn - fetch used by the provider's token refresh.
1195
+ */
1196
+ async getFreshCredential(accountId, fetchFn = fetch) {
1197
+ return this.credentialFor(accountId, fetchFn, false);
1198
+ }
1199
+ /**
1200
+ * Renew one account's credential unconditionally.
1201
+ *
1202
+ * This is the answer to a 401 that the local clock did not predict: an access
1203
+ * token can be revoked upstream or rotated by another holder while it still
1204
+ * looks unexpired, and only the service's own refusal says so. Renewing it is
1205
+ * what separates that from a credential that genuinely needs a new sign-in.
1206
+ */
1207
+ async renewCredential(accountId, fetchFn = fetch) {
1208
+ return this.credentialFor(accountId, fetchFn, true);
1209
+ }
1210
+ /**
1211
+ * Resolve, and if needed renew, one account's credential.
1212
+ *
1213
+ * With no id the account that would serve the next request is used — the
1214
+ * active one, then the primary, then the first — because a caller that does
1215
+ * not name an account (the catalog loader) still has to present the
1216
+ * credential that is actually in play.
1217
+ */
1218
+ async credentialFor(accountId, fetchFn, force) {
1219
+ const data = await this.read();
1220
+ const target = accountId === void 0 ? data.accounts.find((account) => account.id === data.activeAccountId) ?? data.accounts.find((account) => account.isPrimary) ?? data.accounts[0] : data.accounts.find((account) => account.id === accountId);
1221
+ if (target === void 0) throw new LlmError(this.hooks.emptyMessage ?? `未登录 ${this.hooks.displayName} 账号,请先在设置页添加账号。`, "AUTH");
1222
+ if (!this.isCredentialUsable(target)) throw new LlmError(`${this.hooks.displayName} 账号的凭据已被拒绝,需要重新登录。`, "AUTH", { status: 401 });
1223
+ if (!force && (!this.shouldRefreshCredential(target, Date.now()) || !this.hooks.refresh)) return target.credentials;
1224
+ if (!this.hooks.refresh) return target.credentials;
1225
+ let refreshed;
1226
+ try {
1227
+ refreshed = await this.hooks.refresh(target.credentials, fetchFn);
1228
+ } catch (error) {
1229
+ const status = this.hooks.refreshFailureStatus?.(error);
1230
+ if (status !== void 0) await this.markAuthFailed(target.id, error instanceof Error ? error.message : String(error), status).catch(() => void 0);
1231
+ throw error;
1232
+ }
1233
+ await this.updateAccountCredentials(target.id, refreshed);
1234
+ return refreshed;
1235
+ }
1175
1236
  /** Whether one account's credential must be refreshed before it is handed out. */
1176
1237
  shouldRefreshCredential(account, now) {
1177
1238
  if (this.hooks.needsRefresh) return this.hooks.needsRefresh(account.credentials, now);
@@ -13841,6 +13902,7 @@ const catalogSnapshotScopesLoaded$1 = /* @__PURE__ */ new Set();
13841
13902
  function clearCachedCatalog$2() {
13842
13903
  catalogCache$1 = null;
13843
13904
  catalogSnapshotScopesLoaded$1.clear();
13905
+ catalogActiveRegions.clear();
13844
13906
  }
13845
13907
  /**
13846
13908
  * Read one model entry from the live catalog.
@@ -13920,7 +13982,9 @@ async function cachedOrRevalidate(options) {
13920
13982
  }
13921
13983
  if (accessToken === void 0) {
13922
13984
  if (options.store === void 0) return [];
13923
- try {
13985
+ accessToken = catalogAccessToken(region);
13986
+ if (accessToken === void 0 && options.credentialProvider !== void 0) accessToken = await options.credentialProvider(region).catch(() => void 0);
13987
+ if (accessToken === void 0 && options.credentialProvider === void 0) try {
13924
13988
  accessToken = (await ensureAccessToken$1(options.store, {
13925
13989
  fetchFn: options.fetchFn,
13926
13990
  signal: options.signal
@@ -13928,6 +13992,7 @@ async function cachedOrRevalidate(options) {
13928
13992
  } catch {
13929
13993
  return [];
13930
13994
  }
13995
+ if (accessToken === void 0) return [];
13931
13996
  }
13932
13997
  const cacheKey = `${region}:${accessToken.slice(-8)}`;
13933
13998
  if (catalogCache$1 !== null && catalogCache$1.key === cacheKey && Date.now() - catalogCache$1.fetchedAt < 18e5) return catalogCache$1.models;
@@ -13946,7 +14011,9 @@ async function performListing(options) {
13946
14011
  let accessToken = options.accessToken;
13947
14012
  if (accessToken === void 0) {
13948
14013
  if (options.store === void 0) return [];
13949
- try {
14014
+ accessToken = catalogAccessToken(region);
14015
+ if (accessToken === void 0 && options.credentialProvider !== void 0) accessToken = await options.credentialProvider(region).catch(() => void 0);
14016
+ if (accessToken === void 0 && options.credentialProvider === void 0) try {
13950
14017
  accessToken = (await ensureAccessToken$1(options.store, {
13951
14018
  fetchFn: options.fetchFn,
13952
14019
  signal: options.signal
@@ -13954,6 +14021,7 @@ async function performListing(options) {
13954
14021
  } catch {
13955
14022
  return [];
13956
14023
  }
14024
+ if (accessToken === void 0) return [];
13957
14025
  }
13958
14026
  const response = await (options.fetchFn ?? fetch)(openAIUrl(MODELS_PATH$1, region), {
13959
14027
  headers: await kimiCodeHeaders(accessToken, "openai"),
@@ -13964,6 +14032,7 @@ async function performListing(options) {
13964
14032
  const data = Array.isArray(payload) ? payload : asRecord$5(payload)?.data;
13965
14033
  if (!Array.isArray(data)) throw new Error("Kimi Code model listing was not in the documented shape.");
13966
14034
  const models = data.map(parseCatalogModel).filter((model) => model !== void 0);
14035
+ rememberCatalogCredential(region, accessToken);
13967
14036
  catalogCache$1 = {
13968
14037
  fetchedAt: Date.now(),
13969
14038
  models,
@@ -13976,6 +14045,28 @@ async function performListing(options) {
13976
14045
  function cacheKeyOf(region, accessToken) {
13977
14046
  return `${region}:${accessToken.slice(-8)}`;
13978
14047
  }
14048
+ /**
14049
+ * Region whose active account is already carried by the catalog cache.
14050
+ *
14051
+ * The settings card reads the card and the catalog with the pool's active
14052
+ * credential but calls the loader without one, so without this the loader would
14053
+ * fall back to the single-credential mirror — a second copy of the same
14054
+ * rotating refresh token. Refreshing that copy invalidates the token the pool
14055
+ * will present on the next model request, and the account then reads as
14056
+ * rejected until a new sign-in.
14057
+ */
14058
+ const catalogActiveRegions = /* @__PURE__ */ new Map();
14059
+ /**
14060
+ * Record which credential the last listing used, so a token-free caller for the
14061
+ * same region can reuse it instead of decrypting the mirror.
14062
+ */
14063
+ function rememberCatalogCredential(region, accessToken) {
14064
+ catalogActiveRegions.set(region, accessToken);
14065
+ }
14066
+ /** The token the cache already holds for this region, if any. */
14067
+ function catalogAccessToken(region) {
14068
+ return catalogActiveRegions.get(region);
14069
+ }
13979
14070
  /** Shape check for a persisted snapshot.
13980
14071
  *
13981
14072
  * Entries are already in the parsed catalog shape, so they are accepted as
@@ -14318,10 +14409,18 @@ async function fetchAccountQuota$3(store, options = {}) {
14318
14409
  } catch (error) {
14319
14410
  throw error;
14320
14411
  }
14321
- const response = await fetchFn(openAIUrl(USAGES_PATH, credentials.region), {
14412
+ const requestUsage = async (credentials) => fetchFn(openAIUrl(USAGES_PATH, credentials.region), {
14322
14413
  headers: await kimiCodeHeaders(credentials.accessToken, "openai"),
14323
14414
  signal: timeoutSignal$2(options.signal, DISCOVERY_TIMEOUT_MS$2)
14324
14415
  });
14416
+ let response = await requestUsage(credentials);
14417
+ if (response.status === 401) {
14418
+ const renewed = await forceRenew(store, credentials, options, fetchFn);
14419
+ if (renewed !== void 0) {
14420
+ credentials = renewed;
14421
+ response = await requestUsage(credentials);
14422
+ }
14423
+ }
14325
14424
  if (response.status === 401) throw new KimiCodeUnauthorizedError("Kimi Code rejected the stored credential (401). Sign in again from Settings > Kimi Code.");
14326
14425
  if (response.status === 404) throw new Error("The Kimi Code usage endpoint is unavailable for this account. Confirm the subscription is active.");
14327
14426
  if (!response.ok) throw new Error(`Kimi Code usage request failed (${response.status}).`);
@@ -14329,7 +14428,7 @@ async function fetchAccountQuota$3(store, options = {}) {
14329
14428
  const profile = await fetchProfile(store, {
14330
14429
  fetchFn,
14331
14430
  signal: options.signal,
14332
- ...options.credentials === void 0 ? {} : { credentials: options.credentials }
14431
+ ...options.credentials === void 0 ? {} : { credentials }
14333
14432
  });
14334
14433
  const account = accountFromCredentials$1(credentials, payload, profile ?? void 0);
14335
14434
  const learned = {};
@@ -14352,6 +14451,34 @@ async function fetchAccountQuota$3(store, options = {}) {
14352
14451
  return snapshot;
14353
14452
  }
14354
14453
  /**
14454
+ * Renew an access token once after the usage endpoint refused it.
14455
+ *
14456
+ * A pool supplies {@link QuotaFetchOptions.renewFn}, because only the pool can
14457
+ * persist the rotated refresh token. Without one the single-credential store
14458
+ * renews itself — but only when it still holds the very token that was refused:
14459
+ * a store already carrying a different pair was rotated by someone else, and
14460
+ * refreshing it again would spend a token the upstream has not rejected.
14461
+ */
14462
+ async function forceRenew(store, refused, options, fetchFn) {
14463
+ if (options.renewFn !== void 0) try {
14464
+ return await options.renewFn(refused);
14465
+ } catch {
14466
+ return;
14467
+ }
14468
+ if (options.credentials !== void 0) return void 0;
14469
+ const stored = await store.read().catch(() => null);
14470
+ if (stored === null || stored.refreshToken !== refused.refreshToken) return void 0;
14471
+ try {
14472
+ return await ensureAccessToken$1(store, {
14473
+ fetchFn,
14474
+ signal: options.signal,
14475
+ force: true
14476
+ });
14477
+ } catch {
14478
+ return;
14479
+ }
14480
+ }
14481
+ /**
14355
14482
  * Build the account view for one credential.
14356
14483
  *
14357
14484
  * There is no account-profile endpoint on the coding API: the signed-in
@@ -16414,9 +16541,11 @@ var KimiCodeAdapter = class extends LlmAdapter {
16414
16541
  * shipped fallback otherwise, narrowed by the user's enabled selection.
16415
16542
  */
16416
16543
  async catalog() {
16544
+ const pool = this.accountPool;
16417
16545
  const live = await (this.options.loadCatalog ?? (() => loadProviderModels$1({
16418
16546
  fetchFn: this.options.fetchFn,
16419
- store: this.store
16547
+ store: this.store,
16548
+ ...pool === null ? {} : { credentialProvider: (_region) => pool.getFreshCredential(void 0, this.options.fetchFn ?? fetch).then((c) => c.accessToken) }
16420
16549
  })))().catch(() => []);
16421
16550
  if (live.length > 0) return live;
16422
16551
  return FALLBACK_MODELS$2.map((model) => ({
@@ -16841,7 +16970,8 @@ async function getKimiCodeWebStatus(store, modelSettings, preferences, options =
16841
16970
  const poolData = accountPool === void 0 ? null : await accountPool.read().catch(() => null);
16842
16971
  const accounts = accountPool === void 0 ? [] : await accountPool.listAccounts().catch(() => []);
16843
16972
  const activeAccount = accounts.find((entry) => entry.id === poolData?.activeAccountId) ?? accounts.find((entry) => entry.isPrimary) ?? accounts[0];
16844
- const active = (poolData === null ? void 0 : poolData.accounts.find((entry) => entry.id === poolData.activeAccountId) ?? poolData.accounts.find((entry) => entry.isPrimary) ?? poolData.accounts[0])?.credentials ?? credentials;
16973
+ const activePoolAccount = poolData === null ? void 0 : poolData.accounts.find((entry) => entry.id === poolData.activeAccountId) ?? poolData.accounts.find((entry) => entry.isPrimary) ?? poolData.accounts[0];
16974
+ const active = (accountPool === void 0 || activePoolAccount === void 0 ? void 0 : await accountPool.getFreshCredential(activePoolAccount.id, options.fetchFn ?? fetch).catch(() => void 0)) ?? activePoolAccount?.credentials ?? credentials;
16845
16975
  const region = active?.region ?? await resolveRegion();
16846
16976
  const live = await loadProviderModels$1({
16847
16977
  fetchFn: options.fetchFn,
@@ -16910,6 +17040,33 @@ function registerKimiCodeRoutes(ctx, store, modelSettings, preferences, options
16910
17040
  credentials: target?.credentials
16911
17041
  };
16912
17042
  };
17043
+ /** Renewal seam for the quota fetch, bound to one pool account. */
17044
+ const renewFor = (accountId) => {
17045
+ const pool = accountPool;
17046
+ if (pool === void 0 || accountId === void 0) return void 0;
17047
+ return (_credentials) => pool.renewCredential(accountId, fetchFn);
17048
+ };
17049
+ /**
17050
+ * The credential the active account should be used with right now.
17051
+ *
17052
+ * Every card path goes through the pool here. A pool owns both the rotation
17053
+ * and the write-back, so handing out {@link activeAccount}'s stored value
17054
+ * meant the card kept presenting an access token that expired fifteen minutes
17055
+ * after the last model request, and read the 401 it earned as a credential the
17056
+ * user had to replace by signing in again.
17057
+ *
17058
+ * Without a pool there is no rotation to consult: the single-credential store
17059
+ * renews itself while the quota is fetched.
17060
+ */
17061
+ const effectiveCredentials = async (target) => {
17062
+ if (accountPool === void 0) return target.credentials;
17063
+ if (target.id === void 0) return target.credentials;
17064
+ try {
17065
+ return await accountPool.getFreshCredential(target.id, fetchFn);
17066
+ } catch {
17067
+ return target.credentials;
17068
+ }
17069
+ };
16913
17070
  const quotaRefresh = new QuotaRefresh();
16914
17071
  return ctx.webServer.register({
16915
17072
  kind: "prefix",
@@ -16923,13 +17080,17 @@ function registerKimiCodeRoutes(ctx, store, modelSettings, preferences, options
16923
17080
  const poolActive = await activeAccount();
16924
17081
  const cached = getCachedQuotaFor(poolActive.id ?? null);
16925
17082
  if (poolActive.credentials !== void 0 && (cached === null || Date.now() - (cached.fetchedAt || 0) > 12e4)) {
16926
- const refresh = () => fetchAccountQuota$3(store, {
16927
- fetchFn,
16928
- ...accountPool === void 0 ? {} : {
16929
- credentials: poolActive.credentials,
16930
- accountId: poolActive.id
16931
- }
16932
- });
17083
+ const refresh = async () => {
17084
+ const credentials = await effectiveCredentials(poolActive);
17085
+ return fetchAccountQuota$3(store, {
17086
+ fetchFn,
17087
+ ...accountPool === void 0 ? {} : {
17088
+ credentials,
17089
+ accountId: poolActive.id,
17090
+ renewFn: renewFor(poolActive.id)
17091
+ }
17092
+ });
17093
+ };
16933
17094
  if (cached === null) await quotaRefresh.run(refresh);
16934
17095
  else quotaRefresh.start(refresh);
16935
17096
  }
@@ -16992,8 +17153,9 @@ function registerKimiCodeRoutes(ctx, store, modelSettings, preferences, options
16992
17153
  const { account, latencyMs } = await testConnection(store, {
16993
17154
  fetchFn,
16994
17155
  ...accountPool === void 0 ? {} : {
16995
- credentials: poolActive.credentials,
16996
- accountId: poolActive.id
17156
+ credentials: await effectiveCredentials(poolActive),
17157
+ accountId: poolActive.id,
17158
+ renewFn: renewFor(poolActive.id)
16997
17159
  }
16998
17160
  });
16999
17161
  return sendJson$2(response, 200, {
@@ -17021,8 +17183,9 @@ function registerKimiCodeRoutes(ctx, store, modelSettings, preferences, options
17021
17183
  fetchFn,
17022
17184
  force: true,
17023
17185
  ...accountPool === void 0 ? {} : {
17024
- credentials: quotaActive.credentials,
17025
- accountId: quotaActive.id
17186
+ credentials: await effectiveCredentials(quotaActive),
17187
+ accountId: quotaActive.id,
17188
+ renewFn: renewFor(quotaActive.id)
17026
17189
  }
17027
17190
  }) === null) return sendJson$2(response, 502, {
17028
17191
  ok: false,
@@ -17086,7 +17249,7 @@ function registerKimiCodeRoutes(ctx, store, modelSettings, preferences, options
17086
17249
  fetchFn,
17087
17250
  store,
17088
17251
  region: catalogActive.credentials.region,
17089
- accessToken: catalogActive.credentials.accessToken,
17252
+ accessToken: (await effectiveCredentials(catalogActive))?.accessToken,
17090
17253
  force: true
17091
17254
  }).catch(() => void 0);
17092
17255
  return sendJson$2(response, 200, {
@@ -233,6 +233,46 @@ export declare class AccountPoolCore<TCredentials, TAccount extends PoolAccountS
233
233
  account: TAccount;
234
234
  credentials: TCredentials;
235
235
  }>;
236
+ /**
237
+ * Refresh one named account's credential for a caller that is not a metered
238
+ * model request.
239
+ *
240
+ * The settings card is what this exists for. It addresses an account by id
241
+ * rather than taking a rotation slot, and it used to hand the stored
242
+ * credential to the provider unchanged; with a 15-minute access token that
243
+ * meant a card opened more than a quarter of an hour after the last model
244
+ * request sent an expired bearer to the usage endpoint and was answered with
245
+ * 401 — "sign in again" for a credential that a plain refresh would have
246
+ * renewed.
247
+ *
248
+ * Rotation bookkeeping is deliberately ignored, matching
249
+ * {@link getCredentialAccount}: a cooldown or a pinned account describes
250
+ * routing, not whether the credential can be read. A credential the provider
251
+ * has already declared unusable is still refused, because refreshing it
252
+ * cannot succeed.
253
+ *
254
+ * @param accountId - the pool account to read, or undefined for the primary.
255
+ * @param fetchFn - fetch used by the provider's token refresh.
256
+ */
257
+ getFreshCredential(accountId?: string, fetchFn?: typeof fetch): Promise<TCredentials>;
258
+ /**
259
+ * Renew one account's credential unconditionally.
260
+ *
261
+ * This is the answer to a 401 that the local clock did not predict: an access
262
+ * token can be revoked upstream or rotated by another holder while it still
263
+ * looks unexpired, and only the service's own refusal says so. Renewing it is
264
+ * what separates that from a credential that genuinely needs a new sign-in.
265
+ */
266
+ renewCredential(accountId?: string, fetchFn?: typeof fetch): Promise<TCredentials>;
267
+ /**
268
+ * Resolve, and if needed renew, one account's credential.
269
+ *
270
+ * With no id the account that would serve the next request is used — the
271
+ * active one, then the primary, then the first — because a caller that does
272
+ * not name an account (the catalog loader) still has to present the
273
+ * credential that is actually in play.
274
+ */
275
+ private credentialFor;
236
276
  /** Whether one account's credential must be refreshed before it is handed out. */
237
277
  private shouldRefreshCredential;
238
278
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/common/account-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wCAAwC,CAAA;AAE/C,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,QAAS,CAAA;AAK5C,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,YAAY;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,YAAY,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,4EAA4E;AAC5E,MAAM,WAAW,QAAQ,CAAC,QAAQ;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,uBAAuB,CAAA;IACzC,QAAQ,EAAE,QAAQ,EAAE,CAAA;CACrB;AAED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB,CAA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CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAb1B;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;gBAGrC,KAAK,sBAA4B,EACjC,aAAa,yBAA+B,EAC5C,WAAW,CAAC,EAAE,uBAAuB,YAAA,EACrC,OAAO,GAAE,sBAA2B,EACrD,WAAW,CAAC,EAAE,mBAAmB;IAMnC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAI/C,mBAAmB,IAAI,mBAAmB;IAI1C,mBAAmB,IAAI,SAAS;IAIhC,OAAO,CAAC,QAAQ;IAIhB;;;OAGG;YACW,OAAO;IA0BrB,OAAO,CAAC,gBAAgB;IAUlB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAmB/D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAkCpG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YAgBpD,aAAa;CAmL7B;AAQD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,WAAW,EAAE,CAAA"}
@@ -56,7 +56,24 @@ export declare function loadProviderModels(options?: {
56
56
  region?: KimiCodeRegion;
57
57
  signal?: AbortSignal;
58
58
  force?: boolean;
59
+ /**
60
+ * Read the active credential from the account pool.
61
+ *
62
+ * Every refresh rotates the refresh token and invalidates the previous one.
63
+ * The single-credential file is a *copy* of the pool's primary account, so
64
+ * refreshing that copy spends the token the pool will present on the next
65
+ * model request — the account then reads as rejected until a new sign-in.
66
+ * Supplying this keeps the loader on the one credential authority.
67
+ */
68
+ credentialProvider?: (region: KimiCodeRegion) => Promise<string | undefined>;
59
69
  }): Promise<KimiCodeCatalogModel[]>;
70
+ /**
71
+ * Record which credential the last listing used, so a token-free caller for the
72
+ * same region can reuse it instead of decrypting the mirror.
73
+ */
74
+ export declare function rememberCatalogCredential(region: KimiCodeRegion, accessToken: string): void;
75
+ /** Test seam: forget which credential the cached listings were fetched with. */
76
+ export declare function clearCatalogCredentials(): void;
60
77
  /** Choose the wire dialect for one model, from the live catalog when it says. */
61
78
  export declare function wireForCatalogEntry(modelId: string, catalog: readonly KimiCodeCatalogModel[]): KimiCodeWire;
62
79
  /** Thinking levels for one model, from the catalog when it declares them. */
@@ -146,6 +163,17 @@ export interface QuotaFetchOptions {
146
163
  * account's name, so a snapshot is only reused for the same id.
147
164
  */
148
165
  accountId?: string;
166
+ /**
167
+ * Refresh this credential and hand back the replacement, or undefined when
168
+ * the caller has no way to renew it.
169
+ *
170
+ * A usage call that answers 401 is the only signal that an access token
171
+ * stopped being accepted; rotation bookkeeping cannot see it, because the
172
+ * token still looks unexpired locally. The caller that owns the credential —
173
+ * the pool — supplies the write-back here, so the one retry happens where the
174
+ * rotated refresh token can actually be persisted.
175
+ */
176
+ renewFn?: (credentials: KimiCodeCredentials) => Promise<KimiCodeCredentials | undefined>;
149
177
  }
150
178
  /**
151
179
  * Fetch and cache the account's quota snapshot.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAQd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EAEnB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,cAA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wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,uBAAuB,EACrC,OAAO,GAAE,qBAA0B,EACnC,WAAW,GAAE,mBAAmB,GAAG,SAA+B,GACjE,MAAM,IAAI,CA+TZ;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eddyskywalker/dsh-chatgpt-subscription",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
5
5
  "author": {
6
6
  "name": "eddyskywalker",