@eddyskywalker/dsh-chatgpt-subscription 0.6.8 → 0.7.0

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
+ - **修「0.1.6 上 dispatch 预设挂载失败」**:harness 0.1.6 把 workflow 引擎的包名从 `@deepseek-ai/dsh-workflow-worker-thread` 改成 `@deepseek-ai/dsh-workflow-ptc`,preset-sync 靠探测当前安装能解析哪个拼写来改写预设行;但探测根只看 profile 目录、cwd 与插件自身目录,而标准装法下 harness 是全局 npm 安装、插件在 profile 的 pnpm 树里,Node 从插件位置解析不到 harness 嵌套的 `node_modules`——两个拼写都"解析不到"时按设计不改写,旧名字原样同步进 `~/.dsh/.agent-presets`,预设挂载即报 `names a plugin that cannot be resolved`。0.1.5 上无需改写,故障完全隐形。`candidatePackageRoots` 新增 harness CLI 入口脚本(`process.argv[1]`,经 realpath 解 bin shim 与相对路径)所在目录作为候选根:它必然位于 harness 安装树内,向上走即达 harness 自带包。改写仍是双向的,0.1.5 行为不变(旧名可解析故保留)。新增 2 条用例:入口脚本旁的 harness 包可达、入口缺失或悬空不抛错。
6
+ - **修复 ChatGPT 线路的网页搜索不可用**(实机 sighting:对话里执行「网页搜索」直接报 `Error: ChatGPT subscription credentials are required for Codex search.`,连本仓库自己的检索也一起失败):
7
+ - **根因是「取号」与「取凭据」两件事被合并成了一条路径**。ChatGPT 号池为了在 429 之前就跳过已用尽的账号,会在按账号缓存到「Codex 窗口已用尽」时把该账号移出轮换(`account-pool-core.getEffectiveAccount` → `isEligible`)。而 OAuth 服务的 `credentials()` 过去**只有这一条路径**,于是 `codex-search` / `codex-fetch` / `codex-images` 和配额卡片全都拿不到凭据。实测确认:窗口打满时 `oauth.credentials()` 抛 `LlmError(RATE_LIMIT)`,而**同一个 token 直接打 `/alpha/search` 却能正常返回结果**——搜索并不计入 Codex 限流窗口,被挡住的只是调度,不是凭据。
8
+ - **区分「调度问题」与「凭据问题」**:号池内核新增 `getCredentialAccount()`,只按凭据本身是否可用(`authStatus`、被拒绝的 refresh token)判断,**忽略冷却与本次请求的 tried 集合**;OAuth 服务新增 `credentials(force, { purpose: 'tool' | 'request' })`,`'tool'` 走前者,且只刷新它选中的那个账号(不会为了取凭据而轮换会话账号,也不写 `lastUsedAt` / `activeAccountId`)。模型请求仍走原有严格路径,配额门控不受影响。
9
+ - **刷新后的轮换令牌必须落盘**:tool 路径若在临近过期时刷新,会把新凭据写回号池并镜像主账号——否则池里留下的就是上游已作废的 refresh token。
10
+ - **报错不再误导**:搜索的凭据失败现在按原因分流——配额/限流是 `WEB_PROVIDER_RATE_LIMITED`,文案为「Codex search is rate limited」并带上底层原因;需要重新登录才是 `WEB_PROVIDER_CREDENTIAL_MISSING`。图片工具的凭据错误同样附带底层原因。此前一律说「credentials are required」,把「额度用尽」指向了「去登录」。
11
+ - **配额卡片自身也被这条路径挡住**:窗口打满后卡片显示「ChatGPT credentials could not be refreshed」并停在上次快照——最该解释额度耗尽的界面反而最先失效。`UsageService` 的所有凭据读取改为 tool 用途后,卡片能继续展示真实用量。
12
+ - 新增 15 条回归测试:号池内核 7 条(冷却中仍可取凭据、忽略 tried 集合、固定账号生效、已失效凭据仍拒绝、不移动会话轮换、刷新并落盘、空池提示)、号池 + OAuth 端到端 2 条(打满窗口下 tool 可取凭据且配额卡片仍 `ready`、「tool 不轮换会话账号」)、搜索提供方 5 条(以 tool 用途取凭据、401 重试、限流/登录/存储三类失败的正确 code 与文案)、配额服务 1 条。全部用真实号池接线而非 mock,因此锁定的是调用链本身。
5
13
  - **新增 WorkBuddy 线路**(`workbuddy-subscription` Provider),接入腾讯 WorkBuddy / CodeBuddy 订阅,成为本插件的第五条线路。该 ID 与用户自定义 OpenAI 兼容 Provider 常用的 `workbuddy` 分开,因此二者可同时安装和选择。既可直接复用 CodeBuddy 桌面端登录态,也可按国区/国际区通过官方浏览器授权添加账号;后者存入 Windows DPAPI / macOS Keychain / Linux Secret Service。插件托管账号可删除,桌面账号只能隐藏/恢复且绝不删除原凭据文件。
