dsh-opendesign-corouter 0.1.7 → 0.1.9

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
@@ -32,7 +32,7 @@ dsh plugin --profile web add dsh-opendesign-corouter
32
32
  也可打开 [Actions → CI](https://github.com/KouzakiUmi/dsh-opendesign-corouter/actions/workflows/ci.yml),从成功构建下载 **`dsh-opendesign-corouter-build`** artifact。登录 GitHub 后解压 ZIP,取得 `.tgz` 与 `.sha256`,再安装本地包:
33
33
 
34
34
  ```console
35
- dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.7.tgz
35
+ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.9.tgz
36
36
  ```
37
37
 
38
38
  `web` 只是示例,请替换为目标 Profile。Desktop 使用桌面安装器提供的 `dsh` 入口;独立公共 CLI 不能代管保留的 `desktop` Profile。安装后的启用与重载按目标 DSH 的管理流程进行。
@@ -53,12 +53,14 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.7.tgz
53
53
  | Provider | 模型数 | 用途 |
54
54
  | --- | ---: | --- |
55
55
  | `opendesign-corouter-plan` | 13 | Core / Design Plan 附赠通道,含预检确认覆盖的 MiniMax M3.1 Flash |
56
- | `opendesign-corouter-paid` | 25 | Plan 套餐模型及其他钱包付费模型 |
56
+ | `opendesign-corouter-paid` | 26 | Plan 套餐模型及其他钱包付费模型 |
57
57
 
58
58
  上表为内置目录。模型页可通过当前配置网关的 OpenAI 兼容 `/models` 接口刷新目录,逐个启用或停用模型,并配置温度、top-p、默认输出上限、上下文预算及思考深度。停用同时影响模型选择器和直接调用;参数会保存并应用到实际请求。媒体生成接口不在对话目录中,未知能力不按名称猜测。
59
59
 
60
60
  推理协议可选 **OpenAI Chat Completions、OpenAI Responses、Anthropic Messages**。模型发现始终使用当前网关的 OpenAI 兼容 `/models` 接口,不随推理协议切换。
61
61
 
62
+ 思考档位按精确型号的厂商文档维护,并按当前协议筛选。34 款提供离散档位,4 款为固定思考或开关/预算控制,Muse Wonder 的精确别名尚待确认。旧配置中的无效默认档位可在参数设置中改为“继承默认”。[逐模型来源与网关验证状态](docs/reasoning-evidence.md)
63
+
62
64
  > **分组不等于计费隔离。** 赠送额度耗尽后是否转扣套餐余额或钱包,由服务端和账号权益决定。选择“套餐赠送”不能保证绝不消耗钱包余额。
63
65
 
64
66
  ### 四层额度,不重复相加
@@ -79,11 +81,11 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.7.tgz
79
81
  <img src="docs/previews/theme-light.png" width="1040" alt="连接与登录页,展示桌面优先开关、独立登录按钮和不回填的 API Key 输入框;模拟数据">
80
82
  </picture>
81
83
 
82
- ### 空轮监控,只作用于赠送模型
84
+ ### DeepSeek V4.1 Flash 空回答检测
83
85
 
84
86
  独立开关,默认开启。参考 [dsh-empty-turn-guard](https://github.com/FYTXY/dsh-empty-turn-guard),将“正常 stop、没有工具调用、答案为空或只剩协议残渣”的工具对话标成 `EMPTY_RESPONSE`。
85
87
 
86
- 检测到空回答后,由 DSH 的重试策略决定是否重试,**重复请求可能额外消耗额度**。该监控仅用于套餐赠送模型的工具对话。
88
+ 检测到空回答后,由 DSH 的重试策略决定是否重试,**重复请求可能额外消耗额度**。该附加监控仅用于 DeepSeek V4.1 Flash 的工具对话,识别 DSML、thinking 及 `<rea:tool_calls>` 残留。
87
89
 
88
90
  ## 使用前先知道
89
91
 
package/lib/catalog.d.ts CHANGED
@@ -6,9 +6,12 @@
6
6
  * 详情页内联 `data-model="{...}"` JSON(公开页面,2026-10-26)。
7
7
  * - group:官网首页套餐卡 `https://corouter.open-design.ai/zh/` 的
8
8
  * `data-model-module="design-plan"` 12 款归 `plan`;其余在售对话模型归 `paid`。
9
- * - `plan` 12 款的 contextWindow / maxOutputTokens / inputModalities / reasoningEfforts
9
+ * - `plan` 原有 12 款的 contextWindow / maxOutputTokens / inputModalities
10
10
  * 来自 Go 侧 `dsh-opendesign-go` 0.1.9 的 MODEL_DEFAULTS(同一 `amr-link` endpoint 部署资料),
11
11
  * 作为部署参考,尚无官网能力数值的独立佐证;只用于对应的原有 12 款模型。
12
+ * - `gpt-6.1-terra` 的 contextWindow / maxOutputTokens / inputModalities 取自
13
+ * 厂商型号文档(1,050,000 / 128,000 / text+image,与 `gpt-6-luna` 同口径);
14
+ * CoRouter 网关侧未实测该型号的有效预算。
12
15
  * - 客户端桌面安装(Open Design 0.26.1)不内联 CoRouter 目录;其
13
16
  * `vela model preset --format json` 只有 11 个旧预设 id(见 docs/client-evidence.md),
14
17
  * 与本表不同代,故不用于本目录。
@@ -16,9 +19,11 @@
16
19
  * 分组语义(重要):`plan`/`paid` 是**本插件本地目录分类**,用于把“套餐赠送通道”与
17
20
  * “其余付费通道”拆成两个 Provider,不是上游强制计费契约。最终可用性、扣哪个额度池、
18
21
  * 是否先扣 Design Plan 额度再用套餐模型/钱包额度,全部由服务端按账号套餐决定。
19
- * 2026-10-27 官方 GET /v1/models 实测补齐五个 ID,现为 plan 13 + paid 25。
22
+ * 2026-10-27 官方 GET /v1/models 实测补齐五个 ID,同日厂商型号文档与服务目录
23
+ * 补齐 GPT-6.1 Terra,现为 plan 13 + paid 26。
20
24
  * 同日桌面 Vela 按模型 billing preflight:M3.1 Flash 的 modelCovered=true /
21
25
  * funding=coding_plan,新增于附赠通道;其余四项为 false / wallet,归付费通道。
26
+ * GPT-6.1 Terra 同为 modelCovered=false / funding=wallet,归付费通道。
22
27
  * 此分类以当次工作区证据为依据,不保证其他账号或未来套餐权益。
23
28
  * 新增项证据及名称来源见 docs/client-evidence.md;不从型号名推断能力。
24
29
  *
@@ -26,8 +31,8 @@
26
31
  * - 媒体模型 `GPT Image 2`、`Nano Banana 2`、`Seedream 5 Lite / Pro`:
27
32
  * 走 `/api/v1/media/*`,不应出现在对话模型列表里,避免选中后 chat 请求必败。
28
33
  *
29
- * `paid` 25 款及新增 M3.1 Flash 的能力字段一律缺省:没有可核实的能力数值,
30
- * 未知模态保持缺省;`['text']` 仅表示已确认的纯文本输入。
34
+ * 思考档位按厂商型号资料记录,来源见 docs/reasoning-evidence.md;网关逐路由行为未实测。
35
+ * 其余容量与模态字段仍按已有来源保留,未知值保持缺省。
31
36
  */
32
37
  export interface CatalogModel {
33
38
  id: string;
@@ -36,11 +41,12 @@ export interface CatalogModel {
36
41
  contextWindow?: number;
37
42
  maxOutputTokens?: number;
38
43
  inputModalities?: readonly ('text' | 'image')[];
44
+ /** Undefined means unconfirmed; an empty array means no discrete effort selector. */
39
45
  reasoningEfforts?: readonly string[];
40
46
  }
41
47
  /**
42
48
  * `plan` 为官网 12 款 Core / Design Plan 模型,加预检确认覆盖的 M3.1 Flash;
43
- * 其余 25 项归 `paid`(Plan / 钱包付费通道)。
49
+ * 其余 26 项归 `paid`(Plan / 钱包付费通道)。
44
50
  */
45
51
  export declare const MODELS: readonly CatalogModel[];
46
52
  export declare function modelsFor(group: 'plan' | 'paid'): readonly CatalogModel[];
package/lib/client.js CHANGED
@@ -20234,6 +20234,19 @@ var TYPERT_REMOTE = createTypertRemoteInfo({ package: "dsh-opendesign-corouter",
20234
20234
  } }, external_exports);
20235
20235
  var typert_remote_client_default = TYPERT_REMOTE;
20236
20236
 
20237
+ // src/reasoning.ts
20238
+ var PROTOCOL_EFFORTS = {
20239
+ "chat-completions": ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"],
20240
+ responses: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
20241
+ messages: ["none", "low", "medium", "high", "xhigh", "max"]
20242
+ };
20243
+ function protocolAcceptsEffort(protocol, effort) {
20244
+ return PROTOCOL_EFFORTS[protocol].includes(effort);
20245
+ }
20246
+ function modelReasoningEfforts(model, protocol) {
20247
+ return model.reasoningEfforts?.filter((effort) => protocolAcceptsEffort(protocol, effort));
20248
+ }
20249
+
20237
20250
  // src/client.ts
20238
20251
  var h = React.createElement;
20239
20252
  var SETTINGS_NS = "llm-opendesign-corouter";
@@ -20277,6 +20290,7 @@ function installStyles() {
20277
20290
  style.dataset.opendesignCorouter = "";
20278
20291
  style.textContent = `
20279
20292
  .odc-settings{color:var(--dsw-alias-label-primary,inherit);max-width:860px;padding:6px 2px 24px;font-size:13px;line-height:1.5}
20293
+ .odc-settings{color-scheme:light;container-type:inline-size}body[data-ds-dark-theme] .odc-settings{color-scheme:dark}
20280
20294
  .odc-settings *{box-sizing:border-box}.odc-settings h2{margin:0;font-size:21px;line-height:1.35;font-weight:650;letter-spacing:-.02em}.odc-settings h3{margin:0;font-size:14px;font-weight:650}.odc-settings p{margin:0}
20281
20295
  .odc-intro{margin:6px 0 18px!important;color:var(--dsw-alias-label-secondary,inherit);font-size:12px}.odc-tabs{display:flex;gap:4px;overflow-x:auto;margin:0 0 16px;padding:0 0 8px;border-bottom:1px solid var(--dsw-alias-border-l4,transparent)}
20282
20296
  .odc-tab{flex:none;border:1px solid transparent;border-radius:8px;padding:7px 13px;background:transparent;color:var(--dsw-alias-label-secondary,inherit);font:inherit;cursor:pointer}.odc-tab:hover{background:var(--dsw-alias-bg-layer-1,transparent)}.odc-tab[aria-selected=true]{color:var(--dsw-alias-label-primary,inherit);border-color:var(--dsw-alias-border-l3,transparent);background:var(--dsw-alias-bg-layer-1,transparent)}
@@ -20290,11 +20304,15 @@ function installStyles() {
20290
20304
  .odc-model-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}.odc-model-list{display:grid;gap:6px;margin:10px 0 0;padding:0;list-style:none}.odc-model-item{padding:9px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent);min-width:0}.odc-model-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;flex-wrap:wrap}.odc-model-switch{min-width:0;flex:1 1 190px}.odc-model-item strong,.odc-model-item code{display:block;overflow-wrap:anywhere}.odc-model-item strong{font-size:12px;font-weight:600}.odc-model-item code{margin-top:2px;color:var(--dsw-alias-label-secondary,inherit);font-size:11px}.odc-model-meta{margin-top:6px!important;color:var(--dsw-alias-label-secondary,inherit);font-size:11px;overflow-wrap:anywhere}.odc-model-count{color:var(--dsw-alias-label-secondary,inherit);font-size:11px;font-weight:400}.odc-chip{display:inline-flex;align-items:center;padding:1px 7px;border:1px solid var(--dsw-alias-border-l3,transparent);border-radius:999px;color:var(--dsw-alias-label-secondary,inherit);font-size:10px;line-height:1.6}
20291
20305
  .odc-model-details{margin-top:8px}.odc-model-details>summary{cursor:pointer;color:var(--dsw-alias-label-secondary,inherit);font-size:11px;line-height:1.7}.odc-model-editor{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 10px;margin-top:8px}
20292
20306
  .odc-field{display:grid;gap:6px;margin-top:14px}.odc-field-compact{margin-top:8px}.odc-field label,.odc-switch-text{font-size:12px;font-weight:550}.odc-input{width:100%;min-width:0;min-height:34px;padding:7px 9px;border:1px solid var(--dsw-alias-border-l3,transparent);border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent);color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:12px}.odc-field-compact .odc-input{min-height:30px;padding:5px 8px;font-size:11px}.odc-input::placeholder{color:var(--dsw-alias-label-secondary,inherit);opacity:1}.odc-input:disabled{opacity:.55}
20307
+ .odc-input option{background:var(--dsw-alias-bg-layer-2,Canvas);color:var(--dsw-alias-label-primary,CanvasText)}
20308
+ .odc-input,.odc-button:not(.odc-button-primary),.odc-tab[aria-selected=true]{border-color:var(--dsw-alias-border-l3,CanvasText);border-color:color-mix(in srgb,var(--dsw-alias-label-primary,CanvasText) 45%,var(--dsw-alias-bg-layer-2,Canvas))}
20293
20309
  .odc-switch{display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 2px;cursor:pointer}.odc-switch input{appearance:auto;width:20px;height:20px;flex:none;margin:0;cursor:inherit;accent-color:var(--dsw-alias-brand-primary,Highlight)}.odc-switch>span{display:grid;gap:4px;min-width:0}.odc-switch:has(input:disabled){cursor:not-allowed;opacity:.6}.odc-divider{height:1px;border:0;background:var(--dsw-alias-border-l4,transparent);margin:2px 0}.odc-link{color:var(--dsw-alias-brand-primary,inherit);text-underline-offset:3px}
20294
20310
  .odc-readonly{display:grid;gap:10px;margin-top:14px;padding:10px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent)}.odc-code{display:block;min-width:0;color:var(--dsw-alias-label-primary,inherit);font-family:ui-monospace,'Cascadia Mono',Consolas,monospace;font-size:11px;line-height:1.6;overflow-wrap:anywhere}
20295
20311
  .odc-timing{padding:12px 0;border-top:1px solid var(--dsw-alias-border-l4,transparent)}.odc-timing .odc-metric{min-height:0}.odc-settings>.odc-notice{margin-bottom:14px}.odc-model-details>summary{min-height:32px;padding:6px 0}
20296
20312
  .odc-field-error{color:var(--dsw-alias-state-error-primary,inherit);color:color-mix(in srgb,var(--dsw-alias-state-error-primary,CanvasText) 85%,var(--dsw-alias-label-primary,CanvasText))}
20313
+ .odc-model-groups{align-items:start}.odc-label,.odc-hint,.odc-meta,.odc-window dt,.odc-quota-footer dt,.odc-quota-footer dd,.odc-window-details>summary,.odc-model-details>summary,.odc-model-item code,.odc-model-meta,.odc-model-count,.odc-code{font-size:12px}.odc-field-compact .odc-input,.odc-button-small{font-size:12px}.odc-button-small{min-height:32px}.odc-chip{font-size:11px}
20297
20314
  .odc-settings :focus-visible{outline:2px solid var(--dsw-alias-brand-primary,Highlight);outline-offset:3px}@media(max-width:680px){.odc-quota-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.odc-model-groups{grid-template-columns:1fr}.odc-model-editor{grid-template-columns:1fr}}@media(max-width:380px){.odc-quota-grid{grid-template-columns:1fr}.odc-card{padding:12px}}
20315
+ @container(max-width:680px){.odc-quota-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.odc-model-groups,.odc-model-editor{grid-template-columns:1fr}}@container(max-width:380px){.odc-quota-grid{grid-template-columns:1fr}.odc-card{padding:12px}}
20298
20316
  `;
20299
20317
  document.head.append(style);
20300
20318
  return () => style.remove();
@@ -20705,8 +20723,9 @@ function EffortField({ id, model, value, disabled, onChange }) {
20705
20723
  const mounted = useMounted();
20706
20724
  const [error62, setError] = React.useState(void 0);
20707
20725
  const listed = model.reasoningEfforts ?? [];
20708
- const options = value === void 0 || listed.includes(value) ? listed : [...listed, value];
20709
- const unknown2 = options.length === 0;
20726
+ const invalidDefault = value !== void 0 && !listed.includes(value);
20727
+ const options = invalidDefault ? [...listed, value] : listed;
20728
+ const unavailable = listed.length === 0;
20710
20729
  return h(
20711
20730
  "div",
20712
20731
  { className: "odc-field odc-field-compact" },
@@ -20715,8 +20734,9 @@ function EffortField({ id, model, value, disabled, onChange }) {
20715
20734
  id,
20716
20735
  className: "odc-input",
20717
20736
  value: value ?? "",
20718
- disabled: disabled || unknown2,
20737
+ disabled: disabled || unavailable && !invalidDefault,
20719
20738
  "aria-describedby": `${id}-hint`,
20739
+ "aria-invalid": invalidDefault || error62 !== void 0,
20720
20740
  onChange: (event) => {
20721
20741
  const next = event.target.value;
20722
20742
  void (async () => {
@@ -20726,13 +20746,13 @@ function EffortField({ id, model, value, disabled, onChange }) {
20726
20746
  }
20727
20747
  }, [
20728
20748
  h("option", { key: "", value: "" }, "\u7EE7\u627F\u9ED8\u8BA4"),
20729
- ...options.map((effort) => h("option", { key: effort, value: effort }, effort))
20749
+ ...options.map((effort) => h("option", { key: effort, value: effort, disabled: invalidDefault && effort === value }, invalidDefault && effort === value ? `${effort}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : effort))
20730
20750
  ]),
20731
20751
  h("small", {
20732
20752
  className: error62 === void 0 ? "odc-hint" : "odc-hint odc-field-error",
20733
20753
  id: `${id}-hint`,
20734
20754
  ...error62 === void 0 ? {} : { role: "alert" }
20735
- }, error62 ?? (unknown2 ? "\u8BE5\u6A21\u578B\u76EE\u5F55\u672A\u63D0\u4F9B\u601D\u8003\u6863\u4F4D\uFF0C\u65E0\u6CD5\u8986\u76D6\u3002" : "\u53EA\u5217\u51FA\u8BE5\u6A21\u578B\u5DF2\u77E5\u6863\u4F4D\uFF1B\u7559\u7A7A\u7EE7\u627F\u9ED8\u8BA4\u3002"))
20755
+ }, error62 ?? (invalidDefault ? "\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4E0D\u9002\u7528\u4E8E\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u7EE7\u627F\u9ED8\u8BA4\u3002" : unavailable ? "\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\u672A\u63D0\u4F9B\u53EF\u8C03\u6574\u7684\u601D\u8003\u6863\u4F4D\u3002" : "\u7559\u7A7A\u4F7F\u7528\u670D\u52A1\u7AEF\u9ED8\u8BA4\u6863\u4F4D\u3002"))
20736
20756
  );
20737
20757
  }
20738
20758
  function ModelRow({ model, settings, authoritative, writable, pending, onCommit }) {
@@ -20902,7 +20922,11 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
20902
20922
  };
20903
20923
  const source = status?.modelsSource === "openai" ? "\u5F53\u524D\u7F51\u5173" : status?.modelsSource === "builtin" ? "\u5185\u7F6E\u76EE\u5F55" : "\u5C1A\u672A\u786E\u8BA4";
20904
20924
  const updated = status?.modelsUpdatedAt === void 0 ? "" : ` \xB7 \u66F4\u65B0\u4E8E ${formatTime(status.modelsUpdatedAt)}`;
20905
- const models = status?.models ?? [];
20925
+ const protocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol ?? "chat-completions";
20926
+ const models = (status?.models ?? []).map((model) => {
20927
+ const reasoningEfforts = modelReasoningEfforts(model, protocol);
20928
+ return { ...model, ...reasoningEfforts === void 0 ? {} : { reasoningEfforts } };
20929
+ });
20906
20930
  return h(
20907
20931
  React.Fragment,
20908
20932
  null,
@@ -21027,7 +21051,7 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
21027
21051
  "section",
21028
21052
  { className: "odc-card" },
21029
21053
  h("h3", null, "\u7A7A\u8F6E\u76D1\u63A7"),
21030
- h("p", { className: "odc-hint" }, "\u68C0\u6D4B\u5957\u9910\u8D60\u9001\u6A21\u578B\u5728\u5DE5\u5177\u5BF9\u8BDD\u4E2D\u8FD4\u56DE\u7684\u7A7A\u56DE\u7B54\u3002"),
21054
+ h("p", { className: "odc-hint" }, "\u68C0\u6D4B DeepSeek V4.1 Flash \u5DE5\u5177\u5BF9\u8BDD\u4E2D\u7684\u7A7A\u56DE\u7B54\u6216\u534F\u8BAE\u6807\u8BB0\u6B8B\u7559\u3002"),
21031
21055
  h("div", { style: { marginTop: 14 } }, h(Switch, {
21032
21056
  checked: formSnapshot.value?.emptyTurnGuard ?? status?.config.emptyTurnGuard ?? true,
21033
21057
  disabled: !writable || pendingField.includes("emptyTurnGuard"),
@@ -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.7";
6
+ export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.9";
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;
package/lib/index.js CHANGED
@@ -65,13 +65,26 @@ import {
65
65
  // src/catalog.ts
66
66
  var TEXT_ONLY = ["text"];
67
67
  var TEXT_AND_IMAGE = ["text", "image"];
68
- var EFFORTS_FULL = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
69
- var EFFORTS_STD = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
68
+ var EFFORTS_REASONING = ["low", "medium", "high", "xhigh", "max"];
69
+ var EFFORTS_OPENAI = ["none", ...EFFORTS_REASONING];
70
+ var EFFORTS_GLM52 = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
70
71
  var EFFORTS_LOW_HIGH = ["low", "high", "max"];
72
+ var EFFORTS_LEVELS = ["low", "medium", "high"];
73
+ var EFFORTS_GROK = [...EFFORTS_LEVELS, "xhigh"];
74
+ var EFFORTS_MUSE = ["minimal", ...EFFORTS_REASONING];
71
75
  var MODELS = [
72
- // ── OpenAI(7) ─────────────────────────────────────────────
73
- { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "paid" },
74
- { id: "gpt-6-astra", name: "GPT-6 Astra", group: "paid" },
76
+ // ── OpenAI(8) ─────────────────────────────────────────────
77
+ { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "paid", reasoningEfforts: EFFORTS_REASONING },
78
+ {
79
+ id: "gpt-6.1-terra",
80
+ name: "GPT-6.1 Terra",
81
+ group: "paid",
82
+ contextWindow: 105e4,
83
+ maxOutputTokens: 128e3,
84
+ inputModalities: TEXT_AND_IMAGE,
85
+ reasoningEfforts: EFFORTS_OPENAI
86
+ },
87
+ { id: "gpt-6-astra", name: "GPT-6 Astra", group: "paid", reasoningEfforts: EFFORTS_REASONING },
75
88
  {
76
89
  id: "gpt-6-luna",
77
90
  name: "GPT-6 Luna",
@@ -79,20 +92,20 @@ var MODELS = [
79
92
  contextWindow: 105e4,
80
93
  maxOutputTokens: 128e3,
81
94
  inputModalities: TEXT_AND_IMAGE,
82
- reasoningEfforts: EFFORTS_FULL
95
+ reasoningEfforts: EFFORTS_OPENAI
83
96
  },
84
- { id: "gpt-6-sol", name: "GPT-6 Sol", group: "paid" },
85
- { id: "gpt-5.6-luna", name: "GPT-5.6 Luna", group: "paid" },
86
- { id: "gpt-5.6-sol", name: "GPT-5.6 Sol", group: "paid" },
87
- { id: "gpt-5.6-terra", name: "GPT-5.6 Terra", group: "paid" },
97
+ { id: "gpt-6-sol", name: "GPT-6 Sol", group: "paid", reasoningEfforts: EFFORTS_OPENAI },
98
+ { id: "gpt-5.6-luna", name: "GPT-5.6 Luna", group: "paid", reasoningEfforts: EFFORTS_OPENAI },
99
+ { id: "gpt-5.6-sol", name: "GPT-5.6 Sol", group: "paid", reasoningEfforts: EFFORTS_OPENAI },
100
+ { id: "gpt-5.6-terra", name: "GPT-5.6 Terra", group: "paid", reasoningEfforts: EFFORTS_OPENAI },
88
101
  // ── Anthropic(8) ──────────────────────────────────────────
89
- { id: "claude-fable-5.1", name: "Claude Fable 5.1", group: "paid" },
90
- { id: "claude-fable-5", name: "Claude Fable 5", group: "paid" },
91
- { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "paid" },
92
- { id: "claude-opus-5", name: "Claude Opus 5", group: "paid" },
93
- { id: "claude-opus-4.8", name: "Claude Opus 4.8", group: "paid" },
94
- { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "paid" },
95
- { id: "claude-sonnet-5", name: "Claude Sonnet 5", group: "paid" },
102
+ { id: "claude-fable-5.1", name: "Claude Fable 5.1", group: "paid", reasoningEfforts: EFFORTS_REASONING },
103
+ { id: "claude-fable-5", name: "Claude Fable 5", group: "paid", reasoningEfforts: EFFORTS_REASONING },
104
+ { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "paid", reasoningEfforts: EFFORTS_REASONING },
105
+ { id: "claude-opus-5", name: "Claude Opus 5", group: "paid", reasoningEfforts: EFFORTS_REASONING },
106
+ { id: "claude-opus-4.8", name: "Claude Opus 4.8", group: "paid", reasoningEfforts: EFFORTS_REASONING },
107
+ { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "paid", reasoningEfforts: EFFORTS_REASONING },
108
+ { id: "claude-sonnet-5", name: "Claude Sonnet 5", group: "paid", reasoningEfforts: EFFORTS_REASONING },
96
109
  {
97
110
  id: "claude-haiku-5.5",
98
111
  name: "Claude Haiku 5.5",
@@ -100,7 +113,7 @@ var MODELS = [
100
113
  contextWindow: 1e6,
101
114
  maxOutputTokens: 128e3,
102
115
  inputModalities: TEXT_AND_IMAGE,
103
- reasoningEfforts: EFFORTS_STD
116
+ reasoningEfforts: EFFORTS_REASONING
104
117
  },
105
118
  // ── DeepSeek(4) ───────────────────────────────────────────
106
119
  {
@@ -110,7 +123,7 @@ var MODELS = [
110
123
  contextWindow: 1e6,
111
124
  maxOutputTokens: 384e3,
112
125
  inputModalities: TEXT_AND_IMAGE,
113
- reasoningEfforts: EFFORTS_FULL
126
+ reasoningEfforts: EFFORTS_LOW_HIGH
114
127
  },
115
128
  {
116
129
  id: "deepseek-v4-pro",
@@ -119,7 +132,7 @@ var MODELS = [
119
132
  contextWindow: 1e6,
120
133
  maxOutputTokens: 384e3,
121
134
  inputModalities: TEXT_ONLY,
122
- reasoningEfforts: EFFORTS_FULL
135
+ reasoningEfforts: EFFORTS_LOW_HIGH
123
136
  },
124
137
  {
125
138
  id: "deepseek-v4-flash",
@@ -128,7 +141,7 @@ var MODELS = [
128
141
  contextWindow: 1e6,
129
142
  maxOutputTokens: 384e3,
130
143
  inputModalities: TEXT_AND_IMAGE,
131
- reasoningEfforts: EFFORTS_FULL
144
+ reasoningEfforts: EFFORTS_LOW_HIGH
132
145
  },
133
146
  {
134
147
  id: "deepseek-v4-flash-vision-exp",
@@ -137,7 +150,7 @@ var MODELS = [
137
150
  contextWindow: 1e6,
138
151
  maxOutputTokens: 384e3,
139
152
  inputModalities: TEXT_AND_IMAGE,
140
- reasoningEfforts: EFFORTS_FULL
153
+ reasoningEfforts: EFFORTS_LOW_HIGH
141
154
  },
142
155
  // ── Z.ai(3) ───────────────────────────────────────────────
143
156
  {
@@ -158,7 +171,7 @@ var MODELS = [
158
171
  inputModalities: TEXT_AND_IMAGE,
159
172
  reasoningEfforts: EFFORTS_LOW_HIGH
160
173
  },
161
- { id: "glm-5.2", name: "GLM-5.2", group: "paid" },
174
+ { id: "glm-5.2", name: "GLM-5.2", group: "paid", reasoningEfforts: EFFORTS_GLM52 },
162
175
  // ── Moonshot(3) ───────────────────────────────────────────
163
176
  {
164
177
  id: "kimi-k2.7-code",
@@ -167,18 +180,18 @@ var MODELS = [
167
180
  contextWindow: 262144,
168
181
  maxOutputTokens: 262144,
169
182
  inputModalities: TEXT_AND_IMAGE,
170
- reasoningEfforts: EFFORTS_STD
183
+ reasoningEfforts: []
171
184
  },
172
- { id: "kimi-k3", name: "Kimi K3", group: "paid" },
173
- { id: "kimi-k3.1-pro", name: "Kimi K3.1 Pro", group: "paid" },
185
+ { id: "kimi-k3", name: "Kimi K3", group: "paid", reasoningEfforts: EFFORTS_LOW_HIGH },
186
+ { id: "kimi-k3.1-pro", name: "Kimi K3.1 Pro", group: "paid", reasoningEfforts: EFFORTS_LOW_HIGH },
174
187
  // ── Google(3) ─────────────────────────────────────────────
175
- { id: "gemini-4-argon", name: "Gemini 4 Argon", group: "paid" },
176
- { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", group: "paid" },
177
- { id: "gemini-3.7-flash", name: "Gemini 3.7 Flash", group: "paid" },
188
+ { id: "gemini-4-argon", name: "Gemini 4 Argon", group: "paid", reasoningEfforts: EFFORTS_LEVELS },
189
+ { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", group: "paid", reasoningEfforts: EFFORTS_LEVELS },
190
+ { id: "gemini-3.7-flash", name: "Gemini 3.7 Flash", group: "paid", reasoningEfforts: EFFORTS_LEVELS },
178
191
  // ── xAI(3) ────────────────────────────────────────────────
179
- { id: "grok-4.7", name: "Grok 4.7", group: "paid" },
180
- { id: "grok-4.6", name: "Grok 4.6", group: "paid" },
181
- { id: "grok-4.5", name: "Grok 4.5", group: "paid" },
192
+ { id: "grok-4.7", name: "Grok 4.7", group: "paid", reasoningEfforts: EFFORTS_GROK },
193
+ { id: "grok-4.6", name: "Grok 4.6", group: "paid", reasoningEfforts: EFFORTS_GROK },
194
+ { id: "grok-4.5", name: "Grok 4.5", group: "paid", reasoningEfforts: EFFORTS_LEVELS },
182
195
  // ── Xiaomi(2) ─────────────────────────────────────────────
183
196
  {
184
197
  id: "mimo-v2.6-pro",
@@ -187,7 +200,7 @@ var MODELS = [
187
200
  contextWindow: 1e6,
188
201
  maxOutputTokens: 128e3,
189
202
  inputModalities: TEXT_AND_IMAGE,
190
- reasoningEfforts: EFFORTS_STD
203
+ reasoningEfforts: []
191
204
  },
192
205
  {
193
206
  id: "mimo-v2.6-flash",
@@ -196,7 +209,7 @@ var MODELS = [
196
209
  contextWindow: 1e6,
197
210
  maxOutputTokens: 128e3,
198
211
  inputModalities: TEXT_AND_IMAGE,
199
- reasoningEfforts: EFFORTS_STD
212
+ reasoningEfforts: []
200
213
  },
201
214
  // ── Tencent(1) ────────────────────────────────────────────
202
215
  {
@@ -206,13 +219,13 @@ var MODELS = [
206
219
  contextWindow: 1e6,
207
220
  maxOutputTokens: 64e3,
208
221
  inputModalities: TEXT_ONLY,
209
- reasoningEfforts: EFFORTS_STD
222
+ reasoningEfforts: ["none", "high"]
210
223
  },
211
224
  // ── Alibaba(1) ────────────────────────────────────────────
212
- { id: "qwen3.7-max", name: "Qwen3.7 Max", group: "paid" },
225
+ { id: "qwen3.7-max", name: "Qwen3.7 Max", group: "paid", reasoningEfforts: [] },
213
226
  // Official API additions; display labels for undocumented entries are local formatting.
214
- { id: "minimax-m3.1-flash", name: "MiniMax M3.1 Flash", group: "plan" },
215
- { id: "muse-spark-1.3", name: "Muse Spark 1.3", group: "paid" },
227
+ { id: "minimax-m3.1-flash", name: "MiniMax M3.1 Flash", group: "plan", reasoningEfforts: EFFORTS_REASONING },
228
+ { id: "muse-spark-1.3", name: "Muse Spark 1.3", group: "paid", reasoningEfforts: EFFORTS_MUSE },
216
229
  { id: "muse-wonder", name: "Muse Wonder", group: "paid" }
217
230
  ];
218
231
  var BY_ID = new Map(MODELS.map((model) => [model.id, model]));
@@ -294,6 +307,15 @@ function isModelEnabled(id, settings = {}) {
294
307
  return settings[id]?.enabled !== false;
295
308
  }
296
309
 
310
+ // src/schema-serialization.ts
311
+ function serializableTransform(callback) {
312
+ return Object.assign(callback, {
313
+ toJSON() {
314
+ return `(${serializableTransform.toString()})(${callback.toString()})`;
315
+ }
316
+ });
317
+ }
318
+
297
319
  // src/config.ts
298
320
  var SETTINGS_NS = "llm-opendesign-corouter";
299
321
  var PLAN_PROVIDER = "opendesign-corouter-plan";
@@ -301,11 +323,11 @@ var PAID_PROVIDER = "opendesign-corouter-paid";
301
323
  var DEFAULT_BASE_URL = "https://amr-link.open-design.ai/v1";
302
324
  var Config = Schema.object({
303
325
  apiKeyEnv: Schema.string().max(128).pattern(/^[A-Za-z_][A-Za-z0-9_]*$/u).default("COROUTER_API_KEY").description("CoRouter API Key \u7684\u73AF\u5883\u53D8\u91CF\u6216 DSH \u51ED\u636E\u5F15\u7528\u540D").volatile(),
304
- baseURL: Schema.transform(Schema.string(), assertBaseURL).default(DEFAULT_BASE_URL).description("CoRouter \u7F51\u5173\u5730\u5740\uFF1B\u4E0D\u7528\u4E8E\u63A7\u5236\u53F0\u767B\u5F55\u6216\u989D\u5EA6\u67E5\u8BE2").volatile(),
326
+ baseURL: Schema.transform(Schema.string(), serializableTransform(assertBaseURL)).default(DEFAULT_BASE_URL).description("CoRouter \u7F51\u5173\u5730\u5740\uFF1B\u4E0D\u7528\u4E8E\u63A7\u5236\u53F0\u767B\u5F55\u6216\u989D\u5EA6\u67E5\u8BE2").volatile(),
305
327
  apiProtocol: Schema.union(API_PROTOCOL_IDS).default("chat-completions").description("\u7F51\u5173\u652F\u6301\u7684\u63A8\u7406\u534F\u8BAE\uFF1B\u6A21\u578B\u76EE\u5F55\u901A\u8FC7\u8BE5\u7F51\u5173\u7684\u517C\u5BB9\u63A5\u53E3\u8BFB\u53D6").volatile(),
306
- modelSettings: Schema.transform(Schema.dict(Schema.any()), parseModelSettingsMap).default({}).description("\u9010\u6A21\u578B\u542F\u7528\u72B6\u6001\u548C\u8BF7\u6C42\u53C2\u6570").volatile(),
328
+ modelSettings: Schema.transform(Schema.dict(Schema.any()), serializableTransform(parseModelSettingsMap)).default({}).description("\u9010\u6A21\u578B\u542F\u7528\u72B6\u6001\u548C\u8BF7\u6C42\u53C2\u6570").volatile(),
307
329
  useDesktopCredential: Schema.boolean().default(true).description("\u4F18\u5148\u8BFB\u53D6 OpenDesign \u684C\u9762\u7AEF\u767B\u5F55\u6001\u67E5\u8BE2\u989D\u5EA6").volatile(),
308
- emptyTurnGuard: Schema.boolean().default(true).description("\u76D1\u63A7\u5957\u9910\u8D60\u9001\u6A21\u578B\u7684\u7A7A\u8F6E/\u534F\u8BAE\u6B8B\u6E23\uFF1B\u7531\u5BBF\u4E3B\u91CD\u8BD5\u7B56\u7565\u5904\u7406\uFF0C\u53EF\u80FD\u989D\u5916\u6D88\u8017\u8D60\u9001\u989D\u5EA6").volatile(),
330
+ emptyTurnGuard: Schema.boolean().default(true).description("\u68C0\u6D4B DeepSeek V4.1 Flash \u5DE5\u5177\u5BF9\u8BDD\u7684\u7A7A\u56DE\u7B54\uFF1B\u7531\u5BBF\u4E3B\u91CD\u8BD5\u7B56\u7565\u5904\u7406\uFF0C\u53EF\u80FD\u989D\u5916\u6D88\u8017\u989D\u5EA6").volatile(),
309
331
  quotaRefreshSeconds: Schema.natural().min(5).max(3600).default(60).description("\u989D\u5EA6\u81EA\u52A8\u5237\u65B0\u95F4\u9694\uFF08\u79D2\uFF09").volatile(),
310
332
  requestTimeoutMs: Schema.natural().min(1e3).max(36e5).default(18e5).description("\u63A8\u7406\u8BF7\u6C42\u603B\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09").volatile(),
311
333
  streamIdleTimeoutMs: Schema.natural().min(1e3).max(18e5).default(3e5).description("\u6D41\u5F0F\u54CD\u5E94\u65E0\u6570\u636E\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09").volatile()
@@ -809,6 +831,7 @@ var RESIDUE_PATTERNS = [
809
831
  /<\s*\/?\s*||DSML||[^>]*>/gu,
810
832
  /||DSML||[^\n<>]*>?/gu,
811
833
  /<\s*\/?\s*thinking\s*>/giu,
834
+ /<\s*\/?\s*rea:tool_calls\s*>/giu,
812
835
  /<\s*\/?\s*返璞归真\s*>/gu
813
836
  ];
814
837
  var ONLY_MARKUP_PUNCTUATION = /^[\s<>/\\||=_-]*$/u;
@@ -943,6 +966,19 @@ function streamHeaders(apiKey, extra = {}) {
943
966
  };
944
967
  }
945
968
 
969
+ // src/reasoning.ts
970
+ var PROTOCOL_EFFORTS = {
971
+ "chat-completions": ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"],
972
+ responses: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
973
+ messages: ["none", "low", "medium", "high", "xhigh", "max"]
974
+ };
975
+ function protocolAcceptsEffort(protocol, effort) {
976
+ return PROTOCOL_EFFORTS[protocol].includes(effort);
977
+ }
978
+ function modelReasoningEfforts(model, protocol) {
979
+ return model.reasoningEfforts?.filter((effort) => protocolAcceptsEffort(protocol, effort));
980
+ }
981
+
946
982
  // src/protocols/chat-completions.ts
947
983
  function buildChatCompletionsRequest(ctx) {
948
984
  const { options, model } = ctx;
@@ -957,7 +993,10 @@ function buildChatCompletionsRequest(ctx) {
957
993
  if (!Number.isSafeInteger(options.maxTokens) || options.maxTokens <= 0) throw new LlmError5("maxTokens \u5FC5\u987B\u662F\u6B63\u6574\u6570", "INVALID_REQUEST");
958
994
  body.max_tokens = options.maxTokens;
959
995
  }
960
- if (options.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
996
+ if (options.reasoningEffort !== void 0) {
997
+ if (!protocolAcceptsEffort("chat-completions", options.reasoningEffort)) throw new LlmError5("Chat Completions \u534F\u8BAE\u4E0D\u63A5\u53D7\u8BE5\u601D\u8003\u6DF1\u5EA6", "UNSUPPORTED_OPTION");
998
+ body.reasoning_effort = options.reasoningEffort;
999
+ }
961
1000
  if (options.stop?.length) body.stop = options.stop;
962
1001
  return { url: inferenceEndpoint(ctx.baseURL, "chat-completions"), headers: streamHeaders(ctx.apiKey), body };
963
1002
  }
@@ -1041,7 +1080,6 @@ function anthropicUsage(raw) {
1041
1080
  // src/protocols/messages.ts
1042
1081
  var MESSAGES_DEFAULT_MAX_TOKENS = 4096;
1043
1082
  var ANTHROPIC_VERSION = "2023-06-01";
1044
- var THINKING_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
1045
1083
  var DATA_URL = /^data:([^;,]+);base64,(.*)$/su;
1046
1084
  function messagesURL(baseURL) {
1047
1085
  return inferenceEndpoint(baseURL, "messages");
@@ -1133,7 +1171,7 @@ function buildMessagesRequest(ctx) {
1133
1171
  if (options.reasoningEffort !== void 0) {
1134
1172
  const effort = String(options.reasoningEffort);
1135
1173
  if (effort === "none") body.thinking = { type: "disabled" };
1136
- else if (THINKING_EFFORTS.includes(effort)) {
1174
+ else if (protocolAcceptsEffort("messages", effort)) {
1137
1175
  body.thinking = { type: "adaptive" };
1138
1176
  body.output_config = { effort };
1139
1177
  } else throw new LlmError7(`Anthropic Messages \u534F\u8BAE\u4E0D\u63A5\u53D7\u601D\u8003\u6DF1\u5EA6\u300C${effort}\u300D`, "UNSUPPORTED_OPTION");
@@ -1331,7 +1369,6 @@ import {
1331
1369
  LlmError as LlmError8,
1332
1370
  ToolCallId as ToolCallId3
1333
1371
  } from "@deepseek-ai/dsh-llm";
1334
- var REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
1335
1372
  function userContent(text2, images) {
1336
1373
  if (!images.length) return text2;
1337
1374
  return [
@@ -1392,7 +1429,7 @@ function buildResponsesRequest(ctx) {
1392
1429
  }
1393
1430
  if (options.reasoningEffort !== void 0) {
1394
1431
  const effort = String(options.reasoningEffort);
1395
- if (!REASONING_EFFORTS.includes(effort)) throw new LlmError8(`Responses \u534F\u8BAE\u4E0D\u63A5\u53D7\u601D\u8003\u6DF1\u5EA6\u300C${effort}\u300D`, "UNSUPPORTED_OPTION");
1432
+ if (!protocolAcceptsEffort("responses", effort)) throw new LlmError8(`Responses \u534F\u8BAE\u4E0D\u63A5\u53D7\u601D\u8003\u6DF1\u5EA6\u300C${effort}\u300D`, "UNSUPPORTED_OPTION");
1396
1433
  body.reasoning = { effort, summary: "auto" };
1397
1434
  }
1398
1435
  if (options.stop?.length) throw new LlmError8("Responses \u534F\u8BAE\u4E0D\u652F\u6301 stop \u5E8F\u5217", "UNSUPPORTED_OPTION");
@@ -1701,7 +1738,8 @@ function outputReserve(model, protocol) {
1701
1738
  function metadata(provider, row, config) {
1702
1739
  const setting = config.modelSettings?.[row.id];
1703
1740
  const reserve = setting?.maxTokens ?? outputReserve(row, config.apiProtocol ?? "chat-completions");
1704
- const efforts = row.reasoningEfforts ?? (setting?.reasoningEffort ? [setting.reasoningEffort] : void 0);
1741
+ const efforts = modelReasoningEfforts(row, config.apiProtocol ?? "chat-completions");
1742
+ const defaultEffort = setting?.reasoningEffort !== void 0 && efforts?.includes(setting.reasoningEffort) ? setting.reasoningEffort : void 0;
1705
1743
  return {
1706
1744
  provider,
1707
1745
  id: row.id,
@@ -1711,7 +1749,7 @@ function metadata(provider, row, config) {
1711
1749
  ...reserve === void 0 ? {} : { defaultMaxTokens: reserve },
1712
1750
  ...efforts?.length ? { reasoning: {
1713
1751
  efforts: efforts.map((id) => ({ id: ReasoningEffortId(id), name: { none: "\u5173\u95ED", minimal: "\u6700\u4F4E", low: "\u4F4E", medium: "\u4E2D", high: "\u9AD8", xhigh: "\u8F83\u9AD8", ultra: "\u6781\u9AD8", max: "\u6700\u9AD8" }[id] ?? id })),
1714
- ...setting?.reasoningEffort ? { defaultEffort: ReasoningEffortId(setting.reasoningEffort) } : {}
1752
+ ...defaultEffort === void 0 ? {} : { defaultEffort: ReasoningEffortId(defaultEffort) }
1715
1753
  } } : {}
1716
1754
  };
1717
1755
  }
@@ -1758,11 +1796,13 @@ var CoRouterAdapter = class extends LlmAdapter {
1758
1796
  async *#stream(options, config, row) {
1759
1797
  const signal = AbortSignal.any([combinedSignal(options.signal, config.requestTimeoutMs), this.#lifetime.signal]);
1760
1798
  signal.throwIfAborted();
1799
+ const setting = config.modelSettings?.[row.id] ?? {};
1800
+ const protocolId = config.apiProtocol ?? "chat-completions";
1801
+ const effort = options.reasoningEffort ?? (setting.reasoningEffort ? ReasoningEffortId(setting.reasoningEffort) : void 0);
1802
+ if (effort !== void 0 && !modelReasoningEfforts(row, protocolId)?.includes(effort)) throw new LlmError10("\u6240\u9009\u601D\u8003\u6DF1\u5EA6\u4E0D\u9002\u7528\u4E8E\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\uFF1B\u8BF7\u4FEE\u6539\u9ED8\u8BA4\u503C\u6216\u9009\u62E9\u5176\u4ED6\u6863\u4F4D", "UNSUPPORTED_OPTION");
1761
1803
  const raw = await this.options.apiKey(config.apiKeyEnv, config.baseURL);
1762
1804
  if (!raw) throw new LlmError10("\u672A\u914D\u7F6E\u5F53\u524D\u7F51\u5173\u7684\u63A8\u7406\u51ED\u636E\uFF1B\u8BF7\u5B8C\u6210\u8BBE\u5907\u6388\u6743\u6216\u914D\u7F6E\u5BF9\u5E94 API Key", "MISSING_CREDENTIAL");
1763
1805
  const key = assertUsableApiKey(raw, "dsh-opendesign-corouter", config.apiKeyEnv);
1764
- const setting = config.modelSettings?.[row.id] ?? {};
1765
- const protocolId = config.apiProtocol ?? "chat-completions";
1766
1806
  const images = /* @__PURE__ */ new Map();
1767
1807
  const attemptedImages = /* @__PURE__ */ new Set();
1768
1808
  const unreadableImages = /* @__PURE__ */ new Set();
@@ -1796,8 +1836,6 @@ var CoRouterAdapter = class extends LlmAdapter {
1796
1836
  if (room < 1) throw new LlmError10("\u5F53\u524D\u8F93\u5165\u6CA1\u6709\u4E3A\u8F93\u51FA\u7559\u4E0B\u4E0A\u4E0B\u6587\u7A7A\u95F4", "CONTEXT_WINDOW_EXCEEDED");
1797
1837
  maxTokens = Math.min(capped, Math.floor(room));
1798
1838
  }
1799
- const effort = options.reasoningEffort ?? (setting.reasoningEffort ? ReasoningEffortId(setting.reasoningEffort) : void 0);
1800
- if (effort !== void 0 && row.reasoningEfforts && !row.reasoningEfforts.includes(effort)) throw new LlmError10("\u8BE5\u6A21\u578B\u4E0D\u652F\u6301\u6240\u9009\u601D\u8003\u6DF1\u5EA6", "UNSUPPORTED_OPTION");
1801
1839
  const effective = {
1802
1840
  ...projectedOptions,
1803
1841
  ...(options.temperature ?? setting.temperature) === void 0 ? {} : { temperature: options.temperature ?? setting.temperature },
@@ -1846,11 +1884,12 @@ var CoRouterAdapter = class extends LlmAdapter {
1846
1884
  throw gatewayError(response.status, error);
1847
1885
  }
1848
1886
  if (!response.body) throw new LlmError10("CoRouter \u8FD4\u56DE\u7A7A\u54CD\u5E94", "EMPTY_RESPONSE");
1849
- const tracker = new EmptyTurnTracker({ enabled: row.group === "plan" && config.emptyTurnGuard && Boolean(options.tools?.length), onEmptyTurn: () => this.options.onEmptyTurn?.() });
1887
+ const monitor = row.group === "plan" && row.id === "deepseek-v4.1-flash" && config.emptyTurnGuard && Boolean(options.tools?.length);
1888
+ const tracker = new EmptyTurnTracker({ enabled: monitor, onEmptyTurn: () => this.options.onEmptyTurn?.() });
1850
1889
  try {
1851
1890
  for await (const chunk of protocol.stream(response.body, signal, config.streamIdleTimeoutMs)) {
1852
1891
  tracker.observe(chunk);
1853
- if (chunk.type === "finish" && row.group === "plan" && config.emptyTurnGuard) yield { ...chunk, reason: tracker.resolve(chunk.reason) };
1892
+ if (chunk.type === "finish" && monitor) yield { ...chunk, reason: tracker.resolve(chunk.reason) };
1854
1893
  else yield chunk;
1855
1894
  }
1856
1895
  } catch (error) {
@@ -2200,7 +2239,7 @@ import { randomUUID } from "node:crypto";
2200
2239
 
2201
2240
  // src/device-auth.ts
2202
2241
  var DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
2203
- var DEVICE_AUTH_PLUGIN_VERSION = "0.1.7";
2242
+ var DEVICE_AUTH_PLUGIN_VERSION = "0.1.9";
2204
2243
  var DEVICE_REQUEST_TIMEOUT_MS = 2e4;
2205
2244
  var DEVICE_RESPONSE_MAX_BYTES = 65536;
2206
2245
  var DEVICE_POLL_MIN_MS = 1e3;
@@ -3495,15 +3534,19 @@ var OpenDesignCoRouterService = class extends (_a = TypertRemoteService, _status
3495
3534
  login: this._login.status(),
3496
3535
  config: state.config,
3497
3536
  guardedTurns: this.guardedTurns,
3498
- models: this._models.map(({ id, name: name2, group: group2, contextWindow, maxOutputTokens, reasoningEfforts }) => ({
3499
- id,
3500
- name: name2,
3501
- group: group2,
3502
- enabled: isModelEnabled(id, state.config.modelSettings),
3503
- ...contextWindow === void 0 ? {} : { contextWindow },
3504
- ...maxOutputTokens === void 0 ? {} : { maxOutputTokens },
3505
- ...reasoningEfforts === void 0 ? {} : { reasoningEfforts }
3506
- })),
3537
+ models: this._models.map((row) => {
3538
+ const { id, name: name2, group: group2, contextWindow, maxOutputTokens } = row;
3539
+ const reasoningEfforts = modelReasoningEfforts(row, state.config.apiProtocol ?? "chat-completions");
3540
+ return {
3541
+ id,
3542
+ name: name2,
3543
+ group: group2,
3544
+ enabled: isModelEnabled(id, state.config.modelSettings),
3545
+ ...contextWindow === void 0 ? {} : { contextWindow },
3546
+ ...maxOutputTokens === void 0 ? {} : { maxOutputTokens },
3547
+ ...reasoningEfforts === void 0 ? {} : { reasoningEfforts }
3548
+ };
3549
+ }),
3507
3550
  modelsSource: this._modelsUpdatedAt ? "openai" : "builtin",
3508
3551
  ...this._modelsUpdatedAt ? { modelsUpdatedAt: this._modelsUpdatedAt } : {},
3509
3552
  ...this._modelsError ? { modelsError: this._modelsError } : {}