@mofeng2223/dsh-claude-provider 0.2.1 → 0.3.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
@@ -2,83 +2,112 @@
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 general-purpose reasoning controls did not fully match the request parameters required by newer Claude models. As a result, selecting a reasoning level could either produce an HTTP 400 error or be silently mapped by the adapter to a different effective level—for example, Max in the interface could actually be sent as High. `@mofeng2223/dsh-claude-provider` added an explicit Claude provider type and sent the correct reasoning parameters for each Claude model.~~
6
+
7
+ DeepSeek Harness 0.1.0-rc.8 now supports reasoning-effort parameters for Claude models, but they still need to be configured manually in `settings.yaml`. Therefore, this plugin no longer intercepts or rewrites model requests at runtime. Instead, it writes the corresponding native settings to `settings.yaml` when a Claude provider is saved through the front end.
8
+
9
+ The plugin retains its dedicated Claude provider configuration page, so users do not need to edit `settings.yaml` manually. Anthropic-native model discovery, automatic defaults for common Claude models, and other features not yet available in DeepSeek Harness are also retained.
10
+
11
+ ## What this plugin does
12
+
13
+ 1. **Adds a dedicated Claude provider type**
14
+
15
+ 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.
16
+
17
+ <p align="center">
18
+ <img src="./docs/images/provider-entry.en.jpg" alt="Add Claude Provider entry in DeepSeek Harness" width="580">
19
+ </p>
20
+
21
+ Selecting **Add Claude Provider** opens the dedicated Anthropic Messages form:
22
+
23
+ <p align="center">
24
+ <img src="./docs/images/claude-provider-form.en.jpg" alt="Claude Provider form in DeepSeek Harness" width="580">
25
+ </p>
26
+
27
+ 2. **Adds model-specific reasoning modes**
28
+
29
+ Each model can use one of three configurable mode sets:
30
+
31
+ - Five levels: Low, Medium, High, XHigh, and Max
32
+ - Four levels: Low, Medium, High, and Max
33
+ - Toggle: On or Off
34
+
35
+ New models default to five levels, and Claude providers default to High.
36
+
37
+ ~~For adaptive thinking models, the plugin converted the selected level into Claude's `thinking.type: adaptive` and `output_config.effort` request format, preventing adapter rejections or silent downgrades.~~
38
+
39
+ For adaptive thinking models, the plugin writes the selected level to DSH's native configuration when saved.
40
+
41
+ <p align="center">
42
+ <img src="./docs/images/model-defaults.en.jpg" alt="Claude model capacity defaults and reasoning modes" width="580">
43
+ </p>
44
+
45
+ 3. **Adds native Anthropic model discovery**
46
+
47
+ 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.
48
+
49
+ 4. **Fills known Claude model defaults after discovery**
50
+
51
+ 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.
52
+
53
+ 5. **Uses native RC8 settings without request rewriting**
54
+
55
+ Discovery, defaults, and reasoning controls are limited to Provider IDs explicitly created as **Claude Providers**. The saved provider remains a standard `llm-pi-ai` route; the plugin neither replaces global `fetch` nor modifies RC8's model adapter.
34
56
 
35
57
  ## Install
36
58
 
37
- Build the Web client and refresh the single distributable archive after
38
- changing the plugin source:
59
+ ### Published package
60
+
61
+ Install the Web profile for the browser interface:
62
+
63
+ ```sh
64
+ npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
65
+ ```
66
+
67
+ Install the Headless profile for command-line runs without the Web interface:
39
68
 
40
69
  ```sh
70
+ npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
71
+ ```
72
+
73
+ Restart the corresponding DeepSeek Harness process after installation.
74
+
75
+ ### From source
76
+
77
+ Build and package the repository first:
78
+
79
+ ```sh
80
+ git clone https://github.com/MoFeng2223/dsh-claude-provider.git
81
+ cd dsh-claude-provider
82
+ npm install
41
83
  npm run build
84
+ mkdir -p dist
42
85
  npm pack --pack-destination dist
43
86
  ```
44
87
 
45
- Install the published package directly:
88
+ Install the generated package into the Web profile:
46
89
 
47
90
  ```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
91
+ npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
50
92
  ```
51
93
 
52
- Restart the corresponding Harness process after installation.
94
+ Or install it into the Headless profile:
53
95
 
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.
96
+ ```sh
97
+ npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
98
+ ```
59
99
 
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.
100
+ ## Uninstall
63
101
 
64
- ## Remove
102
+ Run the command for each profile where the plugin was installed:
65
103
 
