@mofeng2223/dsh-claude-provider 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,83 +2,104 @@
2
2
 
3
3
  English | [简体中文](./README.zh-CN.md)
4
4
 
5
- `@mofeng2223/dsh-claude-provider` adds a visible, reusable Claude provider type
6
- to DeepSeek Harness and fixes its routes when an Anthropic Messages adapter still
7
- serialize reasoning as `thinking.type: enabled` with `budget_tokens`. For the
8
- explicitly registered provider/model pairs, it converts the outgoing request to
9
- `thinking.type: adaptive` plus `output_config.effort`.
10
-
11
- Use **Add Claude provider** to create any number of Provider IDs under this one
12
- type. Membership is stored explicitly in the plugin's own settings namespace.
13
- The plugin never infers membership from the `anthropic-messages` protocol, a
14
- `claude-*` model ID, or a default reasoning value. Generic custom providers and
15
- built-in providers are therefore untouched even when they use the same wire
16
- protocol.
17
-
18
- Only explicitly typed providers receive the Claude badge, native model
19
- discovery, recorded capacity defaults, per-model thinking modes, and adaptive
20
- request conversion. At request time the plugin reads the selected model's
21
- configured effort list: four- and five-level profiles use adaptive thinking,
22
- while an On/Off profile keeps the legacy budget-based path. Newly entered
23
- models default to five levels, so future model IDs can be configured without a
24
- plugin update. Claude providers select High by default; toggle-only models are
25
- shown as On/Off and default to On, without an extra provider-default choice.
26
-
27
- The same package supplies both the Host request adapter and the Web settings
28
- client. The client marks its model-directory request with a private discovery
29
- protocol handled by the Host half. Only that request uses Anthropic's native
30
- `GET /v1/models` endpoint, with `x-api-key` and `anthropic-version` headers.
31
- It supports Anthropic cursor pagination and reads `display_name`,
32
- `max_input_tokens`, and `max_tokens` when the provider returns them. No
33
- OpenAI-compatible listing or Bearer-auth fallback is attempted.
5
+ DeepSeek Harness's generic reasoning controls do not fully match the request parameters expected by newer Claude models. A selected level can therefore fail with HTTP 400, or be silently mapped to another effective level, such as Max behaving as High. `@mofeng2223/dsh-claude-provider` adds an explicit Claude provider type and sends the reasoning parameters that each configured Claude model expects.
6
+
7
+ ## What this plugin does
8
+
9
+ 1. **Adds a dedicated Claude provider type**
10
+
11
+ The Models settings page gains a separate **Claude Provider** form. You can create multiple Provider IDs under this type without mixing them with generic custom providers.
12
+
13
+ <p align="center">
14
+ <img src="./docs/images/provider-entry.en.jpg" alt="Add Claude Provider entry in DeepSeek Harness" width="580">
15
+ </p>
16
+
17
+ Selecting **Add Claude Provider** opens the dedicated Anthropic Messages form:
18
+
19
+ <p align="center">
20
+ <img src="./docs/images/claude-provider-form.en.jpg" alt="Claude Provider form in DeepSeek Harness" width="580">
21
+ </p>
22
+
23
+ 2. **Adds model-specific reasoning modes**
24
+
25
+ Each model can use one of three configurable mode sets:
26
+
27
+ - Five levels: Low, Medium, High, XHigh, and Max
28
+ - Four levels: Low, Medium, High, and Max
29
+ - Toggle: On or Off
30
+
31
+ New models default to five levels. Claude providers default to High, while toggle-only models default to On. For adaptive-thinking models, the plugin converts the selection to Claude's `thinking.type: adaptive` and `output_config.effort` request format instead of allowing the adapter to collapse or reject the selected level.
32
+
33
+ <p align="center">
34
+ <img src="./docs/images/model-defaults.en.jpg" alt="Claude model capacity defaults and reasoning modes" width="580">
35
+ </p>
36
+
37
+ 3. **Adds native Anthropic model discovery**
38
+
39
+ DeepSeek Harness's generic custom provider cannot list models for the `anthropic-messages` protocol. This plugin adds model discovery for Claude providers through the provider's native Anthropic-compatible `GET /v1/models` endpoint, including cursor pagination.
40
+
41
+ 4. **Fills known Claude model defaults after discovery**
42
+
43
+ When a discovered model matches a recorded Claude model ID, the plugin automatically fills its context window, maximum output length, and reasoning-mode set. Models entered manually remain fully editable and are not overwritten by this lookup.
44
+
45
+ 5. **Leaves every other provider unchanged**
46
+
47
+ All discovery, defaults, reasoning controls, and request rewriting are limited to Provider IDs explicitly created as **Claude Providers**. DeepSeek Harness's built-in providers and ordinary custom providers keep their original behavior, even when they use `anthropic-messages` or expose a `claude-*` model ID.
34
48
 
