dsh-codex-subscription 2.6.4 → 2.6.6

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.en.md CHANGED
@@ -106,7 +106,7 @@ This plugin supports the latest DeepSeek Harness release recorded in its package
106
106
  2. Paste this package name, with its version, into the **Package name or address** field:
107
107
 
108
108
  ```text
109
- dsh-codex-subscription@2.6.4
109
+ dsh-codex-subscription@2.6.6
110
110
  ```
111
111
 
112
112
  3. Click **Install** and wait for completion. Follow the page instructions; save your work before restarting if requested.
@@ -118,7 +118,7 @@ Why the version is included: DSH's plugin page only installs versions that are a
118
118
  <summary>Terminal installation (with an existing dsh command)</summary>
119
119
 
120
120
  ```sh
121
- dsh plugin --profile web add dsh-codex-subscription@2.6.4
121
+ dsh plugin --profile web add dsh-codex-subscription@2.6.6
122
122
  ```
123
123
 
124
124
  Follow the restart instructions, then sign in under **Settings → Codex**. Both the Plugins page and the terminal use DSH's installation management.
@@ -131,7 +131,7 @@ Follow the restart instructions, then sign in under **Settings → Codex**. Both
131
131
  After signing in and selecting a Codex model in Web, install the same plugin in the Headless profile:
132
132
 
133
133
  ```sh
134
- dsh plugin --profile headless add dsh-codex-subscription@2.6.4
134
+ dsh plugin --profile headless add dsh-codex-subscription@2.6.6
135
135
  dsh --profile headless "Reply with only the word: ok"
136
136
  ```
137
137
 
@@ -266,7 +266,7 @@ Find this plugin on the DSH **Plugins** page and use its update or uninstall act
266
266
  <summary>Terminal commands</summary>
267
267
 
268
268
  ```sh
269
- dsh plugin --profile web update dsh-codex-subscription@2.6.4
269
+ dsh plugin --profile web update dsh-codex-subscription@2.6.6
270
270
  ```
271
271
 
272
272
  Run only when you want to uninstall:
@@ -282,7 +282,7 @@ dsh plugin --profile web remove dsh-codex-subscription
282
282
  <details>
283
283
  <summary>DSH 0.2.0-rc.2 reports the plugin as incompatible?</summary>
284
284
 
285
- DSH 0.2.0-rc.2 did not exist when any release before 2.2.10 was published, and a published package's compatibility declaration cannot be changed. Install 2.2.10 or later (a bare package name can resolve to an older release during the first 24 hours, so enter `dsh-codex-subscription@2.2.10`) from the **Plugins** page, or run `dsh plugin --profile web update dsh-codex-subscription@2.6.4`, then restart DSH.
285
+ DSH 0.2.0-rc.2 did not exist when any release before 2.2.10 was published, and a published package's compatibility declaration cannot be changed. Install 2.2.10 or later (a bare package name can resolve to an older release during the first 24 hours, so enter `dsh-codex-subscription@2.2.10`) from the **Plugins** page, or run `dsh plugin --profile web update dsh-codex-subscription@2.6.6`, then restart DSH.
286
286
 
287
287
  </details>
288
288
 
package/README.md CHANGED
@@ -106,7 +106,7 @@
106
106
  2. 在 **包名或地址** 输入框中粘贴下面的包名(已带版本号):
107
107
 
108
108
  ```text
109
- dsh-codex-subscription@2.6.4
109
+ dsh-codex-subscription@2.6.6
110
110
  ```
111
111
 
112
112
  3. 点击 **安装**,等待安装完成;按页面提示操作,需要重启时先保存工作。
@@ -118,7 +118,7 @@
118
118
  <summary>终端安装(已能运行 dsh 命令)</summary>
119
119
 
120
120
  ```sh
121
- dsh plugin --profile web add dsh-codex-subscription@2.6.4
121
+ dsh plugin --profile web add dsh-codex-subscription@2.6.6
122
122
  ```
