@eddyskywalker/dsh-chatgpt-subscription 0.24.1 → 0.24.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 +16 -0
- package/icon.svg +28 -0
- package/lib/index.js +163 -23
- package/lib/types/host/antigravity/oauth.d.ts +22 -1
- package/lib/types/host/antigravity/oauth.d.ts.map +1 -1
- package/lib/types/host/antigravity/port-constants.d.ts +18 -5
- package/lib/types/host/antigravity/port-constants.d.ts.map +1 -1
- package/lib/types/host/claude/oauth.d.ts +8 -4
- package/lib/types/host/claude/oauth.d.ts.map +1 -1
- package/lib/types/host/claude/types.d.ts +20 -5
- package/lib/types/host/claude/types.d.ts.map +1 -1
- package/lib/types/host/command-code/oauth.d.ts +6 -3
- package/lib/types/host/command-code/oauth.d.ts.map +1 -1
- package/lib/types/host/command-code/types.d.ts +22 -2
- package/lib/types/host/command-code/types.d.ts.map +1 -1
- package/lib/types/host/kimi-code/adapter.d.ts +21 -4
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.24.2 - 2026-10-14
|
|
6
|
+
- **[三条登录线路] 回调端口探测窗口按「100 端口一块」的否证前提定宽,导致整段保留区把探测窗口吃穿:Windows 实测连续 277 个端口不可用,而窗口只有 128(command-code 只有 10)**
|
|
7
|
+
- **现象**:本机全量 `npx vitest run` 稳定复现 **7 failed / 3711 passed**,全部集中在 `test/antigravity-callback-port.test.ts`(5 条)与 `test/login-open-browser-seams.test.ts`(2 条),报 `No usable local port for the Antigravity sign-in callback (tried 128 ports from 51121 on localhost)`,另有一条直接 `listen EACCES: permission denied ::1:51121`。
|
|
8
|
+
- **根因(实测否证既有注释)**:`port-constants.ts` 写着「Windows 排除区最多 100 端口一块,128 覆盖任何一块」——本机实测从默认端口 51121 起**连续 277 个端口不可用**(51121-51397,`netsh` 表印证),窗口在排除区内部就耗尽,必然抛错。除静态表外还有一批**散落的单端口 EACCES**(51512/51580/51620/51840…)根本不在 `netsh` 表里,属 Hyper-V/HNS 动态保留,且会在**百毫秒尺度上出现与释放**。三个取值(`antigravity` 128、`claude` 128、`command-code` **10**)建立在同一个被否定之前提上。
|
|
9
|
+
- **失效形态三条各不相同**:`antigravity` 抛错、`claude` 返回 `null` → `beginLogin` 把用户**静默推进手动粘贴流程**(机器上明明有数百个空闲端口就在保留区后面)、`command-code` 抛错且**没有手动流程可退**,窄窗口等于登录直接死掉。
|
|
10
|
+
- **改法**:三条线路的窗口统一为 **1024**(≈实测最宽区的 3.7 倍;终点 52144 / 54716 / 6983 均远低于 65535,command-code 另有断言确保不越入 49152+ 的 OS 动态端口区)并重写被否证的注释,把 277 宽实测、失效形态与 ~0.35ms/次探测的最坏代价一并记入。`resolveCallbackPort` / `findAvailablePort` 各补一个**可选**注入式 `probe` seam(`claude` 本就已有同形参数),使「窗口契约」与「机器事实」解耦;生产默认值仍是真绑定,调用点逐字未变。`claude` 的 `probed.length <= CALLBACK_PORT_ATTEMPTS` 收紧为 `===`,`command-code` 测试里硬编码的 `5959 + 10` 改为常量推导(两侧区间断言保留,上界仍被断言)。
|
|
11
|
+
- **command-code 的 10 为什么加宽(而非保持)**:「matches the official CLI」约束的是**起点**(5959 保留且仍先试,有测试钉死字面量),不是宽度;端口经 callback URL 交给 studio,5960+ 本就是「非 CLI 端口」,加宽不引入新的端口类别;决定性是失败形态——这条线路没有手动流程可退,窗口耗尽即登录失败。
|
|
12
|
+
- **测试为什么不碰真实 socket**:曾出现「用真实 socket 拼一段连续占用区」的写法在同一棵树上**时过时不过**(40 轮 3 轮失败,且 3 次全部停在 build 期就是 EACCES 的端口上,自持有端口一次都没变)——动态保留区会在测试运行途中解禁。新用例因此**全部注入 probe**,零真实 socket、零 skip,与机器排布无关。
|
|
13
|
+
- **验证**:`npm run typecheck` 0 错误;全量 **225 passed | 1 skipped(226 文件)、3732 passed | 7 skipped、0 failed**(基线 7 failed);承重文件连跑 20 次全绿;`login-open-browser-seams.test.ts` **未改测试**,靠生产修复自然通过且真的走到了 abort 分支。承重已双向检查:常量单独还原为 128/10 时 5 条立刻失败(`expected 128 to be greater than 277`、`expected null to be 53969`、`expected 'manual' to be 'loopback'`、`No free local port … (tried 10 ports from 5959)`)。
|
|
14
|
+
- **[Kimi Code] 上游瞬时过载不再被当成账号限流:一次 `The engine is currently overloaded` 曾把唯一账号冷却 15 分钟,重试期间连一次网络请求都发不出去**
|
|
15
|
+
- **现象**:现场会话 `session-70d30e6b`(2026-10-14 20:29)一个回合以 `全部 1 个 Kimi Code 账号均处于配额限制或冷却中 (429)。最短预计在 15 分钟后解除冷却。` 失败。账号登录正常、订阅正常、额度正常,用户点一次「继续」后自行恢复。三次重试的间隔为 3.2s / 6.1s,**等于纯退避时间、零网络耗时**——请求根本没发出去。
|
|
16
|
+
- **根因(两处叠加)**:① `classifyKimiFailure` 只在正文命中 `exceeded_current_quota_error` / `insufficient balance` 等额度文案时才判为额度类,`The engine is currently overloaded, please try again later.` 一条都不匹配,于是落进 429 兜底分支得到 `RATE_LIMIT`;② adapter 的 HTTP 分支与 in-band 分支的冷却判据都是**裸状态码 `response.status === 429`**,与错误码无关,所以分类改对也拦不住冷却。过载因此被写进 `cooldownUntil`(无 `Retry-After` 时套用 `POOL_COOLDOWN_MS = 15 分钟`)并**落盘**,号池随即用 `isEligible` 把唯一账号判掉,`allUnavailableError` 拼出上面那句话。单账号号池没有第二个账号可轮转 = 一次过载直接锁死整条线路。
|
|
17
|
+
- **这与全仓约定相悖**:`glm-coding-plan/mapper-openai.ts` 早已把 `OVERLOADED` 映射为非账号级的 `SERVER`,注释写明「把过载混进 RATE_LIMIT 会让号池按限流去冷却账号,而过载根本不是某个账号的错」;`claude` 线同样按 kind 分类、不冷却过载。本线路缺这道区分是偏离,不是取舍。
|
|
18
|
+
- **改法**:新增 `UPSTREAM_OVERLOAD_PATTERNS` 按**正文**识别过载(`engine is (currently )?overloaded` / `upstream model provider is temporarily unavailable` 等,刻意保留限定语,避免吞掉将来可能出现的「本账号请求量过载」类真限流),`KimiFailureClassification` 新增 `upstreamOverload` 字段把「归属」显式带出来——`code` 只有一个、说不了「可重试」与「不属于任何账号」这两件事,`accountScoped` 只回答「能不能换号」而不回答「要不要冷却」。过载返回 `SERVER`(仍在 `retryableCodes` 内,退避重试行为不变;用 `RATE_LIMIT` 会让 UI 读出「你的账号被限流了」这个错误结论);HTTP 分支与 in-band 分支**都**加 `!failure.upstreamOverload` 排除,两条路行为一致。
|
|
19
|
+
- **验证**:`npm run typecheck` 0 错误;`test/kimi-code-adapter.test.ts` 41 例 + `test/kimi-code-account-pool.test.ts` 22 例共 63 例全绿;全量 **3732 passed | 7 skipped、0 failed**。承重已双向检查:把 `adapter.ts` 单独还原后,3 条新用例立刻失败(`expected 'RATE_LIMIT' to be 'SERVER'` 等,含「账号留在轮转里且真的重发了请求」「in-band 与 HTTP 结论一致」两条端到端断言)。
|
|
20
|
+
|
|
5
21
|
## 0.24.1 - 2026-10-14
|
|
6
22
|
- **[调度模式 & 子代理授权守卫] 插件端机制级修复模型调用 `list_subagent_models` 后仍疯狂翻找本地文件定义的问题,并全面优化预设提示词(现场会话 `session-01724ca8`)**
|
|
7
23
|
- **现象**:主模型在启动阶段已调用 `list_subagent_models`,但因无参调用 `list_subagent_models({})` 只返回 provider 摘要,或看到上游工具描述写着 `"Catalog membership is advisory"` / `"Child LLM selection is optional..."`,不敢直接采信返回值,紧接着连续 9 个回合在工作区 grep `subagentModelAuthorization`、读取源码、递归扫描 `~/.dsh`(触发 120s 命令超时)并翻看 `settings.json` / `cordis.patch.yml` 以寻找「真正的允许清单定义」。
|
package/icon.svg
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
本插件的插件管理器图标(package.json 的 "icon" 声明,36×36 规格,见 DSH 官方实验插件同款)。
|
|
3
|
+
|
|
4
|
+
画的是「聚合」:四条订阅线路(四枚节点)收进中心一块圆角方块(本插件那个统一的账号/订阅管理面)。
|
|
5
|
+
取色都有出处,不新造品牌色:中心 #10A37F 是本仓库 src/client/hub/brand-icons.ts 里 chatgpt 那条
|
|
6
|
+
线路的 tile 色(本插件正是以 ChatGPT 订阅起家的那条),线路节点与辐条用的 #7AC2FF → #4A65E8
|
|
7
|
+
与 DSH 官方插件图形同一支渐变。图形为装饰性,不依赖 currentColor / CSS 变量,可安全地按 data: URI
|
|
8
|
+
渲染在插件管理器的 <img> 里(PackageArtwork)。
|
|
9
|
+
-->
|
|
10
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
|
+
<g stroke="url(#a)" stroke-width="2.8" stroke-linecap="round">
|
|
12
|
+
<path d="M18 12.8V9.7" />
|
|
13
|
+
<path d="M18 23.2V26.3" />
|
|
14
|
+
<path d="M12.8 18H9.7" />
|
|
15
|
+
<path d="M23.2 18H26.3" />
|
|
16
|
+
</g>
|
|
17
|
+
<circle cx="18" cy="6.6" r="3.1" fill="url(#a)" />
|
|
18
|
+
<circle cx="18" cy="29.4" r="3.1" fill="url(#a)" />
|
|
19
|
+
<circle cx="6.6" cy="18" r="3.1" fill="url(#a)" />
|
|
20
|
+
<circle cx="29.4" cy="18" r="3.1" fill="url(#a)" />
|
|
21
|
+
<rect x="12.25" y="12.25" width="11.5" height="11.5" rx="3.6" fill="#10A37F" />
|
|
22
|
+
<defs>
|
|
23
|
+
<linearGradient id="a" x1="7" y1="6" x2="30" y2="30" gradientUnits="userSpaceOnUse">
|
|
24
|
+
<stop stop-color="#7AC2FF" />
|
|
25
|
+
<stop offset="1" stop-color="#4A65E8" />
|
|
26
|
+
</linearGradient>
|
|
27
|
+
</defs>
|
|
28
|
+
</svg>
|
package/lib/index.js
CHANGED
|
@@ -4955,6 +4955,27 @@ var FileModelSettingsStore$2 = class {
|
|
|
4955
4955
|
*/
|
|
4956
4956
|
/** Default loopback port the Antigravity CLI's own flow uses. */
|
|
4957
4957
|
const DEFAULT_CALLBACK_PORT$2 = 51121;
|
|
4958
|
+
/**
|
|
4959
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
4960
|
+
*
|
|
4961
|
+
* An excluded range is not a block of fixed width. Windows reserves whatever
|
|
4962
|
+
* span Hyper-V/WinNAT/its own services hold, it moves on every reboot, and a
|
|
4963
|
+
* Windows 11 host was measured handing this line's default port 277 consecutive
|
|
4964
|
+
* excluded ports (51121-51397). A window narrower than the run the default
|
|
4965
|
+
* starts inside ends *inside* that run and then reports "no usable port" on a
|
|
4966
|
+
* machine where hundreds of free ports sit immediately behind it — so the width
|
|
4967
|
+
* of this window, not the width the probe assumes, is what keeps the flow
|
|
4968
|
+
* working.
|
|
4969
|
+
*
|
|
4970
|
+
* 1024 is roughly 3.7x the widest run measured, which is the margin that stops
|
|
4971
|
+
* this depending on any single host's layout, and it still ends at 52144, far
|
|
4972
|
+
* below the 65535 ceiling. The window is cheap because it is walked one failed
|
|
4973
|
+
* bind at a time: a rejected listen measured ~0.35ms here (277 probes in 96ms),
|
|
4974
|
+
* so even the full 1024-probe worst case — only reached when every port in the
|
|
4975
|
+
* window is unusable, immediately before the actionable error — costs ~0.36s
|
|
4976
|
+
* once per sign-in. The ordinary case stops at the first usable port.
|
|
4977
|
+
*/
|
|
4978
|
+
const CALLBACK_PORT_ATTEMPTS$2 = 1024;
|
|
4958
4979
|
let cachedQuota;
|
|
4959
4980
|
let quotaFetchInFlight = null;
|
|
4960
4981
|
/** Bumped by every cache clear so an in-flight fetch cannot publish stale state. */
|
|
@@ -5290,11 +5311,19 @@ function callbackPort() {
|
|
|
5290
5311
|
* URI carries whatever port this returns, so any free loopback port works. A
|
|
5291
5312
|
* configured `DSH_ANTIGRAVITY_CALLBACK_PORT` still wins — callers who set it
|
|
5292
5313
|
* accept that the port must be usable.
|
|
5314
|
+
*
|
|
5315
|
+
* How wide such a reserved run is not something this function can look up — it
|
|
5316
|
+
* is the host's own bookkeeping — so the probe only has to be wider than the
|
|
5317
|
+
* widest run it can meet, and it walks a window sized for that (see
|
|
5318
|
+
* {@link CALLBACK_PORT_ATTEMPTS}) instead of guessing a block size. `start` and
|
|
5319
|
+
* `probe` are the seams that keep that claim testable: production probes from
|
|
5320
|
+
* the line's own default and judges each port by really binding it, and a test
|
|
5321
|
+
* can point the walk at a run whose width it controls.
|
|
5293
5322
|
*/
|
|
5294
|
-
async function resolveCallbackPort$1(attempts =
|
|
5323
|
+
async function resolveCallbackPort$1(attempts = CALLBACK_PORT_ATTEMPTS$2, host = resolveCallbackHost(), start = DEFAULT_CALLBACK_PORT$2, probe = (port) => isPortUsable$1(port, host)) {
|
|
5295
5324
|
if (antigravityEnv("CALLBACK_PORT") !== void 0) return callbackPort();
|
|
5296
|
-
for (let offset = 0; offset < attempts; offset += 1) if (await
|
|
5297
|
-
throw new Error(`No usable local port for the Antigravity sign-in callback (tried ${attempts} ports from ${
|
|
5325
|
+
for (let offset = 0; offset < attempts; offset += 1) if (await probe(start + offset)) return start + offset;
|
|
5326
|
+
throw new Error(`No usable local port for the Antigravity sign-in callback (tried ${attempts} ports from ${start} on ${host}). A Windows excluded-port range may cover them; set DSH_ANTIGRAVITY_CALLBACK_PORT to a free port.`);
|
|
5298
5327
|
}
|
|
5299
5328
|
/**
|
|
5300
5329
|
* Whether one port can be bound on the interface the listener will use.
|
|
@@ -5377,7 +5406,7 @@ async function getUserEmail(token, fetchFn = fetch) {
|
|
|
5377
5406
|
}
|
|
5378
5407
|
async function startCallbackServer(expectedState) {
|
|
5379
5408
|
const host = resolveCallbackHost();
|
|
5380
|
-
const port = await resolveCallbackPort$1(
|
|
5409
|
+
const port = await resolveCallbackPort$1(CALLBACK_PORT_ATTEMPTS$2, host);
|
|
5381
5410
|
return new Promise((resolve, reject) => {
|
|
5382
5411
|
let settled = false;
|
|
5383
5412
|
let timeout;
|
|
@@ -13395,6 +13424,28 @@ const BILLING_SUBSCRIPTIONS_PATH = "/alpha/billing/subscriptions";
|
|
|
13395
13424
|
const USAGE_SUMMARY_PATH = "/alpha/usage/summary";
|
|
13396
13425
|
/** First loopback port tried for the browser callback; matches the official CLI. */
|
|
13397
13426
|
const DEFAULT_CALLBACK_PORT$1 = 5959;
|
|
13427
|
+
/**
|
|
13428
|
+
* Consecutive ports probed when the default is taken.
|
|
13429
|
+
*
|
|
13430
|
+
* The CLI opens its own search at 5959, which {@link DEFAULT_CALLBACK_PORT}
|
|
13431
|
+
* keeps, so on an ordinary machine this line still lands on the port the CLI
|
|
13432
|
+
* would. The WIDTH is recovery budget, not compatibility: the studio is handed
|
|
13433
|
+
* whatever port this returns in the callback URL, so ports past the CLI's own
|
|
13434
|
+
* range were already reachable here before the window was widened, and starting
|
|
13435
|
+
* at the CLI default is what preserves the "behaves like the CLI" property if the
|
|
13436
|
+
* studio ever does pin an allowlist.
|
|
13437
|
+
*
|
|
13438
|
+
* The failure shape makes the width matter more than it does for a line that has
|
|
13439
|
+
* a manual flow to fall back to: exhausting this window is a thrown error and a
|
|
13440
|
+
* dead sign-in, not a downgrade. Windows (Hyper-V/WinNAT) reserves TCP port
|
|
13441
|
+
* ranges of no fixed width that change on every reboot — one host was measured
|
|
13442
|
+
* holding 277 consecutive ports — so a ten-port window is one reboot away from
|
|
13443
|
+
* failing outright and a wider one is not. 1024 matches the other two sign-in
|
|
13444
|
+
* lines here and still ends at 6983: clear of the privileged ports, clear of the
|
|
13445
|
+
* OS dynamic range, and walked one failed bind at a time (~0.35ms each), so the
|
|
13446
|
+
* worst case costs a fraction of a second once per sign-in.
|
|
13447
|
+
*/
|
|
13448
|
+
const CALLBACK_PORT_ATTEMPTS$1 = 1024;
|
|
13398
13449
|
const CALLBACK_PATH$1 = "/callback";
|
|
13399
13450
|
/** Page the studio's browser tab lands on after a successful POST; CLI-compatible. */
|
|
13400
13451
|
const CALLBACK_COMPLETE_PATH = "/callback/complete";
|
|
@@ -17169,16 +17220,19 @@ function checkPortAvailable(port) {
|
|
|
17169
17220
|
});
|
|
17170
17221
|
}
|
|
17171
17222
|
/**
|
|
17172
|
-
* First free loopback port in the
|
|
17223
|
+
* First free loopback port in the probe range.
|
|
17173
17224
|
*
|
|
17174
17225
|
* The studio receives the port in the callback URL, so any free port works;
|
|
17175
17226
|
* starting at the CLI's own default keeps behavior identical on a machine where
|
|
17176
|
-
* a server-side allowlist is ever introduced.
|
|
17227
|
+
* a server-side allowlist is ever introduced. `probe` is the seam the tests walk
|
|
17228
|
+
* a reserved run through, which is what lets the width of the window be asserted
|
|
17229
|
+
* without binding a thousand real sockets on a machine whose own reservations
|
|
17230
|
+
* move underneath the test.
|
|
17177
17231
|
*/
|
|
17178
|
-
async function findAvailablePort(start = DEFAULT_CALLBACK_PORT$1, attempts =
|
|
17232
|
+
async function findAvailablePort(start = DEFAULT_CALLBACK_PORT$1, attempts = CALLBACK_PORT_ATTEMPTS$1, probe = checkPortAvailable) {
|
|
17179
17233
|
for (let offset = 0; offset < attempts; offset += 1) {
|
|
17180
17234
|
const port = start + offset;
|
|
17181
|
-
if (await
|
|
17235
|
+
if (await probe(port)) return port;
|
|
17182
17236
|
}
|
|
17183
17237
|
throw new Error(`No free local port for the Command Code sign-in callback (tried ${attempts} ports from ${start}).`);
|
|
17184
17238
|
}
|
|
@@ -24868,10 +24922,14 @@ function countOmitted(current, baseline, resolved) {
|
|
|
24868
24922
|
*
|
|
24869
24923
|
* The retryable set is therefore:
|
|
24870
24924
|
*
|
|
24871
|
-
* - `SERVER` — any 5xx, including that upstream-unavailable 502
|
|
24872
|
-
*
|
|
24873
|
-
*
|
|
24874
|
-
*
|
|
24925
|
+
* - `SERVER` — any 5xx, including that upstream-unavailable 502, and the
|
|
24926
|
+
* overloaded 429 (`UPSTREAM_OVERLOAD_PATTERNS`). Overload shares the 429
|
|
24927
|
+
* status with real back-pressure but not its meaning: it describes the state
|
|
24928
|
+
* of the upstream engine, which every account behind this endpoint shares, so
|
|
24929
|
+
* it is filed as the server condition it is and the pool is left alone;
|
|
24930
|
+
* - `RATE_LIMIT` — a 429 that is genuine back-pressure ("too many requests"),
|
|
24931
|
+
* which the documentation describes as transient and which does belong to the
|
|
24932
|
+
* account that hit it, so rotation on it still earns its keep;
|
|
24875
24933
|
* - `TRANSPORT` — a connection that produced no response at all;
|
|
24876
24934
|
* - `TIMEOUT` — a stalled stream, handled by the idle watchdog.
|
|
24877
24935
|
*
|
|
@@ -24917,6 +24975,35 @@ const ENTITLEMENT_PATTERNS = [
|
|
|
24917
24975
|
/recognized as other/i,
|
|
24918
24976
|
/currently plan supports only/i
|
|
24919
24977
|
];
|
|
24978
|
+
/**
|
|
24979
|
+
* 正文里说明「上游引擎过载」的措辞,与上面两组按**归属**分界,而不是按严重程度。
|
|
24980
|
+
*
|
|
24981
|
+
* - `ENTITLEMENT_PATTERNS` 说的是套餐:换号、换时间都不会变,是请求/套餐的属性;
|
|
24982
|
+
* - `QUOTA_EXHAUSTED_PATTERNS` 说的是这个账号自己的余额/额度:别人可能还好,
|
|
24983
|
+
* 但这个账号在窗口重置前一定起不来;
|
|
24984
|
+
* - 本组说的是**上游引擎的繁忙**:这是所有账号共用的同一台引擎,谁来问都是这句
|
|
24985
|
+
* 话,本地没有任何动作能改变它。
|
|
24986
|
+
*
|
|
24987
|
+
* 第三组必须单独识别,因为它和真正的限流共用同一个 429 状态码,却不共享结论。
|
|
24988
|
+
* 服务端用 429 表达「引擎过载」时,本线路此前把它归进 RATE_LIMIT,号池随即按
|
|
24989
|
+
* 限流语义给**唯一那个账号**写 15 分钟冷却(`POOL_COOLDOWN_MS`),之后同一
|
|
24990
|
+
* 会话的每一次重试都被 `isEligible` 直接挡在门外——重试根本没发出网络请求,
|
|
24991
|
+
* 3 次退避(3.2s/6.1s,纯本地耗时)打在一个登录正常、额度正常的账号上,最后以
|
|
24992
|
+
* 「全部 1 个 Kimi Code 账号均处于配额限制或冷却中 (429)。最短预计在 15 分钟后
|
|
24993
|
+
* 解除冷却。」收场。真正被限流的服务端状态不该有账号级的副作用。
|
|
24994
|
+
*
|
|
24995
|
+
* 这里只按正文判定,绝不按状态码判定:同一个 429 既可能是过载也可能是真限流,
|
|
24996
|
+
* 唯一能区分的证据就是服务自己写下的那句话。措辞取自本线路文档与实际响应,
|
|
24997
|
+
* 刻意保留 "the engine is …" 的限定,避免把任何提到 "overload" 的正文一律
|
|
24998
|
+
* 吞掉——将来若出现「本账号请求量过载」这类真限流措辞,它不该落进这一组。
|
|
24999
|
+
*/
|
|
25000
|
+
const UPSTREAM_OVERLOAD_PATTERNS = [
|
|
25001
|
+
/\bengine is (currently )?overloaded\b/i,
|
|
25002
|
+
/\bservers? (?:is|are) (?:currently )?overloaded\b/i,
|
|
25003
|
+
/\bservice is (?:currently )?overloaded\b/i,
|
|
25004
|
+
/\bupstream model provider is temporarily unavailable\b/i,
|
|
25005
|
+
/\bcurrently overloaded\b/i
|
|
25006
|
+
];
|
|
24920
25007
|
/** Body text the service uses for a 429 that must NOT be retried. */
|
|
24921
25008
|
const QUOTA_EXHAUSTED_PATTERNS$1 = [
|
|
24922
25009
|
/exceeded_current_quota_error/i,
|
|
@@ -24968,12 +25055,14 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24968
25055
|
code: CONTEXT_OVERFLOW_CODE,
|
|
24969
25056
|
retryable: false,
|
|
24970
25057
|
accountScoped: false,
|
|
25058
|
+
upstreamOverload: false,
|
|
24971
25059
|
message: `${PROVIDER_NAME$5} context window exceeded: ${detail}`
|
|
24972
25060
|
};
|
|
24973
25061
|
if (status === 402) return {
|
|
24974
25062
|
code: "SERVER",
|
|
24975
25063
|
retryable: true,
|
|
24976
25064
|
accountScoped: false,
|
|
25065
|
+
upstreamOverload: false,
|
|
24977
25066
|
message: `${PROVIDER_NAME$5} could not verify the subscription tier (402). Retrying; if it persists, confirm the membership is active.${detail ? ` ${detail}` : ""}`
|
|
24978
25067
|
};
|
|
24979
25068
|
if (status === 401 || status === 403) {
|
|
@@ -24981,6 +25070,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24981
25070
|
code: "PROVIDER_ERROR",
|
|
24982
25071
|
retryable: false,
|
|
24983
25072
|
accountScoped: false,
|
|
25073
|
+
upstreamOverload: false,
|
|
24984
25074
|
message: `${PROVIDER_NAME$5} refused this request for the current plan: ${detail || "the requested model or context is not included"}. Switch to a model the plan includes, lower the context-window override, or upgrade the subscription.`
|
|
24985
25075
|
};
|
|
24986
25076
|
if (status === 403) {
|
|
@@ -24989,6 +25079,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24989
25079
|
code: "PROVIDER_ERROR",
|
|
24990
25080
|
retryable: false,
|
|
24991
25081
|
accountScoped: true,
|
|
25082
|
+
upstreamOverload: false,
|
|
24992
25083
|
message: `${PROVIDER_NAME$5} blocked the request on an account limit (403): ${detail || (limitReached ? "the account limit was reached" : "the account refused the request")}. The quota refreshes on its own schedule — check the Kimi Code card in Settings for the reset time.`
|
|
24993
25084
|
};
|
|
24994
25085
|
}
|
|
@@ -24996,6 +25087,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24996
25087
|
code: "INVALID_CREDENTIAL",
|
|
24997
25088
|
retryable: false,
|
|
24998
25089
|
accountScoped: false,
|
|
25090
|
+
upstreamOverload: false,
|
|
24999
25091
|
message: `${PROVIDER_NAME$5} rejected the stored credential (401). Sign in again from Settings > Kimi Code.${detail ? ` ${detail}` : ""}`
|
|
25000
25092
|
};
|
|
25001
25093
|
}
|
|
@@ -25004,31 +25096,43 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
25004
25096
|
code: "PROVIDER_ERROR",
|
|
25005
25097
|
retryable: false,
|
|
25006
25098
|
accountScoped: true,
|
|
25099
|
+
upstreamOverload: false,
|
|
25007
25100
|
message: `${PROVIDER_NAME$5} reports the account quota is exhausted: ${detail || "no remaining quota"}. Top up or wait for the window to reset.`
|
|
25008
25101
|
};
|
|
25102
|
+
if (matchesAny$1(detail, UPSTREAM_OVERLOAD_PATTERNS)) return {
|
|
25103
|
+
code: "SERVER",
|
|
25104
|
+
retryable: true,
|
|
25105
|
+
accountScoped: false,
|
|
25106
|
+
upstreamOverload: true,
|
|
25107
|
+
message: `${PROVIDER_NAME$5} upstream engine is overloaded (429): ${detail || "the engine is currently overloaded"}. This is a temporary upstream condition shared by every account, so no account is taken out of rotation; retrying with backoff.`
|
|
25108
|
+
};
|
|
25009
25109
|
return {
|
|
25010
25110
|
code: "RATE_LIMIT",
|
|
25011
25111
|
retryable: true,
|
|
25012
25112
|
accountScoped: false,
|
|
25013
|
-
|
|
25113
|
+
upstreamOverload: false,
|
|
25114
|
+
message: `${PROVIDER_NAME$5} is rate limited (429): ${detail || "too many requests"}. Retrying with backoff.`
|
|
25014
25115
|
};
|
|
25015
25116
|
}
|
|
25016
25117
|
if (status >= 500) return {
|
|
25017
25118
|
code: "SERVER",
|
|
25018
25119
|
retryable: true,
|
|
25019
25120
|
accountScoped: false,
|
|
25121
|
+
upstreamOverload: matchesAny$1(detail, UPSTREAM_OVERLOAD_PATTERNS),
|
|
25020
25122
|
message: `${PROVIDER_NAME$5} upstream server error (${status}): ${detail || "the model provider is temporarily unavailable"}. Retrying with backoff.`
|
|
25021
25123
|
};
|
|
25022
25124
|
if (status === 400) return {
|
|
25023
25125
|
code: "PROVIDER_ERROR",
|
|
25024
25126
|
retryable: false,
|
|
25025
25127
|
accountScoped: false,
|
|
25128
|
+
upstreamOverload: false,
|
|
25026
25129
|
message: `${PROVIDER_NAME$5} rejected the request (400): ${detail || "the request was not accepted"}`
|
|
25027
25130
|
};
|
|
25028
25131
|
return {
|
|
25029
25132
|
code: "PROVIDER_ERROR",
|
|
25030
25133
|
retryable: false,
|
|
25031
25134
|
accountScoped: false,
|
|
25135
|
+
upstreamOverload: false,
|
|
25032
25136
|
message: `${PROVIDER_NAME$5} API error (${status}): ${detail || "No response"}`
|
|
25033
25137
|
};
|
|
25034
25138
|
}
|
|
@@ -25061,7 +25165,13 @@ function accountLimitCooldownMs(bodyText, now = Date.now()) {
|
|
|
25061
25165
|
if (resetsAt !== null && Number.isFinite(resetsAt) && resetsAt > now) return Math.min(Math.max(resetsAt - now, POOL_COOLDOWN_MS$3), MAX_ACCOUNT_LIMIT_COOLDOWN_MS);
|
|
25062
25166
|
return BILLING_CYCLE_PATTERN.test(bodyText) ? BILLING_CYCLE_COOLDOWN_MS : ACCOUNT_LIMIT_COOLDOWN_MS;
|
|
25063
25167
|
}
|
|
25064
|
-
/**
|
|
25168
|
+
/**
|
|
25169
|
+
* Cooldown one rate-limited account takes when the provider states no delay.
|
|
25170
|
+
*
|
|
25171
|
+
* 只在**真正的**限流上使用:上游引擎过载走 SERVER,既不落这条窗口,也不消耗轮转
|
|
25172
|
+
* 名额。它是 15 分钟而不是服务自己说的时长,正是因为拿不准——拿不准的那次猜测
|
|
25173
|
+
* 落在一个只有单个账号的号池上,代价是整个号池在 15 分钟里彻底不可用。
|
|
25174
|
+
*/
|
|
25065
25175
|
const POOL_COOLDOWN_MS$3 = 15 * 6e4;
|
|
25066
25176
|
/**
|
|
25067
25177
|
* Fallback cooldown for an account whose usage window is spent.
|
|
@@ -25288,7 +25398,7 @@ var KimiCodeAdapter = class extends LlmAdapter {
|
|
|
25288
25398
|
const after = response.status === 429 ? retryAfterMs$1(response.headers) : void 0;
|
|
25289
25399
|
if (pool !== null && accountId !== void 0) {
|
|
25290
25400
|
const planScoped = response.status === 429 && matchesAny$1(detail, ENTITLEMENT_PATTERNS);
|
|
25291
|
-
if (response.status === 429 && !planScoped) {
|
|
25401
|
+
if (response.status === 429 && !planScoped && !failure.upstreamOverload) {
|
|
25292
25402
|
const cooldownMs = failure.accountScoped ? accountLimitCooldownMs(detail) : after ?? POOL_COOLDOWN_MS$3;
|
|
25293
25403
|
await pool.markCooldown(accountId, cooldownMs, `${PROVIDER_NAME$5} 429`).catch(() => void 0);
|
|
25294
25404
|
if (await pool.hasAnotherAvailableAccount(tried)) continue;
|
|
@@ -25384,7 +25494,7 @@ var KimiCodeAdapter = class extends LlmAdapter {
|
|
|
25384
25494
|
if (status === null) return reclassified;
|
|
25385
25495
|
const failure = classifyKimiFailure(status, bodyText);
|
|
25386
25496
|
const planScoped = status === 429 && matchesAny$1(bodyText, ENTITLEMENT_PATTERNS);
|
|
25387
|
-
if (status === 429 && !planScoped) await this.coolInBandRateLimit(pool, accountId, failure.accountScoped, bodyText);
|
|
25497
|
+
if (status === 429 && !planScoped && !failure.upstreamOverload) await this.coolInBandRateLimit(pool, accountId, failure.accountScoped, bodyText);
|
|
25388
25498
|
else if (failure.code === "INVALID_CREDENTIAL") await pool.markAuthFailed(accountId, failure.message).catch(() => void 0);
|
|
25389
25499
|
else if (failure.accountScoped) await pool.markCooldown(accountId, accountLimitCooldownMs(bodyText), `${PROVIDER_NAME$5} in-stream 403`).catch(() => void 0);
|
|
25390
25500
|
return reclassified;
|
|
@@ -37086,6 +37196,32 @@ const CLAUDE_CLI_VERSION = "2.1.293";
|
|
|
37086
37196
|
* see {@link CALLBACK_PORT_ATTEMPTS}.
|
|
37087
37197
|
*/
|
|
37088
37198
|
const DEFAULT_CALLBACK_PORT = 53692;
|
|
37199
|
+
/**
|
|
37200
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
37201
|
+
*
|
|
37202
|
+
* Windows (Hyper-V/WinNAT) dynamically reserves TCP port ranges that change on
|
|
37203
|
+
* every reboot. A fixed callback port can land inside one and `listen` fails
|
|
37204
|
+
* with `EACCES`, so browser authorization never completes.
|
|
37205
|
+
*
|
|
37206
|
+
* An excluded run is not a block of a width anyone can look up. One Windows 11
|
|
37207
|
+
* host was measured holding 277 consecutive unusable ports (51121-51397) plus
|
|
37208
|
+
* scattered single ones that appear in no static table, and the picture changes
|
|
37209
|
+
* across reboots — so a window justified as "covers any single block" is covering
|
|
37210
|
+
* a block size that does not exist. A window narrower than the run the default
|
|
37211
|
+
* starts inside ends INSIDE that run, and the consequence here is worse than an
|
|
37212
|
+
* error: resolveCallbackPort returns null, which beginLogin reads as "fall back
|
|
37213
|
+
* to manual". The user is then pushed into pasting a code with no visible cause
|
|
37214
|
+
* on a machine that has hundreds of free ports immediately behind the run.
|
|
37215
|
+
*
|
|
37216
|
+
* 1024 is ~3.7x the widest run measured and still ends at 54716, far below the
|
|
37217
|
+
* 65535 ceiling. The window is walked one failed bind at a time (~0.35ms per
|
|
37218
|
+
* rejected listen here), so the worst case costs a fraction of a second once per
|
|
37219
|
+
* sign-in and only when every port in it is unusable; the ordinary case stops at
|
|
37220
|
+
* the first usable port. Widening changes neither which port is tried first nor
|
|
37221
|
+
* the default status as the one port known to be registered for this client
|
|
37222
|
+
* (see {@link DEFAULT_CALLBACK_PORT}).
|
|
37223
|
+
*/
|
|
37224
|
+
const CALLBACK_PORT_ATTEMPTS = 1024;
|
|
37089
37225
|
/** Path of the loopback callback the browser is redirected to. */
|
|
37090
37226
|
const CALLBACK_PATH = "/callback";
|
|
37091
37227
|
/** Idle ceiling for one streaming response before it is declared stalled. */
|
|
@@ -41950,12 +42086,16 @@ function isPortUsable(port) {
|
|
|
41950
42086
|
* First usable loopback port, or null when the probe finds none.
|
|
41951
42087
|
*
|
|
41952
42088
|
* null rather than a throw is deliberate (see beginLogin): a failed probe is
|
|
41953
|
-
* NOT a hard error, it is the signal to fall back to the manual flow.
|
|
41954
|
-
*
|
|
41955
|
-
*
|
|
41956
|
-
*
|
|
41957
|
-
|
|
41958
|
-
|
|
42089
|
+
* NOT a hard error, it is the signal to fall back to the manual flow. That is
|
|
42090
|
+
* exactly why the window has to be wide rather than merely generous: a run of
|
|
42091
|
+
* excluded ports wider than CALLBACK_PORT_ATTEMPTS ends this walk early and drops
|
|
42092
|
+
* the user into a paste-a-code flow for a reason nothing on screen explains,
|
|
42093
|
+
* while the ports immediately behind that run sit free. Windows
|
|
42094
|
+
* (Hyper-V/WinNAT) reserves ranges of no fixed width that move on every reboot,
|
|
42095
|
+
* so the width of this window, not any assumed block size, is what keeps the
|
|
42096
|
+
* sign-in in loopback.
|
|
42097
|
+
*/
|
|
42098
|
+
async function resolveCallbackPort(probe = isPortUsable, attempts = CALLBACK_PORT_ATTEMPTS) {
|
|
41959
42099
|
for (let offset = 0; offset < attempts; offset += 1) {
|
|
41960
42100
|
const port = DEFAULT_CALLBACK_PORT + offset;
|
|
41961
42101
|
if (port > 65535) return null;
|
|
@@ -42355,7 +42495,7 @@ async function beginLogin(store, options = {}) {
|
|
|
42355
42495
|
port = await resolveCallbackPort(probe);
|
|
42356
42496
|
if (port === null) {
|
|
42357
42497
|
resolvedMode = "manual";
|
|
42358
|
-
fallbackReason = "No free loopback port in the
|
|
42498
|
+
fallbackReason = "No free loopback port in the 1024-port range starting at 53692.";
|
|
42359
42499
|
} else try {
|
|
42360
42500
|
server = await listen(port, LOOPBACK_HOST);
|
|
42361
42501
|
} catch (error) {
|
|
@@ -22,8 +22,29 @@ export declare function callbackPort(): number;
|
|
|
22
22
|
* URI carries whatever port this returns, so any free loopback port works. A
|
|
23
23
|
* configured `DSH_ANTIGRAVITY_CALLBACK_PORT` still wins — callers who set it
|
|
24
24
|
* accept that the port must be usable.
|
|
25
|
+
*
|
|
26
|
+
* How wide such a reserved run is not something this function can look up — it
|
|
27
|
+
* is the host's own bookkeeping — so the probe only has to be wider than the
|
|
28
|
+
* widest run it can meet, and it walks a window sized for that (see
|
|
29
|
+
* {@link CALLBACK_PORT_ATTEMPTS}) instead of guessing a block size. `start` and
|
|
30
|
+
* `probe` are the seams that keep that claim testable: production probes from
|
|
31
|
+
* the line's own default and judges each port by really binding it, and a test
|
|
32
|
+
* can point the walk at a run whose width it controls.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveCallbackPort(attempts?: number, host?: string, start?: number,
|
|
35
|
+
/**
|
|
36
|
+
* How one port is judged. Defaults to the real bind on `host`, the only
|
|
37
|
+
* authority that can answer the question for the machine this will run on.
|
|
38
|
+
*
|
|
39
|
+
* Overridable because the width of the window is a contract while the width of
|
|
40
|
+
* the run it must clear is a machine fact: Windows reservations appear *and*
|
|
41
|
+
* are released while a test is running, and another process can own a port a
|
|
42
|
+
* scenario wanted free, so a run built out of real sockets measures this host
|
|
43
|
+
* as much as the probe. An injected judge gives the run a known width and
|
|
44
|
+
* leaves the assertion about the window alone. (The Claude line injects its
|
|
45
|
+
* probe the same way.)
|
|
25
46
|
*/
|
|
26
|
-
|
|
47
|
+
probe?: (port: number) => Promise<boolean>): Promise<number>;
|
|
27
48
|
export declare function resolveCallbackHost(raw?: string | undefined): string;
|
|
28
49
|
export declare function redirectUri(port?: number, host?: string): string;
|
|
29
50
|
export declare function clientId(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/oauth.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAcrD,OAAO,EAAE,mBAAmB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAKL,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAA;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AASD,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/oauth.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAcrD,OAAO,EAAE,mBAAmB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACnF,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CAAC,CAkCjC;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhD;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,CAAC,EAAE,WAAW,EACpB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC7B,OAAO,GAAE,OAAO,KAAa,EAC7B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;AACpC;;;;;;;;GAQG;AACH,MAAM,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAkB,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CA+BjC"}
|
|
@@ -10,11 +10,24 @@
|
|
|
10
10
|
/** Default loopback port the Antigravity CLI's own flow uses. */
|
|
11
11
|
export declare const DEFAULT_CALLBACK_PORT = 51121;
|
|
12
12
|
/**
|
|
13
|
-
* How many consecutive ports one probe covers.
|
|
13
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* An excluded range is not a block of fixed width. Windows reserves whatever
|
|
16
|
+
* span Hyper-V/WinNAT/its own services hold, it moves on every reboot, and a
|
|
17
|
+
* Windows 11 host was measured handing this line's default port 277 consecutive
|
|
18
|
+
* excluded ports (51121-51397). A window narrower than the run the default
|
|
19
|
+
* starts inside ends *inside* that run and then reports "no usable port" on a
|
|
20
|
+
* machine where hundreds of free ports sit immediately behind it — so the width
|
|
21
|
+
* of this window, not the width the probe assumes, is what keeps the flow
|
|
22
|
+
* working.
|
|
23
|
+
*
|
|
24
|
+
* 1024 is roughly 3.7x the widest run measured, which is the margin that stops
|
|
25
|
+
* this depending on any single host's layout, and it still ends at 52144, far
|
|
26
|
+
* below the 65535 ceiling. The window is cheap because it is walked one failed
|
|
27
|
+
* bind at a time: a rejected listen measured ~0.35ms here (277 probes in 96ms),
|
|
28
|
+
* so even the full 1024-probe worst case — only reached when every port in the
|
|
29
|
+
* window is unusable, immediately before the actionable error — costs ~0.36s
|
|
30
|
+
* once per sign-in. The ordinary case stops at the first usable port.
|
|
18
31
|
*/
|
|
19
|
-
export declare const CALLBACK_PORT_ATTEMPTS =
|
|
32
|
+
export declare const CALLBACK_PORT_ATTEMPTS = 1024;
|
|
20
33
|
//# sourceMappingURL=port-constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port-constants.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/port-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"port-constants.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/port-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAA"}
|
|
@@ -316,10 +316,14 @@ export declare function getLoginStatus(): LoginFlowStatus;
|
|
|
316
316
|
* First usable loopback port, or null when the probe finds none.
|
|
317
317
|
*
|
|
318
318
|
* null rather than a throw is deliberate (see beginLogin): a failed probe is
|
|
319
|
-
* NOT a hard error, it is the signal to fall back to the manual flow.
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
319
|
+
* NOT a hard error, it is the signal to fall back to the manual flow. That is
|
|
320
|
+
* exactly why the window has to be wide rather than merely generous: a run of
|
|
321
|
+
* excluded ports wider than CALLBACK_PORT_ATTEMPTS ends this walk early and drops
|
|
322
|
+
* the user into a paste-a-code flow for a reason nothing on screen explains,
|
|
323
|
+
* while the ports immediately behind that run sit free. Windows
|
|
324
|
+
* (Hyper-V/WinNAT) reserves ranges of no fixed width that move on every reboot,
|
|
325
|
+
* so the width of this window, not any assumed block size, is what keeps the
|
|
326
|
+
* sign-in in loopback.
|
|
323
327
|
*/
|
|
324
328
|
export declare function resolveCallbackPort(probe?: (port: number) => Promise<boolean>, attempts?: number): Promise<number | null>;
|
|
325
329
|
/** A value a user pasted into the manual sign-in box, or why it was rejected. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AAGH,OAAa,EAAwB,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAA;AAmBxF;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE5E,YAAY,EAAE,iBAAiB,EAAE,CAAA;AAEjC;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACzC,KAAK,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAMD,gEAAgE;AAChE,eAAO,MAAM,aAAa,cAAc,CAAA;AAgCxC,4EAA4E;AAC5E,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,KAAK;IAChB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBAAzC,OAAO,EAAE,MAAM,EAAW,KAAK,CAAC,EAAE,OAAO,YAAA;CAItD;AAiHD,u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,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAahC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAoChE;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GACvC,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAwB1E;AAMD,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAY3G;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC,CAsH1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAMlC"}
|
|
@@ -195,12 +195,27 @@ export declare const DEFAULT_CALLBACK_PORT = 53692;
|
|
|
195
195
|
*
|
|
196
196
|
* Windows (Hyper-V/WinNAT) dynamically reserves TCP port ranges that change on
|
|
197
197
|
* every reboot. A fixed callback port can land inside one and `listen` fails
|
|
198
|
-
* with `EACCES`, so browser authorization never completes.
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
198
|
+
* with `EACCES`, so browser authorization never completes.
|
|
199
|
+
*
|
|
200
|
+
* An excluded run is not a block of a width anyone can look up. One Windows 11
|
|
201
|
+
* host was measured holding 277 consecutive unusable ports (51121-51397) plus
|
|
202
|
+
* scattered single ones that appear in no static table, and the picture changes
|
|
203
|
+
* across reboots — so a window justified as "covers any single block" is covering
|
|
204
|
+
* a block size that does not exist. A window narrower than the run the default
|
|
205
|
+
* starts inside ends INSIDE that run, and the consequence here is worse than an
|
|
206
|
+
* error: resolveCallbackPort returns null, which beginLogin reads as "fall back
|
|
207
|
+
* to manual". The user is then pushed into pasting a code with no visible cause
|
|
208
|
+
* on a machine that has hundreds of free ports immediately behind the run.
|
|
209
|
+
*
|
|
210
|
+
* 1024 is ~3.7x the widest run measured and still ends at 54716, far below the
|
|
211
|
+
* 65535 ceiling. The window is walked one failed bind at a time (~0.35ms per
|
|
212
|
+
* rejected listen here), so the worst case costs a fraction of a second once per
|
|
213
|
+
* sign-in and only when every port in it is unusable; the ordinary case stops at
|
|
214
|
+
* the first usable port. Widening changes neither which port is tried first nor
|
|
215
|
+
* the default status as the one port known to be registered for this client
|
|
216
|
+
* (see {@link DEFAULT_CALLBACK_PORT}).
|
|
202
217
|
*/
|
|
203
|
-
export declare const CALLBACK_PORT_ATTEMPTS =
|
|
218
|
+
export declare const CALLBACK_PORT_ATTEMPTS = 1024;
|
|
204
219
|
/** Path of the loopback callback the browser is redirected to. */
|
|
205
220
|
export declare const CALLBACK_PATH = "/callback";
|
|
206
221
|
/** Idle ceiling for one streaming response before it is declared stalled. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/claude/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uCAAuC;AACvC,eAAO,MAAM,WAAW,wBAAwB,CAAA;AAChD,kEAAkE;AAClE,eAAO,MAAM,aAAa,mCAAe,CAAA;AAEzC,kFAAkF;AAClF,eAAO,MAAM,QAAQ,8BAA8B,CAAA;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,2BAA2B,CAAA;AACrD,2EAA2E;AAC3E,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,gEAAgE;AAChE,eAA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AAM,UAAU;IACrB,qFAAqF;;IAErF,+EAA+E;;IAE/E,iFAAiF;;IAEjF,mFAAmF;;IAEnF,uEAAuE;;IAEvE,kDAAkD;;IAElD,+CAA+C;;IAE/C,mFAAmF;;CAE3E,CAAA;AAEV,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,gCAAgC,CAAA;AAE9E,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAA8B,CAAA;AAEvF,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAKD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAGzC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAG9D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CASzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAIhF;AAoBD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,MAA8B,GAAG,MAAM,CAEhF"}
|
|
@@ -31,13 +31,16 @@ export declare function buildAuthUrl(input: {
|
|
|
31
31
|
/** State token the studio must echo back; 32 random bytes, base64url. */
|
|
32
32
|
export declare function generateState(): string;
|
|
33
33
|
/**
|
|
34
|
-
* First free loopback port in the
|
|
34
|
+
* First free loopback port in the probe range.
|
|
35
35
|
*
|
|
36
36
|
* The studio receives the port in the callback URL, so any free port works;
|
|
37
37
|
* starting at the CLI's own default keeps behavior identical on a machine where
|
|
38
|
-
* a server-side allowlist is ever introduced.
|
|
38
|
+
* a server-side allowlist is ever introduced. `probe` is the seam the tests walk
|
|
39
|
+
* a reserved run through, which is what lets the width of the window be asserted
|
|
40
|
+
* without binding a thousand real sockets on a machine whose own reservations
|
|
41
|
+
* move underneath the test.
|
|
39
42
|
*/
|
|
40
|
-
export declare function findAvailablePort(start?: number, attempts?: number): Promise<number>;
|
|
43
|
+
export declare function findAvailablePort(start?: number, attempts?: number, probe?: (port: number) => Promise<boolean>): Promise<number>;
|
|
41
44
|
export interface CommandCodeAuthServerHandle {
|
|
42
45
|
server: Server;
|
|
43
46
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAA;AAehG,OAAO,EAAE,mBAAmB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAEhF,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAA;AAE9E,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,sBAAsB,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,sEAAsE;AACtE,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAA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,CAAA;IAClB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9D,GACL,OAAO,CAAC,yBAAyB,CAAC,CAqEpC;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAO,GAC3G,OAAO,CAAC,kBAAkB,CAAC,CAkB7B;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -37,8 +37,28 @@ export declare const BILLING_SUBSCRIPTIONS_PATH = "/alpha/billing/subscriptions"
|
|
|
37
37
|
export declare const USAGE_SUMMARY_PATH = "/alpha/usage/summary";
|
|
38
38
|
/** First loopback port tried for the browser callback; matches the official CLI. */
|
|
39
39
|
export declare const DEFAULT_CALLBACK_PORT = 5959;
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Consecutive ports probed when the default is taken.
|
|
42
|
+
*
|
|
43
|
+
* The CLI opens its own search at 5959, which {@link DEFAULT_CALLBACK_PORT}
|
|
44
|
+
* keeps, so on an ordinary machine this line still lands on the port the CLI
|
|
45
|
+
* would. The WIDTH is recovery budget, not compatibility: the studio is handed
|
|
46
|
+
* whatever port this returns in the callback URL, so ports past the CLI's own
|
|
47
|
+
* range were already reachable here before the window was widened, and starting
|
|
48
|
+
* at the CLI default is what preserves the "behaves like the CLI" property if the
|
|
49
|
+
* studio ever does pin an allowlist.
|
|
50
|
+
*
|
|
51
|
+
* The failure shape makes the width matter more than it does for a line that has
|
|
52
|
+
* a manual flow to fall back to: exhausting this window is a thrown error and a
|
|
53
|
+
* dead sign-in, not a downgrade. Windows (Hyper-V/WinNAT) reserves TCP port
|
|
54
|
+
* ranges of no fixed width that change on every reboot — one host was measured
|
|
55
|
+
* holding 277 consecutive ports — so a ten-port window is one reboot away from
|
|
56
|
+
* failing outright and a wider one is not. 1024 matches the other two sign-in
|
|
57
|
+
* lines here and still ends at 6983: clear of the privileged ports, clear of the
|
|
58
|
+
* OS dynamic range, and walked one failed bind at a time (~0.35ms each), so the
|
|
59
|
+
* worst case costs a fraction of a second once per sign-in.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CALLBACK_PORT_ATTEMPTS = 1024;
|
|
42
62
|
export declare const CALLBACK_PATH = "/callback";
|
|
43
63
|
/** Page the studio's browser tab lands on after a successful POST; CLI-compatible. */
|
|
44
64
|
export declare const CALLBACK_COMPLETE_PATH = "/callback/complete";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAGhG,eAAO,MAAM,WAAW,iBAAiB,CAAA;AACzC,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C,oFAAoF;AACpF,eAAO,MAAM,WAAW,qBAAqB,CAAA;AAC7C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,aAAa,CAAA;AAC/C,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAA;AAElC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAI3D,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAI9D,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,WAAW,kBAAkB,CAAA;AAC1C,gDAAgD;AAChD,eAAO,M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,GAAE,iBAAmC,GAAG,MAAM,CAE9E;AAED,wBAAgB,WAAW,CAAC,GAAG,GAAE,iBAAmC,GAAG,MAAM,CAE5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,eAAe,GAAG,SAAS,CAOlH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAAS,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAKzF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUrE;AA6CD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAGQ,CAAA"}
|
|
@@ -16,10 +16,14 @@ import { KimiCodeAccountPool } from './account-pool.ts';
|
|
|
16
16
|
*
|
|
17
17
|
* The retryable set is therefore:
|
|
18
18
|
*
|
|
19
|
-
* - `SERVER` — any 5xx, including that upstream-unavailable 502
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* - `SERVER` — any 5xx, including that upstream-unavailable 502, and the
|
|
20
|
+
* overloaded 429 (`UPSTREAM_OVERLOAD_PATTERNS`). Overload shares the 429
|
|
21
|
+
* status with real back-pressure but not its meaning: it describes the state
|
|
22
|
+
* of the upstream engine, which every account behind this endpoint shares, so
|
|
23
|
+
* it is filed as the server condition it is and the pool is left alone;
|
|
24
|
+
* - `RATE_LIMIT` — a 429 that is genuine back-pressure ("too many requests"),
|
|
25
|
+
* which the documentation describes as transient and which does belong to the
|
|
26
|
+
* account that hit it, so rotation on it still earns its keep;
|
|
23
27
|
* - `TRANSPORT` — a connection that produced no response at all;
|
|
24
28
|
* - `TIMEOUT` — a stalled stream, handled by the idle watchdog.
|
|
25
29
|
*
|
|
@@ -65,6 +69,19 @@ export interface KimiFailureClassification {
|
|
|
65
69
|
message: string;
|
|
66
70
|
/** True only when the failure is worth retrying. */
|
|
67
71
|
retryable: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 本次失败是不是上游引擎过载(正文命中 `UPSTREAM_OVERLOAD_PATTERNS`)。
|
|
74
|
+
*
|
|
75
|
+
* 单列成一个字段,是因为「过载」这条信息号池需要、而 code 本身已经不够用了:
|
|
76
|
+
* 过载要可重试(harness 的退避重试正是为它准备的),所以它必须留在
|
|
77
|
+
* retryable 集合里;但过载不是任何账号的错,所以它绝不能被当成账号级限流
|
|
78
|
+
* 写进冷却。code 只有一个,说不了这两件事;`accountScoped` 也只回答「能不能
|
|
79
|
+
* 换号」,不回答「要不要冷却」——真正限流时答案是「能换号、也要冷却」,
|
|
80
|
+
* 过载时是「不必换号、更不必冷却」。两条路都可重试却必须分开处理,所以这里
|
|
81
|
+
* 把归属显式带出来,而不是让调用方拿状态码去猜:同一个 429 状态码同时承载
|
|
82
|
+
* 这两种含义,而这正是本缺陷的成因。
|
|
83
|
+
*/
|
|
84
|
+
upstreamOverload: boolean;
|
|
68
85
|
/**
|
|
69
86
|
* True when the refusal belongs to THIS account alone, so another pooled
|
|
70
87
|
* account may still serve the same request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAEV,iBAAiB,EAEjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAGL,WAAW,EASX,mBAAmB,EACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,KAAK,oBAAoB,EAEzB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAUnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAcL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAI3B,MAAM,aAAa,CAAA;AA+EpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAKvD
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAEV,iBAAiB,EAEjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAGL,WAAW,EASX,mBAAmB,EACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,KAAK,oBAAoB,EAEzB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,i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,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YAgBpD,aAAa;IAqU5B;;;;;;;;;;;;;;;OAeG;YACW,mBAAmB;IA6DjC;;;;;;;;OAQG;YACW,mBAAmB;CASlC;AAQD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,WAAW,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eddyskywalker/dsh-chatgpt-subscription",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
|
|
5
|
+
"icon": "./icon.svg",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "eddyskywalker",
|
|
7
8
|
"url": "https://www.npmjs.com/~eddyskywalker"
|
|
@@ -111,6 +112,7 @@
|
|
|
111
112
|
"antigravity-login": "./bin/antigravity-login.mjs"
|
|
112
113
|
},
|
|
113
114
|
"files": [
|
|
115
|
+
"icon.svg",
|
|
114
116
|
"lib/index.js",
|
|
115
117
|
"lib/client.js",
|
|
116
118
|
"lib/client.js.map",
|