35
49
  ## Install
36
50
 
37
- Build the Web client and refresh the single distributable archive after
38
- changing the plugin source:
51
+ ### Published package
52
+
53
+ Install the Web profile for the browser interface:
39
54
 
40
55
  ```sh
56
+ npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
57
+ ```
58
+
59
+ Install the Headless profile for command-line runs without the Web interface:
60
+
61
+ ```sh
62
+ npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
63
+ ```
64
+
65
+ Restart the corresponding DeepSeek Harness process after installation.
66
+
67
+ ### From source
68
+
69
+ Build and package the repository first:
70
+
71
+ ```sh
72
+ git clone https://github.com/MoFeng2223/dsh-claude-provider.git
73
+ cd dsh-claude-provider
74
+ npm install
41
75
  npm run build
76
+ mkdir -p dist
42
77
  npm pack --pack-destination dist
43
78
  ```
44
79
 
45
- Install the published package directly:
80
+ Install the generated package into the Web profile:
46
81
 
47
82
  ```sh
48
- npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
49
- npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
83
+ npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
50
84
  ```
51
85
 
52
- Restart the corresponding Harness process after installation.
86
+ Or install it into the Headless profile:
53
87
 
54
- Do not use the source directory as the normal installation target. That creates
55
- a pnpm `link:` dependency, and current DSH/pnpm builds can leave the top-level
56
- link behind after the dependency and bundle registration have been removed.
57
- Archive installs are package-manager-owned and uninstall without those stale
58
- links.
88
+ ```sh
89
+ npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
90
+ ```
59
91
 
60
- Set `DSH_CLAUDE_PROVIDER_DEBUG=1` temporarily to print one redacted line for
61
- each rewritten request. The diagnostic contains only provider, model, and
62
- selected effort.
92
+ ## Uninstall
63
93
 
64
- ## Remove
94
+ Run the command for each profile where the plugin was installed:
65
95
 
66
96
  ```sh
67
97
  npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
68
98
  npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
69
99
  ```
70
100
 
71
- Uninstall intentionally leaves `~/.dsh/settings.yaml` and stored credentials
72
- alone. Existing Claude-type providers therefore remain visible as ordinary custom
73
- `anthropic-messages` routes, but lose this plugin's Claude badge, per-model
74
- thinking-mode controls, native Anthropic model discovery, and adaptive request
75
- rewrite.
101
+ Uninstalling the plugin does not delete `~/.dsh/settings.yaml` or stored credentials. Existing Claude providers remain configured as ordinary custom `anthropic-messages` routes, but lose the Claude-specific interface, model discovery, defaults, reasoning controls, and adaptive request conversion supplied by this plugin.
76
102
 
77
- The plugin never stores or logs API keys. Model discovery uses the one-shot key
78
- typed into the form or resolves the existing route's credential through DSH;
79
- the value is sent only to that route's Anthropic Models API. Its request
80
- transformer runs only inside `llm/stream` calls for Provider IDs explicitly
81
- registered under this plugin's type and leaves every other provider untouched.
103
+ ## License
82
104
 
83
- The generated `.tgz` package is portable. Copy it to Windows and install it by
84
- its local path; no source build or platform-specific dependency is required.
105
+ [MIT](./LICENSE)
package/README.zh-CN.md CHANGED
@@ -2,55 +2,104 @@
2
2
 
3
3
  [English](./README.md) | 简体中文
4
4
 