123
123
 
124
124
  安装完成后按提示重启 DSH,再到 **设置 → Codex 订阅** 登录。插件页面和终端均由 DSH 管理安装。
@@ -131,7 +131,7 @@ dsh plugin --profile web add dsh-codex-subscription@2.6.4
131
131
  先在 Web 中完成登录并选择一次 Codex 模型,再把同一个插件安装到 Headless profile:
132
132
 
133
133
  ```sh
134
- dsh plugin --profile headless add dsh-codex-subscription@2.6.4
134
+ dsh plugin --profile headless add dsh-codex-subscription@2.6.6
135
135
  dsh --profile headless "只回复:ok"
136
136
  ```
137
137
 
@@ -295,7 +295,7 @@ DSH 实机设置截图。
295
295
  <summary>终端方式</summary>
296
296
 
297
297
  ```sh
298
- dsh plugin --profile web update dsh-codex-subscription@2.6.4
298
+ dsh plugin --profile web update dsh-codex-subscription@2.6.6
299
299
  ```
300
300
 
301
301
  仅在需要卸载时运行:
@@ -311,7 +311,7 @@ dsh plugin --profile web remove dsh-codex-subscription
311
311
  <details>
312
312
  <summary>DSH 0.2.0-rc.2 提示插件不兼容?</summary>
313
313
 
314
- 2.2.10 之前的所有版本发布时 DSH 0.2.0-rc.2 还不存在,其兼容声明无法事后修改。请安装 2.2.10 或更高版本(只填包名时,发布满 24 小时前可能装到旧版,请直接填 `dsh-codex-subscription@2.2.10`):在 **插件** 页面更新,或运行 `dsh plugin --profile web update dsh-codex-subscription@2.6.4`,然后重启 DSH。
314
+ 2.2.10 之前的所有版本发布时 DSH 0.2.0-rc.2 还不存在,其兼容声明无法事后修改。请安装 2.2.10 或更高版本(只填包名时,发布满 24 小时前可能装到旧版,请直接填 `dsh-codex-subscription@2.2.10`):在 **插件** 页面更新,或运行 `dsh plugin --profile web update dsh-codex-subscription@2.6.6`,然后重启 DSH。
315
315
 
316
316
  </details>
317
317
 
