@mofeng2223/dsh-claude-provider 0.5.10 → 0.6.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
@@ -4,7 +4,7 @@ English | [简体中文](./README.zh-CN.md)
4
4
 
5
5
  DSH Claude Provider adds a dedicated Claude configuration interface to DeepSeek Harness. You can add multiple Claude providers, choose reasoning levels for each model, and automatically fetch model lists and fill in capacity settings and reasoning presets for common Claude models, without editing configuration files manually.
6
6
 
7
- Compared with the official generic custom provider form, the plugin adds a dedicated Claude entry, five-level, four-level, and on/off reasoning presets, and automatic defaults for known Claude models. DeepSeek Harness handles the saved reasoning configuration natively.
7
+ Compared with the official generic custom provider form, the plugin adds a dedicated Claude entry, a per-model adaptive thinking toggle, and automatic defaults for known Claude models. DeepSeek Harness handles the saved reasoning configuration natively.
8
8
 
9
9
  ## What this plugin does
10
10
 
@@ -16,15 +16,11 @@ Compared with the official generic custom provider form, the plugin adds a dedic
16
16
  <img src="./docs/images/claude-provider-tabs.en.png" alt="Claude provider tab and configuration form" width="580">
17
17
  </p>
18
18
 
19
- 2. **Adds model-specific reasoning modes**
19
+ 2. **Adds a per-model adaptive thinking toggle**
20
20
 
21
- Each model can use one of three configurable mode sets:
21
+ Adds an Adaptive thinking toggle for each model alongside DSH's existing reasoning-level settings. Reasoning levels and their corresponding API parameter values remain customizable.
22
22
 
23
- - Five levels: Low, Medium, High, XHigh, and Max
24
- - Four levels: Low, Medium, High, and Max
25
- - Toggle: On or Off
26
-
27
- New models default to five levels, and Claude providers default to High.
23
+ For Anthropic-compatible models that support adaptive thinking. When enabled, the model adjusts its thinking based on task complexity and your selected reasoning level. When disabled, it uses the thinking token limit associated with that level.
28
24
 
29
25
  On save, the plugin writes each model's reasoning levels and adaptive thinking settings to DeepSeek Harness's native configuration.
30
26
 
package/README.zh-CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  DSH Claude Provider 为 DeepSeek Harness 提供专用的 Claude 配置界面。你可以添加多个 Claude 提供方,为每个模型选择推理档位,并自动获取模型列表、填写常用 Claude 模型的容量和推理预设,无需手动编辑配置文件。
6
6
 
7
- 相比官方的通用自定义提供方配置,插件增加了独立的 Claude 入口、五档/四档/开关式推理预设,以及按已知 Claude 模型自动填写参数的功能。保存后的推理配置由 DeepSeek Harness 原生处理。
7
+ 相比官方的通用自定义提供方配置,插件增加了独立的 Claude 入口、按模型设置的自适应思考开关,以及按已知 Claude 模型自动填写参数的功能。保存后的推理配置由 DeepSeek Harness 原生处理。
8
8
 
9
9
  ## 插件功能
10
10
 
@@ -16,15 +16,11 @@ DSH Claude Provider 为 DeepSeek Harness 提供专用的 Claude 配置界面。
16
16
  <img src="./docs/images/claude-provider-tabs.png" alt="Claude 提供方选项与配置表单" width="580">
17
17
  </p>
18
18
 
19
- 2. **增加按模型设置的推理模式**
19
+ 2. **增加按模型设置的自适应思考开关**
20
20
 
21
- 每个模型可以单独选择以下三种档位配置之一:
21
+ 在 DSH 原有的推理等级设置中,为每个模型增加“自适应思考”开关。推理档位及对应的 API 参数值仍可自定义。
22
22
 
23
- - 五档:Low、Medium、High、XHigh、Max
24
- - 四档:Low、Medium、High、Max
25
- - 开关:On、Off
26
-
27
- 新增模型默认使用五档,Claude 提供方默认选择 High。
23
+ 适用于支持自适应思考的 Anthropic 兼容模型。开启后,模型根据任务难度和你选择的推理等级自动调整思考量;关闭后,改用该等级对应的思考 token 数量上限。
28
24
 
29
25
  插件会在保存时将模型的推理档位和自适应思考设置写入 DeepSeek Harness 原生配置。
30
26
 
package/lib/client.js CHANGED
@@ -6,7 +6,6 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let react = require("react");
9
- let react_dom = require("react-dom");
10
9
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
11
10
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
12
11
  //#region lib/types/client/apiKey.js