5
- `@mofeng2223/dsh-claude-provider` 为 DeepSeek Harness 增加一个可见且可复用的“Claude 提供方”类型,并修正其 Anthropic Messages 适配器仍将思考参数序列化为 `thinking.type: enabled` `budget_tokens` 的问题。对于明确登记在此类型下的提供方和模型组合,插件会将请求转换为 `thinking.type: adaptive` 与 `output_config.effort`。
5
+ DeepSeek Harness 的通用推理强度控制与新版 Claude 模型要求的请求参数并不完全匹配,因此选择某个档位后,可能直接出现 HTTP 400,也可能被适配器静默映射成另一个实际档位,例如界面选择 Max,实际请求却只相当于 High。`@mofeng2223/dsh-claude-provider` 增加了一个明确的 Claude 提供方类型,并按照每个 Claude 模型的配置发送正确的推理参数。
6
6
 
7
- 通过“添加 Claude 提供方”可以在同一个类型下创建任意多个 Provider ID。类型归属会明确保存在插件自己的设置命名空间中。插件不会根据 `anthropic-messages` 协议、`claude-*` 模型 ID 或默认思考强度推断类型。因此,即使通用自定义提供方或内置提供方使用相同协议,插件也不会修改它们。
7
+ ## 插件功能
8
8
 
9
- 只有明确登记为此类型的提供方才会获得 Claude 标识、原生模型发现、已记录容量预填、按模型设置思考模式以及 adaptive 请求转换。发送请求时,插件会读取所选模型配置的思考档位:四档和五档配置使用 adaptive thinking;开启/关闭配置继续使用旧版基于预算的思考方式。手动新增的模型默认使用五档,因此未来新增的模型 ID 也可以直接配置。Claude 提供方默认选择 High;仅支持开关的模型显示为 On/Off,并默认选择 On,不再额外显示 Default。
9
+ 1. **增加独立的 Claude 提供方类型**
10
10
 
11
- 同一个 npm 包同时提供 Host 请求适配器和 Web 设置客户端。客户端会使用内部发现协议标记“获取模型目录”请求,再由 Host 部分处理。只有这个请求会调用 Anthropic 原生的 `GET /v1/models` 接口,并使用 `x-api-key` 和 `anthropic-version` 请求头。
11
+ 模型设置页面会增加单独的“Claude 提供方”表单。你可以在这个类型下创建多个 Provider ID,不会与普通自定义提供方混在一起。
12
12
 
13
- 插件支持 Anthropic 游标分页,并会在提供方返回相关字段时读取 `display_name`、`max_input_tokens` 和 `max_tokens`。插件不会尝试使用 OpenAI 兼容的模型列表接口,也不会回退到 Bearer 鉴权。
13
+ <p align="center">
14
+ <img src="./docs/images/provider-entry.jpg" alt="DeepSeek Harness 中新增的 Claude 提供方入口" width="580">
15
+ </p>
16
+
17
+ 点击“添加 Claude 提供方”后,会打开独立的 Anthropic Messages 配置表单:
18
+
19
+ <p align="center">
20
+ <img src="./docs/images/claude-provider-form.jpg" alt="DeepSeek Harness 中的 Claude 提供方表单" width="580">
21
+ </p>
22
+
23
+ 2. **增加按模型设置的推理模式**
24
+
25
+ 每个模型可以单独选择以下三种档位配置之一:
26
+
27
+ - 五档:Low、Medium、High、XHigh、Max
28
+ - 四档:Low、Medium、High、Max
29
+ - 开关:On、Off
30
+
31
+ 新增模型默认使用五档。Claude 提供方默认选择 High,仅支持开关的模型默认选择 On。对于 adaptive thinking 模型,插件会把所选档位转换成 Claude 使用的 `thinking.type: adaptive` 与 `output_config.effort` 请求格式,避免适配器拒绝请求或把档位降级。
32
+
33
+ <p align="center">
34
+ <img src="./docs/images/model-defaults.jpg" alt="Claude 模型容量预填与思考模式设置" width="580">
35
+ </p>
36
+
37
+ 3. **补充 Anthropic 原生模型探测**
38
+
39
+ DeepSeek Harness 的普通自定义提供方在使用 `anthropic-messages` 协议时无法获取模型列表。本插件为 Claude 提供方增加了基于 Anthropic 兼容 `GET /v1/models` 接口的模型探测,并支持游标分页。
40
+
41
+ 4. **探测后自动填写常用 Claude 模型参数**
42
+
43
+ 探测到的模型 ID 如果与插件已经记录的 Claude 模型匹配,插件会自动填写上下文窗口、最大输出长度和推理模式。用户手动添加的模型仍然可以自由编辑,不会被这项自动匹配覆盖。
44
+
45
+ 5. **不影响其他提供方**
46
+
47
+ 模型探测、参数预填、推理档位和请求转换只对明确创建为“Claude 提供方”的 Provider ID 生效。DeepSeek Harness 的内置提供方和普通自定义提供方会保持原有行为,即使它们同样使用 `anthropic-messages` 协议,或者包含 `claude-*` 模型 ID,也不会被插件修改。
14
48
 
