dsh-free-model 0.5.1 → 0.5.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/README.md +9 -2
- package/README_EN.md +9 -2
- package/SECURITY-AUDIT.md +3 -3
- package/package.json +1 -1
- package/vendor/channel-pack/pack.js +961 -249
|
@@ -893,7 +893,7 @@ async function requestToken(body, keyPair, fetcher = fetch) {
|
|
|
893
893
|
if (!response.ok || !data?.credentials) {
|
|
894
894
|
const message2 = `CodeArts token request failed: ${response.status}${data ? ` ${JSON.stringify(data)}` : ""}`;
|
|
895
895
|
const errorCode = String(data?.error_code ?? "");
|
|
896
|
-
if (data?.error === "invalid_grant" || errorCode.includes("ExpiredRefreshToken")) {
|
|
896
|
+
if (data?.error === "invalid_grant" || errorCode.includes("ExpiredRefreshToken") || errorCode.includes("STS5.1806") || /refresh\s*token\s+has\s+been\s+used/i.test(message2)) {
|
|
897
897
|
throw new RefreshTokenExpiredError(message2);
|
|
898
898
|
}
|
|
899
899
|
throw new Error(message2);
|
|
@@ -29339,10 +29339,10 @@ function normalizeModelId(id) {
|
|
|
29339
29339
|
function parseModelInfo(m, seen) {
|
|
29340
29340
|
const rawId = m["model_id"];
|
|
29341
29341
|
if (typeof rawId !== "string" || rawId.length === 0) return void 0;
|
|
29342
|
-
const id =
|
|
29342
|
+
const id = rawId;
|
|
29343
29343
|
if (id.includes("-VL-") || id.endsWith("-VL")) return void 0;
|
|
29344
29344
|
const rawName = m["model_name"];
|
|
29345
|
-
const name2 = typeof rawName === "string" && rawName.length > 0 ?
|
|
29345
|
+
const name2 = typeof rawName === "string" && rawName.length > 0 ? rawName : id;
|
|
29346
29346
|
if (seen.has(id)) return void 0;
|
|
29347
29347
|
seen.add(id);
|
|
29348
29348
|
return { id, name: name2 };
|
|
@@ -32349,6 +32349,95 @@ function isTruncatedArguments(raw) {
|
|
|
32349
32349
|
return true;
|
|
32350
32350
|
}
|
|
32351
32351
|
}
|
|
32352
|
+
var COMPLETE_INVALID_LITERAL_RE = /^(?:NaN|-?Infinity|undefined)$/;
|
|
32353
|
+
var INVISIBLE_FORMAT_RE = /[\p{Cf}]/gu;
|
|
32354
|
+
function classifyToolArguments(raw) {
|
|
32355
|
+
const trimmed = raw.trim();
|
|
32356
|
+
if (trimmed.length === 0) return "ok";
|
|
32357
|
+
try {
|
|
32358
|
+
JSON.parse(trimmed);
|
|
32359
|
+
return "ok";
|
|
32360
|
+
} catch {
|
|
32361
|
+
}
|
|
32362
|
+
if (COMPLETE_INVALID_LITERAL_RE.test(trimmed)) return "invalid";
|
|
32363
|
+
const visible = trimmed.replace(INVISIBLE_FORMAT_RE, "");
|
|
32364
|
+
if (visible !== trimmed) {
|
|
32365
|
+
try {
|
|
32366
|
+
JSON.parse(visible);
|
|
32367
|
+
return "truncated";
|
|
32368
|
+
} catch {
|
|
32369
|
+
}
|
|
32370
|
+
}
|
|
32371
|
+
const last = trimmed[trimmed.length - 1];
|
|
32372
|
+
if (last !== "}" && last !== "]") return "truncated";
|
|
32373
|
+
let braces = 0;
|
|
32374
|
+
let brackets = 0;
|
|
32375
|
+
let inString = false;
|
|
32376
|
+
let escaped = false;
|
|
32377
|
+
for (const ch of trimmed) {
|
|
32378
|
+
if (escaped) {
|
|
32379
|
+
escaped = false;
|
|
32380
|
+
continue;
|
|
32381
|
+
}
|
|
32382
|
+
if (ch === "\\") {
|
|
32383
|
+
escaped = true;
|
|
32384
|
+
continue;
|
|
32385
|
+
}
|
|
32386
|
+
if (ch === '"') {
|
|
32387
|
+
inString = !inString;
|
|
32388
|
+
continue;
|
|
32389
|
+
}
|
|
32390
|
+
if (inString) continue;
|
|
32391
|
+
if (ch === "{") braces += 1;
|
|
32392
|
+
else if (ch === "}") {
|
|
32393
|
+
braces -= 1;
|
|
32394
|
+
if (braces < 0) return "truncated";
|
|
32395
|
+
} else if (ch === "[") brackets += 1;
|
|
32396
|
+
else if (ch === "]") {
|
|
32397
|
+
brackets -= 1;
|
|
32398
|
+
if (brackets < 0) return "truncated";
|
|
32399
|
+
}
|
|
32400
|
+
}
|
|
32401
|
+
if (braces !== 0 || brackets !== 0) return "truncated";
|
|
32402
|
+
if (inString) return "truncated";
|
|
32403
|
+
return "invalid";
|
|
32404
|
+
}
|
|
32405
|
+
var TOOL_ARGS_INVALID_CODE = "TOOL_ARGS_INVALID";
|
|
32406
|
+
function isUsableToolArguments(raw) {
|
|
32407
|
+
if (raw.trim().length === 0) return true;
|
|
32408
|
+
let parsed;
|
|
32409
|
+
try {
|
|
32410
|
+
parsed = JSON.parse(raw);
|
|
32411
|
+
} catch {
|
|
32412
|
+
return false;
|
|
32413
|
+
}
|
|
32414
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return false;
|
|
32415
|
+
return true;
|
|
32416
|
+
}
|
|
32417
|
+
function toolArgsInvalidIsSoleOutput(invalidCount, emittedProse, blocks, upstreamTruncated) {
|
|
32418
|
+
if (invalidCount === 0) return false;
|
|
32419
|
+
if (upstreamTruncated) return false;
|
|
32420
|
+
if (emittedProse !== "") return false;
|
|
32421
|
+
for (const block of blocks) {
|
|
32422
|
+
if (hasUsableToolName(block.name) && isUsableToolArguments(block.text)) return false;
|
|
32423
|
+
}
|
|
32424
|
+
return true;
|
|
32425
|
+
}
|
|
32426
|
+
function toolArgsInvalidBlocks(entries) {
|
|
32427
|
+
const out = [];
|
|
32428
|
+
for (const entry of entries) {
|
|
32429
|
+
out.push({ name: entry.block.name, chars: entry.block.text.length });
|
|
32430
|
+
}
|
|
32431
|
+
return out;
|
|
32432
|
+
}
|
|
32433
|
+
function toolArgsInvalidFailure(blocks) {
|
|
32434
|
+
const shown = blocks.slice(0, 3).map((block) => `${block.name ?? "(\u672A\u547D\u540D\u5DE5\u5177)"}\uFF0C${block.chars} \u5B57\u7B26`).join("\uFF1B");
|
|
32435
|
+
const scope = blocks.length > 3 ? `${shown}\uFF1B\u7B49 ${blocks.length} \u4E2A\u8C03\u7528` : shown;
|
|
32436
|
+
return {
|
|
32437
|
+
message: `\u6A21\u578B\u751F\u6210\u7684\u5DE5\u5177\u53C2\u6570\u4E0D\u662F\u5408\u6CD5 JSON\uFF08${scope}\uFF09\uFF0C\u672C\u6B21\u8C03\u7528\u5DF2\u4E22\u5F03\u3002\u8FD9\u4E0D\u662F\u8F93\u51FA token \u4E0A\u9650\uFF0C\u4E5F\u4E0D\u662F\u7F51\u7EDC\u4E2D\u65AD \u2014\u2014 \u76F4\u63A5\u91CD\u8BD5\u5373\u53EF\uFF1B\u82E5\u8FDE\u7EED\u51FA\u73B0\uFF0C\u5EFA\u8BAE\u66F4\u6362\u6A21\u578B\u6216\u7F29\u5C0F\u8BE5\u6B21\u8C03\u7528\u7684\u8DE8\u5EA6\uFF08\u4F8B\u5982\u4E0A\u4E0B\u6587\u538B\u7F29\u7684 startId\u2013endId \u533A\u95F4\uFF09\u3002`,
|
|
32438
|
+
code: TOOL_ARGS_INVALID_CODE
|
|
32439
|
+
};
|
|
32440
|
+
}
|
|
32352
32441
|
var REASONING_LOOP_CODE = "REASONING_LOOP";
|
|
32353
32442
|
function resolveSliceChars(raw) {
|
|
32354
32443
|
const value = raw ?? 64;
|
|
@@ -33801,6 +33890,33 @@ var CodeArtsAdapter = class extends LlmAdapter {
|
|
|
33801
33890
|
* 懒加载远端模型目录。resolveModel 可能先于 listModels 被调用
|
|
33802
33891
|
* (如直接进入会话),此时同样触发远端拉取。
|
|
33803
33892
|
*/
|
|
33893
|
+
/**
|
|
33894
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
33895
|
+
*
|
|
33896
|
+
* ## ⚠️⚠️ 只清「已完成」标记,**绝不清 `remoteModels` 数据**
|
|
33897
|
+
*
|
|
33898
|
+
* `ensureRemoteModels` 的失败语义**已经是对的**:
|
|
33899
|
+
* - `fetchRemote()` 抛异常 ⇒ 直接冒出,`remoteModels` **保持旧值**
|
|
33900
|
+
* (用户继续看到旧目录,比退回 `DEFAULT_MODELS` 兜底子集好);
|
|
33901
|
+
* - 返回空数组 ⇒ `return false`(不落缓存、不立刻重试)。
|
|
33902
|
+
*
|
|
33903
|
+
* 若在这里顺手写 `this.remoteModels = undefined` 就会**毁掉**这个好语义:
|
|
33904
|
+
* 一次网络抖动 ⇒ 好端端的旧目录被清 ⇒ `listAllModels()` 落回兜底表
|
|
33905
|
+
*(那是**子集**且**已过期**,实测 3 条已 404)⇒ 用户突然少看到一批模型。
|
|
33906
|
+
*
|
|
33907
|
+
* ⇒ **只清标记**,让 `ensureRemoteModels` 自己决定何时覆盖数据。
|
|
33908
|
+
*
|
|
33909
|
+
* ⚠️ `listAllModels()` 是**同步**读 `remoteModels` 的缓存视图 ⇒ 刷新成功后它
|
|
33910
|
+
* 立刻看到新值(`ensureRemoteModels` 已重新赋值),无需额外「补读」步骤。
|
|
33911
|
+
*
|
|
33912
|
+
* ⚠️ 本方法**必须 public**:`index.ts` 的定时器经 `modelAdapters` 逐家调用
|
|
33913
|
+
*(那里每项是 `withDeadModelPruning` 的 Proxy,新成员自动透出并绑 `this`)。
|
|
33914
|
+
*/
|
|
33915
|
+
async refreshCatalog() {
|
|
33916
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
33917
|
+
this.remoteComplete = false;
|
|
33918
|
+
await this.ensureRemoteModels();
|
|
33919
|
+
}
|
|
33804
33920
|
async ensureRemoteModels() {
|
|
33805
33921
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
33806
33922
|
if (this.remoteComplete || fetchRemote === void 0) return;
|
|
@@ -34465,6 +34581,48 @@ function isRateLimited(body, status) {
|
|
|
34465
34581
|
}
|
|
34466
34582
|
var RESET_TIME_PATTERN = /(?:将在|reset at)\s+([\d-]+\s+[\d:]+)\s+(UTC[+-]\d+(?::\d+)?)/i;
|
|
34467
34583
|
var RATE_LIMIT_FALLBACK_MS = 36e5;
|
|
34584
|
+
var CREDIT_EXHAUSTED_BUSINESS_CODE = 14018;
|
|
34585
|
+
var CREDIT_EXHAUSTED_PATTERN = /credits?\s+exhausted|quota\s+exhausted|积分.{0,4}(?:不足|耗尽|用尽)|额度.{0,4}(?:不足|耗尽|用尽)|余额.{0,4}(?:不足|耗尽|用尽)/i;
|
|
34586
|
+
function isCreditExhausted(body) {
|
|
34587
|
+
if (body.length === 0) return false;
|
|
34588
|
+
try {
|
|
34589
|
+
const data = JSON.parse(body);
|
|
34590
|
+
const inner = typeof data.error === "object" && data.error !== null ? data.error : void 0;
|
|
34591
|
+
const nested = typeof inner?.data === "object" && inner.data !== null ? inner.data : void 0;
|
|
34592
|
+
const codes = [data.code, inner?.code, nested?.code];
|
|
34593
|
+
if (codes.some((code) => code === CREDIT_EXHAUSTED_BUSINESS_CODE || code === String(CREDIT_EXHAUSTED_BUSINESS_CODE))) {
|
|
34594
|
+
return true;
|
|
34595
|
+
}
|
|
34596
|
+
} catch {
|
|
34597
|
+
}
|
|
34598
|
+
return CREDIT_EXHAUSTED_PATTERN.test(body);
|
|
34599
|
+
}
|
|
34600
|
+
function creditExhaustedResetAtMs(nowMs = Date.now()) {
|
|
34601
|
+
return nextUtc8DayStartMs(nowMs);
|
|
34602
|
+
}
|
|
34603
|
+
function explicitRateResetAtMs(body) {
|
|
34604
|
+
try {
|
|
34605
|
+
const data = JSON.parse(body);
|
|
34606
|
+
const inner = typeof data.error === "object" && data.error !== null ? data.error : void 0;
|
|
34607
|
+
const nested = typeof inner?.data === "object" && inner.data !== null ? inner.data : void 0;
|
|
34608
|
+
const candidates = [data.msg, inner?.msg, nested?.msg];
|
|
34609
|
+
for (const candidate of candidates) {
|
|
34610
|
+
if (typeof candidate !== "string") continue;
|
|
34611
|
+
const resetMatch = RESET_TIME_PATTERN.exec(candidate);
|
|
34612
|
+
if (!resetMatch) continue;
|
|
34613
|
+
const resetMs = Date.parse(`${resetMatch[1]} ${resetMatch[2]}`);
|
|
34614
|
+
if (!Number.isNaN(resetMs)) return resetMs;
|
|
34615
|
+
}
|
|
34616
|
+
return void 0;
|
|
34617
|
+
} catch {
|
|
34618
|
+
const bareMatch = RESET_TIME_PATTERN.exec(body);
|
|
34619
|
+
if (bareMatch !== null) {
|
|
34620
|
+
const bareMs = Date.parse(`${bareMatch[1]} ${bareMatch[2]}`);
|
|
34621
|
+
if (!Number.isNaN(bareMs)) return bareMs;
|
|
34622
|
+
}
|
|
34623
|
+
return void 0;
|
|
34624
|
+
}
|
|
34625
|
+
}
|
|
34468
34626
|
function parseRateLimitError(body, currentModel, status) {
|
|
34469
34627
|
const fallback = () => ({
|
|
34470
34628
|
modelId: currentModel,
|
|
@@ -34567,10 +34725,61 @@ var CONTENT_FINGERPRINTS = [
|
|
|
34567
34725
|
// 且不动后半句 —— 破坏 agent 提示词的语义比多拦一轮更糟。
|
|
34568
34726
|
// ⚠️ 匹配仍走本文件的**大小写不敏感 + 位置无关** replaceAll(行首锚定是
|
|
34569
34727
|
// 服务端的判据,不是我们的改写范围)—— 改写范围宁可略宽。
|
|
34570
|
-
|
|
34571
|
-
|
|
34728
|
+
// ⚠️ **`find` 刻意不带末尾句点**(对齐上游 76d33062):DSH 哪天把句号改成别的
|
|
34729
|
+
// 标点或去掉,带句点的写法会**静默停止匹配**(症状 = 渠道整轮 400 复发,
|
|
34730
|
+
// 与「完全没登记」同形)。不带句点只要求前 52 字符逐字一致。
|
|
34731
|
+
find: "You are an AI agent powered by DeepSeek Harness",
|
|
34732
|
+
replace: "You are an AI agent built on the DeepSeek Harness runtime",
|
|
34572
34733
|
note: "2026-10-21 \u672C\u673A\u5BF9 copilot.tencent.com \u5B9E\u6D4B\uFF1A\u539F\u53E5 400/11128\u3001\u6539\u5199\u540E 200\uFF083 \u6A21\u578B\u590D\u9A8C\uFF09"
|
|
34573
34734
|
},
|
|
34735
|
+
{
|
|
34736
|
+
// ★ **DSH 的 `@` 文件引用说明句**(上游 `82d007a6`;本 fork 2026-10-29 移植+真机复验)。
|
|
34737
|
+
//
|
|
34738
|
+
// ## ⚠️⚠️ 本条**不含任何品牌词** —— 这正是它被前一轮漏掉的原因
|
|
34739
|
+
//
|
|
34740
|
+
// 上一轮(2026-10-21)登记的是 `You are an AI agent powered by DeepSeek Harness.`
|
|
34741
|
+
// 那条带品牌名,靠「找含 DeepSeek Harness 的句子」能扫到。而本条是**纯功能描述**:
|
|
34742
|
+
// 没有 `DeepSeek`、没有 `dsh`、没有 `Harness` ⇒ 按品牌名普查**必然漏掉**。
|
|
34743
|
+
// ⇒ **判据不是品牌名,是「`@` 路径引用语法说明」这个 DSH 独有写法。**
|
|
34744
|
+
// 以后新增登记时请回来读这一行:**别只按品牌名普查**。
|
|
34745
|
+
//
|
|
34746
|
+
// ## 出处(极易被漏第二次,故写明)
|
|
34747
|
+
//
|
|
34748
|
+
// `@deepseek-ai/dsh-file-reference-local` 注入的 `context:file-reference` 段
|
|
34749
|
+
// (`FILE_REFERENCE_PROMPT`)。它在 agent 有 `read` 工具时**恒非空** ⇒ **每轮必带**,
|
|
34750
|
+
// 与加载了哪些插件 / skill **完全无关**(上游曾误判为 superpowers 撑大 system 所致,
|
|
34751
|
+
// 实测删掉整段后仍被拦,该假设已证伪)。
|
|
34752
|
+
//
|
|
34753
|
+
// ## 本 fork 真机复验(2026-10-29,`copilot.tencent.com`,真实账号)
|
|
34754
|
+
//
|
|
34755
|
+
// | 探针 | 结果 |
|
|
34756
|
+
// |---|---|
|
|
34757
|
+
// | 中性基线 | ✅ 200 |
|
|
34758
|
+
// | 原句 `Tokens prefixed with @ … workspace root` | ❌ **400/11128** |
|
|
34759
|
+
// | 上游 `replace`(只调语序) | ✅ **200** |
|
|
34760
|
+
//
|
|
34761
|
+
// 且已确认**我们 DSH 的真实 system 里就有这句**(从 10-28 的会话日志逐字取出,
|
|
34762
|
+
// 前半段与下方 `find` 完全一致)⇒ 不登记 = 腾讯系渠道每轮必拦。
|
|
34763
|
+
//
|
|
34764
|
+
// ## 上游的逐格实测要点(`82d007a6`,勿删,用来判「以后要不要再登记同族」)
|
|
34765
|
+
//
|
|
34766
|
+
// - 字面量 **111 字符**:110 前缀放行 / 111 拦 ⇒ **必须写满整句**;
|
|
34767
|
+
// - 只发前半句(48 字符)或只发后半句(44 字符)**各自都放行** ⇒ 触发串
|
|
34768
|
+
// **跨句边界**,切一半会**空跑**(探针会得出「已放行」的假阴性);
|
|
34769
|
+
// - **位置无关**(裸串/前接空格/换行/中文/嵌在句中 全 ❌)——与本文件的
|
|
34770
|
+
// `Main branch …` 那条同型,区别于「Claude Code 身份句」的行首锚定;
|
|
34771
|
+
// - **大小写不敏感**。
|
|
34772
|
+
//
|
|
34773
|
+
// ⚠️ 已知边界(上游明列):服务端认**逐字符长字面量** ⇒ DSH 哪天改动这两句任一
|
|
34774
|
+
// 字符,本规则会**静默停止匹配**(症状 = 该渠道整轮 400 复发,与「完全没登记」同形)。
|
|
34775
|
+
// 守卫见 `scripts/channel-fingerprint-test.mjs`。
|
|
34776
|
+
find: "Tokens prefixed with @ are paths the user explicitly referenced. Relative paths resolve from the workspace root",
|
|
34777
|
+
// 只调整语序:`相对路径从工作区根解析` → `路径相对工作区根解析`。语义不变,
|
|
34778
|
+
// 且**整句其余部分逐字不动** —— 后半段(目录 list / 用 read / 不得声称已读过 /
|
|
34779
|
+
// 引号语法)是防模型编造文件内容的核心约束,一个字都不许删。
|
|
34780
|
+
replace: "Tokens prefixed with @ are paths the user explicitly referenced. Paths resolve relative to the workspace root",
|
|
34781
|
+
note: "\u4E0A\u6E38 82d007a6\uFF082026-10-28 \u771F\u5B9E\u62A5\u969C\uFF09+ \u672C\u673A 2026-10-29 \u590D\u9A8C\uFF1A\u539F\u53E5 400\u3001\u8C03\u8BED\u5E8F\u540E 200\uFF1B\u26A0\uFE0F \u672C\u6761\u4E0D\u542B\u54C1\u724C\u8BCD\uFF0C\u6309\u300C\u627E\u542B DeepSeek Harness \u7684\u53E5\u5B50\u300D\u666E\u67E5\u5FC5\u6F0F"
|
|
34782
|
+
},
|
|
34574
34783
|
{
|
|
34575
34784
|
// ZCode 内建常量:`$Js="Main branch (you will usually use this for PRs)"`。
|
|
34576
34785
|
// 每个 git 仓库里的会话都会被注入(拼在 `Main branch … : <分支名>` 这一行)。
|
|
@@ -34650,6 +34859,38 @@ var CONTENT_FINGERPRINTS = [
|
|
|
34650
34859
|
// 实测两端点均 200(buddy / workbuddy,2026-10-18)。措辞与原文等义。
|
|
34651
34860
|
replace: "To give feedback, users should report the issue at the project issue tracker",
|
|
34652
34861
|
note: "Gitee IKLYCT\uFF1B\u672C\u673A 2026-10-18 \u5BF9 workbuddy / CodeBuddy \u53CC\u7AEF\u70B9\u5B9E\u6D4B\uFF1Asystem\uFF08\u542B\u975E\u9996\u4F4D\uFF09\u4E0E assistant \u6B63\u6587\u5747 400/11128\uFF0Cuser / reasoning_content / tool \u7ED3\u679C\u653E\u884C\uFF0C\u6539\u5199\u540E\u4E24\u7AEF\u70B9\u5747 200"
|
|
34862
|
+
},
|
|
34863
|
+
{
|
|
34864
|
+
// ★ **DSH 的 Web GUI 环境说明句**(2026-10-29 本机二分定位,**上游尚未登记**)。
|
|
34865
|
+
//
|
|
34866
|
+
// ## 怎么发现的:前两条都已改写、整段仍 400 逼出来的第三条
|
|
34867
|
+
//
|
|
34868
|
+
// 0.5.2 上线后本机复验:真实 system 里身份首句与 `@` 文件引用句**都确认已改写**,
|
|
34869
|
+
// 但**整段仍然 400**。行级二分 58 行 → 定位到这一行(1111 字符),
|
|
34870
|
+
// 再前缀二分到**精确 221 字符**(220 放行)。
|
|
34871
|
+
//
|
|
34872
|
+
// ## 触发性(本机 2026-10-29,copilot.tencent.com,真实账号)
|
|
34873
|
+
//
|
|
34874
|
+
// | 探针 | 结果 |
|
|
34875
|
+
// |---|---|
|
|
34876
|
+
// | 该行整行(1111 字符) | ❌ 400 |
|
|
34877
|
+
// | 改 `they mean this GUI` → `they mean the GUI` | ✅ **200(采用)** |
|
|
34878
|
+
// | 改 `DeepSeek Harness Web GUI` → `… web interface` | ✅ 200 |
|
|
34879
|
+
// | 改 `You are interacting` → `You are talking` | ✅ 200 |
|
|
34880
|
+
//
|
|
34881
|
+
// ⇒ 服务端认**逐字符长字面量**,改任一字符即放行。
|
|
34882
|
+
//
|
|
34883
|
+
// ## 为什么选「this GUI → the GUI」
|
|
34884
|
+
//
|
|
34885
|
+
// 三种改法都实测 200。选这一条因为**不碰专有名词、不改动词、句长几乎不变、
|
|
34886
|
+
// 语义完全等同**(两者都指当前这个 GUI)。改 `Web GUI` 会动产品名形态,
|
|
34887
|
+
// 改 `interacting` 会改语气 —— 都没必要。
|
|
34888
|
+
//
|
|
34889
|
+
// ⚠️ 已知边界(与 `@` 那条同型):服务端认逐字符长字面量 ⇒ DSH 改动这句任一
|
|
34890
|
+
// 字符,本规则会**静默停止匹配**(症状 = 该渠道整轮 400 复发)。
|
|
34891
|
+
find: 'You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names. When the user refers to "this page", "this GUI", or "this app" without naming another target, they mean this GUI.',
|
|
34892
|
+
replace: 'You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names. When the user refers to "this page", "the GUI", or "this app" without naming another target, they mean the GUI.',
|
|
34893
|
+
note: "2026-10-29 \u672C\u673A\u4E8C\u5206\u5B9A\u4F4D\uFF08\u4E0A\u6E38\u5C1A\u672A\u767B\u8BB0\uFF09\uFF1A221 \u5B57\u7B26\u5B57\u9762\u91CF\u3001220 \u653E\u884C\uFF1B\u524D\u4E24\u6761\u5DF2\u6539\u5199\u4F46\u6574\u6BB5\u4ECD 400 \u65F6\u903C\u51FA\u6765\u7684\u7B2C\u4E09\u6761\uFF1B\u6539 this GUI\u2192the GUI \u5B9E\u6D4B 200"
|
|
34653
34894
|
}
|
|
34654
34895
|
];
|
|
34655
34896
|
function escapeRegExp(literal) {
|
|
@@ -35168,6 +35409,27 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35168
35409
|
pixelBudget: this.product.imagePixelBudget
|
|
35169
35410
|
});
|
|
35170
35411
|
}
|
|
35412
|
+
/**
|
|
35413
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
35414
|
+
*
|
|
35415
|
+
* ## ⚠️⚠️ 只清 `remoteComplete`,**三个缓存字段都不清**
|
|
35416
|
+
*
|
|
35417
|
+
* 本类的目录缓存有**三个联动字段**(`remoteModels` / `remoteMeta` /
|
|
35418
|
+
* `remoteContextWindows`),它们由 `ensureRemoteModels` 内部**一起重建** ⇒
|
|
35419
|
+
* 清标记后重拉即可,手动清任何一个都会制造「只更新一半」的不一致中间态。
|
|
35420
|
+
*
|
|
35421
|
+
* 失败语义(与 codearts 同):拉取抛异常 ⇒ `ensureRemoteModels` 直接冒出、
|
|
35422
|
+
* **三个字段都保留旧值**;返回空数组 ⇒ `return false`(不落缓存)。
|
|
35423
|
+
* ⇒ 一次网络抖动不会把好端端的旧目录清成兜底子集。
|
|
35424
|
+
*
|
|
35425
|
+
* ⚠️ 本类服务**两个产品**(buddy / workbuddy),各自一个实例 ⇒ 定时器按
|
|
35426
|
+
* `modelAdapters` 的两项分别调用,各自刷新,互不影响。
|
|
35427
|
+
*/
|
|
35428
|
+
async refreshCatalog() {
|
|
35429
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
35430
|
+
this.remoteComplete = false;
|
|
35431
|
+
await this.ensureRemoteModels();
|
|
35432
|
+
}
|
|
35171
35433
|
async ensureRemoteModels() {
|
|
35172
35434
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
35173
35435
|
if (this.remoteComplete || fetchRemote === void 0) return;
|
|
@@ -35636,12 +35898,21 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35636
35898
|
}
|
|
35637
35899
|
}
|
|
35638
35900
|
const channelRejected = isChannelVerificationRejection(errorText, response.status);
|
|
35639
|
-
|
|
35901
|
+
const contentRejectedOn400 = isContentRejection(errorText);
|
|
35902
|
+
if (this.options.accountPool && (isRateLimited(errorText, response.status) || channelRejected || contentRejectedOn400)) {
|
|
35640
35903
|
const tried = /* @__PURE__ */ new Set();
|
|
35641
35904
|
if (currentAccountId) tried.add(currentAccountId);
|
|
35642
|
-
let sawContentRejection =
|
|
35643
|
-
let contentRejectionStatus = 0;
|
|
35644
|
-
let contentRejectionBody = "";
|
|
35905
|
+
let sawContentRejection = contentRejectedOn400;
|
|
35906
|
+
let contentRejectionStatus = contentRejectedOn400 ? response.status : 0;
|
|
35907
|
+
let contentRejectionBody = contentRejectedOn400 ? errorText : "";
|
|
35908
|
+
if (contentRejectedOn400 && currentAccountId !== "") {
|
|
35909
|
+
await markPolicyBlockedAccount(
|
|
35910
|
+
this.options.accountPool,
|
|
35911
|
+
this.product.id,
|
|
35912
|
+
currentAccountId,
|
|
35913
|
+
options.model
|
|
35914
|
+
);
|
|
35915
|
+
}
|
|
35645
35916
|
let sawChannelVerification = channelRejected;
|
|
35646
35917
|
let channelVerificationStatus = channelRejected ? response.status : 0;
|
|
35647
35918
|
let channelVerificationBody = channelRejected ? errorText : "";
|
|
@@ -35650,10 +35921,12 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35650
35921
|
if (currentAccountId !== "" && isRateLimited(errorText, response.status) && !rateLimitMarked.has(currentAccountId)) {
|
|
35651
35922
|
rateLimitMarked.add(currentAccountId);
|
|
35652
35923
|
const parsed = parseRateLimitError(errorText, options.model, response.status);
|
|
35924
|
+
const creditExhausted = isCreditExhausted(errorText);
|
|
35925
|
+
const resetAtMs = creditExhausted ? explicitRateResetAtMs(errorText) ?? creditExhaustedResetAtMs() : parsed?.resetTimeMs ?? Date.now() + RATE_LIMIT_FALLBACK_MS;
|
|
35653
35926
|
await this.options.accountPool.updateModelRateLimit(
|
|
35654
35927
|
currentAccountId,
|
|
35655
35928
|
parsed?.modelId ?? options.model,
|
|
35656
|
-
|
|
35929
|
+
resetAtMs
|
|
35657
35930
|
);
|
|
35658
35931
|
}
|
|
35659
35932
|
const next = await this.options.accountPool.getAvailableAccount(
|
|
@@ -35995,6 +36268,7 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35995
36268
|
}
|
|
35996
36269
|
}
|
|
35997
36270
|
const argsTruncated = [...toolCalls.values()].some((block) => isTruncatedArguments(block.text));
|
|
36271
|
+
const invalidArgEntries = [...toolCalls.values()].filter((block) => hasUsableToolName(block.name)).map((block) => ({ block, kind: classifyToolArguments(block.text) })).filter((entry) => entry.kind === "invalid");
|
|
35998
36272
|
const droppedUnnamedCalls = [...toolCalls.values()].some((block) => !block.announced);
|
|
35999
36273
|
const proseCutByStopString = finishReason2 === "stop" && toolOrder.length === 0 && isProseTruncatedByStopString(emittedProse);
|
|
36000
36274
|
const reasoningLoopIsSoleOutput = loopDetected && emittedProse === "" && toolOrder.length === 0;
|
|
@@ -36002,7 +36276,12 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
36002
36276
|
loopGuard?.diagnostics,
|
|
36003
36277
|
options.maxTokens,
|
|
36004
36278
|
"reasoning"
|
|
36005
|
-
) } : loopDetected ? { kind: "max-tokens" } :
|
|
36279
|
+
) } : loopDetected ? { kind: "max-tokens" } : toolArgsInvalidIsSoleOutput(
|
|
36280
|
+
invalidArgEntries.length,
|
|
36281
|
+
emittedProse,
|
|
36282
|
+
toolCalls.values(),
|
|
36283
|
+
argsTruncated
|
|
36284
|
+
) ? { kind: "error", failure: toolArgsInvalidFailure(toolArgsInvalidBlocks(invalidArgEntries)) } : finishReason2 === "length" || finishReason2 === void 0 && toolOrder.length > 0 || argsTruncated || proseCutByStopString || droppedUnnamedCalls && toolOrder.length === 0 ? { kind: "max-tokens" } : finishReason2 === "tool_calls" || toolOrder.length > 0 ? { kind: "tool-calls" } : { kind: "stop" };
|
|
36006
36285
|
yield { type: "finish", reason: resolveEmptyResponseReason(reason, blockCount) };
|
|
36007
36286
|
}
|
|
36008
36287
|
};
|
|
@@ -36741,6 +37020,30 @@ var LobsteraiAdapter = class extends LlmAdapter3 {
|
|
|
36741
37020
|
* `listModels` 与 `resolveModel` 共用:`resolveModel` 可能先于 `listModels`
|
|
36742
37021
|
* 被调用(如直接从历史会话进入),此时同样需要触发一次拉取。
|
|
36743
37022
|
*/
|
|
37023
|
+
/**
|
|
37024
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
37025
|
+
*
|
|
37026
|
+
* ## ⚠️⚠️ 本类短路判据是 `remoteModels !== undefined`(不是 `remoteComplete`)
|
|
37027
|
+
*
|
|
37028
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,
|
|
37029
|
+
* `ensureRemoteModels` 会**保留 undefined** ⇒ 目录退回**兜底子表**(那是个**子集**
|
|
37030
|
+
* 且**已过期**)⇒ 一次网络抖动就让用户少看到一批模型。
|
|
37031
|
+
*
|
|
37032
|
+
* ⇒ 采用**保存—尝试—失败恢复**:旧目录先存下来,重拉后若仍为空就放回去。
|
|
37033
|
+
* 这样「刷新失败」与「不刷新」对用户是无差别的(都继续看旧目录)。
|
|
37034
|
+
*/
|
|
37035
|
+
async refreshCatalog() {
|
|
37036
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
37037
|
+
const previous = this.remoteModels;
|
|
37038
|
+
this.remoteModels = void 0;
|
|
37039
|
+
try {
|
|
37040
|
+
await this.ensureRemoteModels();
|
|
37041
|
+
} finally {
|
|
37042
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
37043
|
+
this.remoteModels = previous;
|
|
37044
|
+
}
|
|
37045
|
+
}
|
|
37046
|
+
}
|
|
36744
37047
|
async ensureRemoteModels() {
|
|
36745
37048
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
36746
37049
|
if (this.remoteModels !== void 0 || fetchRemote === void 0) return;
|
|
@@ -38739,6 +39042,7 @@ async function* consumeOpenAiSse(response, options, config) {
|
|
|
38739
39042
|
}
|
|
38740
39043
|
}
|
|
38741
39044
|
const argsTruncated = [...toolCalls.values()].some((block) => isTruncatedArguments(block.text));
|
|
39045
|
+
const invalidArgEntries = [...toolCalls.values()].filter((block) => hasUsableToolName(block.name)).map((block) => ({ block, kind: classifyToolArguments(block.text) })).filter((entry) => entry.kind === "invalid");
|
|
38742
39046
|
const incompleteTools = finishReason2 === void 0 && toolOrder.length > 0;
|
|
38743
39047
|
const droppedUnnamedCalls = [...toolCalls.values()].some((block) => !block.announced);
|
|
38744
39048
|
if (!sawDataFrame) {
|
|
@@ -38757,7 +39061,12 @@ async function* consumeOpenAiSse(response, options, config) {
|
|
|
38757
39061
|
loopGuard?.diagnostics,
|
|
38758
39062
|
config.maxTokens,
|
|
38759
39063
|
"reasoning"
|
|
38760
|
-
) } : loopDetected ? { kind: "max-tokens" } :
|
|
39064
|
+
) } : loopDetected ? { kind: "max-tokens" } : toolArgsInvalidIsSoleOutput(
|
|
39065
|
+
invalidArgEntries.length,
|
|
39066
|
+
emittedProse,
|
|
39067
|
+
toolCalls.values(),
|
|
39068
|
+
truncatedStream
|
|
39069
|
+
) ? { kind: "error", failure: toolArgsInvalidFailure(toolArgsInvalidBlocks(invalidArgEntries)) } : finishReason2 === "length" || incompleteTools || truncatedStream || argsTruncated || proseCutByStopString || droppedUnnamedCalls && toolOrder.length === 0 ? { kind: "max-tokens" } : finishReason2 === "tool_calls" || toolOrder.length > 0 ? { kind: "tool-calls" } : { kind: "stop" };
|
|
38761
39070
|
yield { type: "finish", reason: resolveEmptyResponseReason(reason, blockCount) };
|
|
38762
39071
|
}
|
|
38763
39072
|
|
|
@@ -40323,6 +40632,9 @@ function collectImages4(content, refs) {
|
|
|
40323
40632
|
if (block.type === "tool-result" && Array.isArray(block.content)) collectImages4(block.content, refs);
|
|
40324
40633
|
}
|
|
40325
40634
|
}
|
|
40635
|
+
function serializeTraeMessagesForTest(messages, imageUrls) {
|
|
40636
|
+
return serializeTraeMessages(messages, imageUrls);
|
|
40637
|
+
}
|
|
40326
40638
|
function serializeTraeMessages(messages, imageUrls) {
|
|
40327
40639
|
const wire = [];
|
|
40328
40640
|
const normalized = normalizeHarnessMessages(messages);
|
|
@@ -40338,6 +40650,7 @@ function serializeTraeMessages(messages, imageUrls) {
|
|
|
40338
40650
|
};
|
|
40339
40651
|
for (const message2 of normalized) {
|
|
40340
40652
|
if (message2.role === "assistant") {
|
|
40653
|
+
flushToolImages();
|
|
40341
40654
|
const content2 = stripCourseLeakFromHistoryContent(
|
|
40342
40655
|
message2.role,
|
|
40343
40656
|
Array.isArray(message2.content) ? message2.content : []
|
|
@@ -40396,8 +40709,8 @@ function serializeTraeMessages(messages, imageUrls) {
|
|
|
40396
40709
|
flushToolImages();
|
|
40397
40710
|
wire.push({ role: "user", content: parts ?? text });
|
|
40398
40711
|
}
|
|
40399
|
-
flushToolImages();
|
|
40400
40712
|
}
|
|
40713
|
+
flushToolImages();
|
|
40401
40714
|
return wire;
|
|
40402
40715
|
}
|
|
40403
40716
|
function errorDetail5(body) {
|
|
@@ -40480,6 +40793,30 @@ var TraeAdapter = class extends LlmAdapter5 {
|
|
|
40480
40793
|
return { id, name: this.product.displayName };
|
|
40481
40794
|
}
|
|
40482
40795
|
/** 懒加载远端模型目录(仅拉取一次)。 */
|
|
40796
|
+
/**
|
|
40797
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
40798
|
+
*
|
|
40799
|
+
* ## ⚠️⚠️ 本类短路判据是 `remoteModels !== undefined`(不是 `remoteComplete`)
|
|
40800
|
+
*
|
|
40801
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,
|
|
40802
|
+
* `ensureRemoteModels` 会**保留 undefined** ⇒ 目录退回**兜底子表**(那是个**子集**
|
|
40803
|
+
* 且**已过期**)⇒ 一次网络抖动就让用户少看到一批模型。
|
|
40804
|
+
*
|
|
40805
|
+
* ⇒ 采用**保存—尝试—失败恢复**:旧目录先存下来,重拉后若仍为空就放回去。
|
|
40806
|
+
* 这样「刷新失败」与「不刷新」对用户是无差别的(都继续看旧目录)。
|
|
40807
|
+
*/
|
|
40808
|
+
async refreshCatalog() {
|
|
40809
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
40810
|
+
const previous = this.remoteModels;
|
|
40811
|
+
this.remoteModels = void 0;
|
|
40812
|
+
try {
|
|
40813
|
+
await this.ensureRemoteModels();
|
|
40814
|
+
} finally {
|
|
40815
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
40816
|
+
this.remoteModels = previous;
|
|
40817
|
+
}
|
|
40818
|
+
}
|
|
40819
|
+
}
|
|
40483
40820
|
async ensureRemoteModels() {
|
|
40484
40821
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
40485
40822
|
if (this.remoteModels !== void 0 || fetchRemote === void 0) return;
|
|
@@ -42063,6 +42400,31 @@ var ClineAdapter = class extends LlmAdapter6 {
|
|
|
42063
42400
|
* ⚠️ **并发去重**:`listModels` 与 `resolveModel` 会在启动时被 DSH 并发调用,
|
|
42064
42401
|
* 不去重会打出多份重复的远端请求(两个端点各一次,乘以并发数)。
|
|
42065
42402
|
*/
|
|
42403
|
+
/**
|
|
42404
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
42405
|
+
*
|
|
42406
|
+
* ## ⚠️⚠️ 本类短路判据是 `remoteModels !== undefined`(不是 `remoteComplete`)
|
|
42407
|
+
*
|
|
42408
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,
|
|
42409
|
+
* `ensureRemoteModels` 会**保留 undefined** ⇒ 目录退回**兜底子表**(那是个**子集**
|
|
42410
|
+
* 且**已过期**)⇒ 一次网络抖动就让用户少看到一批模型。
|
|
42411
|
+
*
|
|
42412
|
+
* ⇒ 采用**保存—尝试—失败恢复**:旧目录先存下来,重拉后若仍为空就放回去。
|
|
42413
|
+
* 这样「刷新失败」与「不刷新」对用户是无差别的(都继续看旧目录)。
|
|
42414
|
+
*/
|
|
42415
|
+
async refreshCatalog() {
|
|
42416
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
42417
|
+
this.remoteComplete = false;
|
|
42418
|
+
const previous = this.remoteModels;
|
|
42419
|
+
this.remoteModels = void 0;
|
|
42420
|
+
try {
|
|
42421
|
+
await this.ensureRemoteModels();
|
|
42422
|
+
} finally {
|
|
42423
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
42424
|
+
this.remoteModels = previous;
|
|
42425
|
+
}
|
|
42426
|
+
}
|
|
42427
|
+
}
|
|
42066
42428
|
async ensureRemoteModels() {
|
|
42067
42429
|
if (this.remoteComplete) return;
|
|
42068
42430
|
await this.catalogGate.run(async () => {
|
|
@@ -42749,6 +43111,32 @@ var LoomyAdapter = class extends LlmAdapter7 {
|
|
|
42749
43111
|
* 改为:只缓存**真实远端目录**,兜底表每次现算(纯本地、零成本),
|
|
42750
43112
|
* 并用 {@link RemoteCatalogGate} 的冷却挡住「每模型重试一次」的放大。
|
|
42751
43113
|
*/
|
|
43114
|
+
/**
|
|
43115
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
43116
|
+
*
|
|
43117
|
+
* ## ⚠️⚠️ 本类短路判据是 `if (this.remoteModels !== undefined) return`(在 `loadModels` 里)
|
|
43118
|
+
*
|
|
43119
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,`loadModels`
|
|
43120
|
+
* 会**返回兜底子表**并把结果留在 `remoteModels` 之外 ⇒ 用户少看到一批模型。
|
|
43121
|
+
*
|
|
43122
|
+
* ⇒ **保存—尝试—失败恢复**:旧目录先存下来,重拉后若没拿到远端就放回去
|
|
43123
|
+
*(「刷新失败」与「不刷新」对用户无差别,都继续看旧目录)。
|
|
43124
|
+
*
|
|
43125
|
+
* ⚠️ 判据是「`remoteModels` 是否被**远端**填上」,不能用「`loadModels` 返回了什么」:
|
|
43126
|
+
* 它在拿不到远端时**照样返回兜底表**(那是展示用,不落 `remoteModels`)。
|
|
43127
|
+
*/
|
|
43128
|
+
async refreshCatalog() {
|
|
43129
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
43130
|
+
const previous = this.remoteModels;
|
|
43131
|
+
this.remoteModels = void 0;
|
|
43132
|
+
try {
|
|
43133
|
+
await this.loadModels();
|
|
43134
|
+
} finally {
|
|
43135
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
43136
|
+
this.remoteModels = previous;
|
|
43137
|
+
}
|
|
43138
|
+
}
|
|
43139
|
+
}
|
|
42752
43140
|
async loadModels() {
|
|
42753
43141
|
if (this.remoteModels !== void 0) return this.remoteModels;
|
|
42754
43142
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
@@ -43213,6 +43601,32 @@ var RaccoonAdapter = class extends LlmAdapter8 {
|
|
|
43213
43601
|
* 改为:只缓存**真实远端目录**,兜底表每次现算(纯本地、零成本),
|
|
43214
43602
|
* 并用 {@link RemoteCatalogGate} 的冷却挡住「每模型重试一次」的放大。
|
|
43215
43603
|
*/
|
|
43604
|
+
/**
|
|
43605
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
43606
|
+
*
|
|
43607
|
+
* ## ⚠️⚠️ 本类短路判据是 `if (this.remoteModels !== undefined) return`(在 `loadModels` 里)
|
|
43608
|
+
*
|
|
43609
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,`loadModels`
|
|
43610
|
+
* 会**返回兜底子表**并把结果留在 `remoteModels` 之外 ⇒ 用户少看到一批模型。
|
|
43611
|
+
*
|
|
43612
|
+
* ⇒ **保存—尝试—失败恢复**:旧目录先存下来,重拉后若没拿到远端就放回去
|
|
43613
|
+
*(「刷新失败」与「不刷新」对用户无差别,都继续看旧目录)。
|
|
43614
|
+
*
|
|
43615
|
+
* ⚠️ 判据是「`remoteModels` 是否被**远端**填上」,不能用「`loadModels` 返回了什么」:
|
|
43616
|
+
* 它在拿不到远端时**照样返回兜底表**(那是展示用,不落 `remoteModels`)。
|
|
43617
|
+
*/
|
|
43618
|
+
async refreshCatalog() {
|
|
43619
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
43620
|
+
const previous = this.remoteModels;
|
|
43621
|
+
this.remoteModels = void 0;
|
|
43622
|
+
try {
|
|
43623
|
+
await this.loadModels();
|
|
43624
|
+
} finally {
|
|
43625
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
43626
|
+
this.remoteModels = previous;
|
|
43627
|
+
}
|
|
43628
|
+
}
|
|
43629
|
+
}
|
|
43216
43630
|
async loadModels() {
|
|
43217
43631
|
if (this.remoteModels !== void 0) return this.remoteModels;
|
|
43218
43632
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
@@ -43574,9 +43988,13 @@ var RefreshScheduler = class {
|
|
|
43574
43988
|
|
|
43575
43989
|
// vendor/channel-pack/src/expiry-sync.ts
|
|
43576
43990
|
var EXPIRY_TOLERANCE_MS = 1e3;
|
|
43577
|
-
function shouldRefreshNow(expiresAtMs, nowMs = Date.now()) {
|
|
43991
|
+
function shouldRefreshNow(expiresAtMs, nowMs = Date.now(), refreshExpiresAtMs) {
|
|
43578
43992
|
if (expiresAtMs === void 0 || !Number.isFinite(expiresAtMs)) return true;
|
|
43579
|
-
|
|
43993
|
+
if (expiresAtMs - nowMs <= REFRESH_LEAD_MS) return true;
|
|
43994
|
+
if (refreshExpiresAtMs !== void 0 && Number.isFinite(refreshExpiresAtMs) && refreshExpiresAtMs - nowMs <= REFRESH_LEAD_MS) {
|
|
43995
|
+
return true;
|
|
43996
|
+
}
|
|
43997
|
+
return false;
|
|
43580
43998
|
}
|
|
43581
43999
|
async function syncAccountExpiry(params) {
|
|
43582
44000
|
const { pool, provider, credential, accessors, accountId, current, tag: tag2 } = params;
|
|
@@ -43623,7 +44041,16 @@ async function refreshAccountWithReconcile(params) {
|
|
|
43623
44041
|
if (refreshed === void 0) {
|
|
43624
44042
|
throw new Error(`${tag2} \u7EED\u671F\u54CD\u5E94\u7F3A\u5C11\u8BBF\u95EE\u4EE4\u724C\uFF0C\u51ED\u636E\u672A\u66F4\u65B0`);
|
|
43625
44043
|
}
|
|
43626
|
-
|
|
44044
|
+
try {
|
|
44045
|
+
await save(refreshed);
|
|
44046
|
+
} catch (error) {
|
|
44047
|
+
params.warn?.(
|
|
44048
|
+
`${tag2} \u8D26\u53F7 ${accountId} \u7EED\u671F**\u5DF2\u6210\u529F\u4F46\u843D\u76D8\u5931\u8D25**\uFF08${provider}\uFF09\uFF1A${error instanceof Error ? error.message : String(error)} \u21D2 refresh_token \u5DF2\u5728\u670D\u52A1\u7AEF\u88AB\u6D88\u8017\uFF0C\u672C\u5730\u51ED\u636E\u5DF2\u5931\u6548\uFF0C\u9700\u91CD\u65B0\u767B\u5F55`
|
|
44049
|
+
);
|
|
44050
|
+
throw params.makeTerminalError(
|
|
44051
|
+
`${tag2} \u8D26\u53F7 ${accountId} \u7EED\u671F\u6210\u529F\u4F46**\u65B0\u51ED\u636E\u843D\u76D8\u5931\u8D25**\uFF1A${provider} \u7684 refresh_token \u662F\u4E00\u6B21\u6027\u7684\uFF0C\u670D\u52A1\u7AEF\u90A3\u4EFD\u5DF2\u88AB\u6D88\u8017\uFF0C\u672C\u5730\u4ECD\u505C\u7559\u5728\u65E7 token \u4E0A\uFF0C\u7EE7\u7EED\u91CD\u8BD5\u53EA\u4F1A\u5F97\u5230\u300C\u5DF2\u88AB\u4F7F\u7528\u300D\u21D2 \u5FC5\u987B\u91CD\u65B0\u767B\u5F55\u3002\u843D\u76D8\u9519\u8BEF\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
44052
|
+
);
|
|
44053
|
+
}
|
|
43627
44054
|
await syncAccountExpiry({
|
|
43628
44055
|
pool,
|
|
43629
44056
|
provider,
|
|
@@ -43638,6 +44065,192 @@ async function refreshAccountWithReconcile(params) {
|
|
|
43638
44065
|
return true;
|
|
43639
44066
|
}
|
|
43640
44067
|
|
|
44068
|
+
// vendor/channel-pack/src/minimax-product.ts
|
|
44069
|
+
var MINIMAX_FALLBACK_MODELS = [
|
|
44070
|
+
{
|
|
44071
|
+
id: "MiniMax-M3.1-Flash-Preview",
|
|
44072
|
+
name: "M3.1-Flash-Preview",
|
|
44073
|
+
contextWindow: 1e6,
|
|
44074
|
+
maxTokens: 128e3,
|
|
44075
|
+
supportsImage: true,
|
|
44076
|
+
effortOptions: ["default", "low", "medium", "high", "xhigh", "max"],
|
|
44077
|
+
defaultEffort: "default",
|
|
44078
|
+
// ⚠️ forced_on:传 disabled 会被服务端**硬拒**(400 `requires adaptive
|
|
44079
|
+
// thinking ... (2013)`,实测)。它与 M2.7 的 forced_on 不同形态:
|
|
44080
|
+
// M2.7 是**静默忽略**,M3.1 是**报错**。
|
|
44081
|
+
thinkingMode: "forced_on"
|
|
44082
|
+
},
|
|
44083
|
+
{
|
|
44084
|
+
id: "MiniMax-M3",
|
|
44085
|
+
name: "M3",
|
|
44086
|
+
contextWindow: 1e6,
|
|
44087
|
+
maxTokens: 128e3,
|
|
44088
|
+
supportsImage: true,
|
|
44089
|
+
// ⚠️ 实测可开关思考(`switchable`):不传/disabled → 0 思考块,
|
|
44090
|
+
// adaptive → 有思考块。官方形态见远端 `variants`。
|
|
44091
|
+
// ⚠️ 但它**没有 `effort_options`** ⇒ 没有「档位」可选,
|
|
44092
|
+
// 只有「开/关」两态 —— 与 Qoder `qmodel` 的「只有关闭思考」同型。
|
|
44093
|
+
thinkingMode: "switchable"
|
|
44094
|
+
},
|
|
44095
|
+
{
|
|
44096
|
+
id: "MiniMax-M2.7-highspeed",
|
|
44097
|
+
name: "M2.7-highspeed",
|
|
44098
|
+
contextWindow: 2e5,
|
|
44099
|
+
maxTokens: 128e3,
|
|
44100
|
+
supportsImage: false,
|
|
44101
|
+
// ⚠️ forced_on:传 disabled 被**静默忽略**(实测仍产出思考块)
|
|
44102
|
+
thinkingMode: "forced_on"
|
|
44103
|
+
},
|
|
44104
|
+
{
|
|
44105
|
+
id: "MiniMax-M2.7",
|
|
44106
|
+
name: "M2.7",
|
|
44107
|
+
contextWindow: 2e5,
|
|
44108
|
+
maxTokens: 128e3,
|
|
44109
|
+
supportsImage: false,
|
|
44110
|
+
thinkingMode: "forced_on"
|
|
44111
|
+
}
|
|
44112
|
+
];
|
|
44113
|
+
var MINIMAX = {
|
|
44114
|
+
id: "minimax",
|
|
44115
|
+
displayName: "MiniMax Code",
|
|
44116
|
+
accountHost: "https://account.minimax.cn",
|
|
44117
|
+
apiHost: "https://agent.minimax.cn",
|
|
44118
|
+
region: "cn",
|
|
44119
|
+
buildEnv: "prod",
|
|
44120
|
+
clientId: "mcode-public",
|
|
44121
|
+
audience: "agent-backend",
|
|
44122
|
+
scope: "agent.default",
|
|
44123
|
+
defaultCredentialRef: "MINIMAX_ACCESS_TOKEN",
|
|
44124
|
+
fallbackModels: MINIMAX_FALLBACK_MODELS,
|
|
44125
|
+
maxImageBytesInline: 10 * 1024 * 1024,
|
|
44126
|
+
maxRequestBodyBytes: 64 * 1024 * 1024
|
|
44127
|
+
};
|
|
44128
|
+
var MINIMAX_DEVICE_CODE_PATH = "/oauth2/device/code";
|
|
44129
|
+
var MINIMAX_TOKEN_PATH = "/oauth2/token";
|
|
44130
|
+
var MINIMAX_MODELS_PATH = "/mavis/api/v1/models";
|
|
44131
|
+
var MINIMAX_INFER_PATH = "/mavis/api/v1/llm/v1/messages";
|
|
44132
|
+
var MINIMAX_SIGNIN_STATUS_PATH = "/minimax-cloud/api/v1/signin/status";
|
|
44133
|
+
var MINIMAX_SIGNIN_CLAIM_PATH = "/minimax-cloud/api/v1/signin/claim";
|
|
44134
|
+
var MINIMAX_CREDIT_DETAILS_PATH = "/minimax-cloud/api/v1/credit/details";
|
|
44135
|
+
var MINIMAX_REQUEST_TIMEOUT_MS = 3e4;
|
|
44136
|
+
var MINIMAX_OAUTH_TIMEOUT_MS = 2e4;
|
|
44137
|
+
|
|
44138
|
+
// vendor/channel-pack/src/minimax.ts
|
|
44139
|
+
function decodeJwtExpMs2(token) {
|
|
44140
|
+
const segments = token.split(".");
|
|
44141
|
+
if (segments.length !== 3 || segments[1] === void 0) return void 0;
|
|
44142
|
+
try {
|
|
44143
|
+
const payload = JSON.parse(Buffer.from(segments[1], "base64url").toString("utf8"));
|
|
44144
|
+
return typeof payload.exp === "number" && Number.isFinite(payload.exp) ? Number.isFinite(payload.exp * 1e3) ? payload.exp * 1e3 : void 0 : void 0;
|
|
44145
|
+
} catch {
|
|
44146
|
+
return void 0;
|
|
44147
|
+
}
|
|
44148
|
+
}
|
|
44149
|
+
function decodeJwtSub(token) {
|
|
44150
|
+
const segments = token.split(".");
|
|
44151
|
+
if (segments.length !== 3 || segments[1] === void 0) return void 0;
|
|
44152
|
+
try {
|
|
44153
|
+
const payload = JSON.parse(Buffer.from(segments[1], "base64url").toString("utf8"));
|
|
44154
|
+
return typeof payload.sub === "string" && payload.sub.length > 0 ? payload.sub : void 0;
|
|
44155
|
+
} catch {
|
|
44156
|
+
return void 0;
|
|
44157
|
+
}
|
|
44158
|
+
}
|
|
44159
|
+
function minimaxCredentialExpiresAtMs(credential) {
|
|
44160
|
+
const raw = credential.expires_at;
|
|
44161
|
+
if (raw !== void 0) {
|
|
44162
|
+
if (/^\d+$/.test(raw)) {
|
|
44163
|
+
const value = Number(raw);
|
|
44164
|
+
const parsed = value > 1e12 ? value : value * 1e3;
|
|
44165
|
+
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
44166
|
+
}
|
|
44167
|
+
}
|
|
44168
|
+
return decodeJwtExpMs2(credential.access_token);
|
|
44169
|
+
}
|
|
44170
|
+
function isMinimaxExpired(credential, nowMs = Date.now()) {
|
|
44171
|
+
const expiresAt = minimaxCredentialExpiresAtMs(credential);
|
|
44172
|
+
return expiresAt !== void 0 && nowMs >= expiresAt;
|
|
44173
|
+
}
|
|
44174
|
+
function isMinimaxRefreshable(credential) {
|
|
44175
|
+
return typeof credential.refresh_token === "string" && credential.refresh_token.length > 0;
|
|
44176
|
+
}
|
|
44177
|
+
function minimaxHeaders(credential) {
|
|
44178
|
+
const headers = new Headers();
|
|
44179
|
+
headers.set("Authorization", `Bearer ${credential.access_token}`);
|
|
44180
|
+
headers.set("Accept", "application/json");
|
|
44181
|
+
return headers;
|
|
44182
|
+
}
|
|
44183
|
+
function minimaxInferHeaders(credential) {
|
|
44184
|
+
const headers = new Headers();
|
|
44185
|
+
headers.set("Authorization", `Bearer ${credential.access_token}`);
|
|
44186
|
+
headers.set("Content-Type", "application/json");
|
|
44187
|
+
headers.set("Accept", "text/event-stream");
|
|
44188
|
+
return headers;
|
|
44189
|
+
}
|
|
44190
|
+
function positiveInt(value) {
|
|
44191
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
44192
|
+
}
|
|
44193
|
+
function nonEmptyString(value) {
|
|
44194
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
44195
|
+
}
|
|
44196
|
+
function stringArray(value) {
|
|
44197
|
+
if (!Array.isArray(value)) return void 0;
|
|
44198
|
+
const out = [];
|
|
44199
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44200
|
+
for (const item of value) {
|
|
44201
|
+
const text = nonEmptyString(item);
|
|
44202
|
+
if (text === void 0 || seen.has(text)) continue;
|
|
44203
|
+
seen.add(text);
|
|
44204
|
+
out.push(text);
|
|
44205
|
+
}
|
|
44206
|
+
return out.length > 0 ? out : void 0;
|
|
44207
|
+
}
|
|
44208
|
+
function normalizeMinimaxModel(raw) {
|
|
44209
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return void 0;
|
|
44210
|
+
const record = raw;
|
|
44211
|
+
const id = nonEmptyString(record.id) ?? nonEmptyString(record.name);
|
|
44212
|
+
if (id === void 0) return void 0;
|
|
44213
|
+
const name2 = nonEmptyString(record.name) ?? id;
|
|
44214
|
+
const limit = typeof record.limit === "object" && record.limit !== null ? record.limit : {};
|
|
44215
|
+
const options = Array.isArray(record.context_window_options) ? record.context_window_options.filter((v) => positiveInt(v) !== void 0) : [];
|
|
44216
|
+
const limitContext = positiveInt(limit.context);
|
|
44217
|
+
const contextWindow = options.length > 0 ? Math.max(...options) : limitContext;
|
|
44218
|
+
const modalities = typeof record.modalities === "object" && record.modalities !== null ? record.modalities : {};
|
|
44219
|
+
const inputs = Array.isArray(modalities.input) ? modalities.input.filter((v) => typeof v === "string") : [];
|
|
44220
|
+
const effortOptions = stringArray(record.effort_options);
|
|
44221
|
+
const rawDefault = nonEmptyString(record.default_effort);
|
|
44222
|
+
const defaultEffort = rawDefault !== void 0 && effortOptions?.includes(rawDefault) === true ? rawDefault : void 0;
|
|
44223
|
+
const thinkingConfig = typeof record.thinking_config === "object" && record.thinking_config !== null ? record.thinking_config : void 0;
|
|
44224
|
+
const thinkingMode = thinkingConfig === void 0 ? void 0 : nonEmptyString(thinkingConfig.mode);
|
|
44225
|
+
const maxTokens = positiveInt(limit.output);
|
|
44226
|
+
return {
|
|
44227
|
+
id,
|
|
44228
|
+
name: name2,
|
|
44229
|
+
// 窗口未知时**不编造**:用 0 表示「不知道」,由 resolveModel 判 `> 0`
|
|
44230
|
+
contextWindow: contextWindow ?? 0,
|
|
44231
|
+
...maxTokens === void 0 ? {} : { maxTokens },
|
|
44232
|
+
supportsImage: inputs.includes("image"),
|
|
44233
|
+
...effortOptions === void 0 ? {} : { effortOptions },
|
|
44234
|
+
...defaultEffort === void 0 ? {} : { defaultEffort },
|
|
44235
|
+
...thinkingMode === void 0 ? {} : { thinkingMode }
|
|
44236
|
+
};
|
|
44237
|
+
}
|
|
44238
|
+
function fallbackToEntry(model) {
|
|
44239
|
+
return {
|
|
44240
|
+
id: model.id,
|
|
44241
|
+
name: model.name,
|
|
44242
|
+
contextWindow: model.contextWindow,
|
|
44243
|
+
maxTokens: model.maxTokens,
|
|
44244
|
+
supportsImage: model.supportsImage,
|
|
44245
|
+
...model.effortOptions === void 0 ? {} : { effortOptions: model.effortOptions },
|
|
44246
|
+
...model.defaultEffort === void 0 ? {} : { defaultEffort: model.defaultEffort },
|
|
44247
|
+
...model.thinkingMode === void 0 ? {} : { thinkingMode: model.thinkingMode }
|
|
44248
|
+
};
|
|
44249
|
+
}
|
|
44250
|
+
function minimaxFallbackEntries(product = MINIMAX) {
|
|
44251
|
+
return product.fallbackModels.map(fallbackToEntry);
|
|
44252
|
+
}
|
|
44253
|
+
|
|
43641
44254
|
// vendor/channel-pack/src/service.ts
|
|
43642
44255
|
function isCodeArtsRefreshable(credential) {
|
|
43643
44256
|
return Boolean(
|
|
@@ -43650,6 +44263,24 @@ var CODEARTS_EXPIRY_ACCESSORS = {
|
|
|
43650
44263
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
43651
44264
|
},
|
|
43652
44265
|
refreshableOf: isCodeArtsRefreshable,
|
|
44266
|
+
/**
|
|
44267
|
+
* **refresh_token 自己的过期时刻**(上游 577b27a7 / 真实报废事故)。
|
|
44268
|
+
*
|
|
44269
|
+
* ⚠️ 华为 STS 的 `refresh_token` JWT 里 `exp` **恒等于「登录时刻 + 30 天」**,
|
|
44270
|
+
* **续期不延长它**;而 `access_token` 寿命恒为 2 小时。⇒ 最后一天两侧严重
|
|
44271
|
+
* 不对称:lead-time 最早放行时刻是 `access 到期 − 60m`,可能**晚于** refresh
|
|
44272
|
+
* 的死亡时刻(实测某账号差 5.8 分钟)⇒ 那次续期「成功得太晚」、随后 refresh
|
|
44273
|
+
* 已只剩 54 分钟寿命 ⇒ 账号报废,而面板仍显示「自动续期」。
|
|
44274
|
+
*
|
|
44275
|
+
* ⇒ 补这条腿让 refresh 也进入 lead-time 判据(两条腿取「或」,见
|
|
44276
|
+
* `shouldRefreshNow` 的注释:「与」会把「refresh 还有 3 天、access 只剩 2 分钟」
|
|
44277
|
+
* 这个**正常态**误判成不用续)。
|
|
44278
|
+
*
|
|
44279
|
+
* ⚠️ 复用 `decodeJwtExpMs`(已处理 `exp` 溢出成 `Infinity` 的形态,那种情况返回
|
|
44280
|
+
* `undefined` 而不是一个假的无限远时刻)。不是 JWT / 无 refresh_token 时返回
|
|
44281
|
+
* `undefined` ⇒ 判据退化成单腿(与改动前逐字节相同)。
|
|
44282
|
+
*/
|
|
44283
|
+
refreshExpiresAtOf: (credential) => decodeJwtExpMs2(credential.refresh_token ?? ""),
|
|
43653
44284
|
identityOf: (credential) => credential.access_key_id ?? ""
|
|
43654
44285
|
};
|
|
43655
44286
|
var CODEARTS_CREDENTIAL_REF = "CODEARTS_ACCESS_TOKEN";
|
|
@@ -43944,6 +44575,7 @@ var CodeArtsAuth = class extends Service {
|
|
|
43944
44575
|
current: entry,
|
|
43945
44576
|
refresh: (c) => this.refreshCredentialUnderLock(entry.credentialRef, c),
|
|
43946
44577
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
44578
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError(message2),
|
|
43947
44579
|
warn: (message2) => this.ctx.logger?.warn?.(message2),
|
|
43948
44580
|
info: (message2) => this.ctx.logger?.info?.(message2)
|
|
43949
44581
|
});
|
|
@@ -44312,6 +44944,7 @@ var BuddyAuth = class extends Service2 {
|
|
|
44312
44944
|
current: entry,
|
|
44313
44945
|
refresh: (c) => this.refreshCredential(c),
|
|
44314
44946
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
44947
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError2(message2),
|
|
44315
44948
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
44316
44949
|
});
|
|
44317
44950
|
} catch (error) {
|
|
@@ -45003,6 +45636,7 @@ var LobsteraiAuth = class extends Service3 {
|
|
|
45003
45636
|
current: entry,
|
|
45004
45637
|
refresh: (c) => this.refreshCredential(c),
|
|
45005
45638
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
45639
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError3(message2),
|
|
45006
45640
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
45007
45641
|
});
|
|
45008
45642
|
} catch (error) {
|
|
@@ -45515,6 +46149,7 @@ var QoderAuth = class extends Service4 {
|
|
|
45515
46149
|
current: entry,
|
|
45516
46150
|
refresh: (c) => this.refreshCredential(c),
|
|
45517
46151
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
46152
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError4(message2),
|
|
45518
46153
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
45519
46154
|
});
|
|
45520
46155
|
} catch (error) {
|
|
@@ -46264,6 +46899,7 @@ var TraeAuth = class _TraeAuth extends Service5 {
|
|
|
46264
46899
|
current: entry,
|
|
46265
46900
|
refresh: (c) => this.refreshCredential(c),
|
|
46266
46901
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
46902
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError5(message2),
|
|
46267
46903
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
46268
46904
|
});
|
|
46269
46905
|
} catch (error) {
|
|
@@ -47010,6 +47646,7 @@ var ClineAuth = class extends Service6 {
|
|
|
47010
47646
|
current: entry,
|
|
47011
47647
|
refresh: (c) => this.refreshCredential(c),
|
|
47012
47648
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
47649
|
+
makeTerminalError: (message2) => new RefreshTokenExpiredError6(message2),
|
|
47013
47650
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
47014
47651
|
});
|
|
47015
47652
|
} catch (error) {
|
|
@@ -54011,7 +54648,7 @@ var OFFICIAL_STABLE_SECTIONS = [
|
|
|
54011
54648
|
'# ZCode Desktop Context\n\n### Files & URLs\n- Return local web URLs as Markdown links (e.g., [label](http://127.0.0.1:8080)).\n- File should be an absolute path or include the workspace folder segment so it can be resolved relative to the workspace.\n- Unless otherwise specified, return local file references as Markdown links (e.g., [name.md](/absolute/path/to/name.md)).\n\n### Inline Code Comments\n- Use the ::code-comment{...} directive when you need to attach feedback directly to specific code lines.\n- Emit one directive per inline comment; emit none when there are no actionable inline comments.\n- Required attributes: title (short label), body (one-paragraph explanation), file (path to the file).\n- Optional attributes: start, end (1-based line numbers), priority (0-3).\n- file should be an absolute path or include the workspace folder segment so it can be resolved relative to the workspace.\n- Keep line ranges tight; end defaults to start.\n- Example: ::code-comment{title="[P2] Off-by-one" body="Loop iterates past the end when length is 0." file="/path/to/foo.ts" start=10 end=11 priority=2}',
|
|
54012
54649
|
"# Working style\n\nWhen you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. If you are weighing a choice, give a recommendation, not an exhaustive survey. Prefer reading the actual file or running the actual command over reasoning about what it probably contains. When a signal pattern-matches to a known failure, check that the evidence actually supports that specific diagnosis before acting on it."
|
|
54013
54650
|
];
|
|
54014
|
-
function buildZcodeSystemBlocks(
|
|
54651
|
+
function buildZcodeSystemBlocks(options) {
|
|
54015
54652
|
const ephemeral = { type: "ephemeral" };
|
|
54016
54653
|
const stable = OFFICIAL_STABLE_SECTIONS.join("\n\n");
|
|
54017
54654
|
const blocks = [
|
|
@@ -54019,13 +54656,34 @@ function buildZcodeSystemBlocks(callerSystem, options) {
|
|
|
54019
54656
|
{ type: "text", text: stable },
|
|
54020
54657
|
{ type: "text", text: buildEnvironmentSection(options) }
|
|
54021
54658
|
];
|
|
54022
|
-
if (typeof callerSystem === "string" && callerSystem.trim().length > 0) {
|
|
54023
|
-
blocks.push({ type: "text", text: callerSystem });
|
|
54024
|
-
}
|
|
54025
54659
|
const last = blocks[blocks.length - 1];
|
|
54026
54660
|
if (last !== void 0) last.cache_control = ephemeral;
|
|
54027
54661
|
return blocks;
|
|
54028
54662
|
}
|
|
54663
|
+
function withCallerSystem(messages, callerSystem) {
|
|
54664
|
+
const out = messages.map((message2) => ({ ...message2 }));
|
|
54665
|
+
if (typeof callerSystem !== "string" || callerSystem.trim().length === 0) return out;
|
|
54666
|
+
const first = out[0];
|
|
54667
|
+
const targetIndex = first !== void 0 && first.role === "user" ? 0 : out.findIndex((message2) => message2.role === "user");
|
|
54668
|
+
if (targetIndex < 0) return out;
|
|
54669
|
+
const target = out[targetIndex];
|
|
54670
|
+
if (target === void 0) return out;
|
|
54671
|
+
const block = { type: "text", text: callerSystem };
|
|
54672
|
+
const content = target.content;
|
|
54673
|
+
if (Array.isArray(content)) {
|
|
54674
|
+
const already = content.some(
|
|
54675
|
+
(item) => item?.text === callerSystem
|
|
54676
|
+
);
|
|
54677
|
+
if (already) return out;
|
|
54678
|
+
target.content = [...content, block];
|
|
54679
|
+
} else if (typeof content === "string") {
|
|
54680
|
+
if (content === callerSystem) return out;
|
|
54681
|
+
target.content = [{ type: "text", text: content }, block];
|
|
54682
|
+
} else {
|
|
54683
|
+
target.content = [block];
|
|
54684
|
+
}
|
|
54685
|
+
return out;
|
|
54686
|
+
}
|
|
54029
54687
|
function buildEnvironmentSection(options) {
|
|
54030
54688
|
const cwd = options.cwd.trim().length > 0 ? options.cwd : ".";
|
|
54031
54689
|
const provider = options.provider ?? "zcode";
|
|
@@ -54687,6 +55345,32 @@ var ZcodeAdapter = class extends LlmAdapter9 {
|
|
|
54687
55345
|
* 改为:只缓存**真实远端目录**,兜底表每次现算(纯本地、零成本),
|
|
54688
55346
|
* 并用 {@link RemoteCatalogGate} 的冷却挡住「每模型重试一次」的放大。
|
|
54689
55347
|
*/
|
|
55348
|
+
/**
|
|
55349
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
55350
|
+
*
|
|
55351
|
+
* ## ⚠️⚠️ 本类短路判据是 `if (this.remoteModels !== undefined) return`(在 `loadModels` 里)
|
|
55352
|
+
*
|
|
55353
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,`loadModels`
|
|
55354
|
+
* 会**返回兜底子表**并把结果留在 `remoteModels` 之外 ⇒ 用户少看到一批模型。
|
|
55355
|
+
*
|
|
55356
|
+
* ⇒ **保存—尝试—失败恢复**:旧目录先存下来,重拉后若没拿到远端就放回去
|
|
55357
|
+
*(「刷新失败」与「不刷新」对用户无差别,都继续看旧目录)。
|
|
55358
|
+
*
|
|
55359
|
+
* ⚠️ 判据是「`remoteModels` 是否被**远端**填上」,不能用「`loadModels` 返回了什么」:
|
|
55360
|
+
* 它在拿不到远端时**照样返回兜底表**(那是展示用,不落 `remoteModels`)。
|
|
55361
|
+
*/
|
|
55362
|
+
async refreshCatalog() {
|
|
55363
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
55364
|
+
const previous = this.remoteModels;
|
|
55365
|
+
this.remoteModels = void 0;
|
|
55366
|
+
try {
|
|
55367
|
+
await this.loadModels();
|
|
55368
|
+
} finally {
|
|
55369
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
55370
|
+
this.remoteModels = previous;
|
|
55371
|
+
}
|
|
55372
|
+
}
|
|
55373
|
+
}
|
|
54690
55374
|
async loadModels() {
|
|
54691
55375
|
if (this.remoteModels !== void 0) return this.remoteModels;
|
|
54692
55376
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
@@ -54916,8 +55600,16 @@ var ZcodeAdapter = class extends LlmAdapter9 {
|
|
|
54916
55600
|
if (activeAccountId !== void 0 && activeAccountId.length > 0) tried.add(activeAccountId);
|
|
54917
55601
|
let credential = await this.resolveCredentialOrThrow(options);
|
|
54918
55602
|
const wire = serializeMessages4(options.messages, imageUrls);
|
|
54919
|
-
const messages =
|
|
54920
|
-
|
|
55603
|
+
const messages = withCallerSystem(
|
|
55604
|
+
// ⚠️ **`withContextPrefix` 不能省**:它负责首轮 user 消息的 `<system-reminder>`
|
|
55605
|
+
// 日期块(官方如此)。上游的正确组合是
|
|
55606
|
+
// `withCallerSystem(withContextPrefix(toAnthropicMessages(wire)), system)` ——
|
|
55607
|
+
// 我第一版只写了 `withCallerSystem(toAnthropicMessages(wire), …)` 会**丢掉日期块**
|
|
55608
|
+
//(虽然实测该块不是 3012 判据,但它是官方形状的一部分)。
|
|
55609
|
+
withContextPrefix(toAnthropicMessages(wire)),
|
|
55610
|
+
options.system
|
|
55611
|
+
);
|
|
55612
|
+
const system = buildZcodeSystemBlocks({
|
|
54921
55613
|
cwd: process.cwd(),
|
|
54922
55614
|
provider: this.product.id,
|
|
54923
55615
|
model: options.model
|
|
@@ -55363,10 +56055,11 @@ function httpErrorCodeForZcode(status, body) {
|
|
|
55363
56055
|
const trimmed = body.trim();
|
|
55364
56056
|
if (trimmed.includes("3007")) return "RATE_LIMIT";
|
|
55365
56057
|
if (hasZcodeUnusualActivity(trimmed)) return "PERMISSION";
|
|
55366
|
-
if (trimmed.includes("1113") || trimmed.includes("\u4F59\u989D\u4E0D\u8DB3")) return "QUOTA_EXCEEDED";
|
|
56058
|
+
if (trimmed.includes("1113") || trimmed.includes("1005") || trimmed.includes("\u4F59\u989D\u4E0D\u8DB3")) return "QUOTA_EXCEEDED";
|
|
55367
56059
|
if (status === 401 || trimmed.includes("1002")) return "AUTH";
|
|
55368
56060
|
if (status === 429) return "RATE_LIMIT";
|
|
55369
56061
|
if (status >= 500) return "SERVER";
|
|
56062
|
+
if (status === 405) return "PERMISSION_DENIED";
|
|
55370
56063
|
if (status === 400) return "INVALID_REQUEST";
|
|
55371
56064
|
return "SERVER";
|
|
55372
56065
|
}
|
|
@@ -55634,192 +56327,6 @@ function rankBuddyAccountsByBalance(accounts, options = {}) {
|
|
|
55634
56327
|
return accounts.map((account, index) => ({ account, index, tier: buddyBalanceTier(account, options) })).sort((a, b) => a.tier - b.tier || a.index - b.index).map((entry) => entry.account);
|
|
55635
56328
|
}
|
|
55636
56329
|
|
|
55637
|
-
// vendor/channel-pack/src/minimax-product.ts
|
|
55638
|
-
var MINIMAX_FALLBACK_MODELS = [
|
|
55639
|
-
{
|
|
55640
|
-
id: "MiniMax-M3.1-Flash-Preview",
|
|
55641
|
-
name: "M3.1-Flash-Preview",
|
|
55642
|
-
contextWindow: 1e6,
|
|
55643
|
-
maxTokens: 128e3,
|
|
55644
|
-
supportsImage: true,
|
|
55645
|
-
effortOptions: ["default", "low", "medium", "high", "xhigh", "max"],
|
|
55646
|
-
defaultEffort: "default",
|
|
55647
|
-
// ⚠️ forced_on:传 disabled 会被服务端**硬拒**(400 `requires adaptive
|
|
55648
|
-
// thinking ... (2013)`,实测)。它与 M2.7 的 forced_on 不同形态:
|
|
55649
|
-
// M2.7 是**静默忽略**,M3.1 是**报错**。
|
|
55650
|
-
thinkingMode: "forced_on"
|
|
55651
|
-
},
|
|
55652
|
-
{
|
|
55653
|
-
id: "MiniMax-M3",
|
|
55654
|
-
name: "M3",
|
|
55655
|
-
contextWindow: 1e6,
|
|
55656
|
-
maxTokens: 128e3,
|
|
55657
|
-
supportsImage: true,
|
|
55658
|
-
// ⚠️ 实测可开关思考(`switchable`):不传/disabled → 0 思考块,
|
|
55659
|
-
// adaptive → 有思考块。官方形态见远端 `variants`。
|
|
55660
|
-
// ⚠️ 但它**没有 `effort_options`** ⇒ 没有「档位」可选,
|
|
55661
|
-
// 只有「开/关」两态 —— 与 Qoder `qmodel` 的「只有关闭思考」同型。
|
|
55662
|
-
thinkingMode: "switchable"
|
|
55663
|
-
},
|
|
55664
|
-
{
|
|
55665
|
-
id: "MiniMax-M2.7-highspeed",
|
|
55666
|
-
name: "M2.7-highspeed",
|
|
55667
|
-
contextWindow: 2e5,
|
|
55668
|
-
maxTokens: 128e3,
|
|
55669
|
-
supportsImage: false,
|
|
55670
|
-
// ⚠️ forced_on:传 disabled 被**静默忽略**(实测仍产出思考块)
|
|
55671
|
-
thinkingMode: "forced_on"
|
|
55672
|
-
},
|
|
55673
|
-
{
|
|
55674
|
-
id: "MiniMax-M2.7",
|
|
55675
|
-
name: "M2.7",
|
|
55676
|
-
contextWindow: 2e5,
|
|
55677
|
-
maxTokens: 128e3,
|
|
55678
|
-
supportsImage: false,
|
|
55679
|
-
thinkingMode: "forced_on"
|
|
55680
|
-
}
|
|
55681
|
-
];
|
|
55682
|
-
var MINIMAX = {
|
|
55683
|
-
id: "minimax",
|
|
55684
|
-
displayName: "MiniMax Code",
|
|
55685
|
-
accountHost: "https://account.minimax.cn",
|
|
55686
|
-
apiHost: "https://agent.minimax.cn",
|
|
55687
|
-
region: "cn",
|
|
55688
|
-
buildEnv: "prod",
|
|
55689
|
-
clientId: "mcode-public",
|
|
55690
|
-
audience: "agent-backend",
|
|
55691
|
-
scope: "agent.default",
|
|
55692
|
-
defaultCredentialRef: "MINIMAX_ACCESS_TOKEN",
|
|
55693
|
-
fallbackModels: MINIMAX_FALLBACK_MODELS,
|
|
55694
|
-
maxImageBytesInline: 10 * 1024 * 1024,
|
|
55695
|
-
maxRequestBodyBytes: 64 * 1024 * 1024
|
|
55696
|
-
};
|
|
55697
|
-
var MINIMAX_DEVICE_CODE_PATH = "/oauth2/device/code";
|
|
55698
|
-
var MINIMAX_TOKEN_PATH = "/oauth2/token";
|
|
55699
|
-
var MINIMAX_MODELS_PATH = "/mavis/api/v1/models";
|
|
55700
|
-
var MINIMAX_INFER_PATH = "/mavis/api/v1/llm/v1/messages";
|
|
55701
|
-
var MINIMAX_SIGNIN_STATUS_PATH = "/minimax-cloud/api/v1/signin/status";
|
|
55702
|
-
var MINIMAX_SIGNIN_CLAIM_PATH = "/minimax-cloud/api/v1/signin/claim";
|
|
55703
|
-
var MINIMAX_CREDIT_DETAILS_PATH = "/minimax-cloud/api/v1/credit/details";
|
|
55704
|
-
var MINIMAX_REQUEST_TIMEOUT_MS = 3e4;
|
|
55705
|
-
var MINIMAX_OAUTH_TIMEOUT_MS = 2e4;
|
|
55706
|
-
|
|
55707
|
-
// vendor/channel-pack/src/minimax.ts
|
|
55708
|
-
function decodeJwtExpMs2(token) {
|
|
55709
|
-
const segments = token.split(".");
|
|
55710
|
-
if (segments.length !== 3 || segments[1] === void 0) return void 0;
|
|
55711
|
-
try {
|
|
55712
|
-
const payload = JSON.parse(Buffer.from(segments[1], "base64url").toString("utf8"));
|
|
55713
|
-
return typeof payload.exp === "number" && Number.isFinite(payload.exp) ? Number.isFinite(payload.exp * 1e3) ? payload.exp * 1e3 : void 0 : void 0;
|
|
55714
|
-
} catch {
|
|
55715
|
-
return void 0;
|
|
55716
|
-
}
|
|
55717
|
-
}
|
|
55718
|
-
function decodeJwtSub(token) {
|
|
55719
|
-
const segments = token.split(".");
|
|
55720
|
-
if (segments.length !== 3 || segments[1] === void 0) return void 0;
|
|
55721
|
-
try {
|
|
55722
|
-
const payload = JSON.parse(Buffer.from(segments[1], "base64url").toString("utf8"));
|
|
55723
|
-
return typeof payload.sub === "string" && payload.sub.length > 0 ? payload.sub : void 0;
|
|
55724
|
-
} catch {
|
|
55725
|
-
return void 0;
|
|
55726
|
-
}
|
|
55727
|
-
}
|
|
55728
|
-
function minimaxCredentialExpiresAtMs(credential) {
|
|
55729
|
-
const raw = credential.expires_at;
|
|
55730
|
-
if (raw !== void 0) {
|
|
55731
|
-
if (/^\d+$/.test(raw)) {
|
|
55732
|
-
const value = Number(raw);
|
|
55733
|
-
const parsed = value > 1e12 ? value : value * 1e3;
|
|
55734
|
-
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
55735
|
-
}
|
|
55736
|
-
}
|
|
55737
|
-
return decodeJwtExpMs2(credential.access_token);
|
|
55738
|
-
}
|
|
55739
|
-
function isMinimaxExpired(credential, nowMs = Date.now()) {
|
|
55740
|
-
const expiresAt = minimaxCredentialExpiresAtMs(credential);
|
|
55741
|
-
return expiresAt !== void 0 && nowMs >= expiresAt;
|
|
55742
|
-
}
|
|
55743
|
-
function isMinimaxRefreshable(credential) {
|
|
55744
|
-
return typeof credential.refresh_token === "string" && credential.refresh_token.length > 0;
|
|
55745
|
-
}
|
|
55746
|
-
function minimaxHeaders(credential) {
|
|
55747
|
-
const headers = new Headers();
|
|
55748
|
-
headers.set("Authorization", `Bearer ${credential.access_token}`);
|
|
55749
|
-
headers.set("Accept", "application/json");
|
|
55750
|
-
return headers;
|
|
55751
|
-
}
|
|
55752
|
-
function minimaxInferHeaders(credential) {
|
|
55753
|
-
const headers = new Headers();
|
|
55754
|
-
headers.set("Authorization", `Bearer ${credential.access_token}`);
|
|
55755
|
-
headers.set("Content-Type", "application/json");
|
|
55756
|
-
headers.set("Accept", "text/event-stream");
|
|
55757
|
-
return headers;
|
|
55758
|
-
}
|
|
55759
|
-
function positiveInt(value) {
|
|
55760
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
55761
|
-
}
|
|
55762
|
-
function nonEmptyString(value) {
|
|
55763
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
55764
|
-
}
|
|
55765
|
-
function stringArray(value) {
|
|
55766
|
-
if (!Array.isArray(value)) return void 0;
|
|
55767
|
-
const out = [];
|
|
55768
|
-
const seen = /* @__PURE__ */ new Set();
|
|
55769
|
-
for (const item of value) {
|
|
55770
|
-
const text = nonEmptyString(item);
|
|
55771
|
-
if (text === void 0 || seen.has(text)) continue;
|
|
55772
|
-
seen.add(text);
|
|
55773
|
-
out.push(text);
|
|
55774
|
-
}
|
|
55775
|
-
return out.length > 0 ? out : void 0;
|
|
55776
|
-
}
|
|
55777
|
-
function normalizeMinimaxModel(raw) {
|
|
55778
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return void 0;
|
|
55779
|
-
const record = raw;
|
|
55780
|
-
const id = nonEmptyString(record.id) ?? nonEmptyString(record.name);
|
|
55781
|
-
if (id === void 0) return void 0;
|
|
55782
|
-
const name2 = nonEmptyString(record.name) ?? id;
|
|
55783
|
-
const limit = typeof record.limit === "object" && record.limit !== null ? record.limit : {};
|
|
55784
|
-
const options = Array.isArray(record.context_window_options) ? record.context_window_options.filter((v) => positiveInt(v) !== void 0) : [];
|
|
55785
|
-
const limitContext = positiveInt(limit.context);
|
|
55786
|
-
const contextWindow = options.length > 0 ? Math.max(...options) : limitContext;
|
|
55787
|
-
const modalities = typeof record.modalities === "object" && record.modalities !== null ? record.modalities : {};
|
|
55788
|
-
const inputs = Array.isArray(modalities.input) ? modalities.input.filter((v) => typeof v === "string") : [];
|
|
55789
|
-
const effortOptions = stringArray(record.effort_options);
|
|
55790
|
-
const rawDefault = nonEmptyString(record.default_effort);
|
|
55791
|
-
const defaultEffort = rawDefault !== void 0 && effortOptions?.includes(rawDefault) === true ? rawDefault : void 0;
|
|
55792
|
-
const thinkingConfig = typeof record.thinking_config === "object" && record.thinking_config !== null ? record.thinking_config : void 0;
|
|
55793
|
-
const thinkingMode = thinkingConfig === void 0 ? void 0 : nonEmptyString(thinkingConfig.mode);
|
|
55794
|
-
const maxTokens = positiveInt(limit.output);
|
|
55795
|
-
return {
|
|
55796
|
-
id,
|
|
55797
|
-
name: name2,
|
|
55798
|
-
// 窗口未知时**不编造**:用 0 表示「不知道」,由 resolveModel 判 `> 0`
|
|
55799
|
-
contextWindow: contextWindow ?? 0,
|
|
55800
|
-
...maxTokens === void 0 ? {} : { maxTokens },
|
|
55801
|
-
supportsImage: inputs.includes("image"),
|
|
55802
|
-
...effortOptions === void 0 ? {} : { effortOptions },
|
|
55803
|
-
...defaultEffort === void 0 ? {} : { defaultEffort },
|
|
55804
|
-
...thinkingMode === void 0 ? {} : { thinkingMode }
|
|
55805
|
-
};
|
|
55806
|
-
}
|
|
55807
|
-
function fallbackToEntry(model) {
|
|
55808
|
-
return {
|
|
55809
|
-
id: model.id,
|
|
55810
|
-
name: model.name,
|
|
55811
|
-
contextWindow: model.contextWindow,
|
|
55812
|
-
maxTokens: model.maxTokens,
|
|
55813
|
-
supportsImage: model.supportsImage,
|
|
55814
|
-
...model.effortOptions === void 0 ? {} : { effortOptions: model.effortOptions },
|
|
55815
|
-
...model.defaultEffort === void 0 ? {} : { defaultEffort: model.defaultEffort },
|
|
55816
|
-
...model.thinkingMode === void 0 ? {} : { thinkingMode: model.thinkingMode }
|
|
55817
|
-
};
|
|
55818
|
-
}
|
|
55819
|
-
function minimaxFallbackEntries(product = MINIMAX) {
|
|
55820
|
-
return product.fallbackModels.map(fallbackToEntry);
|
|
55821
|
-
}
|
|
55822
|
-
|
|
55823
56330
|
// vendor/channel-pack/src/credits.ts
|
|
55824
56331
|
var CHECKIN_ACTIVITY_STATUS_PATH = "/v2/billing/meter/checkin-activity-status";
|
|
55825
56332
|
var DAILY_CHECKIN_PATH = "/v2/billing/meter/daily-checkin";
|
|
@@ -59287,6 +59794,16 @@ async function probeWithAdapter(entry, credential, modelId, timeoutMs) {
|
|
|
59287
59794
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
59288
59795
|
if (isRateLimitFailure(error)) {
|
|
59289
59796
|
const parsed = parseRateLimitError(message2, modelId);
|
|
59797
|
+
const creditExhausted = isCreditExhausted(message2);
|
|
59798
|
+
if (creditExhausted) {
|
|
59799
|
+
const resetMs = explicitRateResetAtMs(message2) ?? creditExhaustedResetAtMs();
|
|
59800
|
+
return {
|
|
59801
|
+
modelId,
|
|
59802
|
+
ok: false,
|
|
59803
|
+
message: `\u989D\u5EA6\u5DF2\u8017\u5C3D\uFF08\u4E0D\u662F\u9650\u6D41\uFF09\uFF1A${message2}\u3002\u6062\u590D\u8981\u9760**\u6B21\u65E5\u914D\u989D**\u6216\u5145\u503C\uFF0C\u4E0D\u662F\u7B49\u4E00\u4F1A\u513F \u2014\u2014 \u8BE5\u8D26\u53F7\u5728\u989D\u5EA6\u6062\u590D\u524D\u4E0D\u53EF\u7528\u3002`,
|
|
59804
|
+
resetTimeMs: resetMs
|
|
59805
|
+
};
|
|
59806
|
+
}
|
|
59290
59807
|
return {
|
|
59291
59808
|
modelId,
|
|
59292
59809
|
ok: false,
|
|
@@ -62825,6 +63342,7 @@ function registerChannelPackEndpoints(ctx, pool, codearts, buddy, workbuddy, lob
|
|
|
62825
63342
|
const all = catalogSource?.listAllModels();
|
|
62826
63343
|
let catalog;
|
|
62827
63344
|
if (all !== void 0) {
|
|
63345
|
+
catalog = [...all];
|
|
62828
63346
|
catalog = [...all];
|
|
62829
63347
|
const known = new Set(catalog.map((model) => model.id));
|
|
62830
63348
|
for (const id of Object.keys(disabledMap)) {
|
|
@@ -66067,6 +66585,7 @@ var MinimaxAuth = class extends Service10 {
|
|
|
66067
66585
|
accessors: MINIMAX_EXPIRY_ACCESSORS,
|
|
66068
66586
|
refresh: (c) => this.refreshCredentialFor(c),
|
|
66069
66587
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
66588
|
+
makeTerminalError: (message2) => new MinimaxRefreshTokenExpiredError(message2),
|
|
66070
66589
|
warn: (message2) => this.ctx.logger?.warn?.(message2),
|
|
66071
66590
|
info: (message2) => this.ctx.logger?.info?.(message2)
|
|
66072
66591
|
});
|
|
@@ -66108,6 +66627,7 @@ var MinimaxAuth = class extends Service10 {
|
|
|
66108
66627
|
current: entry,
|
|
66109
66628
|
refresh: (c) => this.refreshCredentialFor(c),
|
|
66110
66629
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
66630
|
+
makeTerminalError: (message2) => new MinimaxRefreshTokenExpiredError(message2),
|
|
66111
66631
|
warn: (message2) => this.ctx.logger?.warn?.(message2)
|
|
66112
66632
|
});
|
|
66113
66633
|
} catch (error) {
|
|
@@ -66639,6 +67159,32 @@ var MinimaxAdapter = class extends LlmAdapter11 {
|
|
|
66639
67159
|
* 改为:只缓存**真实远端目录**,兜底表每次现算(纯本地、零成本),
|
|
66640
67160
|
* 并用 {@link RemoteCatalogGate} 的冷却挡住「每模型重试一次」的放大。
|
|
66641
67161
|
*/
|
|
67162
|
+
/**
|
|
67163
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
67164
|
+
*
|
|
67165
|
+
* ## ⚠️⚠️ 本类短路判据是 `if (this.remoteModels !== undefined) return`(在 `loadModels` 里)
|
|
67166
|
+
*
|
|
67167
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,`loadModels`
|
|
67168
|
+
* 会**返回兜底子表**并把结果留在 `remoteModels` 之外 ⇒ 用户少看到一批模型。
|
|
67169
|
+
*
|
|
67170
|
+
* ⇒ **保存—尝试—失败恢复**:旧目录先存下来,重拉后若没拿到远端就放回去
|
|
67171
|
+
*(「刷新失败」与「不刷新」对用户无差别,都继续看旧目录)。
|
|
67172
|
+
*
|
|
67173
|
+
* ⚠️ 判据是「`remoteModels` 是否被**远端**填上」,不能用「`loadModels` 返回了什么」:
|
|
67174
|
+
* 它在拿不到远端时**照样返回兜底表**(那是展示用,不落 `remoteModels`)。
|
|
67175
|
+
*/
|
|
67176
|
+
async refreshCatalog() {
|
|
67177
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
67178
|
+
const previous = this.remoteModels;
|
|
67179
|
+
this.remoteModels = void 0;
|
|
67180
|
+
try {
|
|
67181
|
+
await this.loadModels();
|
|
67182
|
+
} finally {
|
|
67183
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
67184
|
+
this.remoteModels = previous;
|
|
67185
|
+
}
|
|
67186
|
+
}
|
|
67187
|
+
}
|
|
66642
67188
|
async loadModels() {
|
|
66643
67189
|
if (this.remoteModels !== void 0) return this.remoteModels;
|
|
66644
67190
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
@@ -67420,6 +67966,7 @@ var GeminiAuth = class extends Service11 {
|
|
|
67420
67966
|
accessors: GEMINI_EXPIRY_ACCESSORS,
|
|
67421
67967
|
refresh: (c) => this.refreshCredential(c),
|
|
67422
67968
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
67969
|
+
makeTerminalError: (message2) => new GeminiRefreshTokenExpiredError(message2),
|
|
67423
67970
|
warn: (message2) => this.ctx.logger?.warn?.(message2),
|
|
67424
67971
|
info: (message2) => this.ctx.logger?.info?.(message2)
|
|
67425
67972
|
});
|
|
@@ -67467,6 +68014,7 @@ var GeminiAuth = class extends Service11 {
|
|
|
67467
68014
|
current: entry,
|
|
67468
68015
|
refresh: (c) => this.refreshCredentialUnderLock(entry.credentialRef, c),
|
|
67469
68016
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
68017
|
+
makeTerminalError: (message2) => new GeminiRefreshTokenExpiredError(message2),
|
|
67470
68018
|
warn: (message2) => this.ctx.logger?.warn?.(message2),
|
|
67471
68019
|
info: (message2) => this.ctx.logger?.info?.(message2)
|
|
67472
68020
|
});
|
|
@@ -68369,6 +68917,7 @@ var AccioAuth = class extends Service12 {
|
|
|
68369
68917
|
current: entry,
|
|
68370
68918
|
refresh: (c) => this.refreshCredentialUnderLock(entry.credentialRef, c),
|
|
68371
68919
|
save: (c) => this.ctx.credentials.set(ref, JSON.stringify(c)),
|
|
68920
|
+
makeTerminalError: (message2) => new AccioRefreshTokenExpiredError(message2),
|
|
68372
68921
|
warn: (message2) => this.warn(message2),
|
|
68373
68922
|
info: (message2) => this.ctx.logger?.info?.(message2)
|
|
68374
68923
|
});
|
|
@@ -69123,6 +69672,21 @@ function isTransportError6(error) {
|
|
|
69123
69672
|
if (message2.includes("epipe") || message2.includes("socket hang up")) return true;
|
|
69124
69673
|
return false;
|
|
69125
69674
|
}
|
|
69675
|
+
function accioFailureClassOf(code) {
|
|
69676
|
+
if (code === "QUOTA_EXCEEDED") return "quota";
|
|
69677
|
+
if (code === "RATE_LIMIT") return "rate";
|
|
69678
|
+
if (code === "AUTH") return "auth";
|
|
69679
|
+
return "other";
|
|
69680
|
+
}
|
|
69681
|
+
function shouldRotateAccioAccount(code) {
|
|
69682
|
+
return accioFailureClassOf(code) !== "other";
|
|
69683
|
+
}
|
|
69684
|
+
function recordsAccioRateLimit(code) {
|
|
69685
|
+
const cls = accioFailureClassOf(code);
|
|
69686
|
+
return cls === "quota" || cls === "rate";
|
|
69687
|
+
}
|
|
69688
|
+
var ACCIO_MAX_ROTATE = 8;
|
|
69689
|
+
var ACCIO_RATE_LIMIT_COOLDOWN_MS = 36e5;
|
|
69126
69690
|
function httpErrorCode6(status) {
|
|
69127
69691
|
if (status === 401 || status === 403) return "AUTH";
|
|
69128
69692
|
if (status === 402) return "QUOTA_EXCEEDED";
|
|
@@ -69409,6 +69973,30 @@ var AccioAdapter = class extends LlmAdapter12 {
|
|
|
69409
69973
|
return { id, name: this.product.displayName };
|
|
69410
69974
|
}
|
|
69411
69975
|
/** 懒加载远端模型目录(仅拉取一次;失败/空结果走闸门冷却)。 */
|
|
69976
|
+
/**
|
|
69977
|
+
* **强制重拉远端目录**(模型上下架自适应;供 `index.ts` 的定时器调用)。
|
|
69978
|
+
*
|
|
69979
|
+
* ## ⚠️⚠️ 本类短路判据是 `remoteModels !== undefined`(不是 `remoteComplete`)
|
|
69980
|
+
*
|
|
69981
|
+
* ⇒ 必须**先清 `remoteModels`** 才能触发重拉;但清掉后若重拉失败,
|
|
69982
|
+
* `ensureRemoteModels` 会**保留 undefined** ⇒ 目录退回**兜底子表**(那是个**子集**
|
|
69983
|
+
* 且**已过期**)⇒ 一次网络抖动就让用户少看到一批模型。
|
|
69984
|
+
*
|
|
69985
|
+
* ⇒ 采用**保存—尝试—失败恢复**:旧目录先存下来,重拉后若仍为空就放回去。
|
|
69986
|
+
* 这样「刷新失败」与「不刷新」对用户是无差别的(都继续看旧目录)。
|
|
69987
|
+
*/
|
|
69988
|
+
async refreshCatalog() {
|
|
69989
|
+
if (this.options.fetchRemoteModels === void 0) return;
|
|
69990
|
+
const previous = this.remoteModels;
|
|
69991
|
+
this.remoteModels = void 0;
|
|
69992
|
+
try {
|
|
69993
|
+
await this.ensureRemoteModels();
|
|
69994
|
+
} finally {
|
|
69995
|
+
if (this.remoteModels === void 0 && previous !== void 0) {
|
|
69996
|
+
this.remoteModels = previous;
|
|
69997
|
+
}
|
|
69998
|
+
}
|
|
69999
|
+
}
|
|
69412
70000
|
async ensureRemoteModels() {
|
|
69413
70001
|
const fetchRemote = this.options.fetchRemoteModels;
|
|
69414
70002
|
if (this.remoteModels !== void 0 || fetchRemote === void 0) return;
|
|
@@ -69630,44 +70218,125 @@ var AccioAdapter = class extends LlmAdapter12 {
|
|
|
69630
70218
|
if (systemInstruction !== "") body.system_instruction = systemInstruction;
|
|
69631
70219
|
else delete body.system_instruction;
|
|
69632
70220
|
if (options.stop !== void 0 && options.stop.length > 0) body.stop_sequences = options.stop;
|
|
69633
|
-
applyAccessToken(body, credential.access_token);
|
|
69634
70221
|
let response = await this.send(credential, body, options);
|
|
69635
|
-
|
|
69636
|
-
|
|
69637
|
-
|
|
69638
|
-
|
|
69639
|
-
|
|
69640
|
-
|
|
69641
|
-
|
|
70222
|
+
let currentAccountId = "";
|
|
70223
|
+
if (this.options.accountPool !== void 0) {
|
|
70224
|
+
try {
|
|
70225
|
+
currentAccountId = await this.options.accountPool.findAccountIdByCredential(
|
|
70226
|
+
ACCIO.id,
|
|
70227
|
+
credential.access_token
|
|
70228
|
+
) ?? "";
|
|
70229
|
+
} catch {
|
|
69642
70230
|
}
|
|
69643
|
-
credential = refreshed;
|
|
69644
|
-
applyAccessToken(body, credential.access_token);
|
|
69645
|
-
response = await this.send(credential, body, options);
|
|
69646
70231
|
}
|
|
69647
|
-
|
|
69648
|
-
|
|
69649
|
-
|
|
69650
|
-
|
|
69651
|
-
|
|
69652
|
-
|
|
69653
|
-
|
|
69654
|
-
|
|
69655
|
-
|
|
69656
|
-
|
|
69657
|
-
|
|
69658
|
-
|
|
69659
|
-
|
|
69660
|
-
|
|
69661
|
-
|
|
69662
|
-
|
|
69663
|
-
|
|
70232
|
+
const tried = /* @__PURE__ */ new Set();
|
|
70233
|
+
let producedAny = false;
|
|
70234
|
+
const markCurrentAccount = async (failureCode) => {
|
|
70235
|
+
if (this.options.accountPool === void 0) return;
|
|
70236
|
+
if (currentAccountId === "" || !recordsAccioRateLimit(failureCode)) return;
|
|
70237
|
+
try {
|
|
70238
|
+
const cls = accioFailureClassOf(failureCode);
|
|
70239
|
+
await this.options.accountPool.updateModelRateLimit(
|
|
70240
|
+
currentAccountId,
|
|
70241
|
+
options.model,
|
|
70242
|
+
cls === "quota" ? nextUtc8DayStartMs() : Date.now() + ACCIO_RATE_LIMIT_COOLDOWN_MS
|
|
70243
|
+
);
|
|
70244
|
+
} catch (error) {
|
|
70245
|
+
console.warn(
|
|
70246
|
+
`[accio] \u8D26\u53F7 ${currentAccountId} \u7684\u51B7\u5374\u6807\u8BB0\u5199\u5165\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD\u6362\u53F7\uFF09\uFF1A`,
|
|
70247
|
+
error instanceof Error ? error.message : String(error)
|
|
70248
|
+
);
|
|
70249
|
+
}
|
|
70250
|
+
};
|
|
70251
|
+
const rotate = async () => {
|
|
70252
|
+
if (this.options.accountPool === void 0) return void 0;
|
|
70253
|
+
try {
|
|
70254
|
+
const next = await this.options.accountPool.getAvailableAccount(
|
|
70255
|
+
ACCIO.id,
|
|
70256
|
+
options.model,
|
|
70257
|
+
tried
|
|
70258
|
+
);
|
|
70259
|
+
if (!next || tried.has(next.entry.id)) return void 0;
|
|
70260
|
+
tried.add(next.entry.id);
|
|
70261
|
+
const nextCredential = next.credential;
|
|
70262
|
+
currentAccountId = next.entry.id;
|
|
70263
|
+
credential = nextCredential;
|
|
70264
|
+
applyAccessToken(body, credential.access_token);
|
|
70265
|
+
return await this.send(credential, body, options);
|
|
70266
|
+
} catch (error) {
|
|
70267
|
+
console.warn(
|
|
70268
|
+
"[accio] \u6362\u53F7\u5931\u8D25\uFF0C\u6309\u300C\u65E0\u53EF\u7528\u8D26\u53F7\u300D\u5904\u7406\uFF1A",
|
|
70269
|
+
error instanceof Error ? error.message : String(error)
|
|
70270
|
+
);
|
|
70271
|
+
return void 0;
|
|
70272
|
+
}
|
|
70273
|
+
};
|
|
70274
|
+
const consumeOnce = async function* (target) {
|
|
70275
|
+
const streamBody = target.body;
|
|
70276
|
+
if (streamBody === null) throw new LlmError20("accio: empty model response body", "EMPTY_RESPONSE");
|
|
70277
|
+
for await (const chunk of consumeAccioSse({
|
|
70278
|
+
body: streamBody.pipeThrough(accioToolCallMergeTransform()),
|
|
70279
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
70280
|
+
idleTimeoutMs: ACCIO_SSE_IDLE_TIMEOUT_MS
|
|
70281
|
+
})) {
|
|
70282
|
+
producedAny = true;
|
|
70283
|
+
yield chunk;
|
|
70284
|
+
}
|
|
70285
|
+
};
|
|
70286
|
+
for (let round = 0; ; round++) {
|
|
70287
|
+
if (!response.ok) {
|
|
70288
|
+
const text = await response.text().catch(() => "");
|
|
70289
|
+
if (response.status === 401 || response.status === 403) {
|
|
70290
|
+
await this.options.refresh();
|
|
70291
|
+
const refreshed = await this.options.resolveCredential(options.model);
|
|
70292
|
+
if (refreshed !== void 0 && refreshed.access_token !== "") {
|
|
70293
|
+
credential = refreshed;
|
|
70294
|
+
applyAccessToken(body, credential.access_token);
|
|
70295
|
+
response = await this.send(credential, body, options);
|
|
70296
|
+
if (response.ok) continue;
|
|
70297
|
+
}
|
|
70298
|
+
}
|
|
70299
|
+
const code = httpErrorCode6(response.status);
|
|
70300
|
+
if (!shouldRotateAccioAccount(code)) {
|
|
70301
|
+
throw new LlmError20(`accio: ${errorDetail6(text)}`, code, { status: response.status });
|
|
70302
|
+
}
|
|
70303
|
+
await markCurrentAccount(code);
|
|
70304
|
+
if (round >= ACCIO_MAX_ROTATE - 1) {
|
|
70305
|
+
throw new LlmError20(`accio: ${errorDetail6(text)}`, code, { status: response.status });
|
|
70306
|
+
}
|
|
70307
|
+
const rotated = await rotate();
|
|
70308
|
+
if (rotated === void 0) {
|
|
70309
|
+
throw new LlmError20(`accio: ${errorDetail6(text)}`, code, { status: response.status });
|
|
70310
|
+
}
|
|
70311
|
+
response = rotated;
|
|
70312
|
+
continue;
|
|
70313
|
+
}
|
|
70314
|
+
if (response.body === null) {
|
|
70315
|
+
throw new LlmError20("accio: empty model response body", "EMPTY_RESPONSE");
|
|
70316
|
+
}
|
|
70317
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
70318
|
+
if (!contentType.includes("text/event-stream")) {
|
|
70319
|
+
const peek = await response.text().catch(() => "");
|
|
70320
|
+
throw new LlmError20(
|
|
70321
|
+
`accio: \u4E0A\u6E38\u672A\u8FD4\u56DE\u4E8B\u4EF6\u6D41\uFF08content-type: ${contentType || "(\u7A7A)"}\uFF09\u2014\u2014\u901A\u5E38\u662F\u88AB\u98CE\u63A7\u62E6\u622A\uFF08\u7F51\u5173\u8FD4\u56DE 200 + HTML \u62E6\u622A\u9875\uFF09\u3002${peek === "" ? "" : ` \u670D\u52A1\u7AEF\u539F\u6587\uFF1A${peek.slice(0, 200)}`}`,
|
|
70322
|
+
"SERVER",
|
|
70323
|
+
{ status: response.status }
|
|
70324
|
+
);
|
|
70325
|
+
}
|
|
70326
|
+
try {
|
|
70327
|
+
yield* consumeOnce(response);
|
|
70328
|
+
return;
|
|
70329
|
+
} catch (error) {
|
|
70330
|
+
if (producedAny) throw error;
|
|
70331
|
+
const code = error instanceof LlmError20 ? error.code : "";
|
|
70332
|
+
if (code === "" || !shouldRotateAccioAccount(code)) throw error;
|
|
70333
|
+
await markCurrentAccount(code);
|
|
70334
|
+
if (round >= ACCIO_MAX_ROTATE - 1) throw error;
|
|
70335
|
+
const rotated = await rotate();
|
|
70336
|
+
if (rotated === void 0) throw error;
|
|
70337
|
+
response = rotated;
|
|
70338
|
+
}
|
|
69664
70339
|
}
|
|
69665
|
-
const merged = response.body.pipeThrough(accioToolCallMergeTransform());
|
|
69666
|
-
yield* consumeAccioSse({
|
|
69667
|
-
body: merged,
|
|
69668
|
-
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
69669
|
-
idleTimeoutMs: ACCIO_SSE_IDLE_TIMEOUT_MS
|
|
69670
|
-
});
|
|
69671
70340
|
}
|
|
69672
70341
|
/** 发起一次推理请求;网络失败映射为可重试的 `TRANSPORT`。 */
|
|
69673
70342
|
async send(credential, body, options) {
|
|
@@ -69875,6 +70544,7 @@ __export(officeace_auth_exports, {
|
|
|
69875
70544
|
fetchModelTokenRates: () => fetchModelTokenRates,
|
|
69876
70545
|
fetchSubscriptionSummary: () => fetchSubscriptionSummary,
|
|
69877
70546
|
isExpiring: () => isExpiring,
|
|
70547
|
+
maybeClaimBonus: () => maybeClaimBonus,
|
|
69878
70548
|
persistLogin: () => persistLogin,
|
|
69879
70549
|
pollLoginCode: () => pollLoginCode,
|
|
69880
70550
|
probeOfficeAce: () => probeOfficeAce,
|
|
@@ -70536,7 +71206,7 @@ async function fetchCloudSubscriptionFor(credential) {
|
|
|
70536
71206
|
}
|
|
70537
71207
|
async function claimDailyBonus(credential) {
|
|
70538
71208
|
if (!credentialUsable(credential)) {
|
|
70539
|
-
|
|
71209
|
+
throw new Error("\u51ED\u636E\u7F3A\u5931\uFF08access \u6216 securityToken \u7F3A\u5931\u6216\u4E3A\u7A7A\uFF09\uFF0C\u672A\u53D1\u8D77\u7B7E\u5230\u8BF7\u6C42");
|
|
70540
71210
|
}
|
|
70541
71211
|
try {
|
|
70542
71212
|
const body = await signAndRequest(
|
|
@@ -70551,8 +71221,10 @@ async function claimDailyBonus(credential) {
|
|
|
70551
71221
|
activityName: typeof s.activity_name === "string" ? s.activity_name : "\u6D3B\u52A8\u5956\u52B1",
|
|
70552
71222
|
points: Number(s.points) || 0
|
|
70553
71223
|
}));
|
|
70554
|
-
} catch {
|
|
70555
|
-
|
|
71224
|
+
} catch (error) {
|
|
71225
|
+
throw new Error(
|
|
71226
|
+
`\u7B7E\u5230\u8BF7\u6C42\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
71227
|
+
);
|
|
70556
71228
|
}
|
|
70557
71229
|
}
|
|
70558
71230
|
var lastClaimAt = /* @__PURE__ */ new Map();
|
|
@@ -70561,7 +71233,18 @@ function maybeClaimBonus(credential, ref) {
|
|
|
70561
71233
|
const hourKey = `${now.getFullYear()}-${now.getMonth()}-${now.getDate()}-${now.getHours()}`;
|
|
70562
71234
|
if (lastClaimAt.get(ref) === hourKey) return Promise.resolve([]);
|
|
70563
71235
|
lastClaimAt.set(ref, hourKey);
|
|
70564
|
-
|
|
71236
|
+
const releaseSlot = () => {
|
|
71237
|
+
if (lastClaimAt.get(ref) === hourKey) lastClaimAt.delete(ref);
|
|
71238
|
+
};
|
|
71239
|
+
return claimDailyBonus(credential).then((skus) => {
|
|
71240
|
+
return skus;
|
|
71241
|
+
}).catch((error) => {
|
|
71242
|
+
console.warn(
|
|
71243
|
+
`[officeace] \u6BCF\u65E5\u7B7E\u5230\u5931\u8D25\uFF08ref=${ref}\uFF09\uFF0C\u5DF2\u64A4\u9500\u672C\u5C0F\u65F6\u5360\u5751\u5141\u8BB8\u91CD\u8BD5\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
71244
|
+
);
|
|
71245
|
+
releaseSlot();
|
|
71246
|
+
return [];
|
|
71247
|
+
});
|
|
70565
71248
|
}
|
|
70566
71249
|
function basicAuthorization(credential) {
|
|
70567
71250
|
return "Basic " + Buffer.from(`${credential.modelAppKey}:${credential.modelAppSecret}`).toString("base64");
|
|
@@ -72775,6 +73458,27 @@ function apply(ctx, config = {}) {
|
|
|
72775
73458
|
// Accio **可续期**(标准 OAuth refresh_token grant)。同款教训见上两行。
|
|
72776
73459
|
["accio", (p) => accio.refreshAll(p)]
|
|
72777
73460
|
];
|
|
73461
|
+
let catalogRefreshInFlight = false;
|
|
73462
|
+
async function refreshAllCatalogs() {
|
|
73463
|
+
if (catalogRefreshInFlight) return;
|
|
73464
|
+
if (typeof modelAdapters === "undefined") return;
|
|
73465
|
+
catalogRefreshInFlight = true;
|
|
73466
|
+
try {
|
|
73467
|
+
for (const [tag2, adapter] of Object.entries(modelAdapters)) {
|
|
73468
|
+
const refresh = adapter.refreshCatalog;
|
|
73469
|
+
if (typeof refresh !== "function") continue;
|
|
73470
|
+
try {
|
|
73471
|
+
await refresh.call(adapter);
|
|
73472
|
+
} catch (error) {
|
|
73473
|
+
ctx.logger?.warn?.(
|
|
73474
|
+
`[channel-pack] ${tag2} \u76EE\u5F55\u5237\u65B0\u5931\u8D25\uFF08\u4FDD\u7559\u65E7\u76EE\u5F55\uFF09\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
73475
|
+
);
|
|
73476
|
+
}
|
|
73477
|
+
}
|
|
73478
|
+
} finally {
|
|
73479
|
+
catalogRefreshInFlight = false;
|
|
73480
|
+
}
|
|
73481
|
+
}
|
|
72778
73482
|
async function refreshAllCredentials() {
|
|
72779
73483
|
for (const [tag2, refreshAll2] of refreshTargets) {
|
|
72780
73484
|
try {
|
|
@@ -72789,7 +73493,10 @@ function apply(ctx, config = {}) {
|
|
|
72789
73493
|
pool.listAllAccounts().then((accounts) => {
|
|
72790
73494
|
if (accounts.length === 0) return;
|
|
72791
73495
|
void refreshAllCredentials();
|
|
72792
|
-
const refreshTimer = setInterval(() =>
|
|
73496
|
+
const refreshTimer = setInterval(() => {
|
|
73497
|
+
void refreshAllCredentials();
|
|
73498
|
+
void refreshAllCatalogs();
|
|
73499
|
+
}, REFRESH_INTERVAL_MS);
|
|
72793
73500
|
refreshTimer.unref?.();
|
|
72794
73501
|
ctx.effect(() => () => {
|
|
72795
73502
|
clearInterval(refreshTimer);
|
|
@@ -73045,11 +73752,16 @@ function apply(ctx, config = {}) {
|
|
|
73045
73752
|
export {
|
|
73046
73753
|
Config,
|
|
73047
73754
|
apply,
|
|
73755
|
+
buildZcodeSystemBlocks,
|
|
73048
73756
|
channelProxyBypassed,
|
|
73049
73757
|
createChannelFetch,
|
|
73758
|
+
httpErrorCodeForZcode,
|
|
73050
73759
|
inject,
|
|
73051
73760
|
makeReadImage,
|
|
73052
73761
|
makeReadImageRequest,
|
|
73762
|
+
maybeClaimBonus,
|
|
73053
73763
|
name,
|
|
73054
|
-
parseWindowsProxy
|
|
73764
|
+
parseWindowsProxy,
|
|
73765
|
+
serializeTraeMessagesForTest,
|
|
73766
|
+
withCallerSystem
|
|
73055
73767
|
};
|