@eddyskywalker/dsh-chatgpt-subscription 0.24.1 → 0.24.3
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 +22 -0
- package/icon.svg +28 -0
- package/lib/index.js +322 -30
- 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/credential-store-secret-service.d.ts +27 -0
- package/lib/types/host/credential-store-secret-service.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,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.24.3 - 2026-10-15
|
|
6
|
+
- **[Linux 凭据存储] 账号池撞上 secret-tool 的 8192 字节 stdin 上限:第 3 个账号添加后凭据写入成功、池写入失败,账号在 UI 闪现后消失(issue #54)**
|
|
7
|
+
- **现象**:Linux(gnome-keyring)下添加第 3 个 WorkBuddy 账号后账号区闪现即消失——凭据条目(7934B)惊险通过,但池条目(约 8960B)≥ 8192 被 `SecretServiceCredentialStore.save` 拒绝,`status.accounts`(池)永远少一个。该上限对齐的是 libsecret `secret-tool` 的 stdin 固定缓冲(超限静默截断仍 exit 0),且对**所有线路**(antigravity / claude / command-code / glm-coding-plan / kimi-code / minimax-code / ollama / step-code / workbuddy 的池与凭据共 25 处调用点)一视同仁,账号一多都会撞。
|
|
8
|
+
- **改法(`credential-store-secret-service.ts`,一处修复全线路受益)**:载荷 ≥ 8192 字节时改为**分片存储**——UTF-8 载荷 base64 后按 7000 字符切片写入独立 shard 条目(account 属性为 `<account>#<gen>#<i>`,Secret Service 属性精确匹配所以互不串扰),主条目最后写入作为**提交点**,内容为信封 `{ __dshChunked: { gen, chunks, bytes } }`;读取时按信封重组并校验解码字节数,损坏即报 `payload is too large` 同款 invalid 错误而非静默截断。小于上限的载荷保持单条目原格式,存量数据零迁移。shard 用随机代际(gen)标签:中断的 save 不触碰旧信封与旧分片,新代际要么整体提交要么回滚清理;提交成功后清理上一代分片(含分片→单条目的收缩场景)。`clear()` 改为先 lookup 探测:既拿到待清理的分片代际,也绕开 Ubuntu libsecret-tools 0.20.4 对不存在条目 `clear` 段错误的坑。分片数上限 128(约 650 KiB)防畸形信封。
|
|
9
|
+
- **验证**:`npm run typecheck` 0 错误;全量 **225 passed | 1 skipped(226 文件)、3739 passed | 7 skipped、0 failed**。新增/更新 12 条 store 用例:分片往返(断言每片 stdin < 8192、重组后逐字节等于原载荷、载荷不出现在命令行参数)、缺失/篡改分片报 invalid、畸形信封拒绝、换代清理、收缩清理、clear 连带清分片、shard 写失败时主条目零触碰。launch 计数测试同步更新(save 多一次探测启动,这是分代清理的信息来源)。
|
|
10
|
+
|
|
11
|
+
## 0.24.2 - 2026-10-14
|
|
12
|
+
- **[三条登录线路] 回调端口探测窗口按「100 端口一块」的否证前提定宽,导致整段保留区把探测窗口吃穿:Windows 实测连续 277 个端口不可用,而窗口只有 128(command-code 只有 10)**
|
|
13
|
+
- **现象**:本机全量 `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`。
|
|
14
|
+
- **根因(实测否证既有注释)**:`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**)建立在同一个被否定之前提上。
|
|
15
|
+
- **失效形态三条各不相同**:`antigravity` 抛错、`claude` 返回 `null` → `beginLogin` 把用户**静默推进手动粘贴流程**(机器上明明有数百个空闲端口就在保留区后面)、`command-code` 抛错且**没有手动流程可退**,窄窗口等于登录直接死掉。
|
|
16
|
+
- **改法**:三条线路的窗口统一为 **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` 改为常量推导(两侧区间断言保留,上界仍被断言)。
|
|
17
|
+
- **command-code 的 10 为什么加宽(而非保持)**:「matches the official CLI」约束的是**起点**(5959 保留且仍先试,有测试钉死字面量),不是宽度;端口经 callback URL 交给 studio,5960+ 本就是「非 CLI 端口」,加宽不引入新的端口类别;决定性是失败形态——这条线路没有手动流程可退,窗口耗尽即登录失败。
|
|
18
|
+
- **测试为什么不碰真实 socket**:曾出现「用真实 socket 拼一段连续占用区」的写法在同一棵树上**时过时不过**(40 轮 3 轮失败,且 3 次全部停在 build 期就是 EACCES 的端口上,自持有端口一次都没变)——动态保留区会在测试运行途中解禁。新用例因此**全部注入 probe**,零真实 socket、零 skip,与机器排布无关。
|
|
19
|
+
- **验证**:`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)`)。
|
|
20
|
+
- **[Kimi Code] 上游瞬时过载不再被当成账号限流:一次 `The engine is currently overloaded` 曾把唯一账号冷却 15 分钟,重试期间连一次网络请求都发不出去**
|
|
21
|
+
- **现象**:现场会话 `session-70d30e6b`(2026-10-14 20:29)一个回合以 `全部 1 个 Kimi Code 账号均处于配额限制或冷却中 (429)。最短预计在 15 分钟后解除冷却。` 失败。账号登录正常、订阅正常、额度正常,用户点一次「继续」后自行恢复。三次重试的间隔为 3.2s / 6.1s,**等于纯退避时间、零网络耗时**——请求根本没发出去。
|
|
22
|
+
- **根因(两处叠加)**:① `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` 拼出上面那句话。单账号号池没有第二个账号可轮转 = 一次过载直接锁死整条线路。
|
|
23
|
+
- **这与全仓约定相悖**:`glm-coding-plan/mapper-openai.ts` 早已把 `OVERLOADED` 映射为非账号级的 `SERVER`,注释写明「把过载混进 RATE_LIMIT 会让号池按限流去冷却账号,而过载根本不是某个账号的错」;`claude` 线同样按 kind 分类、不冷却过载。本线路缺这道区分是偏离,不是取舍。
|
|
24
|
+
- **改法**:新增 `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` 排除,两条路行为一致。
|
|
25
|
+
- **验证**:`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 结论一致」两条端到端断言)。
|
|
26
|
+
|
|
5
27
|
## 0.24.1 - 2026-10-14
|
|
6
28
|
- **[调度模式 & 子代理授权守卫] 插件端机制级修复模型调用 `list_subagent_models` 后仍疯狂翻找本地文件定义的问题,并全面优化预设提示词(现场会话 `session-01724ca8`)**
|
|
7
29
|
- **现象**:主模型在启动阶段已调用 `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
|
@@ -1321,6 +1321,7 @@ function runSecurity(args) {
|
|
|
1321
1321
|
//#endregion
|
|
1322
1322
|
//#region src/host/credential-store-secret-service.ts
|
|
1323
1323
|
const UNAVAILABLE = "Linux encrypted credential storage requires secret-tool (libsecret) and an unlocked Secret Service keyring.";
|
|
1324
|
+
const INVALID = "Secret Service credential payload is invalid";
|
|
1324
1325
|
/**
|
|
1325
1326
|
* How long one Secret Service read may stand in for the stored value.
|
|
1326
1327
|
*
|
|
@@ -1331,6 +1332,46 @@ const UNAVAILABLE = "Linux encrypted credential storage requires secret-tool (li
|
|
|
1331
1332
|
* credentials.
|
|
1332
1333
|
*/
|
|
1333
1334
|
const KEYRING_READ_CACHE_TTL_MS = 15e3;
|
|
1335
|
+
/**
|
|
1336
|
+
* secret-tool reads the secret from stdin into a fixed 8192-byte buffer
|
|
1337
|
+
* (`tool/secret-tool.c` `read_password_stdin()`) and, past the limit, prints
|
|
1338
|
+
* `password is too long` yet still stores the truncated bytes with exit 0 —
|
|
1339
|
+
* a silent corruption the caller cannot detect from the exit code. Payloads
|
|
1340
|
+
* that do not fit are therefore split into shard entries that each stay well
|
|
1341
|
+
* under the limit.
|
|
1342
|
+
*/
|
|
1343
|
+
const SECRET_TOOL_STDIN_LIMIT = 8192;
|
|
1344
|
+
/**
|
|
1345
|
+
* Base64 characters per shard entry. Base64 is ASCII, so characters equal
|
|
1346
|
+
* bytes and any split point is safe; 7000 leaves the shard comfortably below
|
|
1347
|
+
* the stdin limit.
|
|
1348
|
+
*/
|
|
1349
|
+
const SHARD_PAYLOAD_SIZE = 7e3;
|
|
1350
|
+
/**
|
|
1351
|
+
* Upper bound on the shard count one value may occupy. A corrupt or hostile
|
|
1352
|
+
* envelope cannot ask for unbounded lookups; 128 shards still hold ~650 KiB,
|
|
1353
|
+
* far past any plausible credential or account pool.
|
|
1354
|
+
*/
|
|
1355
|
+
const MAX_SHARDS = 128;
|
|
1356
|
+
/** Property that marks a primary entry as the envelope of a chunked value. */
|
|
1357
|
+
const ENVELOPE_KEY = "__dshChunked";
|
|
1358
|
+
/**
|
|
1359
|
+
* Read the envelope of a stored primary entry, or null when the entry holds a
|
|
1360
|
+
* plain value. A malformed envelope is invalid stored data, not a plain value.
|
|
1361
|
+
*/
|
|
1362
|
+
function envelopeFrom(parsed) {
|
|
1363
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
|
|
1364
|
+
const marker = parsed[ENVELOPE_KEY];
|
|
1365
|
+
if (marker === void 0) return null;
|
|
1366
|
+
if (typeof marker !== "object" || marker === null) throw new Error(INVALID);
|
|
1367
|
+
const { gen, chunks, bytes } = marker;
|
|
1368
|
+
if (typeof gen !== "string" || gen === "" || typeof chunks !== "number" || !Number.isInteger(chunks) || chunks < 1 || chunks > MAX_SHARDS || typeof bytes !== "number" || !Number.isInteger(bytes) || bytes < 0) throw new Error(INVALID);
|
|
1369
|
+
return {
|
|
1370
|
+
gen,
|
|
1371
|
+
chunks,
|
|
1372
|
+
bytes
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1334
1375
|
/** Secrets travel over stdin/stdout; command arguments contain only lookup attributes. */
|
|
1335
1376
|
var SecretServiceCredentialStore = class {
|
|
1336
1377
|
service;
|
|
@@ -1350,31 +1391,142 @@ var SecretServiceCredentialStore = class {
|
|
|
1350
1391
|
this.account
|
|
1351
1392
|
];
|
|
1352
1393
|
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Lookup attributes of one shard entry. Secret Service matching is exact on
|
|
1396
|
+
* every given attribute pair, so the primary account value never matches a
|
|
1397
|
+
* shard and vice versa.
|
|
1398
|
+
*/
|
|
1399
|
+
shardAttributes(gen, index) {
|
|
1400
|
+
return [
|
|
1401
|
+
"service",
|
|
1402
|
+
this.service,
|
|
1403
|
+
"account",
|
|
1404
|
+
`${this.account}#${gen}#${index}`
|
|
1405
|
+
];
|
|
1406
|
+
}
|
|
1353
1407
|
async load() {
|
|
1354
1408
|
return this.cache.load(async () => {
|
|
1355
1409
|
const result = await runSecretTool(["lookup", ...this.attributes()]);
|
|
1356
1410
|
if (result.code === 1 && !result.hasStderr && result.stdout === "") return null;
|
|
1357
1411
|
if (result.code !== 0) throw new Error(UNAVAILABLE);
|
|
1412
|
+
let parsed;
|
|
1358
1413
|
try {
|
|
1359
|
-
|
|
1414
|
+
parsed = JSON.parse(result.stdout);
|
|
1415
|
+
} catch {
|
|
1416
|
+
throw new Error(INVALID);
|
|
1417
|
+
}
|
|
1418
|
+
const envelope = envelopeFrom(parsed);
|
|
1419
|
+
if (envelope === null) try {
|
|
1420
|
+
return this.parse(parsed);
|
|
1421
|
+
} catch {
|
|
1422
|
+
throw new Error(INVALID);
|
|
1423
|
+
}
|
|
1424
|
+
const pieces = [];
|
|
1425
|
+
for (let index = 0; index < envelope.chunks; index += 1) {
|
|
1426
|
+
const shard = await runSecretTool(["lookup", ...this.shardAttributes(envelope.gen, index)]);
|
|
1427
|
+
if (shard.code !== 0) throw new Error(INVALID);
|
|
1428
|
+
pieces.push(shard.stdout);
|
|
1429
|
+
}
|
|
1430
|
+
try {
|
|
1431
|
+
const decoded = Buffer.from(pieces.join(""), "base64");
|
|
1432
|
+
if (decoded.length !== envelope.bytes) throw new Error("shard byte count mismatch");
|
|
1433
|
+
return this.parse(JSON.parse(decoded.toString("utf8")));
|
|
1360
1434
|
} catch {
|
|
1361
|
-
throw new Error(
|
|
1435
|
+
throw new Error(INVALID);
|
|
1362
1436
|
}
|
|
1363
1437
|
});
|
|
1364
1438
|
}
|
|
1365
1439
|
async save(value) {
|
|
1366
1440
|
const payload = JSON.stringify(value);
|
|
1367
|
-
|
|
1441
|
+
const bytes = Buffer.byteLength(payload, "utf8");
|
|
1442
|
+
const stale = await this.storedEnvelope();
|
|
1443
|
+
if (bytes < SECRET_TOOL_STDIN_LIMIT) {
|
|
1444
|
+
if ((await runSecretTool([
|
|
1445
|
+
"store",
|
|
1446
|
+
"--label=DSH Antigravity OAuth",
|
|
1447
|
+
...this.attributes()
|
|
1448
|
+
], payload)).code !== 0) throw new Error(UNAVAILABLE);
|
|
1449
|
+
} else await this.saveChunked(payload, bytes);
|
|
1450
|
+
if (stale !== null) await this.clearShards(stale.gen, stale.chunks);
|
|
1451
|
+
this.cache.invalidate();
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Store an oversized payload as shard entries plus an envelope. The shards
|
|
1455
|
+
* are written under a fresh generation tag first and the primary entry last:
|
|
1456
|
+
* that entry is the commit point, so an interrupted save leaves the previous
|
|
1457
|
+
* envelope and its shards fully intact and the new generation is either
|
|
1458
|
+
* committed whole or cleaned up.
|
|
1459
|
+
*/
|
|
1460
|
+
async saveChunked(payload, bytes) {
|
|
1461
|
+
const encoded = Buffer.from(payload, "utf8").toString("base64");
|
|
1462
|
+
const chunks = Math.ceil(encoded.length / SHARD_PAYLOAD_SIZE);
|
|
1463
|
+
if (chunks > MAX_SHARDS) throw new Error("Secret Service credential payload is too large");
|
|
1464
|
+
const gen = randomBytes(6).toString("hex");
|
|
1465
|
+
for (let index = 0; index < chunks; index += 1) {
|
|
1466
|
+
const piece = encoded.slice(index * SHARD_PAYLOAD_SIZE, (index + 1) * SHARD_PAYLOAD_SIZE);
|
|
1467
|
+
if ((await runSecretTool([
|
|
1468
|
+
"store",
|
|
1469
|
+
"--label=DSH Antigravity OAuth",
|
|
1470
|
+
...this.shardAttributes(gen, index)
|
|
1471
|
+
], piece)).code !== 0) {
|
|
1472
|
+
await this.clearShards(gen, index);
|
|
1473
|
+
throw new Error(UNAVAILABLE);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
const envelope = {
|
|
1477
|
+
gen,
|
|
1478
|
+
chunks,
|
|
1479
|
+
bytes
|
|
1480
|
+
};
|
|
1368
1481
|
if ((await runSecretTool([
|
|
1369
1482
|
"store",
|
|
1370
1483
|
"--label=DSH Antigravity OAuth",
|
|
1371
1484
|
...this.attributes()
|
|
1372
|
-
],
|
|
1373
|
-
|
|
1485
|
+
], JSON.stringify({ [ENVELOPE_KEY]: envelope }))).code !== 0) {
|
|
1486
|
+
await this.clearShards(gen, chunks);
|
|
1487
|
+
throw new Error(UNAVAILABLE);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Envelope of the currently stored value, or null when the entry is missing,
|
|
1492
|
+
* holds a plain value, or cannot be read at all. A save that goes on to fail
|
|
1493
|
+
* surfaces its own error, so a probe failure must not fail the save first.
|
|
1494
|
+
*/
|
|
1495
|
+
async storedEnvelope() {
|
|
1496
|
+
const probe = await runSecretTool(["lookup", ...this.attributes()]);
|
|
1497
|
+
if (probe.code !== 0) return null;
|
|
1498
|
+
try {
|
|
1499
|
+
return envelopeFrom(JSON.parse(probe.stdout));
|
|
1500
|
+
} catch {
|
|
1501
|
+
return null;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Remove shard entries, tolerating the ones that are already gone. A missing
|
|
1506
|
+
* entry exits 1 with empty stderr — the same shape a segfaulting secret-tool
|
|
1507
|
+
* takes through the close event (Ubuntu libsecret-tools 0.20.4 crashes on
|
|
1508
|
+
* clearing an entry that does not exist) — so that answer is never an error.
|
|
1509
|
+
*/
|
|
1510
|
+
async clearShards(gen, chunks) {
|
|
1511
|
+
for (let index = 0; index < chunks; index += 1) {
|
|
1512
|
+
const result = await runSecretTool(["clear", ...this.shardAttributes(gen, index)]);
|
|
1513
|
+
if (result.code !== 0 && !(result.code === 1 && !result.hasStderr)) return;
|
|
1514
|
+
}
|
|
1374
1515
|
}
|
|
1375
1516
|
async clear() {
|
|
1376
|
-
const
|
|
1377
|
-
if (
|
|
1517
|
+
const probe = await runSecretTool(["lookup", ...this.attributes()]);
|
|
1518
|
+
if (probe.code !== 0 && !(probe.code === 1 && !probe.hasStderr)) throw new Error(UNAVAILABLE);
|
|
1519
|
+
if (probe.code === 0) {
|
|
1520
|
+
let envelope = null;
|
|
1521
|
+
try {
|
|
1522
|
+
envelope = envelopeFrom(JSON.parse(probe.stdout));
|
|
1523
|
+
} catch {
|
|
1524
|
+
envelope = null;
|
|
1525
|
+
}
|
|
1526
|
+
if (envelope !== null) await this.clearShards(envelope.gen, envelope.chunks);
|
|
1527
|
+
const result = await runSecretTool(["clear", ...this.attributes()]);
|
|
1528
|
+
if (result.code !== 0 && !(result.code === 1 && !result.hasStderr)) throw new Error(UNAVAILABLE);
|
|
1529
|
+
}
|
|
1378
1530
|
this.cache.invalidate();
|
|
1379
1531
|
}
|
|
1380
1532
|
};
|
|
@@ -4955,6 +5107,27 @@ var FileModelSettingsStore$2 = class {
|
|
|
4955
5107
|
*/
|
|
4956
5108
|
/** Default loopback port the Antigravity CLI's own flow uses. */
|
|
4957
5109
|
const DEFAULT_CALLBACK_PORT$2 = 51121;
|
|
5110
|
+
/**
|
|
5111
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
5112
|
+
*
|
|
5113
|
+
* An excluded range is not a block of fixed width. Windows reserves whatever
|
|
5114
|
+
* span Hyper-V/WinNAT/its own services hold, it moves on every reboot, and a
|
|
5115
|
+
* Windows 11 host was measured handing this line's default port 277 consecutive
|
|
5116
|
+
* excluded ports (51121-51397). A window narrower than the run the default
|
|
5117
|
+
* starts inside ends *inside* that run and then reports "no usable port" on a
|
|
5118
|
+
* machine where hundreds of free ports sit immediately behind it — so the width
|
|
5119
|
+
* of this window, not the width the probe assumes, is what keeps the flow
|
|
5120
|
+
* working.
|
|
5121
|
+
*
|
|
5122
|
+
* 1024 is roughly 3.7x the widest run measured, which is the margin that stops
|
|
5123
|
+
* this depending on any single host's layout, and it still ends at 52144, far
|
|
5124
|
+
* below the 65535 ceiling. The window is cheap because it is walked one failed
|
|
5125
|
+
* bind at a time: a rejected listen measured ~0.35ms here (277 probes in 96ms),
|
|
5126
|
+
* so even the full 1024-probe worst case — only reached when every port in the
|
|
5127
|
+
* window is unusable, immediately before the actionable error — costs ~0.36s
|
|
5128
|
+
* once per sign-in. The ordinary case stops at the first usable port.
|
|
5129
|
+
*/
|
|
5130
|
+
const CALLBACK_PORT_ATTEMPTS$2 = 1024;
|
|
4958
5131
|
let cachedQuota;
|
|
4959
5132
|
let quotaFetchInFlight = null;
|
|
4960
5133
|
/** Bumped by every cache clear so an in-flight fetch cannot publish stale state. */
|
|
@@ -5290,11 +5463,19 @@ function callbackPort() {
|
|
|
5290
5463
|
* URI carries whatever port this returns, so any free loopback port works. A
|
|
5291
5464
|
* configured `DSH_ANTIGRAVITY_CALLBACK_PORT` still wins — callers who set it
|
|
5292
5465
|
* accept that the port must be usable.
|
|
5466
|
+
*
|
|
5467
|
+
* How wide such a reserved run is not something this function can look up — it
|
|
5468
|
+
* is the host's own bookkeeping — so the probe only has to be wider than the
|
|
5469
|
+
* widest run it can meet, and it walks a window sized for that (see
|
|
5470
|
+
* {@link CALLBACK_PORT_ATTEMPTS}) instead of guessing a block size. `start` and
|
|
5471
|
+
* `probe` are the seams that keep that claim testable: production probes from
|
|
5472
|
+
* the line's own default and judges each port by really binding it, and a test
|
|
5473
|
+
* can point the walk at a run whose width it controls.
|
|
5293
5474
|
*/
|
|
5294
|
-
async function resolveCallbackPort$1(attempts =
|
|
5475
|
+
async function resolveCallbackPort$1(attempts = CALLBACK_PORT_ATTEMPTS$2, host = resolveCallbackHost(), start = DEFAULT_CALLBACK_PORT$2, probe = (port) => isPortUsable$1(port, host)) {
|
|
5295
5476
|
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 ${
|
|
5477
|
+
for (let offset = 0; offset < attempts; offset += 1) if (await probe(start + offset)) return start + offset;
|
|
5478
|
+
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
5479
|
}
|
|
5299
5480
|
/**
|
|
5300
5481
|
* Whether one port can be bound on the interface the listener will use.
|
|
@@ -5377,7 +5558,7 @@ async function getUserEmail(token, fetchFn = fetch) {
|
|
|
5377
5558
|
}
|
|
5378
5559
|
async function startCallbackServer(expectedState) {
|
|
5379
5560
|
const host = resolveCallbackHost();
|
|
5380
|
-
const port = await resolveCallbackPort$1(
|
|
5561
|
+
const port = await resolveCallbackPort$1(CALLBACK_PORT_ATTEMPTS$2, host);
|
|
5381
5562
|
return new Promise((resolve, reject) => {
|
|
5382
5563
|
let settled = false;
|
|
5383
5564
|
let timeout;
|
|
@@ -13395,6 +13576,28 @@ const BILLING_SUBSCRIPTIONS_PATH = "/alpha/billing/subscriptions";
|
|
|
13395
13576
|
const USAGE_SUMMARY_PATH = "/alpha/usage/summary";
|
|
13396
13577
|
/** First loopback port tried for the browser callback; matches the official CLI. */
|
|
13397
13578
|
const DEFAULT_CALLBACK_PORT$1 = 5959;
|
|
13579
|
+
/**
|
|
13580
|
+
* Consecutive ports probed when the default is taken.
|
|
13581
|
+
*
|
|
13582
|
+
* The CLI opens its own search at 5959, which {@link DEFAULT_CALLBACK_PORT}
|
|
13583
|
+
* keeps, so on an ordinary machine this line still lands on the port the CLI
|
|
13584
|
+
* would. The WIDTH is recovery budget, not compatibility: the studio is handed
|
|
13585
|
+
* whatever port this returns in the callback URL, so ports past the CLI's own
|
|
13586
|
+
* range were already reachable here before the window was widened, and starting
|
|
13587
|
+
* at the CLI default is what preserves the "behaves like the CLI" property if the
|
|
13588
|
+
* studio ever does pin an allowlist.
|
|
13589
|
+
*
|
|
13590
|
+
* The failure shape makes the width matter more than it does for a line that has
|
|
13591
|
+
* a manual flow to fall back to: exhausting this window is a thrown error and a
|
|
13592
|
+
* dead sign-in, not a downgrade. Windows (Hyper-V/WinNAT) reserves TCP port
|
|
13593
|
+
* ranges of no fixed width that change on every reboot — one host was measured
|
|
13594
|
+
* holding 277 consecutive ports — so a ten-port window is one reboot away from
|
|
13595
|
+
* failing outright and a wider one is not. 1024 matches the other two sign-in
|
|
13596
|
+
* lines here and still ends at 6983: clear of the privileged ports, clear of the
|
|
13597
|
+
* OS dynamic range, and walked one failed bind at a time (~0.35ms each), so the
|
|
13598
|
+
* worst case costs a fraction of a second once per sign-in.
|
|
13599
|
+
*/
|
|
13600
|
+
const CALLBACK_PORT_ATTEMPTS$1 = 1024;
|
|
13398
13601
|
const CALLBACK_PATH$1 = "/callback";
|
|
13399
13602
|
/** Page the studio's browser tab lands on after a successful POST; CLI-compatible. */
|
|
13400
13603
|
const CALLBACK_COMPLETE_PATH = "/callback/complete";
|
|
@@ -17169,16 +17372,19 @@ function checkPortAvailable(port) {
|
|
|
17169
17372
|
});
|
|
17170
17373
|
}
|
|
17171
17374
|
/**
|
|
17172
|
-
* First free loopback port in the
|
|
17375
|
+
* First free loopback port in the probe range.
|
|
17173
17376
|
*
|
|
17174
17377
|
* The studio receives the port in the callback URL, so any free port works;
|
|
17175
17378
|
* starting at the CLI's own default keeps behavior identical on a machine where
|
|
17176
|
-
* a server-side allowlist is ever introduced.
|
|
17379
|
+
* a server-side allowlist is ever introduced. `probe` is the seam the tests walk
|
|
17380
|
+
* a reserved run through, which is what lets the width of the window be asserted
|
|
17381
|
+
* without binding a thousand real sockets on a machine whose own reservations
|
|
17382
|
+
* move underneath the test.
|
|
17177
17383
|
*/
|
|
17178
|
-
async function findAvailablePort(start = DEFAULT_CALLBACK_PORT$1, attempts =
|
|
17384
|
+
async function findAvailablePort(start = DEFAULT_CALLBACK_PORT$1, attempts = CALLBACK_PORT_ATTEMPTS$1, probe = checkPortAvailable) {
|
|
17179
17385
|
for (let offset = 0; offset < attempts; offset += 1) {
|
|
17180
17386
|
const port = start + offset;
|
|
17181
|
-
if (await
|
|
17387
|
+
if (await probe(port)) return port;
|
|
17182
17388
|
}
|
|
17183
17389
|
throw new Error(`No free local port for the Command Code sign-in callback (tried ${attempts} ports from ${start}).`);
|
|
17184
17390
|
}
|
|
@@ -24868,10 +25074,14 @@ function countOmitted(current, baseline, resolved) {
|
|
|
24868
25074
|
*
|
|
24869
25075
|
* The retryable set is therefore:
|
|
24870
25076
|
*
|
|
24871
|
-
* - `SERVER` — any 5xx, including that upstream-unavailable 502
|
|
24872
|
-
*
|
|
24873
|
-
*
|
|
24874
|
-
*
|
|
25077
|
+
* - `SERVER` — any 5xx, including that upstream-unavailable 502, and the
|
|
25078
|
+
* overloaded 429 (`UPSTREAM_OVERLOAD_PATTERNS`). Overload shares the 429
|
|
25079
|
+
* status with real back-pressure but not its meaning: it describes the state
|
|
25080
|
+
* of the upstream engine, which every account behind this endpoint shares, so
|
|
25081
|
+
* it is filed as the server condition it is and the pool is left alone;
|
|
25082
|
+
* - `RATE_LIMIT` — a 429 that is genuine back-pressure ("too many requests"),
|
|
25083
|
+
* which the documentation describes as transient and which does belong to the
|
|
25084
|
+
* account that hit it, so rotation on it still earns its keep;
|
|
24875
25085
|
* - `TRANSPORT` — a connection that produced no response at all;
|
|
24876
25086
|
* - `TIMEOUT` — a stalled stream, handled by the idle watchdog.
|
|
24877
25087
|
*
|
|
@@ -24917,6 +25127,35 @@ const ENTITLEMENT_PATTERNS = [
|
|
|
24917
25127
|
/recognized as other/i,
|
|
24918
25128
|
/currently plan supports only/i
|
|
24919
25129
|
];
|
|
25130
|
+
/**
|
|
25131
|
+
* 正文里说明「上游引擎过载」的措辞,与上面两组按**归属**分界,而不是按严重程度。
|
|
25132
|
+
*
|
|
25133
|
+
* - `ENTITLEMENT_PATTERNS` 说的是套餐:换号、换时间都不会变,是请求/套餐的属性;
|
|
25134
|
+
* - `QUOTA_EXHAUSTED_PATTERNS` 说的是这个账号自己的余额/额度:别人可能还好,
|
|
25135
|
+
* 但这个账号在窗口重置前一定起不来;
|
|
25136
|
+
* - 本组说的是**上游引擎的繁忙**:这是所有账号共用的同一台引擎,谁来问都是这句
|
|
25137
|
+
* 话,本地没有任何动作能改变它。
|
|
25138
|
+
*
|
|
25139
|
+
* 第三组必须单独识别,因为它和真正的限流共用同一个 429 状态码,却不共享结论。
|
|
25140
|
+
* 服务端用 429 表达「引擎过载」时,本线路此前把它归进 RATE_LIMIT,号池随即按
|
|
25141
|
+
* 限流语义给**唯一那个账号**写 15 分钟冷却(`POOL_COOLDOWN_MS`),之后同一
|
|
25142
|
+
* 会话的每一次重试都被 `isEligible` 直接挡在门外——重试根本没发出网络请求,
|
|
25143
|
+
* 3 次退避(3.2s/6.1s,纯本地耗时)打在一个登录正常、额度正常的账号上,最后以
|
|
25144
|
+
* 「全部 1 个 Kimi Code 账号均处于配额限制或冷却中 (429)。最短预计在 15 分钟后
|
|
25145
|
+
* 解除冷却。」收场。真正被限流的服务端状态不该有账号级的副作用。
|
|
25146
|
+
*
|
|
25147
|
+
* 这里只按正文判定,绝不按状态码判定:同一个 429 既可能是过载也可能是真限流,
|
|
25148
|
+
* 唯一能区分的证据就是服务自己写下的那句话。措辞取自本线路文档与实际响应,
|
|
25149
|
+
* 刻意保留 "the engine is …" 的限定,避免把任何提到 "overload" 的正文一律
|
|
25150
|
+
* 吞掉——将来若出现「本账号请求量过载」这类真限流措辞,它不该落进这一组。
|
|
25151
|
+
*/
|
|
25152
|
+
const UPSTREAM_OVERLOAD_PATTERNS = [
|
|
25153
|
+
/\bengine is (currently )?overloaded\b/i,
|
|
25154
|
+
/\bservers? (?:is|are) (?:currently )?overloaded\b/i,
|
|
25155
|
+
/\bservice is (?:currently )?overloaded\b/i,
|
|
25156
|
+
/\bupstream model provider is temporarily unavailable\b/i,
|
|
25157
|
+
/\bcurrently overloaded\b/i
|
|
25158
|
+
];
|
|
24920
25159
|
/** Body text the service uses for a 429 that must NOT be retried. */
|
|
24921
25160
|
const QUOTA_EXHAUSTED_PATTERNS$1 = [
|
|
24922
25161
|
/exceeded_current_quota_error/i,
|
|
@@ -24968,12 +25207,14 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24968
25207
|
code: CONTEXT_OVERFLOW_CODE,
|
|
24969
25208
|
retryable: false,
|
|
24970
25209
|
accountScoped: false,
|
|
25210
|
+
upstreamOverload: false,
|
|
24971
25211
|
message: `${PROVIDER_NAME$5} context window exceeded: ${detail}`
|
|
24972
25212
|
};
|
|
24973
25213
|
if (status === 402) return {
|
|
24974
25214
|
code: "SERVER",
|
|
24975
25215
|
retryable: true,
|
|
24976
25216
|
accountScoped: false,
|
|
25217
|
+
upstreamOverload: false,
|
|
24977
25218
|
message: `${PROVIDER_NAME$5} could not verify the subscription tier (402). Retrying; if it persists, confirm the membership is active.${detail ? ` ${detail}` : ""}`
|
|
24978
25219
|
};
|
|
24979
25220
|
if (status === 401 || status === 403) {
|
|
@@ -24981,6 +25222,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24981
25222
|
code: "PROVIDER_ERROR",
|
|
24982
25223
|
retryable: false,
|
|
24983
25224
|
accountScoped: false,
|
|
25225
|
+
upstreamOverload: false,
|
|
24984
25226
|
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
25227
|
};
|
|
24986
25228
|
if (status === 403) {
|
|
@@ -24989,6 +25231,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24989
25231
|
code: "PROVIDER_ERROR",
|
|
24990
25232
|
retryable: false,
|
|
24991
25233
|
accountScoped: true,
|
|
25234
|
+
upstreamOverload: false,
|
|
24992
25235
|
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
25236
|
};
|
|
24994
25237
|
}
|
|
@@ -24996,6 +25239,7 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
24996
25239
|
code: "INVALID_CREDENTIAL",
|
|
24997
25240
|
retryable: false,
|
|
24998
25241
|
accountScoped: false,
|
|
25242
|
+
upstreamOverload: false,
|
|
24999
25243
|
message: `${PROVIDER_NAME$5} rejected the stored credential (401). Sign in again from Settings > Kimi Code.${detail ? ` ${detail}` : ""}`
|
|
25000
25244
|
};
|
|
25001
25245
|
}
|
|
@@ -25004,31 +25248,43 @@ function classifyKimiFailure(status, bodyText) {
|
|
|
25004
25248
|
code: "PROVIDER_ERROR",
|
|
25005
25249
|
retryable: false,
|
|
25006
25250
|
accountScoped: true,
|
|
25251
|
+
upstreamOverload: false,
|
|
25007
25252
|
message: `${PROVIDER_NAME$5} reports the account quota is exhausted: ${detail || "no remaining quota"}. Top up or wait for the window to reset.`
|
|
25008
25253
|
};
|
|
25254
|
+
if (matchesAny$1(detail, UPSTREAM_OVERLOAD_PATTERNS)) return {
|
|
25255
|
+
code: "SERVER",
|
|
25256
|
+
retryable: true,
|
|
25257
|
+
accountScoped: false,
|
|
25258
|
+
upstreamOverload: true,
|
|
25259
|
+
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.`
|
|
25260
|
+
};
|
|
25009
25261
|
return {
|
|
25010
25262
|
code: "RATE_LIMIT",
|
|
25011
25263
|
retryable: true,
|
|
25012
25264
|
accountScoped: false,
|
|
25013
|
-
|
|
25265
|
+
upstreamOverload: false,
|
|
25266
|
+
message: `${PROVIDER_NAME$5} is rate limited (429): ${detail || "too many requests"}. Retrying with backoff.`
|
|
25014
25267
|
};
|
|
25015
25268
|
}
|
|
25016
25269
|
if (status >= 500) return {
|
|
25017
25270
|
code: "SERVER",
|
|
25018
25271
|
retryable: true,
|
|
25019
25272
|
accountScoped: false,
|
|
25273
|
+
upstreamOverload: matchesAny$1(detail, UPSTREAM_OVERLOAD_PATTERNS),
|
|
25020
25274
|
message: `${PROVIDER_NAME$5} upstream server error (${status}): ${detail || "the model provider is temporarily unavailable"}. Retrying with backoff.`
|
|
25021
25275
|
};
|
|
25022
25276
|
if (status === 400) return {
|
|
25023
25277
|
code: "PROVIDER_ERROR",
|
|
25024
25278
|
retryable: false,
|
|
25025
25279
|
accountScoped: false,
|
|
25280
|
+
upstreamOverload: false,
|
|
25026
25281
|
message: `${PROVIDER_NAME$5} rejected the request (400): ${detail || "the request was not accepted"}`
|
|
25027
25282
|
};
|
|
25028
25283
|
return {
|
|
25029
25284
|
code: "PROVIDER_ERROR",
|
|
25030
25285
|
retryable: false,
|
|
25031
25286
|
accountScoped: false,
|
|
25287
|
+
upstreamOverload: false,
|
|
25032
25288
|
message: `${PROVIDER_NAME$5} API error (${status}): ${detail || "No response"}`
|
|
25033
25289
|
};
|
|
25034
25290
|
}
|
|
@@ -25061,7 +25317,13 @@ function accountLimitCooldownMs(bodyText, now = Date.now()) {
|
|
|
25061
25317
|
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
25318
|
return BILLING_CYCLE_PATTERN.test(bodyText) ? BILLING_CYCLE_COOLDOWN_MS : ACCOUNT_LIMIT_COOLDOWN_MS;
|
|
25063
25319
|
}
|
|
25064
|
-
/**
|
|
25320
|
+
/**
|
|
25321
|
+
* Cooldown one rate-limited account takes when the provider states no delay.
|
|
25322
|
+
*
|
|
25323
|
+
* 只在**真正的**限流上使用:上游引擎过载走 SERVER,既不落这条窗口,也不消耗轮转
|
|
25324
|
+
* 名额。它是 15 分钟而不是服务自己说的时长,正是因为拿不准——拿不准的那次猜测
|
|
25325
|
+
* 落在一个只有单个账号的号池上,代价是整个号池在 15 分钟里彻底不可用。
|
|
25326
|
+
*/
|
|
25065
25327
|
const POOL_COOLDOWN_MS$3 = 15 * 6e4;
|
|
25066
25328
|
/**
|
|
25067
25329
|
* Fallback cooldown for an account whose usage window is spent.
|
|
@@ -25288,7 +25550,7 @@ var KimiCodeAdapter = class extends LlmAdapter {
|
|
|
25288
25550
|
const after = response.status === 429 ? retryAfterMs$1(response.headers) : void 0;
|
|
25289
25551
|
if (pool !== null && accountId !== void 0) {
|
|
25290
25552
|
const planScoped = response.status === 429 && matchesAny$1(detail, ENTITLEMENT_PATTERNS);
|
|
25291
|
-
if (response.status === 429 && !planScoped) {
|
|
25553
|
+
if (response.status === 429 && !planScoped && !failure.upstreamOverload) {
|
|
25292
25554
|
const cooldownMs = failure.accountScoped ? accountLimitCooldownMs(detail) : after ?? POOL_COOLDOWN_MS$3;
|
|
25293
25555
|
await pool.markCooldown(accountId, cooldownMs, `${PROVIDER_NAME$5} 429`).catch(() => void 0);
|
|
25294
25556
|
if (await pool.hasAnotherAvailableAccount(tried)) continue;
|
|
@@ -25384,7 +25646,7 @@ var KimiCodeAdapter = class extends LlmAdapter {
|
|
|
25384
25646
|
if (status === null) return reclassified;
|
|
25385
25647
|
const failure = classifyKimiFailure(status, bodyText);
|
|
25386
25648
|
const planScoped = status === 429 && matchesAny$1(bodyText, ENTITLEMENT_PATTERNS);
|
|
25387
|
-
if (status === 429 && !planScoped) await this.coolInBandRateLimit(pool, accountId, failure.accountScoped, bodyText);
|
|
25649
|
+
if (status === 429 && !planScoped && !failure.upstreamOverload) await this.coolInBandRateLimit(pool, accountId, failure.accountScoped, bodyText);
|
|
25388
25650
|
else if (failure.code === "INVALID_CREDENTIAL") await pool.markAuthFailed(accountId, failure.message).catch(() => void 0);
|
|
25389
25651
|
else if (failure.accountScoped) await pool.markCooldown(accountId, accountLimitCooldownMs(bodyText), `${PROVIDER_NAME$5} in-stream 403`).catch(() => void 0);
|
|
25390
25652
|
return reclassified;
|
|
@@ -37086,6 +37348,32 @@ const CLAUDE_CLI_VERSION = "2.1.293";
|
|
|
37086
37348
|
* see {@link CALLBACK_PORT_ATTEMPTS}.
|
|
37087
37349
|
*/
|
|
37088
37350
|
const DEFAULT_CALLBACK_PORT = 53692;
|
|
37351
|
+
/**
|
|
37352
|
+
* How many consecutive ports one probe covers, starting at the default.
|
|
37353
|
+
*
|
|
37354
|
+
* Windows (Hyper-V/WinNAT) dynamically reserves TCP port ranges that change on
|
|
37355
|
+
* every reboot. A fixed callback port can land inside one and `listen` fails
|
|
37356
|
+
* with `EACCES`, so browser authorization never completes.
|
|
37357
|
+
*
|
|
37358
|
+
* An excluded run is not a block of a width anyone can look up. One Windows 11
|
|
37359
|
+
* host was measured holding 277 consecutive unusable ports (51121-51397) plus
|
|
37360
|
+
* scattered single ones that appear in no static table, and the picture changes
|
|
37361
|
+
* across reboots — so a window justified as "covers any single block" is covering
|
|
37362
|
+
* a block size that does not exist. A window narrower than the run the default
|
|
37363
|
+
* starts inside ends INSIDE that run, and the consequence here is worse than an
|
|
37364
|
+
* error: resolveCallbackPort returns null, which beginLogin reads as "fall back
|
|
37365
|
+
* to manual". The user is then pushed into pasting a code with no visible cause
|
|
37366
|
+
* on a machine that has hundreds of free ports immediately behind the run.
|
|
37367
|
+
*
|
|
37368
|
+
* 1024 is ~3.7x the widest run measured and still ends at 54716, far below the
|
|
37369
|
+
* 65535 ceiling. The window is walked one failed bind at a time (~0.35ms per
|
|
37370
|
+
* rejected listen here), so the worst case costs a fraction of a second once per
|
|
37371
|
+
* sign-in and only when every port in it is unusable; the ordinary case stops at
|
|
37372
|
+
* the first usable port. Widening changes neither which port is tried first nor
|
|
37373
|
+
* the default status as the one port known to be registered for this client
|
|
37374
|
+
* (see {@link DEFAULT_CALLBACK_PORT}).
|
|
37375
|
+
*/
|
|
37376
|
+
const CALLBACK_PORT_ATTEMPTS = 1024;
|
|
37089
37377
|
/** Path of the loopback callback the browser is redirected to. */
|
|
37090
37378
|
const CALLBACK_PATH = "/callback";
|
|
37091
37379
|
/** Idle ceiling for one streaming response before it is declared stalled. */
|
|
@@ -41950,12 +42238,16 @@ function isPortUsable(port) {
|
|
|
41950
42238
|
* First usable loopback port, or null when the probe finds none.
|
|
41951
42239
|
*
|
|
41952
42240
|
* 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
|
-
|
|
42241
|
+
* NOT a hard error, it is the signal to fall back to the manual flow. That is
|
|
42242
|
+
* exactly why the window has to be wide rather than merely generous: a run of
|
|
42243
|
+
* excluded ports wider than CALLBACK_PORT_ATTEMPTS ends this walk early and drops
|
|
42244
|
+
* the user into a paste-a-code flow for a reason nothing on screen explains,
|
|
42245
|
+
* while the ports immediately behind that run sit free. Windows
|
|
42246
|
+
* (Hyper-V/WinNAT) reserves ranges of no fixed width that move on every reboot,
|
|
42247
|
+
* so the width of this window, not any assumed block size, is what keeps the
|
|
42248
|
+
* sign-in in loopback.
|
|
42249
|
+
*/
|
|
42250
|
+
async function resolveCallbackPort(probe = isPortUsable, attempts = CALLBACK_PORT_ATTEMPTS) {
|
|
41959
42251
|
for (let offset = 0; offset < attempts; offset += 1) {
|
|
41960
42252
|
const port = DEFAULT_CALLBACK_PORT + offset;
|
|
41961
42253
|
if (port > 65535) return null;
|
|
@@ -42355,7 +42647,7 @@ async function beginLogin(store, options = {}) {
|
|
|
42355
42647
|
port = await resolveCallbackPort(probe);
|
|
42356
42648
|
if (port === null) {
|
|
42357
42649
|
resolvedMode = "manual";
|
|
42358
|
-
fallbackReason = "No free loopback port in the
|
|
42650
|
+
fallbackReason = "No free loopback port in the 1024-port range starting at 53692.";
|
|
42359
42651
|
} else try {
|
|
42360
42652
|
server = await listen(port, LOOPBACK_HOST);
|
|
42361
42653
|
} 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,WA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EAAE,MAAM,KAAK,IAAI,GACnC,OAAO,CAAC,sBAAsB,CAAC,CA2CjC;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE,OAAO,KAAa,EAC7B,MAAM,CAAC,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,GACjE,OAAO,CAAC,iBAAiB,CAAC,CAmE5B;AAED,wBAAgB,iBAAiB,IAAI,iBAAiB,CAErD;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,sBAAsB,EACnC,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC,sBAAsB,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/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AI,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,eAAO,MAAM,UAAU,qBAAqB,CAAA;AAE5C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,sCAAsC,CAAA;AACtE,wEAAwE;AACxE,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAE3E;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,oDAAoD,CAAA;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,yCAAyC,CAAA;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,+GAA+G,CAAA;AAExI;;;;;GAKG;AACH,eAAO,MAAM,UAAU,qBAAqB,CAAA;AAC5C,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,yBAAyB,CAAA;AACtD,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,oCAAoC,CAAA;AAC1E;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kCAAkC,CAAA;AACtE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAA;AACxC,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,EAAE,cAAqB,CAAA;AACjE,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,EAAE,cAAqB,CAAA;AAE5D,+EAA+E;AAC/E,wBAAgB,eAAe,CA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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,sBA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AE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GACxC,OAAO,CAAC,2BAA2B,CAAC,CA2LtC;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,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,oF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,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"}
|
|
@@ -7,8 +7,35 @@ export declare class SecretServiceCredentialStore<T> implements CredentialStore<
|
|
|
7
7
|
private readonly cache;
|
|
8
8
|
constructor(service: string, account: string, parse: (value: unknown) => T);
|
|
9
9
|
private attributes;
|
|
10
|
+
/**
|
|
11
|
+
* Lookup attributes of one shard entry. Secret Service matching is exact on
|
|
12
|
+
* every given attribute pair, so the primary account value never matches a
|
|
13
|
+
* shard and vice versa.
|
|
14
|
+
*/
|
|
15
|
+
private shardAttributes;
|
|
10
16
|
load(): Promise<T | null>;
|
|
11
17
|
save(value: T): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Store an oversized payload as shard entries plus an envelope. The shards
|
|
20
|
+
* are written under a fresh generation tag first and the primary entry last:
|
|
21
|
+
* that entry is the commit point, so an interrupted save leaves the previous
|
|
22
|
+
* envelope and its shards fully intact and the new generation is either
|
|
23
|
+
* committed whole or cleaned up.
|
|
24
|
+
*/
|
|
25
|
+
private saveChunked;
|
|
26
|
+
/**
|
|
27
|
+
* Envelope of the currently stored value, or null when the entry is missing,
|
|
28
|
+
* holds a plain value, or cannot be read at all. A save that goes on to fail
|
|
29
|
+
* surfaces its own error, so a probe failure must not fail the save first.
|
|
30
|
+
*/
|
|
31
|
+
private storedEnvelope;
|
|
32
|
+
/**
|
|
33
|
+
* Remove shard entries, tolerating the ones that are already gone. A missing
|
|
34
|
+
* entry exits 1 with empty stderr — the same shape a segfaulting secret-tool
|
|
35
|
+
* takes through the close event (Ubuntu libsecret-tools 0.20.4 crashes on
|
|
36
|
+
* clearing an entry that does not exist) — so that answer is never an error.
|
|
37
|
+
*/
|
|
38
|
+
private clearShards;
|
|
12
39
|
clear(): Promise<void>;
|
|
13
40
|
}
|
|
14
41
|
//# sourceMappingURL=credential-store-secret-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-store-secret-service.d.ts","sourceRoot":"","sources":["../../../src/host/credential-store-secret-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credential-store-secret-service.d.ts","sourceRoot":"","sources":["../../../src/host/credential-store-secret-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAyEvD,0FAA0F;AAC1F,qBAAa,4BAA4B,CAAC,CAAC,CAAE,YAAW,eAAe,CAAC,CAAC,CAAC;IAMtE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAErB;gBAGkB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAG/C,OAAO,CAAC,UAAU;IAIlB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAIjB,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAqCzB,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnC;;;;;;OAMG;YACW,WAAW;IA2BzB;;;;OAIG;YACW,cAAc;IAU5B;;;;;OAKG;YACW,WAAW;IAWnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAmB7B"}
|
|
@@ -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,MAA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AAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,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.3",
|
|
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",
|