15
49
  ## 安装
16
50
 
17
- 直接安装 npm 上发布的插件:
51
+ ### 安装已发布的版本
52
+
53
+ 浏览器界面使用 Web Profile:
18
54
 
19
55
  ```sh
20
56
  npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
57
+ ```
58
+
59
+ 不使用 Web 界面的命令行运行使用 Headless Profile:
60
+
61
+ ```sh
21
62
  npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
22
63
  ```
23
64
 
24
- 安装完成后,重启对应的 Harness 进程。
65
+ 安装后需要重启对应的 DeepSeek Harness 进程。
25
66
 
26
- 修改插件源码后,可以重新构建 Web 客户端并生成单一分发包:
67
+ ### 从源码安装
68
+
69
+ 先克隆、构建并打包项目:
27
70
 
28
71
  ```sh
72
+ git clone https://github.com/MoFeng2223/dsh-claude-provider.git
73
+ cd dsh-claude-provider
74
+ npm install
29
75
  npm run build
76
+ mkdir -p dist
30
77
  npm pack --pack-destination dist
31
78
  ```
32
79
 
33
- 日常安装不建议直接使用源码目录。直接安装源码目录会创建 pnpm `link:` 依赖;在目前的 DSH/pnpm 版本中,移除依赖和 bundle 注册后,顶层符号链接仍有可能残留。通过 npm 或 `.tgz` 归档安装时,文件由包管理器管理,卸载后不会留下这类链接。
80
+ 将生成的包安装到 Web Profile:
81
+
82
+ ```sh
83
+ npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
84
+ ```
34
85
 
35
- ## 调试
86
+ 或者安装到 Headless Profile:
36
87
 
37
- 临时设置 `DSH_CLAUDE_PROVIDER_DEBUG=1`,可以为每个被改写的请求输出一行经过脱敏的诊断信息。诊断内容只包含提供方、模型和所选思考强度,不包含 API 密钥。
88
+ ```sh
89
+ npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
90
+ ```
38
91
 
39
92
  ## 卸载
40
93
 
94
+ 插件安装在哪个 Profile,就执行对应的卸载命令:
95
+
41
96
  ```sh
42
97
  npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
43
98
  npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
44
99
  ```
45
100
 
46
- 卸载插件时会保留 `~/.dsh/settings.yaml` 和已经保存的凭据。现有的 Claude 类型提供方仍会作为普通的 `anthropic-messages` 自定义路由显示,但会失去本插件提供的 Claude 标识、按模型配置思考模式、Anthropic 原生模型发现以及 adaptive 请求改写功能。
47
-
48
- ## 安全与隐私
49
-
50
- 插件不会存储或记录 API 密钥。获取模型列表时,插件会使用表单中临时输入的密钥,或者通过 DSH 解析现有路由保存的凭据。密钥只会发送到该路由对应的 Anthropic Models API。
51
-
52
- 请求转换器只会在明确登记到本插件类型的 Provider ID 所对应的 `llm/stream` 调用中运行,不会修改任何其他提供方。
101
+ 卸载插件不会删除 `~/.dsh/settings.yaml` 或已经保存的凭据。已有的 Claude 提供方会继续作为普通的 `anthropic-messages` 自定义路由保留,但会失去本插件提供的 Claude 专用界面、模型探测、参数预填、推理档位和 adaptive 请求转换。
53
102
 
54
- ## Windows 支持
103
+ ## 许可证
55
104
 
