dsh-opendesign-corouter 0.1.19 → 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 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` | 13 | Core / Design Plan 附赠通道,含预检确认覆盖的 MiniMax M3.1 Flash |
56
- | `opendesign-corouter-paid` | 26 | Plan 套餐模型及其他钱包付费模型 |
55
+ | `opendesign-corouter-plan` | 按账号核实 | 当前工作区订阅确实覆盖的模型 |
56
+ | `opendesign-corouter-paid` | 按账号核实 | 不含 Coding Plan 或权益尚未核实的模型;每行明确标注 |
57
57
 
58
- 上表为内置目录。模型页可通过当前配置网关的 OpenAI 兼容 `/models` 接口刷新目录,逐个启用或停用模型、控制图片输入,并配置温度、top-p、默认输出上限、上下文窗口档位及思考深度。高级参数默认折叠,图片输入可手动覆盖或恢复自动。未知模态保持未知并尝试发送图片;实际支持情况由网关决定。[图片能力证据](docs/model-capabilities.md)。
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
- 推理协议可选 **OpenAI Chat Completions、OpenAI Responses、Anthropic Messages**。模型发现始终使用当前网关的 OpenAI 兼容 `/models` 接口,不随推理协议切换。
64
+ 推理协议默认 **自动按模型**:GPT / DeepSeek 选 Responses,Claude 选 Messages,其余按精确型号证据选择,原生路由未确认时采用 Responses。全局及逐模型都可显式覆盖,已保存的旧协议继续生效。网关内部透传尚未验证,不能把本地协议选择当作无转译保证。模型发现始终读取 OpenAI 兼容 `/models`。
65
65
 
66
- 思考档位按精确型号的厂商文档维护,并按当前协议筛选。34 款提供离散档位,4 款为固定思考或开关/预算控制,Muse Wonder 的精确别名尚待确认。34 款都带目录默认档位:未选择档位时插件按该值显式发送,模型选择器因此不提供“Default”项。默认取厂商声明;GPT-6 Astra(low)与 Muse Spark 1.3(high)的厂商未声明默认,取已发布实现记录的路由默认。旧配置中的无效默认档位可在参数设置中改为模型默认。[逐模型来源与网关验证状态](docs/reasoning-evidence.md)
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
- | 默认推理接口 | `https://amr-link.open-design.ai/v1/chat/completions` |
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:官网首页套餐卡 `https://corouter.open-design.ai/zh/` 的
8
- * `data-model-module="design-plan"` 12 款归 `plan`;其余在售对话模型归 `paid`。
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-10-27 官方 GET /v1/models 实测补齐五个 ID,同日厂商型号文档与服务目录
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,6 +36,10 @@ 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')[];
@@ -54,14 +54,6 @@ export interface CatalogModel {
54
54
  */
55
55
  defaultEffort?: string;
56
56
  }
57
- /**
58
- * `plan` 为官网 12 款 Core / Design Plan 模型,加预检确认覆盖的 M3.1 Flash;
59
- * 其余 26 项归 `paid`(Plan / 钱包付费通道)。
60
- *
61
- * `defaultEffort` 只写有出处的默认档位:厂商文档声明的默认(docs/reasoning-evidence.md 矩阵),
62
- * 或在厂商未声明时由已发布实现记录的路由默认(GPT-6 Astra=low、Muse Spark 1.3=high)。
63
- * muse-wonder 的档位集合本身未知,保持缺省:请求不发送档位,由上游决定。
64
- */
65
57
  export declare const MODELS: readonly CatalogModel[];
66
58
  export declare function modelsFor(group: 'plan' | 'paid'): readonly CatalogModel[];
67
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?: 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?: ApiProtocol;
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;
@@ -20235,7 +20246,10 @@ function parseStatusModel(value) {
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
20248
  ...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
20238
- ...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
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") }
20239
20253
  };
20240
20254
  }
20241
20255
  function parseEffort(value) {
@@ -20256,7 +20270,7 @@ function parseStatusConfig(value) {
20256
20270
  useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
20257
20271
  baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
20258
20272
  apiKeyEnv,
20259
- ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_IDS, "\u63A8\u7406\u534F\u8BAE") },
20273
+ ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_SELECTION_IDS, "\u63A8\u7406\u534F\u8BAE") },
20260
20274
  ...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
20261
20275
  ...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
20262
20276
  ...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
@@ -20277,7 +20291,7 @@ function parseStatus(value) {
20277
20291
  ids.add(model.id);
20278
20292
  }
20279
20293
  const apiKeyConfigured = flag(value.apiKeyConfigured, "\u51ED\u636E\u662F\u5426\u5C31\u7EEA");
20280
- 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");
20281
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");
20282
20296
  return {
20283
20297
  revision: text(value.revision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION),
@@ -20292,7 +20306,17 @@ function parseStatus(value) {
20292
20306
  models: parsed,
20293
20307
  ...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
20294
20308
  ...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
20295
- ...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") }
20296
20320
  };
20297
20321
  }