6
14
  - **凭据来源**:扫描桌面端的 `*.info` 凭据文件(`CODEBUDDY_AUTH_DIR` 可覆盖,与官方工具链一致)。目录里通常混着当前凭据与若干带时间戳的历史快照,选取顺序是**规范文件名优先,其余按 token 剩余有效期取最长**——只按 mtime 选会选到过期快照(开发过程中确实选到过)。扫描失败的单个文件被跳过而不是让整次扫描失败;`/status` 每次都重扫,避免缓存掩盖刚登录的凭据。
7
15
  - **续期回写**:token 临近过期时调 `/v2/plugin/auth/token/refresh`,并把新 token **原子写回原文件**(只改 `auth` 块,保留桌面端自己的字段),以免桌面端掉线。同进程并发调用**共用一次刷新**——refresh token 会轮换,两次并发刷新会互相作废。写回失败不影响本次请求。
package/lib/index.js CHANGED
@@ -2,12 +2,12 @@ import { createRequire } from "node:module";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import * as LlmModule from "@deepseek-ai/dsh-llm";
4
4
  import { HarnessError, LlmAdapter, LlmError, ProviderRequestId, ReasoningEffortId, attributionHeaders, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
5
- import path, { basename, dirname, join, relative } from "node:path";
5
+ import path, { basename, dirname, join, relative, resolve } from "node:path";
6
6
  import os, { homedir } from "node:os";
7
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
8
8
  import { isDeepStrictEqual } from "node:util";
9
9
  import { execSync, spawn } from "node:child_process";
10
- import fs, { appendFileSync, constants, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, utimesSync, writeFileSync } from "node:fs";
10
+ import fs, { appendFileSync, constants, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, utimesSync, writeFileSync } from "node:fs";
11
11
  import fsPromises, { chmod, lstat, mkdir, open, rename, stat, unlink } from "node:fs/promises";
12
12
  import http, { createServer } from "node:http";
13
13
  import { WebError } from "@deepseek-ai/dsh-web";
@@ -887,6 +887,84 @@ var AccountPoolCore = class {
887
887
  return data.accounts.some((account) => this.isEligible(account, now, triedAccountIds));
888
888
  }
889
889
  /**
890
+ * Read one account's credential for work that is *not* a metered model
891
+ * request, without letting rotation state stand in the way.
892
+ *
893
+ * There are two different questions, and conflating them broke both:
894
+ *
895
+ * - "which account should serve this request?" — a routing decision, answered
896
+ * by {@link getEffectiveAccount} through cooldowns, auth status and the
897
+ * rotation strategy.
898
+ * - "may I have a usable ChatGPT credential?" — a credential question, asked
899
+ * by the web search, web fetch and image tools.
900
+ *
901
+ * A spent Codex rate-limit window says nothing about the other ChatGPT
902
+ * endpoints: search, fetch and image generation are not metered against it and
903
+ * keep working with the very same token. Routing those tools through
904
+ * {@link getEffectiveAccount} made one exhausted window fail all of them —
905
+ * and reported it as "credentials are required", which sent people looking for
906
+ * a sign-in problem they did not have.
907
+ *
908
+ * A credential that is *known* to be unusable is still refused (a rejected
909
+ * refresh token, an account the upstream already rejected at sign-in); only
910
+ * cooldowns — which are rotation bookkeeping — are ignored.
911
+ *
912
+ * @param fetchFn - fetch used if the credential is close to expiry.
913
+ */
914
+ async getCredentialAccount(fetchFn = fetch) {
915
+ const data = await this.read();
916
+ if (data.accounts.length === 0) throw new Error(this.hooks.emptyMessage ?? `未登录 ${this.hooks.displayName} 账号,请先在设置页添加账号。`);
917
+ const now = Date.now();
918
+ const usable = data.accounts.filter((account) => this.isCredentialUsable(account));
919
+ if (usable.length === 0) throw new LlmError(`全部 ${data.accounts.length} 个 ${this.hooks.displayName} 账号均需要重新登录。`, "AUTH", { status: 401 });
920
+ const selected = this.selectAccount(usable, data);
921
+ if (this.shouldRefreshCredential(selected, now) && this.hooks.refresh) {
922
+ const refreshed = await this.hooks.refresh(selected.credentials, fetchFn);
923
+ await this.updateAccountCredentials(selected.id, refreshed);
924
+ return {
925
+ account: selected,
926
+ credentials: refreshed
927
+ };
928
+ }
929
+ return {
930
+ account: selected,
931
+ credentials: selected.credentials
932
+ };
933
+ }
934
+ /** Whether one account's credential must be refreshed before it is handed out. */
935
+ shouldRefreshCredential(account, now) {
936
+ if (this.hooks.needsRefresh) return this.hooks.needsRefresh(account.credentials, now);
937
+ const expires = this.hooks.expiresAt?.(account.credentials);
938
+ return expires !== void 0 && expires <= now + 6e4;
939
+ }
940
+ /**
941
+ * Whether an account's stored credential is known to be unusable.
942
+ *
943
+ * Rotation bookkeeping — cooldowns, the tried set — is deliberately absent:
944
+ * those describe routing, not the credential.
945
+ */
946
+ isCredentialUsable(account) {
947
+ if (account.authStatus !== void 0 && account.authStatus !== "ok") return false;
948
+ if (this.hooks.authRejectedReason?.(account.credentials)) return false;
949
+ return true;
950
+ }
951
+ /** The account a rotation strategy picks out of an already-eligible set. */
952
+ selectAccount(eligible, data) {
953
+ const pinned = this.hooks.preferAccountId?.() ?? null;
954
+ const pinnedAccount = pinned === null ? void 0 : eligible.find((account) => account.id === pinned);
955
+ if (pinnedAccount !== void 0) return pinnedAccount;
956
+ if (data.rotationStrategy === "round-robin") return [...eligible].sort((a, b) => (a.lastUsedAt || 0) - (b.lastUsedAt || 0))[0];
957
+ if (data.rotationStrategy === "sticky") return eligible.find((account) => account.id === data.activeAccountId) || eligible.find((account) => account.isPrimary) || eligible[0];
958
+ return eligible.find((account) => account.isPrimary) || eligible[0];
959
+ }
960
+ /** The error every-account-unavailable raises, including the shortest wait. */
961
+ allUnavailableError(data, now) {
962
+ let shortest = Infinity;
963
+ for (const account of data.accounts) if (account.cooldownUntil !== void 0 && account.cooldownUntil > now) shortest = Math.min(shortest, account.cooldownUntil - now);
964
+ const waitMinutes = Number.isFinite(shortest) ? Math.ceil(shortest / 6e4) : 15;
965
+ return new LlmError(this.hooks.allUnavailableMessage?.(data.accounts.length, waitMinutes) ?? `全部 ${data.accounts.length} 个 ${this.hooks.displayName} 账号均处于配额限制或冷却中 (429)。最短预计在 ${waitMinutes} 分钟后解除冷却。`, "RATE_LIMIT", { status: 429 });
966
+ }
967
+ /**
890
968
  * Pick the account for the next request, refreshing its credential when it is
891
969
  * about to expire.
892
970
  *
@@ -900,23 +978,9 @@ var AccountPoolCore = class {
900
978
  if (data.accounts.length === 0) throw new Error(this.hooks.emptyMessage ?? `未登录 ${this.hooks.displayName} 账号,请先在设置页添加账号。`);
901
979
  const now = Date.now();
902
980
  const eligible = data.accounts.filter((account) => this.isEligible(account, now, excludeIds));
903
- if (eligible.length === 0) {
904
- let shortest = Infinity;
905
- for (const account of data.accounts) if (account.cooldownUntil !== void 0 && account.cooldownUntil > now) shortest = Math.min(shortest, account.cooldownUntil - now);
906
- const waitMinutes = Number.isFinite(shortest) ? Math.ceil(shortest / 6e4) : 15;
907
- throw new LlmError(this.hooks.allUnavailableMessage?.(data.accounts.length, waitMinutes) ?? `全部 ${data.accounts.length} 个 ${this.hooks.displayName} 账号均处于配额限制或冷却中 (429)。最短预计在 ${waitMinutes} 分钟后解除冷却。`, "RATE_LIMIT", { status: 429 });
908
- }
909
- const pinned = this.hooks.preferAccountId?.() ?? null;
910
- const pinnedAccount = pinned === null ? void 0 : eligible.find((account) => account.id === pinned);
911
- let selected;
912
- if (pinnedAccount !== void 0) selected = pinnedAccount;
913
- else if (data.rotationStrategy === "round-robin") selected = [...eligible].sort((a, b) => (a.lastUsedAt || 0) - (b.lastUsedAt || 0))[0];
914
- else if (data.rotationStrategy === "sticky") selected = eligible.find((account) => account.id === data.activeAccountId) || eligible.find((account) => account.isPrimary) || eligible[0];
915
- else selected = eligible.find((account) => account.isPrimary) || eligible[0];
916
- if ((this.hooks.needsRefresh ? this.hooks.needsRefresh(selected.credentials, now) : (() => {
917
- const expires = this.hooks.expiresAt?.(selected.credentials);
918
- return expires !== void 0 && expires <= now + 6e4;
919
- })()) && this.hooks.refresh) {
981
+ if (eligible.length === 0) throw this.allUnavailableError(data, now);
982
+ const selected = this.selectAccount(eligible, data);
983
+ if (this.shouldRefreshCredential(selected, now) && this.hooks.refresh) {
920
984
  let refreshed;
921
985
  try {
922
986
  refreshed = await this.hooks.refresh(selected.credentials, fetchFn);
@@ -1335,8 +1399,26 @@ var OAuthService = class {
1335
1399
  this.lastLoginError = void 0;
1336
1400
  this.logger.info("[dsh-chatgpt-subscription] OAuth credentials cleared");
1337
1401
  }
1338
- async credentials(forceRefresh = false) {
1402
+ /**
1403
+ * The credential to use next.
1404
+ *
1405
+ * @param forceRefresh - refresh even a token that is not close to expiry,
1406
+ * which is how a 401 discovered mid-request recovers.
1407
+ * @param access - who is asking. A `'tool'` caller (web search, fetch, image
1408
+ * generation) bypasses the pool's rotation state: an account cooling down
1409
+ * after a Codex 429 still holds a working token for those endpoints, and
1410
+ * refusing it there turned "your Codex window is spent" into a bogus
1411
+ * "credentials are required" on every web search.
1412
+ */
1413
+ async credentials(forceRefresh = false, access = {}) {
1339
1414
  if (this.pool !== null) {
1415
+ if (access.purpose === "tool") {
1416
+ const { account, credentials } = await this.pool.getCredentialAccount(this.fetchFn);
1417
+ if (!forceRefresh) return credentials;
1418
+ const refreshed = await this.refreshAccount(credentials, this.fetchFn);
1419
+ await this.pool.updateAccountCredentials(account.id, refreshed);
1420
+ return refreshed;
1421
+ }
1340
1422
  const { account, credentials } = await this.pool.getEffectiveAccount(void 0, this.fetchFn);
1341
1423
  if (!forceRefresh) return credentials;
1342
1424
  const refreshed = await this.refreshAccount(credentials, this.fetchFn);
@@ -2266,9 +2348,9 @@ function createCodexImageTool(oauth, attachments, options = {}) {
2266
2348
  }
2267
2349
  async function imageCredentials(oauth, force = false) {
2268
2350
  try {
2269
- return await oauth.credentials(force);
2351
+ return await oauth.credentials(force, { purpose: "tool" });
2270
2352
  } catch (error) {
2271
- throw new HarnessError("ChatGPT subscription credentials are required for Codex image generation.", "CODEX_IMAGE_CREDENTIAL_MISSING", { cause: error });
2353
+ throw new HarnessError(`ChatGPT subscription credentials are required for Codex image generation.${error instanceof Error && error.message !== "" ? ` (${error.message})` : ""}`, "CODEX_IMAGE_CREDENTIAL_MISSING", { cause: error });
2272
2354
  }
2273
2355
  }
2274
2356
  function requestImage(fetchFn, credentials, prompt, turnId, signal) {
@@ -2351,11 +2433,26 @@ function createCodexSearchProvider(oauth, options = {}) {
2351
2433
  }
2352
2434
  async function searchCredentials(oauth, force = false) {
2353
2435
  try {
2354
- return await oauth.credentials(force);
2436
+ return await oauth.credentials(force, { purpose: "tool" });
2355
2437
  } catch (error) {
2356
- throw new WebError("ChatGPT subscription credentials are required for Codex search.", "WEB_PROVIDER_CREDENTIAL_MISSING", { cause: error });
2438
+ throw credentialError(error);
2357
2439
  }
2358
2440
  }
2441
+ /**
2442
+ * Map a credential failure onto the right web error.
2443
+ *
2444
+ * The old single mapping called every failure "credentials are required", so
2445
+ * an unavailable account sent the user hunting for a sign-in problem they did
2446
+ * not have. The provider's own code is preserved and the reason is carried
2447
+ * through, because the two failures need opposite actions: refill the quota
2448
+ * versus sign in again.
2449
+ */
2450
+ function credentialError(error) {
2451
+ const reason = error instanceof Error && error.message !== "" ? error.message : "";
2452
+ if (error instanceof LlmError && error.code === "RATE_LIMIT") return new WebError(reason === "" ? "Codex search is rate limited." : `Codex search is rate limited. ${reason}`, "WEB_PROVIDER_RATE_LIMITED", { cause: error });
2453
+ if (error instanceof LlmError && (error.code === "AUTH" || error.code === "INVALID_CREDENTIAL")) return new WebError(reason === "" ? "Sign in with ChatGPT to use Codex search." : `Sign in with ChatGPT to use Codex search. ${reason}`, "WEB_PROVIDER_CREDENTIAL_MISSING", { cause: error });
2454
+ return new WebError(reason === "" ? "ChatGPT subscription credentials are required for Codex search." : `ChatGPT subscription credentials are required for Codex search. (${reason})`, "WEB_PROVIDER_CREDENTIAL_MISSING", { cause: error });
2455
+ }
2359
2456
  function sendSearch(fetchFn, credentials, query, model, id, signal) {
2360
2457
  return fetchFn(CODEX_SEARCH_URL, {
2361
2458
  method: "POST",
@@ -3852,6 +3949,15 @@ function acceptIdentity(current, incoming) {
3852
3949
  }
3853
3950
  //#endregion
3854
3951
  //#region src/host/usage-service.ts
3952
+ /**
3953
+ * The quota card reads the same account the conversation uses, but it must keep
3954
+ * reading it while that account is cooling down — otherwise the card that exists
3955
+ * to explain a spent window is the first thing the spent window breaks.
3956
+ *
3957
+ * Every credential this service asks for is therefore a `'tool'` read: not a
3958
+ * metered model request, so rotation cooldowns do not apply.
3959
+ */
3960
+ const USAGE_CREDENTIAL_ACCESS = { purpose: "tool" };
3855
3961
  const EMPTY_USAGE = {
3856
3962
  buckets: [],
3857
3963
  credits: null,
@@ -3885,7 +3991,7 @@ var UsageService = class {
3885
3991
  const now = this.now();
3886
3992
  let credentials;
3887
3993
  try {
3888
- credentials = await this.oauth.credentials();
3994
+ credentials = await this.oauth.credentials(false, USAGE_CREDENTIAL_ACCESS);
3889
3995
  } catch (error) {
3890
3996
  const reason = error instanceof Error && error.message !== "" ? ` (${error.message})` : "";
3891
3997
  return this.failure({
@@ -3963,11 +4069,11 @@ var UsageService = class {
3963
4069
  async consumeResetCreditUpstream() {
3964
4070
  let credentials;
3965
4071
  try {
3966
- credentials = await this.oauth.credentials();
4072
+ credentials = await this.oauth.credentials(false, USAGE_CREDENTIAL_ACCESS);
3967
4073
  let creditsResponse = await this.fetchResetCredits(credentials);
3968
4074
  if (creditsResponse.status === 401) {
3969
4075
  await creditsResponse.body?.cancel().catch(() => void 0);
3970
- credentials = await this.oauth.credentials(true);
4076
+ credentials = await this.oauth.credentials(true, USAGE_CREDENTIAL_ACCESS);
3971
4077
  creditsResponse = await this.fetchResetCredits(credentials);
3972
4078
  }
3973
4079
  if (!creditsResponse.ok) {
@@ -3998,7 +4104,7 @@ var UsageService = class {
3998
4104
  });
3999
4105
  if (consumeResponse.status === 401) {
4000
4106
  await consumeResponse.body?.cancel().catch(() => void 0);
4001
- credentials = await this.oauth.credentials(true);
4107
+ credentials = await this.oauth.credentials(true, USAGE_CREDENTIAL_ACCESS);
4002
4108
  consumeResponse = await this.fetchFn(CODEX_RESET_CREDITS_CONSUME_URL, {
4003
4109
  method: "POST",
4004
4110
  headers: {
@@ -4057,7 +4163,7 @@ var UsageService = class {
4057
4163
  let response = await this.fetch(credentials);
4058
4164
  if (response.status === 401) {
4059
4165
  await response.body?.cancel().catch(() => void 0);
4060
- credentials = await this.oauth.credentials(true);
4166
+ credentials = await this.oauth.credentials(true, USAGE_CREDENTIAL_ACCESS);
4061
4167
  accountKey = identityKey(credentials);
4062
4168
  response = await this.fetch(credentials);
4063
4169
  }
@@ -20594,10 +20700,36 @@ function dshHomeDir$1() {
20594
20700
  return process.env.DSH_HOME?.trim() || join(homedir(), ".dsh");
20595
20701
  }
20596
20702
  /**
20703
+ * The harness entry script's directory, when this process is the harness.
20704
+ *
20705
+ * The harness keeps its own packages in the `node_modules` tree of its
20706
+ * installation — a global npm prefix, an npx cache, or a checkout — which no
20707
+ * profile directory, cwd, or plugin package root necessarily reaches: the
20708
+ * plugin lives in the profile's own dependency tree, and Node resolution from
20709
+ * here never crosses into the harness's. The CLI entry script always sits
20710
+ * inside that tree, so its directory is the one candidate guaranteed to reach
20711
+ * the packages the harness ships. Symlinks are resolved because an npm bin
20712
+ * shim may point into the tree from outside it.
20713
+ * @param entryScript - `process.argv[1]` of the running harness.
20714
+ * @returns the entry script's real directory, or `undefined` when there is none.
20715
+ */
20716
+ function harnessEntryDir(entryScript) {
20717
+ if (!entryScript) return void 0;
20718
+ const absolute = resolve(entryScript);
20719
+ try {
20720
+ return dirname(realpathSync(absolute));
20721
+ } catch {
20722
+ return dirname(absolute);
20723
+ }
20724
+ }
20725
+ /**
20597
20726
  * Candidate directories where the running harness or profile packages reside.
20727
+ * @param entryScript - harness CLI entry script, defaults to this process's.
20598
20728
  */
20599
- function candidatePackageRoots() {
20729
+ function candidatePackageRoots(entryScript = process.argv[1]) {
20600
20730
  const roots = /* @__PURE__ */ new Set();
20731
+ const entryDir = harnessEntryDir(entryScript);
20732
+ if (entryDir !== void 0) roots.add(entryDir);
20601
20733
  const profilesDir = join(dshHomeDir$1(), "profiles");
20602
20734
  if (existsSync(profilesDir)) {
20603
20735
  roots.add(profilesDir);
@@ -1 +1 @@
1
- {"version":3,"file":"codex-search.d.ts","sourceRoot":"","sources":["../../../src/host/codex-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,iBAAiB,EAAqE,MAAM,sBAAsB,CAAA;AAM1I,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,KAAK,SAAS,GAAG,OAAO,KAAK,CAAA;AAE7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,MAAM,CAAA;CACzB;AAID,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,0BAA+B,GACvC,iBAAiB,CA8BnB"}
1
+ {"version":3,"file":"codex-search.d.ts","sourceRoot":"","sources":["../../../src/host/codex-search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,iBAAiB,EAAqE,MAAM,sBAAsB,CAAA;AAM1I,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,KAAK,SAAS,GAAG,OAAO,KAAK,CAAA;AAE7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,MAAM,CAAA;CACzB;AAID,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,0BAA+B,GACvC,iBAAiB,CA8BnB"}
@@ -180,6 +180,48 @@ export declare class AccountPoolCore<TCredentials, TAccount extends PoolAccountS
180
180
  /** Whether an account may serve a request right now. */
181
181
  protected isEligible(account: TAccount, now: number, triedAccountIds?: ReadonlySet<string>): boolean;
182
182
  hasAnotherAvailableAccount(triedAccountIds: ReadonlySet<string>): Promise<boolean>;
183
+ /**
184
+ * Read one account's credential for work that is *not* a metered model
185
+ * request, without letting rotation state stand in the way.
186
+ *
187
+ * There are two different questions, and conflating them broke both:
188
+ *
189
+ * - "which account should serve this request?" — a routing decision, answered
190
+ * by {@link getEffectiveAccount} through cooldowns, auth status and the
191
+ * rotation strategy.
192
+ * - "may I have a usable ChatGPT credential?" — a credential question, asked
193
+ * by the web search, web fetch and image tools.
194
+ *
195
+ * A spent Codex rate-limit window says nothing about the other ChatGPT
196
+ * endpoints: search, fetch and image generation are not metered against it and
197
+ * keep working with the very same token. Routing those tools through
198
+ * {@link getEffectiveAccount} made one exhausted window fail all of them —
199
+ * and reported it as "credentials are required", which sent people looking for
200
+ * a sign-in problem they did not have.
201
+ *
202
+ * A credential that is *known* to be unusable is still refused (a rejected
203
+ * refresh token, an account the upstream already rejected at sign-in); only
204
+ * cooldowns — which are rotation bookkeeping — are ignored.
205
+ *
206
+ * @param fetchFn - fetch used if the credential is close to expiry.
207
+ */
208
+ getCredentialAccount(fetchFn?: typeof fetch): Promise<{
209
+ account: TAccount;
210
+ credentials: TCredentials;
211
+ }>;
212
+ /** Whether one account's credential must be refreshed before it is handed out. */
213
+ private shouldRefreshCredential;
214
+ /**
215
+ * Whether an account's stored credential is known to be unusable.
216
+ *
217
+ * Rotation bookkeeping — cooldowns, the tried set — is deliberately absent:
218
+ * those describe routing, not the credential.
219
+ */
220
+ protected isCredentialUsable(account: TAccount): boolean;
221
+ /** The account a rotation strategy picks out of an already-eligible set. */
222
+ private selectAccount;
223
+ /** The error every-account-unavailable raises, including the shortest wait. */
224
+ private allUnavailableError;
183
225
  /**
184
226
  * Pick the account for the next request, refreshing its credential when it is
185
227
  * about to expire.
@@ -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,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QAAQ,CAAC;QAAC,WAAW,EAAE,YAAY,CAAA;KAAE,CAAC;CAiD7D"}
@@ -26,6 +26,23 @@ export declare class OAuthServiceError extends Error {
26
26
  /** Token-endpoint status when the failure came from a response. */
27
27
  status?: number | undefined);
28
28
  }
29
+ /**
30
+ * How the credential will be used, which decides who may serve it.
31
+ *
32
+ * `'request'` (default) is a metered model request: rotation, cooldowns and the
33
+ * pool's cached-quota verdict all apply.
34
+ *
35
+ * `'tool'` is a ChatGPT call that is *not* metered against the Codex
36
+ * rate-limit window — web search, web fetch, image generation. It reads the
37
+ * account already serving the conversation and ignores cooldowns, because a
38
+ * spent Codex window must not take those tools offline; they keep working with
39
+ * the very same access token.
40
+ */
41
+ export type CredentialPurpose = 'request' | 'tool';
42
+ export interface CredentialAccess {
43
+ /** Defaults to `'request'`. */
44
+ purpose?: CredentialPurpose;
45
+ }
29
46
  export interface OAuthServiceOptions {
30
47
  fetchFn?: FetchLike;
31
48
  now?: () => number;
@@ -78,7 +95,18 @@ export declare class OAuthService {
78
95
  * is what a single "sign out" button means to a pool user.
79
96
  */
80
97
  logout(accountId?: string): Promise<void>;
81
- credentials(forceRefresh?: boolean): Promise<StoredOAuthCredentials>;
98
+ /**
99
+ * The credential to use next.
100
+ *
101
+ * @param forceRefresh - refresh even a token that is not close to expiry,
102
+ * which is how a 401 discovered mid-request recovers.
103
+ * @param access - who is asking. A `'tool'` caller (web search, fetch, image
104
+ * generation) bypasses the pool's rotation state: an account cooling down
105
+ * after a Codex 429 still holds a working token for those endpoints, and
106
+ * refusing it there turned "your Codex window is spent" into a bogus
107
+ * "credentials are required" on every web search.
108
+ */
109
+ credentials(forceRefresh?: boolean, access?: CredentialAccess): Promise<StoredOAuthCredentials>;
82
110
  dispose(): void;
83
111
  private exchangeCode;
84
112
  private refreshCredentials;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-service.d.ts","sourceRoot":"","sources":["../../../src/host/oauth-service.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,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Cd,iBAAiB;IAQ/B,OAAO,CAAC,qBAAqB;IA2C7B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,eAAe;CAGxB;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAe7E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAUjF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAE,cAAc,CAAC,MAAM,CAAc,GAAG,cAAc,CAGzG"}
@@ -27,6 +27,11 @@
27
27
  */
28
28
  /** The preset directory this package ships. */
29
29
  export declare const BUNDLED_PRESET_IDS: readonly string[];
30
+ /**
31
+ * Candidate directories where the running harness or profile packages reside.
32
+ * @param entryScript - harness CLI entry script, defaults to this process's.
33
+ */
34
+ export declare function candidatePackageRoots(entryScript?: string | undefined): string[];
30
35
  /**
31
36
  * Whether a package is installed in any candidate node_modules tree.
32
37
  * Matches DSH agent-presets' own discovery check.
@@ -1 +1 @@
1
- {"version":3,"file":"preset-sync.d.ts","sourceRoot":"","sources":["../../../src/host/preset-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAiB,CAAA;AA0EjE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,SAAS,MAAM,EAA4B,GACjD,OAAO,CAYT;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAW3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ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W,EAAE,sBAAsB,GAAG,IAAI;IAInD,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC;YAQrC,0BAA0B;IA2DlC,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC;YASpC,eAAe;IA6C7B,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,OAAO;CAGhB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC9B,QAAQ,CAAC,WAAW,EAAE,cAAc;gBAA3B,WAAW,EAAE,cAAc;CAGjD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,EAAE,CAE9D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAwB7D;AAuED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBpI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eddyskywalker/dsh-chatgpt-subscription",
3
- "version": "0.6.8",
3
+ "version": "0.7.0",
4
4
  "description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
5
5
  "author": {
6
6
  "name": "eddyskywalker",