@mofeng2223/dsh-claude-provider 0.1.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/LICENSE +21 -0
- package/README.md +72 -0
- package/cordis.patch.yml +18 -0
- package/lib/client.js +2911 -0
- package/package.json +54 -0
- package/src/index.js +453 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mofeng2223
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# DSH Claude Provider
|
|
2
|
+
|
|
3
|
+
`@mofeng2223/dsh-claude-provider` adds a visible Custom Claude provider type to
|
|
4
|
+
DeepSeek Harness and fixes Anthropic Messages routes that still
|
|
5
|
+
serialize reasoning as `thinking.type: enabled` with `budget_tokens`. For the
|
|
6
|
+
configured provider/model pairs, it converts the outgoing request to
|
|
7
|
+
`thinking.type: adaptive` plus `output_config.effort`.
|
|
8
|
+
|
|
9
|
+
The bundled defaults recognize every `claude-*` model on every provider route.
|
|
10
|
+
At request time the plugin reads the model's configured effort list: four- and
|
|
11
|
+
five-level profiles use adaptive thinking, while an On/Off profile keeps the
|
|
12
|
+
legacy budget-based path. This lets future Claude model IDs work without a
|
|
13
|
+
plugin update.
|
|
14
|
+
|
|
15
|
+
The same package supplies both the Host request adapter and the Web settings
|
|
16
|
+
client. The client marks its model-directory request with a private discovery
|
|
17
|
+
protocol handled by the Host half. Only that request uses Anthropic's native
|
|
18
|
+
`GET /v1/models` endpoint, with `x-api-key` and `anthropic-version` headers.
|
|
19
|
+
It supports Anthropic cursor pagination and reads `display_name`,
|
|
20
|
+
`max_input_tokens`, and `max_tokens` when the provider returns them. No
|
|
21
|
+
OpenAI-compatible listing or Bearer-auth fallback is attempted.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Build the Web client and refresh the single distributable archive after
|
|
26
|
+
changing the plugin source:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm run build
|
|
30
|
+
npm pack --pack-destination dist
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Install the published package directly:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
|
|
37
|
+
npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Restart the corresponding Harness process after installation.
|
|
41
|
+
|
|
42
|
+
Do not use the source directory as the normal installation target. That creates
|
|
43
|
+
a pnpm `link:` dependency, and current DSH/pnpm builds can leave the top-level
|
|
44
|
+
link behind after the dependency and bundle registration have been removed.
|
|
45
|
+
Archive installs are package-manager-owned and uninstall without those stale
|
|
46
|
+
links.
|
|
47
|
+
|
|
48
|
+
Set `DSH_CLAUDE_PROVIDER_DEBUG=1` temporarily to print one redacted line for
|
|
49
|
+
each rewritten request. The diagnostic contains only provider, model, and
|
|
50
|
+
selected effort.
|
|
51
|
+
|
|
52
|
+
## Remove
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
|
|
56
|
+
npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Uninstall intentionally leaves `~/.dsh/settings.yaml` and stored credentials
|
|
60
|
+
alone. Existing custom providers therefore remain visible as ordinary custom
|
|
61
|
+
`anthropic-messages` routes, but lose this plugin's Claude badge, per-model
|
|
62
|
+
thinking-mode controls, native Anthropic model discovery, and adaptive request
|
|
63
|
+
rewrite.
|
|
64
|
+
|
|
65
|
+
The plugin never stores or logs API keys. Model discovery uses the one-shot key
|
|
66
|
+
typed into the form or resolves the existing route's credential through DSH;
|
|
67
|
+
the value is sent only to that route's Anthropic Models API. Its request
|
|
68
|
+
transformer runs only inside matching `llm/stream` calls and leaves nonmatching
|
|
69
|
+
providers and models untouched.
|
|
70
|
+
|
|
71
|
+
The generated `.tgz` package is portable. Copy it to Windows and install it by
|
|
72
|
+
its local path; no source build or platform-specific dependency is required.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: claude-provider
|
|
3
|
+
name: '@mofeng2223/dsh-claude-provider'
|
|
4
|
+
config:
|
|
5
|
+
debug: !!js process.env.DSH_CLAUDE_PROVIDER_DEBUG === '1'
|
|
6
|
+
routes:
|
|
7
|
+
- provider: '*'
|
|
8
|
+
models: &adaptive_claude_models
|
|
9
|
+
- claude-*
|
|
10
|
+
effortMap:
|
|
11
|
+
minimal: low
|
|
12
|
+
low: low
|
|
13
|
+
medium: medium
|
|
14
|
+
high: high
|
|
15
|
+
xhigh: xhigh
|
|
16
|
+
max: max
|
|
17
|
+
- id: ui-settings-models
|
|
18
|
+
disabled: true
|