66
104
  ```sh
67
105
  npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
68
106
  npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
69
107
  ```
70
108
 
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.
109
+ Uninstalling the plugin does not delete `~/.dsh/settings.yaml` or stored credentials. Existing Claude providers remain ordinary custom `anthropic-messages` routes. Their `reasoningEfforts`, default `reasoning`, and `compat.forceAdaptiveThinking` fields are native RC8 settings, so adaptive thinking and the front-end reasoning-effort selector continue to work. Only the dedicated Claude add/edit UI, model discovery, and recorded defaults disappear.
76
110
 
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.
111
+ ## License
82
112
 
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.
113
+ [MIT](./LICENSE)
package/README.zh-CN.md CHANGED
@@ -2,55 +2,112 @@
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
+ DeepSeek Harness 0.1.0-rc.8 已支持 Claude 系列模型的推理强度参数,但仍需要在 `settings.yaml` 中手动配置。因此,本插件不再在运行时拦截或改写模型请求,而是在用户通过前端保存 Claude 提供方时,将相应的原生配置正确写入 `settings.yaml`。
8
8
 
9
- 只有明确登记为此类型的提供方才会获得 Claude 标识、原生模型发现、已记录容量预填、按模型设置思考模式以及 adaptive 请求转换。发送请求时,插件会读取所选模型配置的思考档位:四档和五档配置使用 adaptive thinking;开启/关闭配置继续使用旧版基于预算的思考方式。手动新增的模型默认使用五档,因此未来新增的模型 ID 也可以直接配置。Claude 提供方默认选择 High;仅支持开关的模型显示为 On/Off,并默认选择 On,不再额外显示 Default。
9
+ 插件仍保留专用的 Claude 提供方配置页面,用户无需手动编辑 `settings.yaml`。Anthropic 原生模型探测、常用 Claude 模型参数自动填写等官方尚未实现的功能也继续保留。
10
10
 
11
- 同一个 npm 包同时提供 Host 请求适配器和 Web 设置客户端。客户端会使用内部发现协议标记“获取模型目录”请求,再由 Host 部分处理。只有这个请求会调用 Anthropic 原生的 `GET /v1/models` 接口,并使用 `x-api-key` 和 `anthropic-version` 请求头。
11
+ ## 插件功能
12
12
 
13
- 插件支持 Anthropic 游标分页,并会在提供方返回相关字段时读取 `display_name`、`max_input_tokens` 和 `max_tokens`。插件不会尝试使用 OpenAI 兼容的模型列表接口,也不会回退到 Bearer 鉴权。
13
+ 1. **增加独立的 Claude 提供方类型**
14
+
15
+ 模型设置页面会增加单独的“Claude 提供方”表单。你可以在这个类型下创建多个 Provider ID,不会与普通自定义提供方混在一起。
16
+
17
+ <p align="center">
18
+ <img src="./docs/images/provider-entry.jpg" alt="DeepSeek Harness 中新增的 Claude 提供方入口" width="580">
19
+ </p>
20
+
21
+ 点击“添加 Claude 提供方”后,会打开独立的 Anthropic Messages 配置表单:
22
+
23
+ <p align="center">
24
+ <img src="./docs/images/claude-provider-form.jpg" alt="DeepSeek Harness 中的 Claude 提供方表单" width="580">
25
+ </p>
26
+
27
+ 2. **增加按模型设置的推理模式**
28
+
29
+ 每个模型可以单独选择以下三种档位配置之一:
30
+
31
+ - 五档:Low、Medium、High、XHigh、Max
32
+ - 四档:Low、Medium、High、Max
33
+ - 开关:On、Off
34
+
35
+ 新增模型默认使用五档,Claude 提供方默认选择 High。
36
+
37
+ ~~对于 adaptive thinking 模型,插件会把所选档位转换成 Claude 使用的 `thinking.type: adaptive` 与 `output_config.effort` 请求格式,避免适配器拒绝请求或把档位降级。~~
38
+
39
+ 对于 adaptive thinking 模型,插件会在保存时将所选档位写入 dsh 原生配置。
40
+
41
+ <p align="center">
42
+ <img src="./docs/images/model-defaults.jpg" alt="Claude 模型容量预填与思考模式设置" width="580">
43
+ </p>
44
+
45
+ 3. **补充 Anthropic 原生模型探测**
46
+
47
+ DeepSeek Harness 的普通自定义提供方在使用 `anthropic-messages` 协议时无法获取模型列表。本插件为 Claude 提供方增加了基于 Anthropic 兼容 `GET /v1/models` 接口的模型探测,并支持游标分页。
48
+
49
+ 4. **探测后自动填写常用 Claude 模型参数**
50
+
51
+ 探测到的模型 ID 如果与插件已经记录的 Claude 模型匹配,插件会自动填写上下文窗口、最大输出长度和推理模式。用户手动添加的模型仍然可以自由编辑,不会被这项自动匹配覆盖。
52
+
53
+ 5. **使用 RC8 原生配置,不改写请求**
54
+
55
+ 模型探测、参数预填和推理档位只对明确创建为“Claude 提供方”的 Provider ID 生效。保存后的提供方仍是标准 `llm-pi-ai` 路由;插件不会替换全局 `fetch`,也不会修改 RC8 的模型适配器。
14
56
 