@@ -56,7 +55,7 @@ window.__ModuleLoader__.load({
56
55
  }
57
56
  //#endregion
58
57
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-models/src/client/ModelsSection.module.css.mjs
59
- const css$3 = ".zGbnIq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.zGbnIq_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.zGbnIq_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.zGbnIq_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}.zGbnIq_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}.zGbnIq_rowCard{border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);border-radius:var(--dsw-radius-xl);flex-direction:column;gap:12px;padding:12px 14px;display:flex}.zGbnIq_rowHead{align-items:center;gap:10px;display:flex}.zGbnIq_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}.zGbnIq_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_rowTag{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-xs);color:var(--dsw-alias-label-secondary);flex:none;padding:1px 6px;font-size:11px;line-height:16px}.zGbnIq_credentialDot{box-sizing:border-box;corner-shape:round;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.zGbnIq_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}.zGbnIq_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}.zGbnIq_accountStatus{color:var(--dsw-alias-state-success-primary);flex:none;align-items:center;gap:6px;font-size:13px;line-height:20px;display:inline-flex}.zGbnIq_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}.zGbnIq_primaryButton,.zGbnIq_secondaryButton,.zGbnIq_addButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;font:inherit;cursor:pointer;border:none;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.zGbnIq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.zGbnIq_secondaryButton,.zGbnIq_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}.zGbnIq_secondaryButton:hover:not(:disabled),.zGbnIq_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.zGbnIq_dangerButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_rowActions .zGbnIq_secondaryButton,.zGbnIq_rowActions .zGbnIq_dangerButton{border-radius:var(--dsw-radius-sm);height:28px;padding:0 10px;font-size:12px;line-height:18px}.zGbnIq_primaryButton:disabled,.zGbnIq_secondaryButton:disabled,.zGbnIq_dangerButton:disabled,.zGbnIq_addButton:disabled,.zGbnIq_linkButton:disabled,.zGbnIq_addModelButton:disabled{opacity:.4;cursor:default}.zGbnIq_primaryButton:focus-visible,.zGbnIq_secondaryButton:focus-visible,.zGbnIq_dangerButton:focus-visible,.zGbnIq_addButton:focus-visible,.zGbnIq_linkButton:focus-visible,.zGbnIq_addModelButton:focus-visible,.zGbnIq_iconButton:focus-visible,.zGbnIq_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.zGbnIq_editor{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;display:flex}.zGbnIq_editorHeader{align-items:baseline;gap:8px;display:flex}.zGbnIq_editorTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_editorRoute{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_field{flex-direction:column;gap:6px;display:flex}.zGbnIq_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}.zGbnIq_helpButton{border:.5px solid var(--dsw-alias-border-l3);corner-shape:round;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:center;cursor:help;background:0 0;border-radius:50%;padding:0;font-size:11px;line-height:15px}.zGbnIq_helpButton:hover,.zGbnIq_helpButton:focus-visible{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-tertiary)}.zGbnIq_linkButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.zGbnIq_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_editorActions{justify-content:flex-end;gap:8px;display:flex}.zGbnIq_addBlock{flex-direction:column;gap:12px;display:flex}.zGbnIq_addActions{display:flex}.zGbnIq_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);flex:1 1 0;gap:6px;min-width:180px;height:44px}.zGbnIq_addModes{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.zGbnIq_addPanel{flex-direction:column;gap:14px;display:flex}.zGbnIq_addPanel[hidden]{display:none}.zGbnIq_addCard,.zGbnIq_setupCard{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}.zGbnIq_addCard .zGbnIq_editor,.zGbnIq_setupCard .zGbnIq_editor{background:0 0;padding:0}.zGbnIq_customized{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px}.zGbnIq_customizedSummary{border-radius:var(--dsw-radius-sm);cursor:pointer;width:fit-content;color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;margin-left:-4px;padding:2px 4px;font-size:12px;font-weight:500;line-height:18px;list-style:none;display:flex}.zGbnIq_customizedSummary::-webkit-details-marker{display:none}.zGbnIq_customizedSummary:before{content:\"\";border-bottom:1.5px solid;border-right:1.5px solid;width:5px;height:5px;transition:transform .12s;transform:rotate(-45deg)translate(-1px,-1px)}.zGbnIq_customized[open]>.zGbnIq_customizedSummary:before{transform:rotate(45deg)translate(-1px,-1px)}.zGbnIq_customizedSummary:hover{color:var(--dsw-alias-label-primary)}.zGbnIq_customizedBody{flex-direction:column;gap:12px;padding-top:12px;display:flex}.zGbnIq_modelCatalog{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;padding-top:12px;display:flex}.zGbnIq_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}.zGbnIq_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.zGbnIq_modelCatalogMeta,.zGbnIq_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_modelList{flex-direction:column;gap:8px;display:flex}.zGbnIq_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.zGbnIq_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);padding:6px}.zGbnIq_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto;align-items:center;gap:6px;display:grid}.zGbnIq_iconButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}.zGbnIq_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.zGbnIq_iconButton:disabled{cursor:default;opacity:.4}.zGbnIq_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.zGbnIq_modelAdvanced{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px 4px 2px;display:grid}.zGbnIq_modelField{flex-direction:column;gap:4px;min-width:0;display:flex}.zGbnIq_modelInputTypes{border:none;grid-column:1/-1;min-width:0;margin:0;padding:0}.zGbnIq_modelInputTypes legend{margin-bottom:4px;padding:0}.zGbnIq_modelInputChoices{flex-wrap:wrap;align-items:center;gap:16px;min-height:32px;display:flex}.zGbnIq_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);text-align:center;padding:12px}.zGbnIq_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);padding:0 10px;font-size:14px;line-height:22px}select.zGbnIq_input{cursor:pointer;max-width:240px}.zGbnIq_input:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.zGbnIq_input::placeholder{color:var(--dsw-alias-label-dimmed)}.zGbnIq_input:disabled{opacity:.6;cursor:default}.zGbnIq_keyInput{position:relative}.zGbnIq_keyInputFilled{padding-right:40px}.zGbnIq_keyToggle{border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;inset:1px 1px 1px auto}.zGbnIq_keyToggle:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.zGbnIq_keyToggle:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.zGbnIq_keyToggle:disabled{opacity:.6;cursor:default}.zGbnIq_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}.zGbnIq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_deleteDialog{width:min(480px,100%)}.zGbnIq_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.zGbnIq_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_hiddenLabel{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.zGbnIq_customizedSummary:before,.zGbnIq_switchThumb{transition:none}}.zGbnIq_fetchDialog{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);max-width:520px}.zGbnIq_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}.zGbnIq_candidateSearch{flex:240px;min-width:0}.zGbnIq_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.zGbnIq_candidate{border-radius:var(--dsw-radius-md)}.zGbnIq_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}.zGbnIq_candidateId{min-width:0;font-family:var(--ds-font-family-code);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;overflow:hidden}.zGbnIq_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}";
58
+ const css$3 = ".zGbnIq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.zGbnIq_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.zGbnIq_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.zGbnIq_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}.zGbnIq_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}.zGbnIq_rowCard{border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);border-radius:var(--dsw-radius-xl);flex-direction:column;gap:12px;padding:12px 14px;display:flex}.zGbnIq_rowHead{align-items:center;gap:10px;display:flex}.zGbnIq_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}.zGbnIq_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_rowTag{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-xs);color:var(--dsw-alias-label-secondary);flex:none;padding:1px 6px;font-size:11px;line-height:16px}.zGbnIq_credentialDot{box-sizing:border-box;corner-shape:round;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.zGbnIq_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}.zGbnIq_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}.zGbnIq_accountStatus{color:var(--dsw-alias-state-success-primary);flex:none;align-items:center;gap:6px;font-size:13px;line-height:20px;display:inline-flex}.zGbnIq_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}.zGbnIq_primaryButton,.zGbnIq_secondaryButton,.zGbnIq_addButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;font:inherit;cursor:pointer;border:none;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.zGbnIq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.zGbnIq_secondaryButton,.zGbnIq_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}.zGbnIq_secondaryButton:hover:not(:disabled),.zGbnIq_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.zGbnIq_dangerButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_rowActions .zGbnIq_secondaryButton,.zGbnIq_rowActions .zGbnIq_dangerButton{border-radius:var(--dsw-radius-sm);height:28px;padding:0 10px;font-size:12px;line-height:18px}.zGbnIq_primaryButton:disabled,.zGbnIq_secondaryButton:disabled,.zGbnIq_dangerButton:disabled,.zGbnIq_addButton:disabled,.zGbnIq_linkButton:disabled,.zGbnIq_addModelButton:disabled{opacity:.4;cursor:default}.zGbnIq_primaryButton:focus-visible,.zGbnIq_secondaryButton:focus-visible,.zGbnIq_dangerButton:focus-visible,.zGbnIq_addButton:focus-visible,.zGbnIq_linkButton:focus-visible,.zGbnIq_addModelButton:focus-visible,.zGbnIq_iconButton:focus-visible,.zGbnIq_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.zGbnIq_editor{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;display:flex}.zGbnIq_editorHeader{align-items:baseline;gap:8px;display:flex}.zGbnIq_editorTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_editorRoute{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_field{flex-direction:column;gap:6px;display:flex}.zGbnIq_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}.zGbnIq_helpButton{border:.5px solid var(--dsw-alias-border-l3);corner-shape:round;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:center;cursor:help;background:0 0;border-radius:50%;padding:0;font-size:11px;line-height:15px}.zGbnIq_helpButton:hover,.zGbnIq_helpButton:focus-visible{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-tertiary)}.zGbnIq_linkButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.zGbnIq_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_editorActions{justify-content:flex-end;gap:8px;display:flex}.zGbnIq_addBlock{flex-direction:column;gap:12px;display:flex}.zGbnIq_addActions{display:flex}.zGbnIq_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);flex:1 1 0;gap:6px;min-width:180px;height:44px}.zGbnIq_addModes{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.zGbnIq_addPanel{flex-direction:column;gap:14px;display:flex}.zGbnIq_addPanel[hidden]{display:none}.zGbnIq_addCard,.zGbnIq_setupCard{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}.zGbnIq_addCard .zGbnIq_editor,.zGbnIq_setupCard .zGbnIq_editor{background:0 0;padding:0}.zGbnIq_customized{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px}.zGbnIq_customizedSummary{border-radius:var(--dsw-radius-sm);cursor:pointer;width:fit-content;color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;margin-left:-4px;padding:2px 4px;font-size:12px;font-weight:500;line-height:18px;list-style:none;display:flex}.zGbnIq_customizedSummary::-webkit-details-marker{display:none}.zGbnIq_customizedSummary:before{content:\"\";border-bottom:1.5px solid;border-right:1.5px solid;width:5px;height:5px;transition:transform .12s;transform:rotate(-45deg)translate(-1px,-1px)}.zGbnIq_customized[open]>.zGbnIq_customizedSummary:before{transform:rotate(45deg)translate(-1px,-1px)}.zGbnIq_customizedSummary:hover{color:var(--dsw-alias-label-primary)}.zGbnIq_customizedBody{flex-direction:column;gap:12px;padding-top:12px;display:flex}.zGbnIq_modelCatalog{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;padding-top:12px;display:flex}.zGbnIq_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}.zGbnIq_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.zGbnIq_modelCatalogMeta,.zGbnIq_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_modelList{flex-direction:column;gap:8px;display:flex}.zGbnIq_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.zGbnIq_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);padding:6px}.zGbnIq_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto;align-items:center;gap:6px;display:grid}.zGbnIq_iconButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}.zGbnIq_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.zGbnIq_iconButton:disabled{cursor:default;opacity:.4}.zGbnIq_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.zGbnIq_modelAdvanced{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px 4px 2px;display:grid}.zGbnIq_modelField{flex-direction:column;gap:4px;min-width:0;display:flex}.zGbnIq_modelInputTypes{border:none;grid-column:1/-1;min-width:0;margin:0;padding:0}.zGbnIq_modelInputTypes legend{margin-bottom:4px;padding:0}.zGbnIq_modelInputChoices{flex-wrap:wrap;align-items:center;gap:16px;min-height:32px;display:flex}.zGbnIq_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_modelReasoning{flex-direction:column;grid-column:1/-1;gap:6px;min-width:0;display:flex}.zGbnIq_modelReasoningLabel{align-items:center;gap:6px;display:inline-flex}.zGbnIq_modelReasoningHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.zGbnIq_modelReasoningRow{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;align-items:center;gap:6px;display:grid}.zGbnIq_modelReasoningRow .zGbnIq_selectInput{max-width:none}.zGbnIq_modelReasoningValueInput{font-family:var(--ds-font-family-code);font-size:13px}.zGbnIq_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);text-align:center;padding:12px}.zGbnIq_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);padding:0 10px;font-size:14px;line-height:22px}select.zGbnIq_input{cursor:pointer;max-width:240px}.zGbnIq_input:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.zGbnIq_input::placeholder{color:var(--dsw-alias-label-dimmed)}.zGbnIq_input:disabled{opacity:.6;cursor:default}.zGbnIq_keyInput{position:relative}.zGbnIq_keyInputFilled{padding-right:40px}.zGbnIq_keyToggle{border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;inset:1px 1px 1px auto}.zGbnIq_keyToggle:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.zGbnIq_keyToggle:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.zGbnIq_keyToggle:disabled{opacity:.6;cursor:default}.zGbnIq_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}.zGbnIq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_deleteDialog{width:min(480px,100%)}.zGbnIq_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.zGbnIq_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_hiddenLabel{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.zGbnIq_customizedSummary:before,.zGbnIq_switchThumb{transition:none}}.zGbnIq_fetchDialog{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);max-width:520px}.zGbnIq_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}.zGbnIq_candidateSearch{flex:240px;min-width:0}.zGbnIq_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.zGbnIq_candidate{border-radius:var(--dsw-radius-md)}.zGbnIq_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}.zGbnIq_candidateId{min-width:0;font-family:var(--ds-font-family-code);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;overflow:hidden}.zGbnIq_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}";
60
59
  const tagId$3 = "@mofeng2223/dsh-claude-provider/ModelsSection.module.css";
61
60
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
62
61
  const tag = document.createElement("style");
@@ -123,6 +122,11 @@ window.__ModuleLoader__.load({
123
122
  "modelInputTypes": "zGbnIq_modelInputTypes",
124
123
  "modelList": "zGbnIq_modelList",
125
124
  "modelListHead": "zGbnIq_modelListHead",
125
+ "modelReasoning": "zGbnIq_modelReasoning",
126
+ "modelReasoningHead": "zGbnIq_modelReasoningHead",
127
+ "modelReasoningLabel": "zGbnIq_modelReasoningLabel",
128
+ "modelReasoningRow": "zGbnIq_modelReasoningRow",
129
+ "modelReasoningValueInput": "zGbnIq_modelReasoningValueInput",
126
130
  "modelRow": "zGbnIq_modelRow",
127
131
  "notice": "zGbnIq_notice",
128
132
  "primaryButton": "zGbnIq_primaryButton",
@@ -255,6 +259,224 @@ window.__ModuleLoader__.load({
255
259
  });
256
260
  }
257
261
  //#endregion
262
+ //#region lib/types/client/ModelReasoningEfforts.js
263
+ /** Reasoning-level declarations for a model on a hand-declared pi-ai route. */
264
+ /** Levels a model offers when the switch is turned on, where the schema lists them: Off plus the common OpenAI-compatible trio. */
265
+ const INITIAL_LEVELS = [
266
+ "off",
267
+ "low",
268
+ "medium",
269
+ "high"
270
+ ];
271
+ /** The wire value a level sends unless its row says otherwise; `null` is the Off entry that sends nothing. */
272
+ function defaultValue(level) {
273
+ return level === "off" ? null : level;
274
+ }
275
+ /**
276
+ * Whether pi-ai accepts a stored value: a non-empty string, or nothing for Off.
277
+ * @param level - the declared level.
278
+ * @param wire - the value stored for it.
279
+ * @returns whether the adapter would resolve the entry.
280
+ */
281
+ function acceptedValue(level, wire) {
282
+ return typeof wire === "string" ? wire.length > 0 : wire === null && level === "off";
283
+ }
284
+ /**
285
+ * Read the declared levels from a row in their stored order, including a key
286
+ * the offered levels do not name, so an edit never drops it.
287
+ * @param model - model row as drafted.
288
+ * @returns the entries; empty for a valueless field, which pi-ai refuses, and
289
+ * `undefined` when the field is absent or `false`.
290
+ */
291
+ function readEfforts(model) {
292
+ const value = model["reasoningEfforts"];
293
+ if (value === null) return [];
294
+ if (typeof value !== "object" || Array.isArray(value)) return void 0;
295
+ return Object.entries(value);
296
+ }
297
+ /**
298
+ * Replace a row's declared levels, preserving every other field.
299
+ * @param model - model row as drafted.
300
+ * @param entries - the levels to write in row order, or `undefined` to remove the field.
301
+ * @returns the replacement row.
302
+ */
303
+ function withEfforts(model, entries) {
304
+ const next = { ...model };
305
+ if (entries === void 0) {
306
+ Reflect.deleteProperty(next, "reasoningEfforts");
307
+ return next;
308
+ }
309
+ next["reasoningEfforts"] = Object.fromEntries(entries);
310
+ return next;
311
+ }
312
+ /**
313
+ * Mirror the pi-ai refusals of a hand-declared `reasoningEfforts`, so a card
314
+ * names the row instead of failing at the write.
315
+ * @param value - drafted `models` value, or `undefined` while inherited.
316
+ * @returns the first refused row, or `undefined` when the adapter will accept every row.
317
+ */
318
+ function validateReasoningEfforts(value) {
319
+ for (const [index, model] of modelDrafts(value).entries()) {
320
+ const entries = readEfforts(model);
321
+ if (entries === void 0) continue;
322
+ if (entries.some(([level, wire]) => !acceptedValue(level, wire))) return {
323
+ index,
324
+ key: "modelReasoningValueRequired"
325
+ };
326
+ if (!entries.some(([level]) => level !== "off")) return {
327
+ index,
328
+ key: "modelReasoningNeedsLevel"
329
+ };
330
+ }
331
+ }
332
+ /**
333
+ * Edit the `reasoningEfforts` a hand-declared pi-ai model offers: a switch,
334
+ * then one row per level pairing the level with the value sent for it. Every
335
+ * row is read from the model, so a reused instance shows its new model.
336
+ * @param props - model declaration and row replacement action.
337
+ * @returns the reasoning-level group.
338
+ */
339
+ function ModelReasoningEfforts({ model, levels, position, disabled, t, onChange, claude, adaptiveFallback }) {
340
+ const entries = readEfforts(model);
341
+ const [typing, setTyping] = (0, react.useState)(void 0);
342
+ const label = `${t("modelReasoning")} ${String(position)}`;
343
+ const used = entries?.map(([level]) => level) ?? [];
344
+ const write = (next) => {
345
+ onChange(withEfforts(model, next));
346
+ };
347
+ const replaceAt = (current, index, entry) => current.map((existing, at) => at === index ? entry : existing);
348
+ const changeLevel = (current, index, from, wire, to) => {
349
+ write(replaceAt(current, index, [to, typeof wire === "string" && wire.length > 0 && wire !== from && from !== "off" && to !== "off" ? wire : defaultValue(to)]));
350
+ };
351
+ const addLevel = (current) => {
352
+ const highest = Math.max(-1, ...used.map((level) => levels.indexOf(level)));
353
+ const level = levels.find((candidate, index) => index > highest && !used.includes(candidate)) ?? levels.find((candidate) => !used.includes(candidate));
354
+ /* v8 ignore next -- the add button is disabled once every level has a row */
355
+ if (level === void 0) return;
356
+ write([...current, [level, defaultValue(level)]]);
357
+ };
358
+ const editValue = (current, index, level, text) => {
359
+ setTyping({
360
+ level,
361
+ text
362
+ });
363
+ const trimmed = text.trim();
364
+ write(replaceAt(current, index, [level, trimmed.length === 0 ? defaultValue(level) : trimmed]));
365
+ };
366
+ const leaveValue = (current, index, level, wire) => {
367
+ setTyping(void 0);
368
+ if (!acceptedValue(level, wire)) write(replaceAt(current, index, [level, defaultValue(level)]));
369
+ };
370
+ const choicesFor = (level) => [...levels.includes(level) ? [] : [level], ...levels.filter((choice) => choice === level || !used.includes(choice))];
371
+ const initialEntries = claude ? Object.entries(reasoningEffortsForPreset(CLAUDE_KNOWN_MODELS[model.id]?.preset ?? "five")) : INITIAL_LEVELS.filter((level) => levels.includes(level)).map((level) => [level, defaultValue(level)]);
372
+ const refused = entries?.some(([level, wire]) => !acceptedValue(level, wire)) === true;
373
+ const missingLevel = entries !== void 0 && !used.some((level) => level !== "off");
374
+ return (0, react_jsx_runtime.jsxs)("div", {
375
+ className: ModelsSection_module_css_default["modelReasoning"],
376
+ role: "group",
377
+ "aria-label": label,
378
+ children: [(0, react_jsx_runtime.jsxs)("div", {
379
+ className: ModelsSection_module_css_default["modelReasoningHead"],
380
+ children: [(0, react_jsx_runtime.jsxs)("span", {
381
+ className: `${ModelsSection_module_css_default["modelFieldLabel"]} ${ModelsSection_module_css_default["modelReasoningLabel"]}`,
382
+ children: [t("modelReasoning"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
383
+ label: t("modelReasoningHelpText"),
384
+ side: "right",
385
+ delayMs: 0,
386
+ focusDelayMs: 0,
387
+ portal: true,
388
+ openOnClick: true,
389
+ children: (0, react_jsx_runtime.jsx)("button", {
390
+ type: "button",
391
+ className: ModelsSection_module_css_default["helpButton"],
392
+ "aria-label": t("modelReasoningHelp"),
393
+ children: "?"
394
+ })
395
+ })]
396
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
397
+ checked: entries !== void 0,
398
+ label,
399
+ disabled,
400
+ onChange: (on) => {
401
+ write(on ? initialEntries : void 0);
402
+ }
403
+ })]
404
+ }), claude ? (0, react_jsx_runtime.jsx)(ClaudeAdaptiveThinking, { model, inherited: adaptiveFallback, position, disabled, t, onChange }) : null, entries === void 0 ? null : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
405
+ entries.length > 0 ? (0, react_jsx_runtime.jsxs)("div", {
406
+ className: ModelsSection_module_css_default["modelReasoningRow"],
407
+ "aria-hidden": "true",
408
+ children: [(0, react_jsx_runtime.jsx)("span", {
409
+ className: ModelsSection_module_css_default["modelFieldLabel"],
410
+ children: t("modelReasoningLevel")
411
+ }), (0, react_jsx_runtime.jsx)("span", {
412
+ className: ModelsSection_module_css_default["modelFieldLabel"],
413
+ children: t("modelReasoningValue")
414
+ })]
415
+ }) : null,
416
+ entries.map(([level, wire], index) => (0, react_jsx_runtime.jsxs)("div", {
417
+ className: ModelsSection_module_css_default["modelReasoningRow"],
418
+ children: [
419
+ (0, react_jsx_runtime.jsx)("select", {
420
+ className: `${ModelsSection_module_css_default["input"]} ${ModelsSection_module_css_default["selectInput"]}`,
421
+ value: level,
422
+ "aria-label": `${t("modelReasoningLevel")} ${String(index + 1)}`,
423
+ disabled,
424
+ onChange: (event) => {
425
+ changeLevel(entries, index, level, wire, event.target.value);
426
+ },
427
+ children: choicesFor(level).map((choice) => (0, react_jsx_runtime.jsx)("option", {
428
+ value: choice,
429
+ children: choice
430
+ }, choice))
431
+ }),
432
+ (0, react_jsx_runtime.jsx)("input", {
433
+ className: `${ModelsSection_module_css_default["input"]} ${ModelsSection_module_css_default["modelReasoningValueInput"]}`,
434
+ type: "text",
435
+ value: typing?.level === level ? typing.text : typeof wire === "string" ? wire : "",
436
+ placeholder: level === "off" ? t("modelReasoningOffValuePlaceholder") : level,
437
+ "aria-label": `${level} ${t("modelReasoningValue")}`,
438
+ "aria-invalid": !acceptedValue(level, wire),
439
+ disabled: disabled || level === "off",
440
+ onChange: (event) => {
441
+ editValue(entries, index, level, event.target.value);
442
+ },
443
+ onBlur: () => {
444
+ leaveValue(entries, index, level, wire);
445
+ }
446
+ }),
447
+ (0, react_jsx_runtime.jsx)("button", {
448
+ type: "button",
449
+ className: `${ModelsSection_module_css_default["iconButton"]} ${ModelsSection_module_css_default["iconButtonDanger"]}`,
450
+ "aria-label": `${t("modelReasoningRemove")} ${level}`,
451
+ title: t("modelReasoningRemove"),
452
+ disabled,
453
+ onClick: () => {
454
+ write(entries.filter((_entry, at) => at !== index));
455
+ },
456
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineRegular, { size: 14 })
457
+ })
458
+ ]
459
+ }, index)),
460
+ refused ? (0, react_jsx_runtime.jsx)("p", {
461
+ className: ModelsSection_module_css_default["error"],
462
+ children: t("modelReasoningValueRequired")
463
+ }) : missingLevel ? (0, react_jsx_runtime.jsx)("p", {
464
+ className: ModelsSection_module_css_default["error"],
465
+ children: t("modelReasoningNeedsLevel")
466
+ }) : null,
467
+ (0, react_jsx_runtime.jsxs)("button", {
468
+ type: "button",
469
+ className: ModelsSection_module_css_default["addModelButton"],
470
+ disabled: disabled || levels.every((level) => used.includes(level)),
471
+ onClick: () => {
472
+ addLevel(entries);
473
+ },
474
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), t("modelReasoningAdd")]
475
+ })
476
+ ] })]
477
+ });
478
+ }
479
+ //#endregion
258
480
  //#region lib/types/client/ModelRow.js