56
- 发布到 npm 的插件和生成的 `.tgz` 包均可跨平台使用。Windows 可以直接通过 npm 包名或本地 `.tgz` 路径安装,无需在目标电脑上重新构建,也不依赖平台专用的原生模块。
105
+ [MIT](./LICENSE)
package/lib/client.js CHANGED
@@ -68,67 +68,67 @@ window.__ModuleLoader__.load({
68
68
  document.head.appendChild(tag);
69
69
  }
70
70
  var ModelsSection_module_css_default = {
71
- "iconButtonDanger": "zGbnIq_iconButtonDanger",
72
- "editorActions": "zGbnIq_editorActions",
73
- "error": "zGbnIq_error",
74
- "modelRow": "zGbnIq_modelRow",
71
+ "editorRoute": "zGbnIq_editorRoute",
75
72
  "section": "zGbnIq_section",
76
- "linkButton": "zGbnIq_linkButton",
77
- "hiddenLabel": "zGbnIq_hiddenLabel",
78
- "rows": "zGbnIq_rows",
79
- "candidateLabel": "zGbnIq_candidateLabel",
80
- "input": "zGbnIq_input",
81
- "notice": "zGbnIq_notice",
82
- "fetchDialog": "zGbnIq_fetchDialog",
83
- "candidate": "zGbnIq_candidate",
84
- "customizedBody": "zGbnIq_customizedBody",
85
- "modelListHead": "zGbnIq_modelListHead",
86
73
  "deleteDialog": "zGbnIq_deleteDialog",
87
- "modelEntry": "zGbnIq_modelEntry",
74
+ "editorHeader": "zGbnIq_editorHeader",
88
75
  "addModelButton": "zGbnIq_addModelButton",
89
- "modelCatalogTitle": "zGbnIq_modelCatalogTitle",
90
- "editorRoute": "zGbnIq_editorRoute",
91
- "rowCard": "zGbnIq_rowCard",
92
- "rowName": "zGbnIq_rowName",
93
- "modelAdvanced": "zGbnIq_modelAdvanced",
76
+ "fieldLabel": "zGbnIq_fieldLabel",
77
+ "deleteConfirm": "zGbnIq_deleteConfirm",
78
+ "addButton": "zGbnIq_addButton",
94
79
  "primaryButton": "zGbnIq_primaryButton",
95
- "intro": "zGbnIq_intro",
96
- "rowIdentity": "zGbnIq_rowIdentity",
80
+ "advancedHint": "zGbnIq_advancedHint",
97
81
  "modelCatalog": "zGbnIq_modelCatalog",
98
- "editorHeader": "zGbnIq_editorHeader",
99
- "credentialDot": "zGbnIq_credentialDot",
100
- "dangerButton": "zGbnIq_dangerButton",
101
- "modelFieldLabel": "zGbnIq_modelFieldLabel",
102
- "field": "zGbnIq_field",
82
+ "modelRow": "zGbnIq_modelRow",
83
+ "fetchDialog": "zGbnIq_fetchDialog",
84
+ "modelAdvanced": "zGbnIq_modelAdvanced",
85
+ "editorActions": "zGbnIq_editorActions",
103
86
  "credentialDotConfigured": "zGbnIq_credentialDotConfigured",
104
87
  "addBlock": "zGbnIq_addBlock",
105
- "deleteConfirm": "zGbnIq_deleteConfirm",
106
- "modelEmpty": "zGbnIq_modelEmpty",
107
- "editor": "zGbnIq_editor",
108
- "addButton": "zGbnIq_addButton",
109
- "candidateList": "zGbnIq_candidateList",
110
- "secondaryButton": "zGbnIq_secondaryButton",
111
- "modelCatalogMeta": "zGbnIq_modelCatalogMeta",
112
- "modelField": "zGbnIq_modelField",
113
- "customized": "zGbnIq_customized",
88
+ "dangerButton": "zGbnIq_dangerButton",
89
+ "rowCard": "zGbnIq_rowCard",
90
+ "credentialDot": "zGbnIq_credentialDot",
114
91
  "selectInput": "zGbnIq_selectInput",
92
+ "error": "zGbnIq_error",
93
+ "secondaryButton": "zGbnIq_secondaryButton",
94
+ "modelCatalogHeading": "zGbnIq_modelCatalogHeading",
95
+ "modelList": "zGbnIq_modelList",
96
+ "modelEntry": "zGbnIq_modelEntry",
97
+ "candidate": "zGbnIq_candidate",
98
+ "modelFieldLabel": "zGbnIq_modelFieldLabel",
99
+ "editor": "zGbnIq_editor",
100
+ "intro": "zGbnIq_intro",
101
+ "modelCatalogTitle": "zGbnIq_modelCatalogTitle",
102
+ "input": "zGbnIq_input",
103
+ "rowTag": "zGbnIq_rowTag",
104
+ "notice": "zGbnIq_notice",
105
+ "modelEmpty": "zGbnIq_modelEmpty",
106
+ "addCard": "zGbnIq_addCard",
115
107
  "iconButton": "zGbnIq_iconButton",
108
+ "linkButton": "zGbnIq_linkButton",
109
+ "hiddenLabel": "zGbnIq_hiddenLabel",
110
+ "candidateId": "zGbnIq_candidateId",
116
111
  "setupCard": "zGbnIq_setupCard",
117
- "fieldLabel": "zGbnIq_fieldLabel",
112
+ "iconButtonDanger": "zGbnIq_iconButtonDanger",
113
+ "title": "zGbnIq_title",
114
+ "rowIdentity": "zGbnIq_rowIdentity",
115
+ "savedNotice": "zGbnIq_savedNotice",
116
+ "candidateLabel": "zGbnIq_candidateLabel",
118
117
  "rowActions": "zGbnIq_rowActions",
119
- "addCard": "zGbnIq_addCard",
120
- "candidateId": "zGbnIq_candidateId",
121
- "modelCatalogHeading": "zGbnIq_modelCatalogHeading",
122
- "credentialDotMissing": "zGbnIq_credentialDotMissing",
123
- "rowTag": "zGbnIq_rowTag",
124
- "customizedSummary": "zGbnIq_customizedSummary",
125
118
  "addActions": "zGbnIq_addActions",
119
+ "candidateList": "zGbnIq_candidateList",
120
+ "rows": "zGbnIq_rows",
121
+ "rowName": "zGbnIq_rowName",
122
+ "modelField": "zGbnIq_modelField",
123
+ "customized": "zGbnIq_customized",
124
+ "modelListHead": "zGbnIq_modelListHead",
126
125
  "editorTitle": "zGbnIq_editorTitle",
127
- "savedNotice": "zGbnIq_savedNotice",
128
- "modelList": "zGbnIq_modelList",
129
- "advancedHint": "zGbnIq_advancedHint",
130
- "title": "zGbnIq_title",
131
- "rowHead": "zGbnIq_rowHead"
126
+ "rowHead": "zGbnIq_rowHead",
127
+ "field": "zGbnIq_field",
128
+ "modelCatalogMeta": "zGbnIq_modelCatalogMeta",
129
+ "credentialDotMissing": "zGbnIq_credentialDotMissing",
130
+ "customizedSummary": "zGbnIq_customizedSummary",
131
+ "customizedBody": "zGbnIq_customizedBody"
132
132
  };
133
133
  //#endregion
134
134
  //#region lib/types/client/EditorFooter.js
@@ -2235,10 +2235,10 @@ window.__ModuleLoader__.load({
2235
2235
  document.head.appendChild(tag);
2236
2236
  }
2237
2237
  var OnboardingModal_module_css_default = {
2238
- "body": "jLrgrW_body",
2239
- "title": "jLrgrW_title",
2238
+ "content": "jLrgrW_content",
2240
2239
  "dialog": "jLrgrW_dialog",
2241
- "content": "jLrgrW_content"
2240
+ "title": "jLrgrW_title",
2241
+ "body": "jLrgrW_body"
2242
2242
  };
2243
2243
  //#endregion
2244
2244
  //#region lib/types/client/OnboardingModal.js
@@ -2388,10 +2388,10 @@ window.__ModuleLoader__.load({
2388
2388
  document.head.appendChild(tag);
2389
2389
  }
2390
2390
  var WelcomeNotice_module_css_default = {
2391
- "error": "t1T8VW_error",
2392
- "primary": "t1T8VW_primary",
2393
2391
  "copy": "t1T8VW_copy",
2394
- "actions": "t1T8VW_actions"
2392
+ "actions": "t1T8VW_actions",
2393
+ "primary": "t1T8VW_primary",
2394
+ "error": "t1T8VW_error"
2395
2395
  };
2396
2396
  //#endregion
2397
2397
  //#region lib/types/client/WelcomeNotice.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mofeng2223/dsh-claude-provider",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Custom Claude provider support for DeepSeek Harness",
5
5
  "author": "mofeng2223",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "type": "module",
26
26
  "dependencies": {
27
- "@deepseek-ai/dsh-settings": "0.1.0-rc.6",
27
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.7",
28
28
  "@deepseek-ai/schemastery": "3.18.1"
29
29
  },
30
30
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=22.19"
49
49
  },
50
50
  "devDependencies": {
51
- "@deepseek-ai/dsh-client-ui-settings-models": "0.1.0-rc.6"
51
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.1.0-rc.7"
52
52
  },
53
53
  "dsh": {
54
54
  "bundle": {
package/src/index.js CHANGED
@@ -304,6 +304,61 @@ export function shouldUseAdaptiveThinking(modelInfo) {
304
304
  return ids.has('low') && ids.has('medium') && ids.has('high') && ids.has('max')
305
305
  }
306
306
 
307
+ function hasAdaptiveEffortMap(map) {
308
+ if (map === null || typeof map !== 'object' || Array.isArray(map)) return false
309
+ return ['low', 'medium', 'high', 'max'].every(level => typeof map[level] === 'string' && map[level].length > 0)
310
+ }
311
+
312
+ /** Whether a pi-ai catalog model should be serialized with adaptive thinking. */
313
+ export function piModelHasAdaptiveEfforts(model) {
314
+ return hasAdaptiveEffortMap(model?.thinkingLevelMap)
315
+ }
316
+
317
+ /**
318
+ * Stamp `compat.forceAdaptiveThinking` onto a pi-ai model so the Anthropic
319
+ * adapter builds `thinking.type: adaptive` before `@anthropic-ai/sdk` sees the
320
+ * payload. That is what removes the SDK deprecation warning for Opus 4.6.
321
+ */
322
+ export function withForcedAdaptiveThinking(model, provider, settings) {
323
+ if (!isClaudeProviderType(settings, provider)) return model
324
+ if (model === null || typeof model !== 'object' || Array.isArray(model)) return model
325
+ if (model.compat?.forceAdaptiveThinking === true) return model
326
+ if (!piModelHasAdaptiveEfforts(model)) return model
327
+ return {
328
+ ...model,
329
+ compat: { ...model.compat, forceAdaptiveThinking: true },
330
+ }
331
+ }
332
+
333
+ function installForceAdaptiveThinking(ctx, providerTypes) {
334
+ const llm = ctx.llm
335
+ if (typeof llm.listProviders !== 'function' || typeof llm.registration !== 'function') return
336
+
337
+ const patched = new WeakSet()
338
+ const wrap = () => {
339
+ for (const provider of llm.listProviders()) {
340
+ const id = provider?.id
341
+ if (typeof id !== 'string' || id.length === 0) continue
342
+ let adapter
343
+ try {
344
+ adapter = llm.registration(id).adapter
345
+ } catch {
346
+ continue
347
+ }
348
+ if (adapter === null || typeof adapter !== 'object' || typeof adapter.modelOf !== 'function') continue
349
+ if (patched.has(adapter)) continue
350
+ const original = adapter.modelOf.bind(adapter)
351
+ adapter.modelOf = (snapshot, providerId, modelId) => (
352
+ withForcedAdaptiveThinking(original(snapshot, providerId, modelId), providerId, providerTypes.get())
353
+ )
354
+ patched.add(adapter)
355
+ }
356
+ }
357
+
358
+ wrap()
359
+ ctx.effect(() => ctx.on('llm/adapters-updated', wrap), 'claude-provider: force adaptive thinking')
360
+ }
361
+
307
362
  function effortFromBudget(budget) {
308
363
  if (typeof budget !== 'number' || !Number.isFinite(budget)) return 'high'
309
364
  if (budget <= 2048) return 'low'
@@ -459,6 +514,7 @@ export function apply(ctx, config) {
459
514
  settingsPath: ['providerTypes'],
460
515
  }])
461
516
  installClaudeModelInfoDefaults(ctx, providerTypes)
517
+ installForceAdaptiveThinking(ctx, providerTypes)
462
518
  installClaudeModelDiscovery(ctx)
463
519
  const storage = new AsyncLocalStorage()
464
520
  const upstreamFetch = globalThis.fetch