@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 +77 -56
- package/README.zh-CN.md +69 -20
- package/lib/client.js +54 -54
- package/package.json +3 -3
- package/src/index.js +56 -0
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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
38
|
-
|
|
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
|
|
80
|
+
Install the generated package into the Web profile:
|
|
46
81
|
|
|
47
82
|
```sh
|
|
48
|
-
npx @deepseek-ai/dsh plugin --profile web add
|
|
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
|
-
|
|
86
|
+
Or install it into the Headless profile:
|
|
53
87
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
61
|
-
each rewritten request. The diagnostic contains only provider, model, and
|
|
62
|
-
selected effort.
|
|
92
|
+
## Uninstall
|
|
63
93
|
|
|
64
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
5
|
+
DeepSeek Harness 的通用推理强度控制与新版 Claude 模型要求的请求参数并不完全匹配,因此选择某个档位后,可能直接出现 HTTP 400,也可能被适配器静默映射成另一个实际档位,例如界面选择 Max,实际请求却只相当于 High。`@mofeng2223/dsh-claude-provider` 增加了一个明确的 Claude 提供方类型,并按照每个 Claude 模型的配置发送正确的推理参数。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 插件功能
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. **增加独立的 Claude 提供方类型**
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
模型设置页面会增加单独的“Claude 提供方”表单。你可以在这个类型下创建多个 Provider ID,不会与普通自定义提供方混在一起。
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65
|
+
安装后需要重启对应的 DeepSeek Harness 进程。
|
|
25
66
|
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
103
|
+
## 许可证
|
|
55
104
|
|
|
56
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
74
|
+
"editorHeader": "zGbnIq_editorHeader",
|
|
88
75
|
"addModelButton": "zGbnIq_addModelButton",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
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
|
-
"
|
|
96
|
-
"rowIdentity": "zGbnIq_rowIdentity",
|
|
80
|
+
"advancedHint": "zGbnIq_advancedHint",
|
|
97
81
|
"modelCatalog": "zGbnIq_modelCatalog",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
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
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
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
|
-
"
|
|
2239
|
-
"title": "jLrgrW_title",
|
|
2238
|
+
"content": "jLrgrW_content",
|
|
2240
2239
|
"dialog": "jLrgrW_dialog",
|
|
2241
|
-
"
|
|
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.
|
|
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.
|
|
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.
|
|
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
|