259
481
  /**
260
482
  * Render consistent model identity, capacity, and input-type controls.
@@ -302,43 +524,46 @@ window.__ModuleLoader__.load({
302
524
  ]
303
525
  }), props.expanded ? (0, react_jsx_runtime.jsxs)("div", {
304
526
  className: ModelsSection_module_css_default["modelAdvanced"],
305
- children: [["contextWindow", "maxTokens"].map((field) => (0, react_jsx_runtime.jsxs)("label", {
306
- className: ModelsSection_module_css_default["modelField"],
307
- children: [(0, react_jsx_runtime.jsx)("span", {
308
- className: ModelsSection_module_css_default["modelFieldLabel"],
309
- children: t(field)
310
- }), (0, react_jsx_runtime.jsx)("input", {
311
- className: ModelsSection_module_css_default["input"],
312
- type: "text",
313
- inputMode: "numeric",
314
- value: props[field].value,
315
- placeholder: props[field].placeholder,
316
- "aria-label": `${t(field)} ${String(position)}`,
317
- disabled,
318
- onChange: (event) => {
319
- props[field].onChange(event.target.value);
320
- },
321
- onBlur: props[field].onBlur
322
- })]
323
- }, field)), (0, react_jsx_runtime.jsx)(ModelInputTypes, {
324
- model,
325
- field: props.inputField,
326
- position,
327
- fallback: props.inputFallback,
328
- disabled: disabled || props.inputLoading === true,
329
- t,
330
- onChange: props.onChange
331
- }), props.thinkingPresets ? (0, react_jsx_runtime.jsxs)("label", {
332
- className: ModelsSection_module_css_default["modelField"],
333
- children: [t("thinkingPreset"), (0, react_jsx_runtime.jsxs)("select", {
334
- className: ModelsSection_module_css_default["input"] + " " + ModelsSection_module_css_default["selectInput"],
335
- value: thinkingPresetOf(model),
336
- "aria-label": t("thinkingPreset") + " " + position,
527
+ children: [
528
+ ["contextWindow", "maxTokens"].map((field) => (0, react_jsx_runtime.jsxs)("label", {
529
+ className: ModelsSection_module_css_default["modelField"],
530
+ children: [(0, react_jsx_runtime.jsx)("span", {
531
+ className: ModelsSection_module_css_default["modelFieldLabel"],
532
+ children: t(field)
533
+ }), (0, react_jsx_runtime.jsx)("input", {
534
+ className: ModelsSection_module_css_default["input"],
535
+ type: "text",
536
+ inputMode: "numeric",
537
+ value: props[field].value,
538
+ placeholder: props[field].placeholder,
539
+ "aria-label": `${t(field)} ${String(position)}`,
540
+ disabled,
541
+ onChange: (event) => {
542
+ props[field].onChange(event.target.value);
543
+ },
544
+ onBlur: props[field].onBlur
545
+ })]
546
+ }, field)),
547
+ (0, react_jsx_runtime.jsx)(ModelInputTypes, {
548
+ model,
549
+ field: props.inputField,
550
+ position,
551
+ fallback: props.inputFallback,
552
+ disabled: disabled || props.inputLoading === true,
553
+ t,
554
+ onChange: props.onChange
555
+ }),
556
+ props.reasoningLevels !== void 0 && props.reasoningLevels.length > 0 ? (0, react_jsx_runtime.jsx)(ModelReasoningEfforts, {
557
+ model,
558
+ levels: props.reasoningLevels,
559
+ claude: props.thinkingPresets === true,
560
+ adaptiveFallback: props.adaptiveFallback,
561
+ position,
337
562
  disabled,
338
- onChange: (event) => props.onChange({ ...model, reasoningEfforts: reasoningEffortsForPreset(event.target.value) }),
339
- children: ["toggle", "four", "five"].map((preset) => (0, react_jsx_runtime.jsx)("option", { value: preset, children: t({ toggle: "thinkingPresetToggle", four: "thinkingPresetFour", five: "thinkingPresetFive" }[preset]) }, preset))
340
- })]
341
- }) : null]
563
+ t,
564
+ onChange: props.onChange
565
+ }) : null
566
+ ]
342
567
  }) : null]
343
568
  });
344
569
  }
@@ -714,10 +939,10 @@ window.__ModuleLoader__.load({
714
939
  onChange(models.map((model, at) => {
715
940
  if (at !== index) return model;
716
941
  const cleared = new Set(Object.entries(next).filter(([, value]) => value === void 0 || value === "").map(([key]) => key));
717
- return Object.fromEntries(Object.entries({
942
+ return carryClaudeDraft(model, Object.fromEntries(Object.entries({
718
943
  ...model,
719
944
  ...next
720
- }).filter(([key]) => !cleared.has(key)));
945
+ }).filter(([key]) => !cleared.has(key))));
721
946
  }));
722
947
  };
723
948
  const fetchModels = async () => {
@@ -836,6 +1061,8 @@ window.__ModuleLoader__.load({
836
1061
  thinkingPresets: props.thinkingPresets,
837
1062
  inputFallback: props.thinkingPresets && CLAUDE_KNOWN_MODELS[model.id] ? ["text", "image"] : inputDefaults.get(textOf(model, "id")) ?? props.defaultInput,
838
1063
  inputLoading: catalogProvider !== void 0 && catalog === void 0,
1064
+ reasoningLevels: props.reasoningLevels,
1065
+ adaptiveFallback: props.adaptiveFallback,
839
1066
  expanded: expanded.has(index),
840
1067
  disabled,
841
1068
  t,
@@ -853,6 +1080,11 @@ window.__ModuleLoader__.load({
853
1080
  editCapacity(index, "maxTokens", text);
854
1081
  }
855
1082
  },
1083
+ onIdBlur: () => {
1084
+ if (!props.thinkingPresets) return;
1085
+ const next = finishClaudeDraft(model);
1086
+ if (next !== model) onChange(models.map((row, at) => at === index ? next : row));
1087
+ },
856
1088
  onFieldChange: (field, value) => {
857
1089
  patch(index, { [field]: value });
858
1090
  },
@@ -879,7 +1111,7 @@ window.__ModuleLoader__.load({
879
1111
  className: ModelsSection_module_css_default["addModelButton"],
880
1112
  disabled,
881
1113
  onClick: () => {
882
- onChange([...models, props.thinkingPresets ? withDefaultClaudeReasoning({ id: "" }) : { id: "" }]);
1114
+ onChange([...models, props.thinkingPresets ? newClaudeModel() : { id: "" }]);
883
1115
  },
884
1116
  children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), t("addModel")]
885
1117
  }),
@@ -1026,6 +1258,26 @@ window.__ModuleLoader__.load({
1026
1258
  if (list?.type !== "union" || list.list === void 0) return [];
1027
1259
  return list.list.map((entry) => entry.value).filter((value) => typeof value === "string");
1028
1260
  }
1261
+ /**
1262
+ * The reasoning levels a hand-declared route's models may declare, read out of
1263
+ * the owning namespace's own schema for the same reason as
1264
+ * {@link protocolChoices}: the levels the page offers and the keys the
1265
+ * adapter accepts in `reasoningEfforts` come from the same `Config`.
1266
+ * @param namespace - the namespace view whose schema declares the profile shape.
1267
+ * @param schema - settings schema operations.
1268
+ * @returns the levels in the schema's escalation order, or an empty list when the schema has none.
1269
+ */
1270
+ function reasoningLevelChoices(namespace, schema) {
1271
+ if (namespace === void 0) return [];
1272
+ const path = [
1273
+ "providers",
1274
+ PROBE_ROUTE,
1275
+ "models",
1276
+ "0",
1277
+ "reasoningEfforts"
1278
+ ];
1279
+ return (((schema.nodeAtPath(schema.rehydrate(namespace.schema), path)?.list ?? []).find((branch) => branch.type === "dict")?.sKey)?.list ?? []).map((entry) => entry.value).filter((value) => typeof value === "string");
1280
+ }
1029
1281
  /** The credential reference a resolved profile names (its `apiKeyEnv` field). */