package/lib/client.js CHANGED
@@ -9153,7 +9153,7 @@ window.__ModuleLoader__.load({
9153
9153
  }
9154
9154
  //#endregion
9155
9155
  //#region src/version.js
9156
- const PACKAGE_VERSION = "2.6.4";
9156
+ const PACKAGE_VERSION = "2.6.6";
9157
9157
  //#endregion
9158
9158
  //#region src/client-recovery.js
9159
9159
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
package/lib/index.js CHANGED
@@ -2080,7 +2080,7 @@ function inheritedOriginalImageRef(session, assetId) {
2080
2080
  }
2081
2081
  //#endregion
2082
2082
  //#region src/version.js
2083
- const PACKAGE_VERSION = "2.6.4";
2083
+ const PACKAGE_VERSION = "2.6.6";
2084
2084
  const USER_AGENT = `dsh-codex-subscription/${PACKAGE_VERSION}`;
2085
2085
  //#endregion
2086
2086
  //#region src/codex-images.js
@@ -3638,10 +3638,13 @@ function createCodexRpcHandler(coordinator, options = {}) {
3638
3638
  }
3639
3639
  //#endregion
3640
3640
  //#region src/transport-failure.js
3641
+ const TRANSIENT_WEBSOCKET_CLOSE = /^WebSocket closed (?:1006|1011|1012|1013)(?:\s|$)/;
3642
+ const GATEWAY_REPLAY_BUFFER_EXCEEDED = /^\s*exceeded request buffer limit while retrying upstream\s*$/;
3641
3643
  function normalizeTransportEvent(event, signal) {
3642
3644
  if (signal?.aborted || event?.type !== "error" || event.reason !== "error") return event;
3643
3645
  const message = event.error?.errorMessage;
3644
- if (typeof message !== "string" || !/^WebSocket closed (?:1006|1011|1012|1013)(?:\s|$)/.test(message)) return event;
3646
+ if (typeof message !== "string") return event;
3647
+ if (!TRANSIENT_WEBSOCKET_CLOSE.test(message) && !GATEWAY_REPLAY_BUFFER_EXCEEDED.test(message)) return event;
3645
3648
  return {
3646
3649
  ...event,
3647
3650
  error: {
@@ -3900,7 +3903,8 @@ Object.freeze([
3900
3903
  "0.82.1",
3901
3904
  "0.85.1",
3902
3905
  "0.87.1",
3903
- "1.1.0"
3906
+ "1.1.0",
3907
+ "1.2.0"
3904
3908
  ]);
3905
3909
  //#endregion
3906
3910
  //#region src/model-catalog.js
@@ -5377,7 +5381,7 @@ function createWakeSignal() {
5377
5381
  };
5378
5382
  }
5379
5383
  function shortResetDelay(usage, nowMs, maxWaitMs, resetMarginMs) {
5380
- if (typeof usage?.rateLimitReachedType === "string" && /^(?:workspace_|.*credits_depleted)/u.test(usage.rateLimitReachedType)) return void 0;
5384
+ if (typeof usage?.rateLimitReachedType === "string" && /^workspace_[a-z_]*usage_limit_reached$/u.test(usage.rateLimitReachedType)) return void 0;
5381
5385
  let latestDelayMs;
5382
5386
  for (const limit of usage?.rateLimits ?? []) {
5383
5387
  if (limit?.id !== "codex") continue;
@@ -5441,6 +5445,29 @@ async function waitForResetOrWake(delayMs, signal, wait, wakeSignal, revision) {
5441
5445
  controller.abort();
5442
5446
  return result;
5443
5447
  }
5448
+ async function modelsReadyOrCancelled(modelsReady, signal) {
5449
+ if (signal?.aborted) return "cancelled";
5450
+ let onAbort;
5451
+ const cancelled = new Promise((resolve) => {
5452
+ onAbort = () => resolve("cancelled");
5453
+ signal?.addEventListener("abort", onAbort, { once: true });
5454
+ });
5455
+ const ready = Promise.resolve().then(modelsReady).then((value) => value === true, () => false);
5456
+ try {
5457
+ return await Promise.race([ready, cancelled]);
5458
+ } finally {
5459
+ signal?.removeEventListener("abort", onAbort);
5460
+ }
5461
+ }
5462
+ /**
5463
+ * Model readiness for a retry after an account switch. The refresh joins the
5464
+ * switch's own catalog reload and is not tied to the turn, so cancelling one
5465
+ * turn never aborts the reload other consumers share.
5466
+ */
5467
+ const catalogModelsReady = (modelCatalog) => async () => {
5468
+ await modelCatalog.refresh();
5469
+ return modelCatalog.getModels().length > 0;
5470
+ };
5444
5471
  /**
5445
5472
  * Recover a Codex subscription RATE_LIMIT only when the backend confirms an
5446
5473
  * exhausted short quota window whose reset is close enough to wait out.
@@ -5449,9 +5476,9 @@ async function waitForResetOrWake(delayMs, signal, wait, wakeSignal, revision) {
5449
5476
  * the host's standard model-retry surface event so the turn shows the reason,
5450
5477
  * countdown, and normal turn cancellation affordance while it is parked.
5451
5478
  */
5452
- function createCodexQuotaRetryHandler({ usageReader, provider = "openai-codex", enabled = () => true, now = Date.now, wait = cancellableDelay, maxWaitMs = DEFAULT_MAX_WAIT_MS, resetMarginMs = DEFAULT_RESET_MARGIN_MS } = {}) {
5479
+ function createCodexQuotaRetryHandler({ usageReader, provider = "openai-codex", enabled = () => true, now = Date.now, wait = cancellableDelay, modelsReady = () => true, maxWaitMs = DEFAULT_MAX_WAIT_MS, resetMarginMs = DEFAULT_RESET_MARGIN_MS } = {}) {
5453
5480
  if (usageReader === void 0 || typeof usageReader.read !== "function") throw new TypeError("quota retry requires a usage reader");
5454
- if (typeof enabled !== "function" || typeof now !== "function" || typeof wait !== "function") throw new TypeError("quota retry requires enablement, clock, and wait functions");
5481
+ if (typeof enabled !== "function" || typeof now !== "function" || typeof wait !== "function" || typeof modelsReady !== "function") throw new TypeError("quota retry requires enablement, clock, wait, and model readiness functions");
5455
5482
  if (!Number.isFinite(maxWaitMs) || maxWaitMs <= 0 || !Number.isFinite(resetMarginMs) || resetMarginMs < 0) throw new TypeError("quota retry requires a positive wait cap and non-negative reset margin");
5456
5483
  const wakeSignal = createWakeSignal();
5457
5484
  const clearCache = async () => {
@@ -5491,6 +5518,12 @@ function createCodexQuotaRetryHandler({ usageReader, provider = "openai-codex",
5491
5518
  const reason = await waitForResetOrWake(resetDelayMs + resetMarginMs, signal, wait, wakeSignal, wakeRevision);
5492
5519
  if (reason === "cancelled" || signal?.aborted) return void 0;
5493
5520
  if (!enabled()) return next();
5521
+ if (reason === "account") {
5522
+ const ready = await modelsReadyOrCancelled(modelsReady, signal);
5523
+ if (ready === "cancelled" || signal?.aborted) return void 0;
5524
+ if (!ready) return next();
5525
+ break;
5526
+ }
5494
5527
  if (reason !== "configuration") break;
5495
5528
  wakeRevision = wakeSignal.revision();
5496
5529
  resetDelayMs = shortResetDelay(usage, now(), maxWaitMs, resetMarginMs);
@@ -6771,7 +6804,8 @@ function apply(ctx, config = {}) {
6771
6804
  const activeQuotaRetries = /* @__PURE__ */ new Set();
6772
6805
  const quotaRetryHandler = createCodexQuotaRetryHandler({
6773
6806
  usageReader,
6774
- enabled: () => normalizeAutoQuotaRetry(settings.get()[AUTO_QUOTA_RETRY_FIELD])
6807
+ enabled: () => normalizeAutoQuotaRetry(settings.get()[AUTO_QUOTA_RETRY_FIELD]),
6808
+ modelsReady: catalogModelsReady(modelCatalog)
6775
6809
  });
6776
6810
  const disposeQuotaRetry = ctx.on("agent/request-error", (payload, next) => {
6777
6811
  if (quotaRetryLifetime.signal.aborted) return Promise.resolve(void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codex-subscription",
3
- "version": "2.6.4",
3
+ "version": "2.6.6",
4
4
  "description": "Use ChatGPT and Codex subscriptions in DeepSeek Harness with OAuth, quota, safe resets, web search, images, and Fast mode",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -93,7 +93,7 @@
93
93
  "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || 0.1.5-alpha.1 || 0.1.5-alpha.2 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
94
94
  "@deepseek-ai/dsh-web": "0.1.2-rc.1 || 0.1.5-alpha.1 || 0.1.5-alpha.2 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
95
95
  "@deepseek-ai/schemastery": "3.18.1 || ^3.18.2",
96
- "@earendil-works/pi-ai": "0.82.1 || 0.85.1 || 0.87.1 || 1.1.0",
96
+ "@earendil-works/pi-ai": "0.82.1 || 0.85.1 || 0.87.1 || 1.1.0 || 1.2.0",
97
97
  "react": "^18.2.0",
98
98
  "react-dom": "^18.2.0",
99
99
  "@deepseek-ai/dsh-subagent-codex": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2"