15
57
  ## 安装
16
58
 
17
- 直接安装 npm 上发布的插件:
59
+ ### 安装已发布的版本
60
+
61
+ 浏览器界面使用 Web Profile:
18
62
 
19
63
  ```sh
20
64
  npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
65
+ ```
66
+
67
+ 不使用 Web 界面的命令行运行使用 Headless Profile:
68
+
69
+ ```sh
21
70
  npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
22
71
  ```
23
72
 
24
- 安装完成后,重启对应的 Harness 进程。
73
+ 安装后需要重启对应的 DeepSeek Harness 进程。
25
74
 
26
- 修改插件源码后,可以重新构建 Web 客户端并生成单一分发包:
75
+ ### 从源码安装
76
+
77
+ 先克隆、构建并打包项目:
27
78
 
28
79
  ```sh
80
+ git clone https://github.com/MoFeng2223/dsh-claude-provider.git
81
+ cd dsh-claude-provider
82
+ npm install
29
83
  npm run build
84
+ mkdir -p dist
30
85
  npm pack --pack-destination dist
31
86
  ```
32
87
 
33
- 日常安装不建议直接使用源码目录。直接安装源码目录会创建 pnpm `link:` 依赖;在目前的 DSH/pnpm 版本中,移除依赖和 bundle 注册后,顶层符号链接仍有可能残留。通过 npm 或 `.tgz` 归档安装时,文件由包管理器管理,卸载后不会留下这类链接。
88
+ 将生成的包安装到 Web Profile:
89
+
90
+ ```sh
91
+ npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
92
+ ```
34
93
 
35
- ## 调试
94
+ 或者安装到 Headless Profile:
36
95
 
37
- 临时设置 `DSH_CLAUDE_PROVIDER_DEBUG=1`,可以为每个被改写的请求输出一行经过脱敏的诊断信息。诊断内容只包含提供方、模型和所选思考强度,不包含 API 密钥。
96
+ ```sh
97
+ npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
98
+ ```
38
99
 
39
100
  ## 卸载
40
101
 
102
+ 插件安装在哪个 Profile,就执行对应的卸载命令:
103
+
41
104
  ```sh
42
105
  npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
43
106
  npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
44
107
  ```
45
108
 
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` 调用中运行,不会修改任何其他提供方。
109
+ 卸载插件不会删除 `~/.dsh/settings.yaml` 或已经保存的凭据。已有的 Claude 提供方会继续作为普通的 `anthropic-messages` 自定义路由保留;`reasoningEfforts`、默认 `reasoning` `compat.forceAdaptiveThinking` 都是 RC8 原生字段,因此自适应思考和前端推理等级选择仍然有效。卸载后只会失去 Claude 专用的添加/编辑界面、模型探测和参数预填。
53
110
 
54
- ## Windows 支持
111
+ ## 许可证
55
112
 
56
- 发布到 npm 的插件和生成的 `.tgz` 包均可跨平台使用。Windows 可以直接通过 npm 包名或本地 `.tgz` 路径安装,无需在目标电脑上重新构建,也不依赖平台专用的原生模块。
113
+ [MIT](./LICENSE)
package/cordis.patch.yml CHANGED
@@ -1,14 +1,5 @@
1
1
  - insert:
2
2
  - id: claude-provider
3
3
  name: '@mofeng2223/dsh-claude-provider'
4
- config:
5
- debug: !!js process.env.DSH_CLAUDE_PROVIDER_DEBUG === '1'
6
- effortMap:
7
- minimal: low
8
- low: low
9
- medium: medium
10
- high: high
11
- xhigh: xhigh
12
- max: max
13
4
  - id: ui-settings-models
14
5
  disabled: true