20298
20322
  function parseTurnMonitor(value) {
@@ -20366,6 +20390,7 @@ function modelReasoningEfforts(model, protocol) {
20366
20390
 
20367
20391
  // src/claude-capabilities.ts
20368
20392
  var RESTRICTED_MESSAGES_SAMPLING = /* @__PURE__ */ new Set([
20393
+ "claude-fable-5.2",
20369
20394
  "claude-fable-5.1",
20370
20395
  "claude-fable-5",
20371
20396
  "claude-opus-5.5",
@@ -20869,7 +20894,7 @@ var MAX_TURN_REVIEW_MAX_CONTINUATIONS = 10;
20869
20894
  var DEFAULT_TURN_REVIEW_NO_PROGRESS_LIMIT = 2;
20870
20895
  var MIN_TURN_REVIEW_NO_PROGRESS_LIMIT = 1;
20871
20896
  var MAX_TURN_REVIEW_NO_PROGRESS_LIMIT = 5;
20872
- var RPC_TIMEOUT_MS = 3e4;
20897
+ var RPC_TIMEOUT_MS = 1e5;
20873
20898
  var MAX_OUTPUT_TOKENS = 1e7;
20874
20899
  var GENERIC_ERROR = "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
20875
20900
  var LOGIN_LABELS = {
@@ -21367,6 +21392,7 @@ function writeModelSettings(map2, id, next) {
21367
21392
  if (next.contextWindow !== void 0) entry.contextWindow = next.contextWindow;
21368
21393
  if (next.contextTier !== void 0) entry.contextTier = next.contextTier;
21369
21394
  if (next.reasoningEffort !== void 0) entry.reasoningEffort = next.reasoningEffort;
21395
+ if (next.apiProtocol !== void 0) entry.apiProtocol = next.apiProtocol;
21370
21396
  if (Object.keys(entry).length === 0) delete out[id];
21371
21397
  else out[id] = entry;
21372
21398
  return out;
@@ -21734,7 +21760,8 @@ function PriceDetails({ tiers }) {
21734
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)))))
21735
21761
  )));
21736
21762
  }
21737
- function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol = "chat-completions", price, priceKnown = false, onCommit }) {
21763
+ function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol: selection = "auto", price, priceKnown = false, onCommit }) {
21764
+ const protocol = effectiveProtocol(model, selection, settings.apiProtocol);
21738
21765
  const id = React2.useId();
21739
21766
  const mounted = useMounted();
21740
21767
  const [error62, setError] = React2.useState(void 0);
@@ -21838,6 +21865,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
21838
21865
  "div",
21839
21866
  { className: "odc-actions" },
21840
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"),
21841
21869
  h2("button", { className: "odc-button odc-button-small", type: "button", disabled: !writable || pending || !hasOverrides, onClick: () => {
21842
21870
  void reset();
21843
21871
  } }, "\u91CD\u7F6E")
@@ -21880,6 +21908,24 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
21880
21908
  { className: "odc-model-details" },
21881
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"}`),
21882
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
+ ),
21883
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,
21884
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,
21885
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,
@@ -22005,9 +22051,9 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
22005
22051
  };
22006
22052
  const source = status?.modelsSource === "openai" ? "\u5F53\u524D\u7F51\u5173" : status?.modelsSource === "builtin" ? "\u5185\u7F6E\u76EE\u5F55" : "\u5C1A\u672A\u786E\u8BA4";
22007
22053
  const updated = status?.modelsUpdatedAt === void 0 ? "" : ` \xB7 \u66F4\u65B0\u4E8E ${formatTime(status.modelsUpdatedAt)}`;
22008
- const protocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol ?? "chat-completions";
22054
+ const protocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol ?? "auto";
22009
22055
  const models = (status?.models ?? []).map((model) => {
22010
- const reasoningEfforts = modelReasoningEfforts(model, protocol);
22056
+ const reasoningEfforts = modelReasoningEfforts(model, effectiveProtocol(model, protocol, settingsMap[model.id]?.apiProtocol));
22011
22057
  return { ...model, ...reasoningEfforts === void 0 ? {} : { reasoningEfforts } };
22012
22058
  });
22013
22059
  return h2(
@@ -22037,6 +22083,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
22037
22083
  ),
22038
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,
22039
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"),
22040
22087
  h2(NoticeView, { notice }),
22041
22088
  h2(
22042
22089
  "section",
@@ -22054,7 +22101,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
22054
22101
  "div",
22055
22102
  { className: "odc-model-groups" },
22056
22103
  h2(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices }),
22057
- h2(ModelGroup, { title: "\u4ED8\u8D39\u6A21\u578B", group: "paid", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices })
22104
+ h2(ModelGroup, { title: "\u975E\u9644\u8D60 / \u6743\u76CA\u672A\u6838\u5B9E", group: "paid", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices })
22058
22105
  )
22059
22106
  );
22060
22107
  }
