dsh-opendesign-corouter 0.1.18 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/lib/adapter.d.ts +5 -0
- package/lib/auth.d.ts +2 -0
- package/lib/catalog.d.ts +16 -12
- package/lib/client.d.ts +4 -4
- package/lib/client.js +73 -18
- package/lib/config.d.ts +4 -4
- package/lib/device-auth.d.ts +1 -1
- package/lib/generated/typert.host.js +29 -5
- package/lib/generated/typert.remote-client.js +29 -5
- package/lib/index.d.ts +13 -13
- package/lib/index.js +1240 -720
- package/lib/index.js.map +4 -4
- package/lib/model-catalog-snapshot.d.ts +2 -0
- package/lib/model-directory.d.ts +59 -0
- package/lib/model-discovery.d.ts +1 -1
- package/lib/model-entitlements.d.ts +44 -0
- package/lib/model-settings.d.ts +3 -0
- package/lib/protocol-options.d.ts +7 -1
- package/lib/protocols/messages.d.ts +1 -1
- package/lib/protocols/responses-replay.d.ts +6 -0
- package/lib/protocols/responses.d.ts +5 -5
- package/lib/protocols/types.d.ts +4 -0
- package/lib/reasoning.d.ts +13 -0
- package/lib/remote.d.ts +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,18 +52,18 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.15.tg
|
|
|
52
52
|
|
|
53
53
|
| Provider | 模型数 | 用途 |
|
|
54
54
|
| --- | ---: | --- |
|
|
55
|
-
| `opendesign-corouter-plan` |
|
|
56
|
-
| `opendesign-corouter-paid` |
|
|
55
|
+
| `opendesign-corouter-plan` | 按账号核实 | 当前工作区订阅确实覆盖的模型 |
|
|
56
|
+
| `opendesign-corouter-paid` | 按账号核实 | 不含 Coding Plan 或权益尚未核实的模型;每行明确标注 |
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
内置参考更新为 46 个对话 ID;运行时从当前网关读取目录,并用同一授权身份的控制令牌逐模型查询工作区预检。首次使用及十分钟后按需刷新,也可手动刷新。普通 API Key 无法与账号令牌对匹配时,不借用桌面账号权益、不假定附赠。逐个启用或停用模型、控制图片输入,并配置温度、top-p、输出、上下文、思考及协议;未知能力保留未知。[模型来源与权益](docs/client-evidence.md) · [图片能力](docs/model-capabilities.md)。
|
|
59
59
|
|
|
60
60
|
上下文窗口按 **默认 272K / 扩展 500K / 最大 872K** 三个互斥档位选择,均为输入与输出合计的工作总窗口;有效窗口取档位与该模型已知参考中的较小值,超过参考的档位不可选。输出仍在这段窗口内预留,自动预留最多为总窗口的 1/4 且不超过模型输出上限。[窗口与档位口径](docs/model-context.md)
|
|
61
61
|
|
|
62
62
|
聊天窗口的模型选择框旁有上下文快捷按钮,当前会话使用本插件模型时出现,显示该模型生效的总窗口,点开可直接切三档。它与设置页写的是同一份全局模型默认,同一模型的其他会话会同步生效。
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
推理协议默认 **自动按模型**:GPT / DeepSeek 选 Responses,Claude 选 Messages,其余按精确型号证据选择,原生路由未确认时采用 Responses。全局及逐模型都可显式覆盖,已保存的旧协议继续生效。网关内部透传尚未验证,不能把本地协议选择当作无转译保证。模型发现始终读取 OpenAI 兼容 `/models`。
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
思考档位按精确型号的厂商文档维护,并按实际协议筛选。所有已核实的可调型号均带有出处的默认值,未选择时显式发送;未知型号不继承邻近型号能力。旧配置中的无效默认值保持可见、可清除。[逐模型来源与网关验证状态](docs/reasoning-evidence.md)
|
|
67
67
|
|
|
68
68
|
> **分组不等于计费隔离。** 赠送额度耗尽后是否转扣套餐余额或钱包,由服务端和账号权益决定。选择“套餐赠送”不能保证绝不消耗钱包余额。
|
|
69
69
|
|
|
@@ -105,7 +105,7 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.15.tg
|
|
|
105
105
|
| Core 声明范围 | `>=0.2.1-rc.3 <0.3.0-0`,范围内其他版本不代表已实测 |
|
|
106
106
|
| Node.js | `>=24.9.0` |
|
|
107
107
|
| 独立登录 | 自动打开需本机 Chrome;也可复制链接到常用浏览器确认 |
|
|
108
|
-
| 默认推理接口 |
|
|
108
|
+
| 默认推理接口 | 自动按模型选择 `/v1/responses`、`/v1/messages` 或 `/v1/chat/completions` |
|
|
109
109
|
|
|
110
110
|
CI 在 Windows 与 Ubuntu 执行构建、类型检查及隔离测试;Ubuntu 另执行四页签浏览器和亮暗主题检查。[开发与验证范围](docs/development.md)
|
|
111
111
|
|
package/lib/adapter.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ import { type RuntimeConfig } from './config.js';
|
|
|
5
5
|
export interface AdapterOptions {
|
|
6
6
|
config(): RuntimeConfig;
|
|
7
7
|
models?(): readonly CatalogModel[];
|
|
8
|
+
readyModels?(): Promise<readonly CatalogModel[]>;
|
|
9
|
+
callIdentity?(): {
|
|
10
|
+
key: string;
|
|
11
|
+
workspace?: string;
|
|
12
|
+
} | undefined;
|
|
8
13
|
apiKey(ref: string, baseURL?: string): Promise<string | undefined>;
|
|
9
14
|
imageDataUrl?(image: ImageAttachmentRef, signal: AbortSignal): Promise<string | undefined>;
|
|
10
15
|
onEmptyTurn?(): void;
|
package/lib/auth.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export declare function desktopConfigPath(env?: NodeJS.ProcessEnv, home?: string
|
|
|
28
28
|
export interface DesktopCredential {
|
|
29
29
|
profile: DesktopProfile;
|
|
30
30
|
controlKey: string;
|
|
31
|
+
/** Used only for exact runtime/control identity matching; never sent to the Client. */
|
|
32
|
+
runtimeKey?: string;
|
|
31
33
|
/** Present only when the profile carries an official origin. */
|
|
32
34
|
apiUrl?: string;
|
|
33
35
|
plan?: string;
|
package/lib/catalog.d.ts
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* 取证来源:
|
|
5
5
|
* - 模型 ID / 显示名 / 供应商 / 单价:`https://corouter.open-design.ai/zh/models/<slug>/`
|
|
6
6
|
* 详情页内联 `data-model="{...}"` JSON(公开页面,2026-10-26)。
|
|
7
|
-
* - group
|
|
8
|
-
*
|
|
7
|
+
* - group:2026-11-17 scoped preflight 的种子观察(11/35);运行时必定重新核实,
|
|
8
|
+
* 无匹配账号证据全部标未知,不从此表授予附赠权益。
|
|
9
9
|
* - `plan` 原有 12 款的 contextWindow / maxOutputTokens 与原模态
|
|
10
10
|
* 来自同网关客户端 `dsh-opendesign-go` 0.1.9 的 MODEL_DEFAULTS;该表标为厂商资料,
|
|
11
11
|
* 不能当作网关实测上限。图片模态按最新证据单独核验。
|
|
12
12
|
* - 其余上下文窗口采用厂商公开资料或明确标注的暂定参考,逐型号来源见
|
|
13
13
|
* docs/model-context.md;CoRouter 实际限制未验证,可以通过模型设置覆盖。
|
|
14
14
|
* - `gpt-6.1-terra` 的 maxOutputTokens / inputModalities 取自厂商型号文档;
|
|
15
|
-
*
|
|
15
|
+
* 新型号 Fable 5.2、Hy4/Flash、Qwen4 Max 的独立资料见 docs/model-context.md。
|
|
16
16
|
* - 客户端桌面安装(Open Design 0.26.1)不内联 CoRouter 目录;其
|
|
17
17
|
* `vela model preset --format json` 只有 11 个旧预设 id(见 docs/client-evidence.md),
|
|
18
18
|
* 与本表不同代,故不用于本目录。
|
|
@@ -20,11 +20,7 @@
|
|
|
20
20
|
* 分组语义(重要):`plan`/`paid` 是**本插件本地目录分类**,用于把“套餐赠送通道”与
|
|
21
21
|
* “其余付费通道”拆成两个 Provider,不是上游强制计费契约。最终可用性、扣哪个额度池、
|
|
22
22
|
* 是否先扣 Design Plan 额度再用套餐模型/钱包额度,全部由服务端按账号套餐决定。
|
|
23
|
-
* 2026-
|
|
24
|
-
* 补齐 GPT-6.1 Terra,现为 plan 13 + paid 26。
|
|
25
|
-
* 同日桌面 Vela 按模型 billing preflight:M3.1 Flash 的 modelCovered=true /
|
|
26
|
-
* funding=coding_plan,新增于附赠通道;其余四项为 false / wallet,归付费通道。
|
|
27
|
-
* GPT-6.1 Terra 同为 modelCovered=false / funding=wallet,归付费通道。
|
|
23
|
+
* 2026-11-17 scoped remote 57 项,过滤媒体后 46;账号预检 11 covered / 35 not covered。
|
|
28
24
|
* 此分类以当次工作区证据为依据,不保证其他账号或未来套餐权益。
|
|
29
25
|
* 新增项证据及名称来源见 docs/client-evidence.md;不从型号名推断能力。
|
|
30
26
|
*
|
|
@@ -40,16 +36,24 @@ export interface CatalogModel {
|
|
|
40
36
|
id: string;
|
|
41
37
|
name: string;
|
|
42
38
|
group: 'plan' | 'paid';
|
|
39
|
+
/** A paired account preflight, never the seed classification, establishes coverage. */
|
|
40
|
+
coverage?: 'included' | 'not-included' | 'unknown';
|
|
41
|
+
/** Preferred wire format backed by model-specific API evidence. */
|
|
42
|
+
nativeProtocol?: 'chat-completions' | 'responses' | 'messages';
|
|
43
43
|
contextWindow?: number;
|
|
44
44
|
maxOutputTokens?: number;
|
|
45
45
|
inputModalities?: readonly ('text' | 'image')[];
|
|
46
46
|
/** Undefined means unconfirmed; an empty array means no discrete effort selector. */
|
|
47
47
|
reasoningEfforts?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* Vendor-documented default effort, always a member of `reasoningEfforts`.
|
|
50
|
+
* The adapter reports it as the route default, so a request that names no
|
|
51
|
+
* effort sends this documented value instead of leaving the choice to an
|
|
52
|
+
* untrusted relay. Omission means the vendor documents no default: nothing
|
|
53
|
+
* is guessed and the provider's own default stands.
|
|
54
|
+
*/
|
|
55
|
+
defaultEffort?: string;
|
|
48
56
|
}
|
|
49
|
-
/**
|
|
50
|
-
* `plan` 为官网 12 款 Core / Design Plan 模型,加预检确认覆盖的 M3.1 Flash;
|
|
51
|
-
* 其余 26 项归 `paid`(Plan / 钱包付费通道)。
|
|
52
|
-
*/
|
|
53
57
|
export declare const MODELS: readonly CatalogModel[];
|
|
54
58
|
export declare function modelsFor(group: 'plan' | 'paid'): readonly CatalogModel[];
|
|
55
59
|
export declare function findModel(id: string): CatalogModel | undefined;
|
package/lib/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import openDesignCoRouterRemote, { type CoRouterRemote } from './generated/typer
|
|
|
3
3
|
import type { TypertClientRemote } from '@deepseek-ai/dsh-typert-protocol';
|
|
4
4
|
import { type LoginState, type Status, type StatusModel, type PriceCatalog } from './remote.js';
|
|
5
5
|
import type { QuotaSnapshot, QuotaWindow } from './quota.js';
|
|
6
|
-
import { type ApiProtocol } from './protocol-options.js';
|
|
6
|
+
import { type ApiProtocol, type ProtocolSelection } from './protocol-options.js';
|
|
7
7
|
import type { ModelSettings, ModelSettingsMap } from './model-settings.js';
|
|
8
8
|
import { type ContextWindowPresetId } from './context-budget.js';
|
|
9
9
|
import { type ModelDirectoryService } from './client-context-quick.js';
|
|
@@ -30,7 +30,7 @@ export interface FormValues {
|
|
|
30
30
|
useDesktopCredential?: boolean;
|
|
31
31
|
baseURL?: string;
|
|
32
32
|
apiKeyEnv?: string;
|
|
33
|
-
apiProtocol?:
|
|
33
|
+
apiProtocol?: ProtocolSelection;
|
|
34
34
|
modelSettings?: ModelSettingsMap;
|
|
35
35
|
quotaRefreshSeconds?: number;
|
|
36
36
|
requestTimeoutMs?: number;
|
|
@@ -214,12 +214,12 @@ export interface ModelRowProps {
|
|
|
214
214
|
writable: boolean;
|
|
215
215
|
pending: boolean;
|
|
216
216
|
disabledReason?: string | undefined;
|
|
217
|
-
protocol?:
|
|
217
|
+
protocol?: ProtocolSelection;
|
|
218
218
|
price?: PriceCatalog['models'][number] | undefined;
|
|
219
219
|
priceKnown?: boolean | undefined;
|
|
220
220
|
onCommit: (next: ModelSettings | undefined) => Promise<boolean>;
|
|
221
221
|
}
|
|
222
|
-
export declare function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
222
|
+
export declare function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol: selection, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
223
223
|
className: string;
|
|
224
224
|
}, HTMLElement>;
|
|
225
225
|
export interface ModelsProps {
|
package/lib/client.js
CHANGED
|
@@ -19969,6 +19969,12 @@ function validUserCode(value) {
|
|
|
19969
19969
|
|
|
19970
19970
|
// src/protocol-options.ts
|
|
19971
19971
|
var API_PROTOCOL_IDS = ["chat-completions", "responses", "messages"];
|
|
19972
|
+
var API_PROTOCOL_SELECTION_IDS = ["auto", ...API_PROTOCOL_IDS];
|
|
19973
|
+
function effectiveProtocol(model, selection = "auto", override) {
|
|
19974
|
+
if (override !== void 0 && override !== "auto") return override;
|
|
19975
|
+
if (selection !== "auto") return selection;
|
|
19976
|
+
return model.nativeProtocol ?? "responses";
|
|
19977
|
+
}
|
|
19972
19978
|
function openAiBaseURL(baseURL) {
|
|
19973
19979
|
const base = baseURL.replace(/\/+$/u, "");
|
|
19974
19980
|
return new URL(base).pathname === "/" ? `${base}/v1` : base;
|
|
@@ -19978,6 +19984,7 @@ function inferenceEndpoint(baseURL, protocol) {
|
|
|
19978
19984
|
return baseURL.trim() === "" ? suffix : `${openAiBaseURL(baseURL.trim())}${suffix}`;
|
|
19979
19985
|
}
|
|
19980
19986
|
var API_PROTOCOL_OPTIONS = [
|
|
19987
|
+
{ id: "auto", name: "\u81EA\u52A8\uFF08\u6309\u6A21\u578B\uFF09", description: "\u4F7F\u7528\u6709\u8BC1\u636E\u7684\u6A21\u578B\u9996\u9009\u534F\u8BAE\uFF1B\u672A\u786E\u8BA4\u539F\u751F\u7AEF\u53E3\u65F6\u4F7F\u7528 Responses\uFF0C\u4E0D\u4FDD\u8BC1\u7F51\u5173\u65E0\u8F6C\u8BD1\u3002" },
|
|
19981
19988
|
{ id: "chat-completions", name: "OpenAI Chat Completions", description: "\u4F7F\u7528 Chat Completions \u8BF7\u6C42\u4E0E\u6D41\u5F0F\u54CD\u5E94\u3002" },
|
|
19982
19989
|
{ id: "responses", name: "OpenAI Responses", description: "\u4F7F\u7528 Responses \u8BF7\u6C42\u4E0E\u6D41\u5F0F\u54CD\u5E94\u3002" },
|
|
19983
19990
|
{ id: "messages", name: "Anthropic Messages", description: "\u4F7F\u7528 Messages \u8BF7\u6C42\u4E0E\u6D41\u5F0F\u54CD\u5E94\u3002" }
|
|
@@ -20003,7 +20010,7 @@ function parseModelSettingsMap(value) {
|
|
|
20003
20010
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
20004
20011
|
const keys = Object.keys(value);
|
|
20005
20012
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
20006
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort"]);
|
|
20013
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort", "apiProtocol"]);
|
|
20007
20014
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
20008
20015
|
const out = {};
|
|
20009
20016
|
for (const id of keys) {
|
|
@@ -20016,6 +20023,10 @@ function parseModelSettingsMap(value) {
|
|
|
20016
20023
|
if (!fields.has(field)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u542B\u6709\u4E0D\u652F\u6301\u7684\u5B57\u6BB5");
|
|
20017
20024
|
}
|
|
20018
20025
|
const parsed = {};
|
|
20026
|
+
if (settings.apiProtocol !== void 0) {
|
|
20027
|
+
if (!["auto", "chat-completions", "responses", "messages"].includes(String(settings.apiProtocol))) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 apiProtocol \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
20028
|
+
parsed.apiProtocol = settings.apiProtocol;
|
|
20029
|
+
}
|
|
20019
20030
|
if (settings.enabled !== void 0) {
|
|
20020
20031
|
if (typeof settings.enabled !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
20021
20032
|
parsed.enabled = settings.enabled;
|
|
@@ -20234,9 +20245,18 @@ function parseStatusModel(value) {
|
|
|
20234
20245
|
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
20235
20246
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
20236
20247
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
20237
|
-
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
20248
|
+
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
|
|
20249
|
+
...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) },
|
|
20250
|
+
...value.nativeProtocol === void 0 ? {} : { nativeProtocol: member(value.nativeProtocol, API_PROTOCOL_IDS, "\u539F\u751F\u534F\u8BAE") },
|
|
20251
|
+
...value.effectiveProtocol === void 0 ? {} : { effectiveProtocol: member(value.effectiveProtocol, API_PROTOCOL_IDS, "\u751F\u6548\u534F\u8BAE") },
|
|
20252
|
+
...value.coverage === void 0 ? {} : { coverage: member(value.coverage, ["included", "not-included", "unknown"], "\u6A21\u578B\u8BA2\u9605\u8986\u76D6") }
|
|
20238
20253
|
};
|
|
20239
20254
|
}
|
|
20255
|
+
function parseEffort(value) {
|
|
20256
|
+
const effort = text(value, "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D", 32);
|
|
20257
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/u.test(effort)) throw new Error("\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
20258
|
+
return effort;
|
|
20259
|
+
}
|
|
20240
20260
|
function parseStatusConfig(value) {
|
|
20241
20261
|
if (!record2(value)) throw new Error("\u914D\u7F6E\u89C6\u56FE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
20242
20262
|
if (typeof value.apiKeyEnv !== "string" || value.apiKeyEnv.length > MAX_ENV_REF) {
|
|
@@ -20250,7 +20270,7 @@ function parseStatusConfig(value) {
|
|
|
20250
20270
|
useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
|
|
20251
20271
|
baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
|
|
20252
20272
|
apiKeyEnv,
|
|
20253
|
-
...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol,
|
|
20273
|
+
...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_SELECTION_IDS, "\u63A8\u7406\u534F\u8BAE") },
|
|
20254
20274
|
...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
|
|
20255
20275
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
20256
20276
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
@@ -20271,7 +20291,7 @@ function parseStatus(value) {
|
|
|
20271
20291
|
ids.add(model.id);
|
|
20272
20292
|
}
|
|
20273
20293
|
const apiKeyConfigured = flag(value.apiKeyConfigured, "\u51ED\u636E\u662F\u5426\u5C31\u7EEA");
|
|
20274
|
-
const apiKeySource = value.apiKeySource === void 0 ? void 0 : member(value.apiKeySource, ["reference", "stored", "device"], "\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
20294
|
+
const apiKeySource = value.apiKeySource === void 0 ? void 0 : member(value.apiKeySource, ["reference", "stored", "device", "desktop"], "\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
20275
20295
|
if (!apiKeyConfigured && apiKeySource !== void 0) throw new Error("\u672A\u914D\u7F6E\u51ED\u636E\u65F6\u4E0D\u80FD\u6307\u5B9A\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
20276
20296
|
return {
|
|
20277
20297
|
revision: text(value.revision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION),
|
|
@@ -20286,7 +20306,17 @@ function parseStatus(value) {
|
|
|
20286
20306
|
models: parsed,
|
|
20287
20307
|
...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
|
|
20288
20308
|
...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
|
|
20289
|
-
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) }
|
|
20309
|
+
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) },
|
|
20310
|
+
...value.modelEntitlements === void 0 ? {} : { modelEntitlements: parseModelEntitlements(value.modelEntitlements) }
|
|
20311
|
+
};
|
|
20312
|
+
}
|
|
20313
|
+
function parseModelEntitlements(value) {
|
|
20314
|
+
if (!record2(value)) throw new Error("\u6A21\u578B\u6743\u76CA\u72B6\u6001\u65E0\u6548");
|
|
20315
|
+
return {
|
|
20316
|
+
state: member(value.state, ["verified", "partial", "unavailable"], "\u6A21\u578B\u6743\u76CA\u72B6\u6001"),
|
|
20317
|
+
...value.source === void 0 ? {} : { source: member(value.source, ["device", "desktop"], "\u6A21\u578B\u6743\u76CA\u6765\u6E90") },
|
|
20318
|
+
...value.tier === void 0 ? {} : { tier: text(value.tier, "\u6A21\u578B\u6743\u76CA\u5957\u9910", 32) },
|
|
20319
|
+
...value.updatedAt === void 0 ? {} : { updatedAt: isoTime(value.updatedAt, "\u6A21\u578B\u6743\u76CA\u66F4\u65B0\u65F6\u95F4") }
|
|
20290
20320
|
};
|
|
20291
20321
|
}
|
|
20292
20322
|
function parseTurnMonitor(value) {
|
|
@@ -20360,6 +20390,7 @@ function modelReasoningEfforts(model, protocol) {
|
|
|
20360
20390
|
|
|
20361
20391
|
// src/claude-capabilities.ts
|
|
20362
20392
|
var RESTRICTED_MESSAGES_SAMPLING = /* @__PURE__ */ new Set([
|
|
20393
|
+
"claude-fable-5.2",
|
|
20363
20394
|
"claude-fable-5.1",
|
|
20364
20395
|
"claude-fable-5",
|
|
20365
20396
|
"claude-opus-5.5",
|
|
@@ -20863,7 +20894,7 @@ var MAX_TURN_REVIEW_MAX_CONTINUATIONS = 10;
|
|
|
20863
20894
|
var DEFAULT_TURN_REVIEW_NO_PROGRESS_LIMIT = 2;
|
|
20864
20895
|
var MIN_TURN_REVIEW_NO_PROGRESS_LIMIT = 1;
|
|
20865
20896
|
var MAX_TURN_REVIEW_NO_PROGRESS_LIMIT = 5;
|
|
20866
|
-
var RPC_TIMEOUT_MS =
|
|
20897
|
+
var RPC_TIMEOUT_MS = 1e5;
|
|
20867
20898
|
var MAX_OUTPUT_TOKENS = 1e7;
|
|
20868
20899
|
var GENERIC_ERROR = "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
|
|
20869
20900
|
var LOGIN_LABELS = {
|
|
@@ -21361,6 +21392,7 @@ function writeModelSettings(map2, id, next) {
|
|
|
21361
21392
|
if (next.contextWindow !== void 0) entry.contextWindow = next.contextWindow;
|
|
21362
21393
|
if (next.contextTier !== void 0) entry.contextTier = next.contextTier;
|
|
21363
21394
|
if (next.reasoningEffort !== void 0) entry.reasoningEffort = next.reasoningEffort;
|
|
21395
|
+
if (next.apiProtocol !== void 0) entry.apiProtocol = next.apiProtocol;
|
|
21364
21396
|
if (Object.keys(entry).length === 0) delete out[id];
|
|
21365
21397
|
else out[id] = entry;
|
|
21366
21398
|
return out;
|
|
@@ -21604,6 +21636,8 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21604
21636
|
const [saving, setSaving] = React2.useState(false);
|
|
21605
21637
|
const [error62, setError] = React2.useState(void 0);
|
|
21606
21638
|
const listed = model.reasoningEfforts ?? [];
|
|
21639
|
+
const modelDefault = model.defaultEffort;
|
|
21640
|
+
const defaultLabel = modelDefault === void 0 ? "\u4E0D\u6307\u5B9A\u6863\u4F4D" : `\u6A21\u578B\u9ED8\u8BA4\uFF08${modelDefault}\uFF09`;
|
|
21607
21641
|
const invalidDefault = value !== void 0 && !listed.includes(value);
|
|
21608
21642
|
const invalidDraft = editing && draft !== "" && !listed.includes(draft);
|
|
21609
21643
|
const options = [...listed];
|
|
@@ -21614,7 +21648,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21614
21648
|
const busy = saving || pending;
|
|
21615
21649
|
const reason = busy ? "\u6B63\u5728\u4FDD\u5B58\u6A21\u578B\u8BBE\u7F6E\uFF0C\u5B8C\u6210\u540E\u53EF\u7EE7\u7EED\u7F16\u8F91\u3002" : disabled ? `${disabledReason ?? "\u914D\u7F6E\u4E0D\u53EF\u5199"}\uFF0C\u65E0\u6CD5\u7F16\u8F91\u3002` : void 0;
|
|
21616
21650
|
const externallyChanged = editing && value !== baseValue && !(saving && value === draft);
|
|
21617
|
-
const hint = reason ?? (editing ? externallyChanged ? "\u914D\u7F6E\u5DF2\u4ECE\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF1B\u53D6\u6D88\u53EF\u67E5\u770B\u6700\u65B0\u503C\uFF0C\u4FDD\u5B58\u5C06\u4F7F\u7528\u5F53\u524D\u8349\u7A3F\u3002" : invalidDraft ? "\u5F53\u524D\u8349\u7A3F\u4E0D\u9002\u7528\u4E8E\u6B64\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\
|
|
21651
|
+
const hint = reason ?? (editing ? externallyChanged ? "\u914D\u7F6E\u5DF2\u4ECE\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF1B\u53D6\u6D88\u53EF\u67E5\u770B\u6700\u65B0\u503C\uFF0C\u4FDD\u5B58\u5C06\u4F7F\u7528\u5F53\u524D\u8349\u7A3F\u3002" : invalidDraft ? "\u5F53\u524D\u8349\u7A3F\u4E0D\u9002\u7528\u4E8E\u6B64\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u6539\u7528\u6A21\u578B\u9ED8\u8BA4\u3002" : `\u9009\u62E9\u201C${defaultLabel}\u201D\u4F1A\u5220\u9664\u5DF2\u4FDD\u5B58\u6863\u4F4D\uFF1B\u4FDD\u5B58\u524D\u4EC5\u4FEE\u6539\u672C\u5730\u8349\u7A3F\u3002` : invalidDefault ? "\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4E0D\u9002\u7528\u4E8E\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u53EF\u7F16\u8F91\u540E\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u6539\u7528\u6A21\u578B\u9ED8\u8BA4\u3002" : unavailable ? "\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\u672A\u63D0\u4F9B\u53EF\u8C03\u6574\u7684\u601D\u8003\u6863\u4F4D\u3002" : modelDefault === void 0 ? "\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u9ED8\u8BA4\u6863\u4F4D\uFF0C\u672A\u8BBE\u7F6E\u65F6\u4E0D\u53D1\u9001\u6863\u4F4D\u8BBE\u7F6E\u3002" : `\u672A\u8BBE\u7F6E\u65F6\u6309\u6A21\u578B\u9ED8\u8BA4\u6863\u4F4D\u300C${modelDefault}\u300D\u53D1\u9001\uFF0C\u4E0D\u7559\u7ED9\u4E0A\u6E38\u51B3\u5B9A\u3002`);
|
|
21618
21652
|
const cancel = () => {
|
|
21619
21653
|
if (saving) return;
|
|
21620
21654
|
setEditing(false);
|
|
@@ -21669,7 +21703,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21669
21703
|
setError(void 0);
|
|
21670
21704
|
}
|
|
21671
21705
|
}, [
|
|
21672
|
-
h2("option", { key: "", value: "" },
|
|
21706
|
+
h2("option", { key: "", value: "" }, defaultLabel),
|
|
21673
21707
|
...options.map((effort) => h2("option", { key: effort, value: effort, disabled: !listed.includes(effort) }, listed.includes(effort) ? effort : `${effort}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09`))
|
|
21674
21708
|
]),
|
|
21675
21709
|
h2(
|
|
@@ -21701,7 +21735,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21701
21735
|
}
|
|
21702
21736
|
}, "\u7F16\u8F91")
|
|
21703
21737
|
),
|
|
21704
|
-
h2("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ??
|
|
21738
|
+
h2("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ?? defaultLabel)
|
|
21705
21739
|
),
|
|
21706
21740
|
h2("small", {
|
|
21707
21741
|
className: "odc-hint",
|
|
@@ -21726,7 +21760,8 @@ function PriceDetails({ tiers }) {
|
|
|
21726
21760
|
h2("dl", null, [["\u8F93\u5165", tier.input], ["\u8F93\u51FA", tier.output], ["\u7F13\u5B58\u8BFB\u53D6", tier.cacheRead], ["\u7F13\u5B58\u5199\u5165", tier.cacheWrite]].map(([label, value]) => h2("div", { key: label }, h2("dt", null, label), h2("dd", null, priceAmount(value, tier.currency)))))
|
|
21727
21761
|
)));
|
|
21728
21762
|
}
|
|
21729
|
-
function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol = "
|
|
21763
|
+
function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol: selection = "auto", price, priceKnown = false, onCommit }) {
|
|
21764
|
+
const protocol = effectiveProtocol(model, selection, settings.apiProtocol);
|
|
21730
21765
|
const id = React2.useId();
|
|
21731
21766
|
const mounted = useMounted();
|
|
21732
21767
|
const [error62, setError] = React2.useState(void 0);
|
|
@@ -21805,7 +21840,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
|
|
|
21805
21840
|
`\u5F53\u524D\u603B\u7A97\u53E3 ${formatTokens(effectiveWindow)}\uFF08\u542B\u8F93\u51FA\u9884\u7559\uFF09`,
|
|
21806
21841
|
`\u8F93\u51FA\u80FD\u529B\u53C2\u8003 ${formatTokens(model.maxOutputTokens)}`,
|
|
21807
21842
|
`\u81EA\u52A8\u8F93\u51FA\u9884\u7559 ${formatTokens(autoReserve)}`,
|
|
21808
|
-
...model.reasoningEfforts === void 0 || model.reasoningEfforts.length === 0 ? [] : [`\u601D\u8003\u6863\u4F4D ${model.reasoningEfforts.join(" / ")}`]
|
|
21843
|
+
...model.reasoningEfforts === void 0 || model.reasoningEfforts.length === 0 ? [] : [`\u601D\u8003\u6863\u4F4D ${model.reasoningEfforts.join(" / ")}${model.defaultEffort === void 0 ? "" : `\uFF08\u6A21\u578B\u9ED8\u8BA4 ${model.defaultEffort}\uFF09`}`]
|
|
21809
21844
|
].join(" \xB7 ");
|
|
21810
21845
|
return h2(
|
|
21811
21846
|
"li",
|
|
@@ -21830,6 +21865,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
|
|
|
21830
21865
|
"div",
|
|
21831
21866
|
{ className: "odc-actions" },
|
|
21832
21867
|
enabled ? null : h2("span", { className: "odc-chip" }, "\u5DF2\u7981\u7528"),
|
|
21868
|
+
h2("span", { className: "odc-chip" }, model.coverage === "included" ? "\u8BA2\u9605\u5DF2\u8986\u76D6" : model.coverage === "not-included" ? "\u4E0D\u542B Coding Plan" : "\u6743\u76CA\u672A\u6838\u5B9E"),
|
|
21833
21869
|
h2("button", { className: "odc-button odc-button-small", type: "button", disabled: !writable || pending || !hasOverrides, onClick: () => {
|
|
21834
21870
|
void reset();
|
|
21835
21871
|
} }, "\u91CD\u7F6E")
|
|
@@ -21872,9 +21908,27 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
|
|
|
21872
21908
|
{ className: "odc-model-details" },
|
|
21873
21909
|
h2("summary", { "aria-label": `${model.name} \u53C2\u6570\u8BBE\u7F6E${price === void 0 ? "" : "\u4E0E\u4EF7\u683C"}` }, `${price === void 0 ? "\u53C2\u6570\u8BBE\u7F6E" : "\u53C2\u6570\u4E0E\u4EF7\u683C"} \xB7 ${hasOverrides ? "\u5DF2\u81EA\u5B9A\u4E49" : "\u4F7F\u7528\u9ED8\u8BA4\u503C"}`),
|
|
21874
21910
|
h2("p", { className: "odc-model-meta" }, facts),
|
|
21911
|
+
h2(
|
|
21912
|
+
"div",
|
|
21913
|
+
{ className: "odc-field" },
|
|
21914
|
+
h2("label", { htmlFor: `${id}-protocol` }, "\u6B64\u6A21\u578B API \u534F\u8BAE"),
|
|
21915
|
+
h2("select", {
|
|
21916
|
+
id: `${id}-protocol`,
|
|
21917
|
+
className: "odc-input",
|
|
21918
|
+
value: settings.apiProtocol ?? "auto",
|
|
21919
|
+
disabled: !writable || pending,
|
|
21920
|
+
onChange: (event) => {
|
|
21921
|
+
const next = { ...settings };
|
|
21922
|
+
if (event.target.value === "auto") delete next.apiProtocol;
|
|
21923
|
+
else next.apiProtocol = event.target.value;
|
|
21924
|
+
void commit(next);
|
|
21925
|
+
}
|
|
21926
|
+
}, API_PROTOCOL_OPTIONS.map((option) => h2("option", { key: option.id, value: option.id }, option.name))),
|
|
21927
|
+
h2("small", { className: "odc-hint" }, `\u5F53\u524D ${protocol} \xB7 ${model.nativeProtocol === void 0 ? "\u539F\u751F\u8DEF\u7531\u672A\u786E\u8BA4\uFF1B\u9ED8\u8BA4 Responses\uFF0C\u7F51\u5173\u53EF\u80FD\u8F6C\u8BD1" : `\u578B\u53F7\u9996\u9009 ${model.nativeProtocol}\uFF1B\u7F51\u5173\u5185\u90E8\u900F\u4F20\u672A\u9A8C\u8BC1`}`)
|
|
21928
|
+
),
|
|
21875
21929
|
model.id === "claude-opus-5.5" && model.contextWindow === 1e6 ? h2("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,000,000 \u4E3A\u5382\u5546\u53C2\u8003\uFF0C\u7F51\u5173\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u6863\u4F4D\u603B\u7A97\u53E3\u4E0D\u4F1A\u8D85\u8FC7\u8BE5\u53C2\u8003\u5BB9\u91CF\u3002") : null,
|
|
21876
21930
|
model.id === "muse-wonder" && model.contextWindow === 1048576 ? h2("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,048,576 \u4E3A\u6682\u5B9A\u53C2\u8003\uFF0C\u7F51\u5173\u578B\u53F7\u6620\u5C04\u53CA\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u6863\u4F4D\u603B\u7A97\u53E3\u4E0D\u4F1A\u8D85\u8FC7\u8BE5\u53C2\u8003\u5BB9\u91CF\u3002") : null,
|
|
21877
|
-
samplingRestricted && model.id === "claude-opus-4.8" ? h2("p", { className: "odc-hint" }, "\
|
|
21931
|
+
samplingRestricted && model.id === "claude-opus-4.8" ? h2("p", { className: "odc-hint" }, "\u672A\u9009\u62E9\u6863\u4F4D\u65F6\u6309\u5382\u5546\u9ED8\u8BA4\u6863\u4F4D high \u53D1\u9001\u81EA\u9002\u5E94\u601D\u8003\uFF1B\u5382\u5546\u5728\u5B8C\u5168\u7701\u7565\u601D\u8003\u914D\u7F6E\u65F6\u4E0D\u542F\u7528\u3002") : null,
|
|
21878
21932
|
samplingRestricted && model.maxOutputTokens === void 0 && settings.maxTokens === void 0 ? h2("p", { className: "odc-hint" }, "Messages \u9ED8\u8BA4\u6700\u5927\u8F93\u51FA 4096\uFF1B\u8F83\u9AD8\u601D\u8003\u6DF1\u5EA6\u53EF\u80FD\u9700\u8981\u589E\u5927\u3002") : null,
|
|
21879
21933
|
price === void 0 ? null : h2(PriceDetails, { tiers: price.tiers }),
|
|
21880
21934
|
h2("p", { className: "odc-hint" }, "\u6570\u503C\u79BB\u5F00\u8F93\u5165\u6846\u540E\u4FDD\u5B58\uFF0C\u7559\u7A7A\u7EE7\u627F\u9ED8\u8BA4\uFF1B\u4E0A\u4E0B\u6587\u7A97\u53E3\u4E3A\u4E09\u6863\u4E92\u65A5\u9009\u62E9\u3002"),
|
|
@@ -21997,9 +22051,9 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21997
22051
|
};
|
|
21998
22052
|
const source = status?.modelsSource === "openai" ? "\u5F53\u524D\u7F51\u5173" : status?.modelsSource === "builtin" ? "\u5185\u7F6E\u76EE\u5F55" : "\u5C1A\u672A\u786E\u8BA4";
|
|
21999
22053
|
const updated = status?.modelsUpdatedAt === void 0 ? "" : ` \xB7 \u66F4\u65B0\u4E8E ${formatTime(status.modelsUpdatedAt)}`;
|
|
22000
|
-
const protocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol ?? "
|
|
22054
|
+
const protocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol ?? "auto";
|
|
22001
22055
|
const models = (status?.models ?? []).map((model) => {
|
|
22002
|
-
const reasoningEfforts = modelReasoningEfforts(model, protocol);
|
|
22056
|
+
const reasoningEfforts = modelReasoningEfforts(model, effectiveProtocol(model, protocol, settingsMap[model.id]?.apiProtocol));
|
|
22003
22057
|
return { ...model, ...reasoningEfforts === void 0 ? {} : { reasoningEfforts } };
|
|
22004
22058
|
});
|
|
22005
22059
|
return h2(
|
|
@@ -22029,6 +22083,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
22029
22083
|
),
|
|
22030
22084
|
status?.apiKeyConfigured === false ? h2("p", { className: "odc-hint" }, "\u5237\u65B0\u6A21\u578B\u9700\u8981\u53EF\u7528\u7684 API Key\uFF1B\u4FDD\u5B58 Key \u540E\u91CD\u8BD5\u3002") : null,
|
|
22031
22085
|
status?.modelsError !== void 0 ? h2("p", { className: "odc-notice", "data-kind": "error", role: "alert" }, status.modelsError) : null,
|
|
22086
|
+
h2("p", { className: "odc-hint", role: "status" }, status?.modelEntitlements?.state === "verified" ? `\u5DF2\u6309\u5F53\u524D\u8D26\u53F7${status.modelEntitlements.tier ? ` ${status.modelEntitlements.tier}` : ""}\u8BA2\u9605\u9010\u6A21\u578B\u6838\u5B9E\u5206\u7EC4\uFF1B\u989D\u5EA6\u8017\u5C3D\u4E0D\u4F1A\u6539\u53D8\u8986\u76D6\u5206\u7C7B\u3002` : status?.modelEntitlements?.state === "partial" ? "\u90E8\u5206\u6A21\u578B\u6743\u76CA\u672A\u80FD\u6838\u5B9E\uFF0C\u672A\u786E\u8BA4\u9879\u4E0D\u6807\u4E3A\u9644\u8D60\uFF1B\u53EF\u5237\u65B0\u91CD\u8BD5\u3002" : "\u5C1A\u672A\u53D6\u5F97\u4E0E\u5F53\u524D\u63A8\u7406\u8EAB\u4EFD\u5339\u914D\u7684\u8BA2\u9605\u6743\u76CA\uFF1B\u8FD9\u4E9B\u6A21\u578B\u4E0D\u4EE3\u8868\u5DF2\u83B7\u9644\u8D60\u6388\u6743\uFF0C\u8BF7\u4F7F\u7528\u72EC\u7ACB\u767B\u5F55\u6216\u5339\u914D\u7684\u684C\u9762\u767B\u5F55\u540E\u5237\u65B0\u3002"),
|
|
22032
22087
|
h2(NoticeView, { notice }),
|
|
22033
22088
|
h2(
|
|
22034
22089
|
"section",
|
|
@@ -22046,7 +22101,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
22046
22101
|
"div",
|
|
22047
22102
|
{ className: "odc-model-groups" },
|
|
22048
22103
|
h2(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices }),
|
|
22049
|
-
h2(ModelGroup, { title: "\
|
|
22104
|
+
h2(ModelGroup, { title: "\u975E\u9644\u8D60 / \u6743\u76CA\u672A\u6838\u5B9E", group: "paid", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices })
|
|
22050
22105
|
)
|
|
22051
22106
|
);
|
|
22052
22107
|
}
|
|
@@ -22112,7 +22167,7 @@ function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingF
|
|
|
22112
22167
|
}, [formReady, formSnapshot.value?.apiKeyEnv, status?.config.apiKeyEnv]);
|
|
22113
22168
|
const writable = formSnapshot.status === "ready" && formSnapshot.value !== void 0 && formSnapshot.writable;
|
|
22114
22169
|
const configuredProtocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol;
|
|
22115
|
-
const protocol = configuredProtocol !== void 0 && API_PROTOCOL_OPTIONS.some((option) => option.id === configuredProtocol) ? configuredProtocol : "
|
|
22170
|
+
const protocol = configuredProtocol !== void 0 && API_PROTOCOL_OPTIONS.some((option) => option.id === configuredProtocol) ? configuredProtocol : "auto";
|
|
22116
22171
|
const baseURL = formSnapshot.value?.baseURL ?? status?.config.baseURL ?? "";
|
|
22117
22172
|
const requestTimeout = formSnapshot.value?.requestTimeoutMs ?? status?.config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
22118
22173
|
const streamIdleTimeout = formSnapshot.value?.streamIdleTimeoutMs ?? status?.config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;
|
|
@@ -22244,7 +22299,7 @@ function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingF
|
|
|
22244
22299
|
"div",
|
|
22245
22300
|
null,
|
|
22246
22301
|
h2("span", { className: "odc-label" }, "\u5F53\u524D\u63A8\u7406\u8DEF\u5F84\uFF08\u53EA\u8BFB\uFF09"),
|
|
22247
|
-
h2("code", { className: "odc-code" }, protocolEndpoint(baseURL, protocol))
|
|
22302
|
+
h2("code", { className: "odc-code" }, protocol === "auto" ? "\u6309\u6A21\u578B\u9009\u62E9\uFF1B\u672A\u786E\u8BA4\u539F\u751F\u65F6\u4F7F\u7528 /responses" : protocolEndpoint(baseURL, protocol))
|
|
22248
22303
|
),
|
|
22249
22304
|
h2("small", { className: "odc-hint" }, "\u5730\u5740\u7531\u63D2\u4EF6\u914D\u7F6E\u63D0\u4F9B\uFF0C\u65E0\u9700\u5728\u6B64\u586B\u5199\uFF1B\u5207\u6362\u534F\u8BAE\u53EA\u6539\u53D8\u8BF7\u6C42\u8DEF\u5F84\u4E0E\u62A5\u6587\u683C\u5F0F\u3002")
|
|
22250
22305
|
)
|
|
@@ -22523,7 +22578,7 @@ function Connection({ status, formSnapshot, setFormField, pendingField, caller,
|
|
|
22523
22578
|
}
|
|
22524
22579
|
}, [state, login?.jobId, busy, keyBusy, opening, status]);
|
|
22525
22580
|
const desktopChecked = formSnapshot.value?.useDesktopCredential ?? status?.config.useDesktopCredential ?? true;
|
|
22526
|
-
const keySource = status?.apiKeySource === "reference" ? `\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528\uFF08${status.config.apiKeyEnv || DEFAULT_KEY_REF}\uFF09` : status?.apiKeySource === "stored" ? "\u5DF2\u4FDD\u5B58\u7684 API Key" : status?.apiKeySource === "device" ? "\u8BBE\u5907\u6388\u6743" : status?.apiKeyConfigured ? "\u5C1A\u672A\u786E\u8BA4" : "\u672A\u914D\u7F6E";
|
|
22581
|
+
const keySource = status?.apiKeySource === "reference" ? `\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528\uFF08${status.config.apiKeyEnv || DEFAULT_KEY_REF}\uFF09` : status?.apiKeySource === "stored" ? "\u5DF2\u4FDD\u5B58\u7684 API Key" : status?.apiKeySource === "device" ? "\u8BBE\u5907\u6388\u6743" : status?.apiKeySource === "desktop" ? "OpenDesign \u684C\u9762\u6388\u6743\uFF08\u540C\u4E00\u4EE4\u724C\u5BF9\uFF09" : status?.apiKeyConfigured ? "\u5C1A\u672A\u786E\u8BA4" : "\u672A\u914D\u7F6E";
|
|
22527
22582
|
return h2(
|
|
22528
22583
|
React2.Fragment,
|
|
22529
22584
|
null,
|
package/lib/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Schema from '@deepseek-ai/schemastery';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ProtocolSelection } from './protocol-options.js';
|
|
3
3
|
import { type ModelSettingsMap } from './model-settings.js';
|
|
4
4
|
import { type ModelCatalogSnapshot } from './model-catalog-snapshot.js';
|
|
5
5
|
export { DEFAULT_MAX_REQUEST_IMAGE_BYTES } from './image-budget.js';
|
|
@@ -19,7 +19,7 @@ export declare const DEFAULT_API_KEY_REF = "COROUTER_API_KEY";
|
|
|
19
19
|
export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
20
20
|
apiKeyEnv: Schema<string, string, "volatile">;
|
|
21
21
|
baseURL: Schema<string, string, "volatile-defined">;
|
|
22
|
-
apiProtocol: Schema<"chat-completions" | "responses" | "messages", "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
22
|
+
apiProtocol: Schema<"auto" | "chat-completions" | "responses" | "messages", "auto" | "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
23
23
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
24
24
|
modelCatalog: Schema<unknown, NoInfer<ModelCatalogSnapshot | undefined>, "volatile">;
|
|
25
25
|
useDesktopCredential: Schema<boolean, boolean, "volatile-defined">;
|
|
@@ -34,7 +34,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
34
34
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
35
35
|
apiKeyEnv: Schema<string, string, "volatile">;
|
|
36
36
|
baseURL: Schema<string, string, "volatile-defined">;
|
|
37
|
-
apiProtocol: Schema<"chat-completions" | "responses" | "messages", "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
37
|
+
apiProtocol: Schema<"auto" | "chat-completions" | "responses" | "messages", "auto" | "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
38
38
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
39
39
|
modelCatalog: Schema<unknown, NoInfer<ModelCatalogSnapshot | undefined>, "volatile">;
|
|
40
40
|
useDesktopCredential: Schema<boolean, boolean, "volatile-defined">;
|
|
@@ -56,7 +56,7 @@ export interface RuntimeConfig {
|
|
|
56
56
|
emptyTurnGuard: boolean;
|
|
57
57
|
requestTimeoutMs: number;
|
|
58
58
|
streamIdleTimeoutMs: number;
|
|
59
|
-
apiProtocol?:
|
|
59
|
+
apiProtocol?: ProtocolSelection;
|
|
60
60
|
modelSettings?: ModelSettingsMap;
|
|
61
61
|
modelCatalog?: ModelCatalogSnapshot;
|
|
62
62
|
quotaRefreshSeconds?: number;
|
package/lib/device-auth.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DeviceTokens {
|
|
|
3
3
|
runtimeKey: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
|
|
6
|
-
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.
|
|
6
|
+
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.2.0";
|
|
7
7
|
export declare const DEVICE_REQUEST_TIMEOUT_MS = 20000;
|
|
8
8
|
/** One bounded launch step of the temporary activation window. */
|
|
9
9
|
export declare const DEVICE_OPEN_TIMEOUT_MS = 30000;
|
|
@@ -37,13 +37,14 @@ function validUserCode(value) {
|
|
|
37
37
|
|
|
38
38
|
// src/protocol-options.ts
|
|
39
39
|
var API_PROTOCOL_IDS = ["chat-completions", "responses", "messages"];
|
|
40
|
+
var API_PROTOCOL_SELECTION_IDS = ["auto", ...API_PROTOCOL_IDS];
|
|
40
41
|
|
|
41
42
|
// src/model-settings.ts
|
|
42
43
|
function parseModelSettingsMap(value) {
|
|
43
44
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
45
|
const keys = Object.keys(value);
|
|
45
46
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
46
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort"]);
|
|
47
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort", "apiProtocol"]);
|
|
47
48
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
48
49
|
const out = {};
|
|
49
50
|
for (const id of keys) {
|
|
@@ -56,6 +57,10 @@ function parseModelSettingsMap(value) {
|
|
|
56
57
|
if (!fields.has(field)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u542B\u6709\u4E0D\u652F\u6301\u7684\u5B57\u6BB5");
|
|
57
58
|
}
|
|
58
59
|
const parsed = {};
|
|
60
|
+
if (settings.apiProtocol !== void 0) {
|
|
61
|
+
if (!["auto", "chat-completions", "responses", "messages"].includes(String(settings.apiProtocol))) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 apiProtocol \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
62
|
+
parsed.apiProtocol = settings.apiProtocol;
|
|
63
|
+
}
|
|
59
64
|
if (settings.enabled !== void 0) {
|
|
60
65
|
if (typeof settings.enabled !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
61
66
|
parsed.enabled = settings.enabled;
|
|
@@ -274,9 +279,18 @@ function parseStatusModel(value) {
|
|
|
274
279
|
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
275
280
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
276
281
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
277
|
-
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
282
|
+
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
|
|
283
|
+
...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) },
|
|
284
|
+
...value.nativeProtocol === void 0 ? {} : { nativeProtocol: member(value.nativeProtocol, API_PROTOCOL_IDS, "\u539F\u751F\u534F\u8BAE") },
|
|
285
|
+
...value.effectiveProtocol === void 0 ? {} : { effectiveProtocol: member(value.effectiveProtocol, API_PROTOCOL_IDS, "\u751F\u6548\u534F\u8BAE") },
|
|
286
|
+
...value.coverage === void 0 ? {} : { coverage: member(value.coverage, ["included", "not-included", "unknown"], "\u6A21\u578B\u8BA2\u9605\u8986\u76D6") }
|
|
278
287
|
};
|
|
279
288
|
}
|
|
289
|
+
function parseEffort(value) {
|
|
290
|
+
const effort = text(value, "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D", 32);
|
|
291
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/u.test(effort)) throw new Error("\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
292
|
+
return effort;
|
|
293
|
+
}
|
|
280
294
|
function parseStatusConfig(value) {
|
|
281
295
|
if (!record(value)) throw new Error("\u914D\u7F6E\u89C6\u56FE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
282
296
|
if (typeof value.apiKeyEnv !== "string" || value.apiKeyEnv.length > MAX_ENV_REF) {
|
|
@@ -290,7 +304,7 @@ function parseStatusConfig(value) {
|
|
|
290
304
|
useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
|
|
291
305
|
baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
|
|
292
306
|
apiKeyEnv,
|
|
293
|
-
...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol,
|
|
307
|
+
...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_SELECTION_IDS, "\u63A8\u7406\u534F\u8BAE") },
|
|
294
308
|
...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
|
|
295
309
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
296
310
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
@@ -311,7 +325,7 @@ function parseStatus(value) {
|
|
|
311
325
|
ids.add(model.id);
|
|
312
326
|
}
|
|
313
327
|
const apiKeyConfigured = flag(value.apiKeyConfigured, "\u51ED\u636E\u662F\u5426\u5C31\u7EEA");
|
|
314
|
-
const apiKeySource = value.apiKeySource === void 0 ? void 0 : member(value.apiKeySource, ["reference", "stored", "device"], "\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
328
|
+
const apiKeySource = value.apiKeySource === void 0 ? void 0 : member(value.apiKeySource, ["reference", "stored", "device", "desktop"], "\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
315
329
|
if (!apiKeyConfigured && apiKeySource !== void 0) throw new Error("\u672A\u914D\u7F6E\u51ED\u636E\u65F6\u4E0D\u80FD\u6307\u5B9A\u63A8\u7406\u51ED\u636E\u6765\u6E90");
|
|
316
330
|
return {
|
|
317
331
|
revision: text(value.revision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION),
|
|
@@ -326,7 +340,17 @@ function parseStatus(value) {
|
|
|
326
340
|
models: parsed,
|
|
327
341
|
...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
|
|
328
342
|
...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
|
|
329
|
-
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) }
|
|
343
|
+
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) },
|
|
344
|
+
...value.modelEntitlements === void 0 ? {} : { modelEntitlements: parseModelEntitlements(value.modelEntitlements) }
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function parseModelEntitlements(value) {
|
|
348
|
+
if (!record(value)) throw new Error("\u6A21\u578B\u6743\u76CA\u72B6\u6001\u65E0\u6548");
|
|
349
|
+
return {
|
|
350
|
+
state: member(value.state, ["verified", "partial", "unavailable"], "\u6A21\u578B\u6743\u76CA\u72B6\u6001"),
|
|
351
|
+
...value.source === void 0 ? {} : { source: member(value.source, ["device", "desktop"], "\u6A21\u578B\u6743\u76CA\u6765\u6E90") },
|
|
352
|
+
...value.tier === void 0 ? {} : { tier: text(value.tier, "\u6A21\u578B\u6743\u76CA\u5957\u9910", 32) },
|
|
353
|
+
...value.updatedAt === void 0 ? {} : { updatedAt: isoTime(value.updatedAt, "\u6A21\u578B\u6743\u76CA\u66F4\u65B0\u65F6\u95F4") }
|
|
330
354
|
};
|
|
331
355
|
}
|
|
332
356
|
function parseTurnMonitor(value) {
|