1030
1282
  function apiKeyEnvOf(namespace, path, schema) {
1031
1283
  if (namespace === void 0) return void 0;
@@ -1281,11 +1533,12 @@ window.__ModuleLoader__.load({
1281
1533
  * and at least one model — are required here rather than at load, so the
1282
1534
  * failure names the field while the user is still looking at it.
1283
1535
  *
1284
- * There is deliberately no reasoning-effort control, here or on the editor
1285
- * card: effort is a per-MODEL capability, and the models under one provider
1286
- * disagree about it, so a provider-scoped control can only be set to a value
1287
- * some of them reject. The composer's model picker offers each model its own
1288
- * levels instead.
1536
+ * There is deliberately no provider-scoped reasoning-effort control, here or
1537
+ * on the editor card: effort is a per-MODEL capability, and the models under
1538
+ * one provider disagree about it, so a provider-scoped control can only be set
1539
+ * to a value some of them reject. Each model row of a hand-declared route
1540
+ * declares its own `reasoningEfforts` instead, and the composer's model picker
1541
+ * offers each model those levels.
1289
1542
  */
1290
1543
  /** The settings namespace a hand-declared provider is written into. */
1291
1544
  const NS$1 = "llm-pi-ai";
@@ -1312,7 +1565,7 @@ window.__ModuleLoader__.load({
1312
1565
  * @returns the creation card.
1313
1566
  */
1314
1567
  function CustomProviderCard(props) {
1315
- const { taken, protocols, operations, t, onBusyChange } = props;
1568
+ const { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;
1316
1569
  const [openedAt] = (0, react.useState)(() => props.revision);
1317
1570
  const [route, setRoute] = (0, react.useState)("");
1318
1571
  const [displayName, setDisplayName] = (0, react.useState)("");
@@ -1345,7 +1598,7 @@ window.__ModuleLoader__.load({
1345
1598
  const routeTaken = taken.includes(route);
1346
1599
  const normalizedBaseURL = baseURL.trim();
1347
1600
  const baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL);
1348
- const modelFailure = validateDeepSeekModels(models);
1601
+ const modelFailure = validateDeepSeekModels(models) ?? validateReasoningEfforts(models);
1349
1602
  const keyFailure = apiKeyFailure(keyDraft);
1350
1603
  const keyValue = keyDraft.trim();
1351
1604
  const ready = route.length > 0 && !routeInvalid && !routeTaken && normalizedBaseURL.length > 0 && !baseUrlInvalid && models.length > 0 && modelFailure === void 0 && keyFailure === void 0;
@@ -1366,7 +1619,7 @@ window.__ModuleLoader__.load({
1366
1619
  const written = await operations.writeSettings(NS$1, [{
1367
1620
  op: "set",
1368
1621
  path: ["providers", route],
1369
- value: profile
1622
+ value: isAdaptiveClaude ? withNativeClaudeProfile(profile) : profile
1370
1623
  }], openedAt);
1371
1624
  if (written.kind !== "written") return written.kind === "conflict" ? t("conflict") : written.message;
1372
1625
  setCommitted(true);
@@ -1401,11 +1654,6 @@ window.__ModuleLoader__.load({
1401
1654
  return (0, react_jsx_runtime.jsxs)("div", {
1402
1655
  className: ModelsSection_module_css_default["editor"],
1403
1656
  children: [
1404
- isAdaptiveClaude ? (0, react_jsx_runtime.jsxs)("p", {
1405
- className: ModelsSection_module_css_default["savedNotice"],
1406
- role: "status",
1407
- children: [t("adaptiveClaudeEnabled"), " ", (0, react_jsx_runtime.jsx)(ClaudeThinkingHelp, { t })]
1408
- }) : null,
1409
1657
  (0, react_jsx_runtime.jsxs)("div", {
1410
1658
  className: ModelsSection_module_css_default["field"],
1411
1659
  children: [(0, react_jsx_runtime.jsx)("span", {
@@ -1514,6 +1762,7 @@ window.__ModuleLoader__.load({
1514
1762
  (0, react_jsx_runtime.jsx)(ModelListEditor, {
1515
1763
  models,
1516
1764
  onChange: setModels,
1765
+ reasoningLevels,
1517
1766
  probe: {
1518
1767
  settingsNs: NS$1,
1519
1768
  baseURL: normalizedBaseURL,
@@ -1665,7 +1914,15 @@ window.__ModuleLoader__.load({
1665
1914
  const value = next === void 0 || next.trim().length === 0 ? void 0 : next;
1666
1915
  setDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));
1667
1916
  };
1668
- const modelFailure = validateDeepSeekModels(schema.getPath(draft, ["models"]));
1917
+ const reasoningLevels = (0, react.useMemo)(() => layout === "pi-ai" && props.declared === true ? reasoningLevelChoices(namespace, schema) : [], [
1918
+ layout,
1919
+ props.declared,
1920
+ namespace,
1921
+ schema
1922
+ ]);
1923
+ const editsReasoning = reasoningLevels.length > 0;
1924
+ const validateModels = (value) => validateDeepSeekModels(value) ?? (editsReasoning ? validateReasoningEfforts(value) : void 0);
1925
+ const modelFailure = validateModels(schema.getPath(draft, ["models"]));
1669
1926
  const keyFailure = apiKeyFailure(keyDraft);
1670
1927
  const keyValue = keyDraft.trim();
1671
1928
  const shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? "keyRequired" : void 0) ?? keyFailure;
@@ -1689,7 +1946,7 @@ window.__ModuleLoader__.load({
1689
1946
  const credentialDraft = layout === "pi-ai" && stringAt(draft, "apiKeyEnv") === void 0 && stringAt(fallback, "apiKeyEnv") === void 0 && keyValue.length > 0 ? schema.setPath(draft, ["apiKeyEnv"], keyRef) : draft;
1690
1947
  const next = props.thinkingPresets === true ? withNativeClaudeProfile(credentialDraft) : credentialDraft;
1691
1948
  if (props.credentialOnly !== true) {
1692
- const failure = validateDeepSeekModels(schema.getPath(next, ["models"]));
1949
+ const failure = validateModels(schema.getPath(next, ["models"]));
1693
1950
  /* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */
1694
1951
  if (failure !== void 0) return `${t("model")} ${String(failure.index + 1)}: ${t(failure.key)}`;
1695
1952
  }
@@ -1918,10 +2175,12 @@ window.__ModuleLoader__.load({
1918
2175
  }) : (0, react_jsx_runtime.jsx)(ModelListEditor, {
1919
2176
  ...catalogProps,
1920
2177
  catalogProvider: props.declared === true ? void 0 : props.provider,
2178
+ reasoningLevels,
1921
2179
  defaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,
1922
2180
  probe,
1923
2181
  probeBlocked: keyFailure,
1924
2182
  thinkingPresets: props.thinkingPresets === true,
2183
+ adaptiveFallback: schema.getPath(draft, ["compat", "forceAdaptiveThinking"]),
1925
2184
  operations,
1926
2185
  onBusyChange: setListBusy
1927
2186
  })
@@ -2078,6 +2337,8 @@ window.__ModuleLoader__.load({
2078
2337
  ...row.entry.nativeAuth === void 0 ? {} : { nativeAuth: row.entry.nativeAuth }
2079
2338
  };
2080
2339
  }
2340
+ // BEGIN CLAUDE HELPERS
2341
+ // These helpers are inserted into the upstream client module by build-client.mjs.
2081
2342
  const CLAUDE_DISCOVERY_API = "mofeng-anthropic-models";
2082
2343
  const CLAUDE_PROVIDER_SETTINGS_NS = "dsh-claude-provider";
2083
2344
  const CLAUDE_PROVIDER_TYPE = "claude-adaptive";
@@ -2090,120 +2351,131 @@ window.__ModuleLoader__.load({
2090
2351
  "claude-haiku-5-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2091
2352
  "claude-haiku-4-5-20251001": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2092
2353
  "claude-haiku-4-5": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2354
+ "claude-opus-4-5-20251101": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2355
+ "claude-opus-4-5": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2093
2356
  "claude-opus-4-6": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "four" }),
2094
2357
  "claude-opus-4-7": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2095
2358
  "claude-opus-4-8": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2096
2359
  "claude-opus-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2097
2360
  "claude-opus-5-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2361
+ "claude-sonnet-4-5-20250929": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2362
+ "claude-sonnet-4-5": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
2098
2363
  "claude-sonnet-4-6": Object.freeze({ contextWindow: 1000000, maxTokens: 64000, preset: "four" }),
2099
2364
  "claude-sonnet-5-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2100
2365
  "claude-sonnet-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" })
2101
2366
  });
2367
+ const CLAUDE_PENDING_MODELS = new WeakSet();
2368
+
2102
2369
  function reasoningEffortsForPreset(preset) {
2103
- if (preset === "toggle") return { ...CLAUDE_TOGGLE_EFFORTS };
2104
- if (preset === "four") return { ...CLAUDE_FOUR_EFFORTS };
2105
- return { ...CLAUDE_FIVE_EFFORTS };
2370
+ if (preset === "toggle") return { ...CLAUDE_TOGGLE_EFFORTS };
2371
+ if (preset === "four") return { ...CLAUDE_FOUR_EFFORTS };
2372
+ return { ...CLAUDE_FIVE_EFFORTS };
2373
+ }
2374
+
2375
+ function claudeAdaptiveEnabled(model, inherited) {
2376
+ const known = CLAUDE_KNOWN_MODELS[model?.id];
2377
+ if (known?.preset === "toggle") return false;
2378
+ const explicit = model?.compat?.forceAdaptiveThinking;
2379
+ if (typeof explicit === "boolean") return explicit;
2380
+ if (typeof inherited === "boolean") return inherited;
2381
+ return known !== undefined && known.preset !== "toggle";
2382
+ }
2383
+
2384
+ function withClaudeAdaptive(model, enabled) {
2385
+ return { ...model, compat: { ...model.compat, forceAdaptiveThinking: enabled } };
2106
2386
  }
2387
+
2388
+ // Defaults are applied only when adopting a new model, never when saving an edit.
2389
+ function withDefaultClaudeReasoning(model) {
2390
+ const known = CLAUDE_KNOWN_MODELS[model.id];
2391
+ const next = Object.hasOwn(model, "reasoningEfforts") ? { ...model } : {
2392
+ ...model, reasoningEfforts: reasoningEffortsForPreset(known?.preset ?? "five")
2393
+ };
2394
+ return typeof next.compat?.forceAdaptiveThinking === "boolean" ? next
2395
+ : withClaudeAdaptive(next, known?.preset !== "toggle");
2396
+ }
2397
+
2107
2398
  function withKnownClaudeInput(model) {
2108
- if (!CLAUDE_KNOWN_MODELS[model?.id] || (Array.isArray(model.input) && model.input.length > 0)) return { ...model };
2109
- return { ...model, input: ["text", "image"] };
2399
+ if (!CLAUDE_KNOWN_MODELS[model?.id] || Array.isArray(model.input)) return { ...model };
2400
+ return { ...model, input: ["text", "image"] };
2110
2401
  }
2402
+
2111
2403
  function withFetchedClaudeMetadata(model) {
2112
- const known = CLAUDE_KNOWN_MODELS[model?.id];
2113
- if (known === undefined) return withDefaultClaudeReasoning(model);
2114
- return { ...withKnownClaudeInput(model), contextWindow: known.contextWindow, maxTokens: known.maxTokens, reasoningEfforts: reasoningEffortsForPreset(known.preset) };
2404
+ const known = CLAUDE_KNOWN_MODELS[model?.id];
2405
+ return withDefaultClaudeReasoning(withKnownClaudeInput({
2406
+ ...model,
2407
+ ...known === undefined ? {} : {
2408
+ contextWindow: model.contextWindow ?? known.contextWindow,
2409
+ maxTokens: model.maxTokens ?? known.maxTokens
2410
+ }
2411
+ }));
2115
2412
  }
2116
- function thinkingPresetOf(model) {
2117
- const efforts = model?.reasoningEfforts;
2118
- if (efforts !== null && typeof efforts === "object" && !Array.isArray(efforts)) {
2119
- if (Object.hasOwn(efforts, "off") && !Object.hasOwn(efforts, "low")) return "toggle";
2120
- if (Object.hasOwn(efforts, "max") && !Object.hasOwn(efforts, "xhigh")) return "four";
2121
- }
2122
- return "five";
2413
+
2414
+ function newClaudeModel() {
2415
+ const model = { id: "" };
2416
+ CLAUDE_PENDING_MODELS.add(model);
2417
+ return model;
2123
2418
  }
2124
- function withDefaultClaudeReasoning(model) {
2125
- const efforts = model?.reasoningEfforts;
2126
- return efforts !== null && typeof efforts === "object" && !Array.isArray(efforts) && Object.keys(efforts).length > 0
2127
- ? { ...model }
2128
- : { ...model, reasoningEfforts: reasoningEffortsForPreset("five") };
2419
+
2420
+ function carryClaudeDraft(model, next) {
2421
+ if (CLAUDE_PENDING_MODELS.has(model)) CLAUDE_PENDING_MODELS.add(next);
2422
+ return next;
2129
2423
  }
2130
- function withNativeClaudeModel(model) {
2131
- const next = withKnownClaudeInput(withDefaultClaudeReasoning(model));
2132
- const efforts = next.reasoningEfforts;
2133
- const adaptive = efforts !== null && typeof efforts === "object" && !Array.isArray(efforts)
2134
- && ["low", "medium", "high", "max"].every((level) => typeof efforts[level] === "string" && efforts[level].length > 0);
2135
- const compat = { ...(next.compat ?? {}) };
2136
- if (adaptive) compat.forceAdaptiveThinking = true;
2137
- else Reflect.deleteProperty(compat, "forceAdaptiveThinking");
2138
- const { compat: _compat, ...rest } = next;
2139
- return { ...rest, ...Object.keys(compat).length === 0 ? {} : { compat } };
2424
+
2425
+ function finishClaudeDraft(model) {
2426
+ return CLAUDE_PENDING_MODELS.has(model) && model.id.trim().length > 0
2427
+ ? withFetchedClaudeMetadata(model) : model;
2140
2428
  }
2141
- function withNativeClaudeProfile(profile) {
2142
- const { compat: currentCompat, ...rest } = profile ?? {};
2143
- const compat = { ...(currentCompat ?? {}) };
2144
- Reflect.deleteProperty(compat, "forceAdaptiveThinking");
2145
- const models = Array.isArray(profile?.models) ? profile.models.map(withNativeClaudeModel) : profile?.models;
2146
- return {
2147
- ...rest,
2148
- api: "anthropic-messages",
2149
- ...Object.keys(compat).length === 0 ? {} : { compat },
2150
- ...models === void 0 ? {} : { models },
2151
- reasoning: "high"
2152
- };
2429
+
2430
+ function withNativeClaudeModel(model, inherited) {
2431
+ const next = finishClaudeDraft(model);
2432
+ return withClaudeAdaptive(next, claudeAdaptiveEnabled(next, inherited));
2153
2433
  }
2154
- function ClaudeThinkingHelp(props) {
2155
- const anchorRef = (0, react.useRef)(null);
2156
- const tooltipRef = (0, react.useRef)(null);
2157
- const [open, setOpen] = (0, react.useState)(false);
2158
- const [position, setPosition] = (0, react.useState)({ left: 12, top: 12, width: 680 });
2159
- (0, react.useLayoutEffect)(() => {
2160
- if (!open) return;
2161
- const place = () => {
2162
- const anchor = anchorRef.current;
2163
- if (anchor === null) return;
2164
- const rect = anchor.getBoundingClientRect();
2165
- const width = Math.max(280, Math.min(680, window.innerWidth - 24));
2166
- const height = tooltipRef.current?.offsetHeight ?? 120;
2167
- const left = Math.max(12, Math.min(rect.left, window.innerWidth - width - 12));
2168
- const below = rect.bottom + 8;
2169
- const top = below + height <= window.innerHeight - 12 ? below : Math.max(12, rect.top - height - 8);
2170
- setPosition({ left, top, width });
2171
- };
2172
- place();
2173
- window.addEventListener("resize", place);
2174
- window.addEventListener("scroll", place, true);
2175
- return () => {
2176
- window.removeEventListener("resize", place);
2177
- window.removeEventListener("scroll", place, true);
2178
- };
2179
- }, [open]);
2180
- const tooltip = open && typeof document !== "undefined" ? (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)("span", {
2181
- ref: tooltipRef,
2182
- className: "mofeng-thinking-tooltip",
2183
- role: "tooltip",
2184
- style: position,
2185
- children: props.t("adaptiveClaudeHelp").split("\n").map((line, index) => (0, react_jsx_runtime.jsx)("span", { children: line }, index))
2186
- }), document.body) : null;
2187
- return (0, react_jsx_runtime.jsxs)(react.Fragment, {
2188
- children: [(0, react_jsx_runtime.jsxs)("span", {
2189
- ref: anchorRef,
2190
- className: "mofeng-thinking-help",
2191
- "aria-label": props.t("adaptiveClaudeHelpLabel"),
2192
- tabIndex: 0,
2193
- onMouseEnter: () => setOpen(true),
2194
- onMouseLeave: () => setOpen(false),
2195
- onFocus: () => setOpen(true),
2196
- onBlur: () => setOpen(false),
2197
- children: ["!", tooltip]
2198
- }), (0, react_jsx_runtime.jsx)("style", {
2199
- children: ".mofeng-thinking-help{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid currentColor;border-radius:50%;font-size:11px;font-weight:700;line-height:1;cursor:help;vertical-align:middle}.mofeng-thinking-tooltip{position:fixed;z-index:2147483647;display:flex;flex-direction:column;gap:5px;box-sizing:border-box;padding:9px 12px;border:1px solid rgba(255,255,255,.18);border-radius:7px;background:#25282d;color:#f5f6f7;font-size:13px;font-weight:400;line-height:1.45;text-align:left;box-shadow:0 6px 20px rgba(0,0,0,.26);pointer-events:none}.mofeng-thinking-tooltip>span{display:block;white-space:normal;overflow-wrap:anywhere}"
2200
- })]
2201
- });
2434
+
2435
+ function withNativeClaudeProfile(profile) {
2436
+ const { compat: currentCompat, ...rest } = profile;
2437
+ const compat = { ...currentCompat };
2438
+ Reflect.deleteProperty(compat, "forceAdaptiveThinking");
2439
+ const models = Array.isArray(profile.models)
2440
+ ? profile.models.map(model => withNativeClaudeModel(model, currentCompat?.forceAdaptiveThinking))
2441
+ : profile.models;
2442
+ const next = { ...rest, ...Object.keys(compat).length ? { compat } : {}, ...models === undefined ? {} : { models } };
2443
+ // A provider-wide default must not refer to a level the edited models no longer offer.
2444
+ if (typeof next.reasoning === "string" && Array.isArray(models)
2445
+ && models.some(model => !Object.hasOwn(model.reasoningEfforts ?? {}, next.reasoning))) {
2446
+ Reflect.deleteProperty(next, "reasoning");
2447
+ }
2448
+ return next;
2202
2449
  }
2450
+
2203
2451
  function isClaudeProvider(row, state) {
2204
- const namespace = state.namespaces.get(CLAUDE_PROVIDER_SETTINGS_NS);
2205
- return namespace?.value?.providerTypes?.[row.entry.provider] === CLAUDE_PROVIDER_TYPE;
2452
+ const namespace = state.namespaces.get(CLAUDE_PROVIDER_SETTINGS_NS);
2453
+ return namespace?.value?.providerTypes?.[row.entry.provider] === CLAUDE_PROVIDER_TYPE;
2454
+ }
2455
+
2456
+ function ClaudeAdaptiveThinking({ model, inherited, position, disabled, t, onChange }) {
2457
+ const label = `${t("claudeAdaptiveThinking")} ${position}`;
2458
+ return react_jsx_runtime.jsxs("div", {
2459
+ className: ModelsSection_module_css_default["modelReasoningHead"],
2460
+ style: { marginTop: 4, marginBottom: 12 },
2461
+ children: [react_jsx_runtime.jsxs("span", {
2462
+ className: `${ModelsSection_module_css_default["modelFieldLabel"]} ${ModelsSection_module_css_default["modelReasoningLabel"]}`,
2463
+ children: [t("claudeAdaptiveThinking"), react_jsx_runtime.jsx(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2464
+ label: t("claudeAdaptiveHelp"), side: "right", delayMs: 0, focusDelayMs: 0, portal: true, openOnClick: true,
2465
+ children: react_jsx_runtime.jsx("button", {
2466
+ type: "button", className: ModelsSection_module_css_default["helpButton"],
2467
+ "aria-label": t("claudeAdaptiveHelpLabel"), children: "?"
2468
+ })
2469
+ })]
2470
+ }), react_jsx_runtime.jsx(_deepseek_ai_dsh_client_ui_primitives.Switch, {
2471
+ checked: claudeAdaptiveEnabled(model, inherited), label,
2472
+ disabled: disabled || CLAUDE_KNOWN_MODELS[model.id]?.preset === "toggle",
2473
+ onChange: enabled => onChange(withClaudeAdaptive(model, enabled))
2474
+ })]
2475
+ });
2206
2476
  }
2477
+
2478
+ // END CLAUDE HELPERS
2207
2479
  /** Stable visible and accessible identity for one provider target. */
2208
2480
  function providerTargetLabel(target) {
2209
2481
  return target.provider === target.displayName ? target.provider : `${target.displayName} (${target.provider})`;
@@ -2364,6 +2636,7 @@ window.__ModuleLoader__.load({
2364
2636
  });
2365
2637
  const piAi = state.namespaces.get("llm-pi-ai");
2366
2638
  const protocols = protocolChoices(piAi, schema);
2639
+ const reasoningLevels = reasoningLevelChoices(piAi, schema);
2367
2640
  const catalogOffered = configurable.length > 0;
2368
2641
  const catalogEnabled = addable.length > 0;
2369
2642
  const customOffered = piAi !== void 0;
@@ -2646,6 +2919,7 @@ window.__ModuleLoader__.load({
2646
2919
  children: (0, react_jsx_runtime.jsx)(CustomProviderCard, {
2647
2920
  taken: state.rows.map((row) => row.entry.provider),
2648
2921
  protocols,
2922
+ reasoningLevels,
2649
2923
  revision: piAi.revision,
2650
2924
  operations,
2651
2925
  t,
@@ -2669,6 +2943,7 @@ window.__ModuleLoader__.load({
2669
2943
  providerType: CLAUDE_PROVIDER_TYPE,
2670
2944
  taken: state.rows.map((row) => row.entry.provider),
2671
2945
  protocols,
2946
+ reasoningLevels,
2672
2947
  revision: piAi.revision,
2673
2948
  operations,
2674
2949
  t,
@@ -3224,6 +3499,16 @@ window.__ModuleLoader__.load({
3224
3499
  modelInputTypes: "Input types",
3225
3500
  modelInputText: "Text",
3226
3501
  modelInputImage: "Image",
3502
+ modelReasoning: "Reasoning levels",
3503
+ modelReasoningLevel: "Level",
3504
+ modelReasoningValue: "API value",
3505
+ modelReasoningHelp: "About reasoning levels",
3506
+ modelReasoningHelpText: "The API value is sent in the request's reasoning-effort field, such as OpenAI's reasoning_effort. It defaults to the level name; where the model provider's API documentation specifies a different value, follow it. Off turns reasoning off and needs no value; a value already written in the configuration is kept and sent.",
3507
+ modelReasoningNeedsLevel: "Add at least one level besides Off, or turn reasoning levels off.",
3508
+ modelReasoningValueRequired: "Every level besides Off needs an API value, and no value can be empty.",
3509
+ modelReasoningAdd: "Add level",
3510
+ modelReasoningRemove: "Delete level",
3511
+ modelReasoningOffValuePlaceholder: "Turns reasoning off",
3227
3512
  addModel: "Add model",
3228
3513
  removeModel: "Delete model",
3229
3514
  modelsEmpty: "No models will be shown in the selector. Unlisted IDs can still be sent directly.",
@@ -3252,17 +3537,10 @@ window.__ModuleLoader__.load({
3252
3537
  customTag: "Custom",
3253
3538
  claudeCustomAdd: "Add Claude provider",
3254
3539
  claudeCustomTitle: "Claude provider",
3255
- claudeTypeUnavailable: "Claude provider type storage is unavailable.",
3256
3540
  claudeTypeTag: "Claude provider",
3257
- claudeTypeIntro: "This provider type saves native RC8 adaptive-thinking compatibility, model reasoning mappings, Claude model discovery, and recorded capacities.",
3258
- adaptiveClaudeEnabled: "Choose a thinking mode for each model; new models default to five levels.",
3259
- adaptiveClaudeHelpLabel: "Thinking mode help",
3260
- adaptiveClaudeHelp: "Five (low / medium / high / xhigh / max): Haiku 5.5, Fable 5.1, Fable 5, Opus 5, Opus 4.8, Opus 4.7, Sonnet 5\nFour (low / medium / high / max): Opus 4.6, Sonnet 4.6\nOn / Off: Haiku 4.5",
3261
- adaptiveClaudeTag: "Claude configured",
3262
- thinkingPreset: "Thinking mode",
3263
- thinkingPresetToggle: "On / Off",
3264
- thinkingPresetFour: "Four levels",
3265
- thinkingPresetFive: "Five levels (default)",
3541
+ claudeAdaptiveThinking: "Adaptive thinking",
3542
+ claudeAdaptiveHelpLabel: "Adaptive thinking help",
3543
+ claudeAdaptiveHelp: "For Anthropic-compatible models that support adaptive thinking. When enabled, the model adjusts its thinking based on task complexity and your selected reasoning level. When disabled, it uses the thinking token limit associated with that level.",
3266
3544
  customRoute: "Provider ID",
3267
3545
  customRouteHint: "Lowercase identifier, starting with a letter, that uniquely names this provider in requests and as its credential name.",
3268
3546
  customRouteInvalid: "Start with a lowercase letter; then lowercase letters, digits, and dashes.",
@@ -3364,6 +3642,16 @@ window.__ModuleLoader__.load({
3364
3642
  modelInputTypes: "输入类型",
3365
3643
  modelInputText: "文本",
3366
3644
  modelInputImage: "图片",
3645
+ modelReasoning: "推理等级",
3646
+ modelReasoningLevel: "档位",
3647
+ modelReasoningValue: "API 参数值",
3648
+ modelReasoningHelp: "推理等级说明",
3649
+ modelReasoningHelpText: "API 参数值会写入请求的推理强度字段(如 OpenAI 的 reasoning_effort),默认与档位名相同;如有不同,以模型提供商的 API 文档为准。Off 表示关闭思考,不需要填写参数值;配置中已写入的值会保留并发送。",
3650
+ modelReasoningNeedsLevel: "至少添加一个 Off 以外的档位;不需要思考请关闭推理等级。",
3651
+ modelReasoningValueRequired: "Off 以外的档位都需要填写 API 参数值,且参数值不能为空字符串。",
3652
+ modelReasoningAdd: "添加档位",
3653
+ modelReasoningRemove: "删除档位",
3654
+ modelReasoningOffValuePlaceholder: "关闭思考",
3367
3655
  addModel: "添加模型",
3368
3656
  removeModel: "删除模型",
3369
3657
  modelsEmpty: "模型选择器中将不显示任何模型;目录外 ID 仍可直接发送。",
@@ -3392,17 +3680,10 @@ window.__ModuleLoader__.load({
3392
3680
  customTag: "自定义",
3393
3681
  claudeCustomAdd: "添加 Claude 提供方",
3394
3682
  claudeCustomTitle: "Claude 提供方",
3395
- claudeTypeUnavailable: "Claude 提供方类型存储不可用。",
3396
3683
  claudeTypeTag: "Claude 提供方",
3397
- claudeTypeIntro: "此提供方类型会写入 RC8 原生自适应思考兼容配置、模型思考映射、Claude 模型发现和已记录容量。",
3398
- adaptiveClaudeEnabled: "每个模型可单独选择思考模式,新增模型默认使用五档。",
3399
- adaptiveClaudeHelpLabel: "思考模式说明",
3400
- adaptiveClaudeHelp: "五档(低 / 中 / 高 / 超高 / 最大):Haiku 5.5、Fable 5.1、Fable 5、Opus 5、Opus 4.8、Opus 4.7、Sonnet 5\n四档(低 / 中 / 高 / 最大):Opus 4.6、Sonnet 4.6\n开启 / 关闭:Haiku 4.5",
3401
- adaptiveClaudeTag: "Claude 已适配",
3402
- thinkingPreset: "思考模式",
3403
- thinkingPresetToggle: "开启 / 关闭",
3404
- thinkingPresetFour: "四档",
3405
- thinkingPresetFive: "五档(默认)",
3684
+ claudeAdaptiveThinking: "自适应思考",
3685
+ claudeAdaptiveHelpLabel: "自适应思考说明",
3686
+ claudeAdaptiveHelp: "适用于支持自适应思考的 Anthropic 兼容模型。开启后,模型根据任务难度和你选择的推理等级自动调整思考量;关闭后,改用该等级对应的思考 token 数量上限。",
3406
3687
  customRoute: "Provider ID",
3407
3688
  customRouteHint: "以小写字母开头的标识,在请求中唯一标识该提供商,并用于派生凭据名。",
3408
3689
  customRouteInvalid: "需以小写字母开头,之后可用小写字母、数字和短横线。",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mofeng2223/dsh-claude-provider",
3
- "version": "0.5.10",
4
- "description": "Custom Claude provider support for DeepSeek Harness 0.2.1-alpha.3",
3
+ "version": "0.6.0",
4
+ "description": "Custom Claude provider support for DeepSeek Harness 0.2.1-rc.1",
5
5
  "author": "mofeng2223",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -62,6 +62,6 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-alpha.3"
65
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-rc.1"
66
66
  }
67
67
  }
package/src/index.js CHANGED
@@ -23,11 +23,15 @@ export const CLAUDE_KNOWN_MODELS = Object.freeze({
23
23
  'claude-haiku-5-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
24
24
  'claude-haiku-4-5-20251001': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
25
25
  'claude-haiku-4-5': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
26
+ 'claude-opus-4-5-20251101': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
27
+ 'claude-opus-4-5': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
26
28
  'claude-opus-4-6': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'four' }),
27
29
  'claude-opus-4-7': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
28
30
  'claude-opus-4-8': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
29
31
  'claude-opus-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
30
32
  'claude-opus-5-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
33
+ 'claude-sonnet-4-5-20250929': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
34
+ 'claude-sonnet-4-5': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
31
35
  'claude-sonnet-4-6': Object.freeze({ contextWindow: 1000000, maxTokens: 64000, preset: 'four' }),
32
36
  'claude-sonnet-5-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
33
37
  'claude-sonnet-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),