@@ -22120,7 +22167,7 @@ function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingF
22120
22167
  }, [formReady, formSnapshot.value?.apiKeyEnv, status?.config.apiKeyEnv]);
22121
22168
  const writable = formSnapshot.status === "ready" && formSnapshot.value !== void 0 && formSnapshot.writable;
22122
22169
  const configuredProtocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol;
22123
- const protocol = configuredProtocol !== void 0 && API_PROTOCOL_OPTIONS.some((option) => option.id === configuredProtocol) ? configuredProtocol : "chat-completions";
22170
+ const protocol = configuredProtocol !== void 0 && API_PROTOCOL_OPTIONS.some((option) => option.id === configuredProtocol) ? configuredProtocol : "auto";
22124
22171
  const baseURL = formSnapshot.value?.baseURL ?? status?.config.baseURL ?? "";
22125
22172
  const requestTimeout = formSnapshot.value?.requestTimeoutMs ?? status?.config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
22126
22173
  const streamIdleTimeout = formSnapshot.value?.streamIdleTimeoutMs ?? status?.config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;
@@ -22252,7 +22299,7 @@ function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingF
22252
22299
  "div",
22253
22300
  null,
22254
22301
  h2("span", { className: "odc-label" }, "\u5F53\u524D\u63A8\u7406\u8DEF\u5F84\uFF08\u53EA\u8BFB\uFF09"),
22255
- 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))
22256
22303
  ),
22257
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")
22258
22305
  )
@@ -22531,7 +22578,7 @@ function Connection({ status, formSnapshot, setFormField, pendingField, caller,
22531
22578
  }
22532
22579
  }, [state, login?.jobId, busy, keyBusy, opening, status]);
22533
22580
  const desktopChecked = formSnapshot.value?.useDesktopCredential ?? status?.config.useDesktopCredential ?? true;
22534
- 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";
22535
22582
  return h2(
22536
22583
  React2.Fragment,
22537
22584
  null,
package/lib/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Schema from '@deepseek-ai/schemastery';
2
- import { type ApiProtocol } from './protocol-options.js';
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?: ApiProtocol;
59
+ apiProtocol?: ProtocolSelection;
60
60
  modelSettings?: ModelSettingsMap;
61
61
  modelCatalog?: ModelCatalogSnapshot;
62
62
  quotaRefreshSeconds?: number;
@@ -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.1.19";
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;
@@ -275,7 +280,10 @@ function parseStatusModel(value) {
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
282
  ...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
278
- ...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
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") }
279
287
  };
280
288
  }
281
289
  function parseEffort(value) {
@@ -296,7 +304,7 @@ function parseStatusConfig(value) {
296
304
  useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
297
305
  baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
298
306
  apiKeyEnv,
299
- ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_IDS, "\u63A8\u7406\u534F\u8BAE") },
307
+ ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_SELECTION_IDS, "\u63A8\u7406\u534F\u8BAE") },
300
308
  ...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
301
309
  ...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
302
310
  ...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
@@ -317,7 +325,7 @@ function parseStatus(value) {
317
325
  ids.add(model.id);
318
326
  }
319
327
  const apiKeyConfigured = flag(value.apiKeyConfigured, "\u51ED\u636E\u662F\u5426\u5C31\u7EEA");
320
- 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");
321
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");
322
330
  return {
323
331
  revision: text(value.revision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION),
@@ -332,7 +340,17 @@ function parseStatus(value) {
332
340
  models: parsed,
333
341
  ...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
334
342
  ...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
335
- ...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") }
336
354
  };
337
355
  }
338
356
  function parseTurnMonitor(value) {
@@ -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;
@@ -275,7 +280,10 @@ function parseStatusModel(value) {
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
282
  ...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
278
- ...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
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") }
279
287
  };
280
288
  }
281
289
  function parseEffort(value) {
@@ -296,7 +304,7 @@ function parseStatusConfig(value) {
296
304
  useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
297
305
  baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
298
306
  apiKeyEnv,
299
- ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_IDS, "\u63A8\u7406\u534F\u8BAE") },
307
+ ...value.apiProtocol === void 0 ? {} : { apiProtocol: member(value.apiProtocol, API_PROTOCOL_SELECTION_IDS, "\u63A8\u7406\u534F\u8BAE") },
300
308
  ...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
301
309
  ...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
302
310
  ...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
@@ -317,7 +325,7 @@ function parseStatus(value) {
317
325
  ids.add(model.id);
318
326
  }
319
327
  const apiKeyConfigured = flag(value.apiKeyConfigured, "\u51ED\u636E\u662F\u5426\u5C31\u7EEA");
320
- 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");
321
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");
322
330
  return {
323
331
  revision: text(value.revision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION),
@@ -332,7 +340,17 @@ function parseStatus(value) {
332
340
  models: parsed,
333
341
  ...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
334
342
  ...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
335
- ...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") }
336
354
  };
337
355
  }
338
356
  function parseTurnMonitor(value) {