dsh-claude-subscription 0.2.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/AGENTS.md +85 -0
- package/LICENSE +21 -0
- package/README.en.md +98 -0
- package/README.md +93 -0
- package/SECURITY.md +31 -0
- package/THIRD_PARTY_NOTICES.md +12 -0
- package/cordis.patch.yml +6 -0
- package/docs/assets/README.md +12 -0
- package/lib/client.js +769 -0
- package/lib/index.js +724 -0
- package/package.json +89 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Agent installation guide
|
|
2
|
+
|
|
3
|
+
Use this guide when a user asks an Agent to install, update, verify, or remove
|
|
4
|
+
`dsh-claude-subscription`.
|
|
5
|
+
|
|
6
|
+
## Safety
|
|
7
|
+
|
|
8
|
+
- Confirm the target DSH profile; use `web` only when it is the user's target.
|
|
9
|
+
- Use the pinned `v0.2.0` release assets for a first install, never a moving branch.
|
|
10
|
+
- Never print OAuth credentials, account IDs, authorization callbacks, or the
|
|
11
|
+
credential store.
|
|
12
|
+
- Do not start, stop, or restart DSH without explicit permission.
|
|
13
|
+
- Preserve the DSH profile, unrelated plugins, and stored OAuth credentials.
|
|
14
|
+
Signing out requires explicit permission.
|
|
15
|
+
- Do not delete any DSH profile during install, update, verification, or uninstall.
|
|
16
|
+
|
|
17
|
+
## Detect the installation
|
|
18
|
+
|
|
19
|
+
Check whether the plugin is already installed in the target DSH profile. When
|
|
20
|
+
it is already listed, use update or uninstall instead of installing again.
|
|
21
|
+
|
|
22
|
+
## Existing DSH CLI
|
|
23
|
+
|
|
24
|
+
When `dsh`, Node.js, and pnpm are already available, install the pinned npm
|
|
25
|
+
package directly:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
dsh plugin --profile web add dsh-claude-subscription@0.2.0
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Update with `dsh plugin --profile web update dsh-claude-subscription`.
|
|
32
|
+
Uninstall the current package with:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
dsh plugin --profile web remove dsh-claude-subscription
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Desktop profile install (DSH Desktop)
|
|
39
|
+
|
|
40
|
+
The DSH Desktop app composes profiles under `~/.dsh/profiles`. For each target
|
|
41
|
+
profile (`desktop`, `web`):
|
|
42
|
+
|
|
43
|
+
1. `pnpm pack` the plugin into a tarball (or download the pinned release tarball).
|
|
44
|
+
2. Copy the tarball into the profile directory.
|
|
45
|
+
3. Add `"dsh-claude-subscription": "file:./dsh-claude-subscription-0.2.0.tgz"` to
|
|
46
|
+
the profile's `package.json` `dependencies` and add `dsh-claude-subscription`
|
|
47
|
+
to its `dsh.profile.bundles` array.
|
|
48
|
+
4. Run `pnpm install` in the profile directory.
|
|
49
|
+
5. The user must restart DSH once for the plugin to load.
|
|
50
|
+
|
|
51
|
+
The installed package keeps its OAuth credentials in DSH's host credential
|
|
52
|
+
service (`ANTHROPIC_SUBSCRIPTION_OAUTH`); never edit that store by hand while
|
|
53
|
+
the plugin runs.
|
|
54
|
+
|
|
55
|
+
## Verify
|
|
56
|
+
|
|
57
|
+
For the existing CLI path, run:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
dsh plugin --profile web list dsh-claude-subscription --depth 0
|
|
61
|
+
dsh --profile web --dump-config
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Success requires:
|
|
65
|
+
|
|
66
|
+
1. The requested package version appears once.
|
|
67
|
+
2. `claude-subscription` appears once in the composed config after install
|
|
68
|
+
or update, and is absent after uninstall.
|
|
69
|
+
3. No unrelated profile or plugin changed.
|
|
70
|
+
4. A running DSH process was not restarted by the operation.
|
|
71
|
+
|
|
72
|
+
Do not treat `dsh plugin --profile web peers check` as the completion test.
|
|
73
|
+
If the user authorizes a live check, restart DSH manually, open
|
|
74
|
+
**Settings -> Claude**, and verify the page loads and reports the saved
|
|
75
|
+
login. Confirm that the `anthropic` provider and its Claude models are
|
|
76
|
+
selectable in the model picker. Only when the user explicitly requests a
|
|
77
|
+
quota-consuming live check, ask the Agent to send one short message with a
|
|
78
|
+
Claude model and confirm the reply.
|
|
79
|
+
|
|
80
|
+
## Failure handling
|
|
81
|
+
|
|
82
|
+
On any failure, report the sanitized command error, DSH version, selected
|
|
83
|
+
profile, requested release, installation mode, what changed, cleanup status,
|
|
84
|
+
and what remains unverified. Do not patch DSH, switch to another paid route,
|
|
85
|
+
wipe credentials, delete a profile, or claim success from a partial check.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-claude-subscription contributors
|
|
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.en.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# DSH Claude Subscription
|
|
2
|
+
|
|
3
|
+
[](https://github.com/x5427876/dsh-claude-subscription/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-claude-subscription)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
[繁體中文](README.md)
|
|
8
|
+
|
|
9
|
+
Sign in to a Claude Pro / Max subscription directly in DeepSeek Harness, with
|
|
10
|
+
no Anthropic API key required. Sign-in and token refresh use the official
|
|
11
|
+
Anthropic OAuth flow (the same one Claude Code uses). Credentials stay in
|
|
12
|
+
DSH's host credential service: no token extraction, no resale, no extra billing.
|
|
13
|
+
|
|
14
|
+
[Agent install](#let-an-agent-install-it-recommended) · [Manual install](#manual-install) · [Update and uninstall](#update-and-uninstall)
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
- Uses your Claude Pro / Max subscription directly inside DSH, with no Anthropic API key required;
|
|
19
|
+
- Signs in to claude.ai from Settings through the official OAuth flow and keeps credentials on the host;
|
|
20
|
+
- Refreshes the access token automatically with the refresh token;
|
|
21
|
+
- Shows sign-in status and token expiry;
|
|
22
|
+
- Shows the **subscription quota**: remaining percentage and reset time for the 5-hour, 7-day, Opus, and Sonnet windows;
|
|
23
|
+
- Adds a **composer quota** toggle (off by default) that shows the current model's remaining quota next to the message input;
|
|
24
|
+
- Fails visibly when subscription routing is unavailable instead of silently using another paid route.
|
|
25
|
+
|
|
26
|
+
## Prepare DSH
|
|
27
|
+
|
|
28
|
+
This plugin supports DeepSeek Harness `0.1.0-rc.6` and `0.1.0-rc.7`, and
|
|
29
|
+
requires a Claude Pro, Max, Team, or Enterprise subscription.
|
|
30
|
+
|
|
31
|
+
If DSH already opens normally, continue with the plugin installation below.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
### Let an Agent install it (recommended)
|
|
36
|
+
|
|
37
|
+
Send the following URL directly to your Agent. The guide contains install,
|
|
38
|
+
update, uninstall, and verification steps. It preserves the DSH profile and
|
|
39
|
+
sign-in and never restarts DSH without permission:
|
|
40
|
+
|
|
41
|
+
[Open the Agent installation guide](https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md)
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Manual install
|
|
48
|
+
|
|
49
|
+
When the `dsh` command is available:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dsh plugin --profile web add dsh-claude-subscription
|
|
53
|
+
dsh plugin --profile web list dsh-claude-subscription --depth 0
|
|
54
|
+
dsh --profile web --dump-config
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For DSH Desktop, put the `pnpm pack` tarball into
|
|
58
|
+
`~/.dsh/profiles/<profile>/`, add the `file:` dependency and the
|
|
59
|
+
`dsh.profile.bundles` entry in that profile's `package.json`, run
|
|
60
|
+
`pnpm install` there, then restart DSH. After install:
|
|
61
|
+
|
|
62
|
+
1. Open **Settings -> Claude subscription** in DSH.
|
|
63
|
+
2. If not signed in, click **Browser sign-in** and authorize on claude.ai.
|
|
64
|
+
3. Pick a Claude model under the `anthropic` provider in the model picker.
|
|
65
|
+
4. Turn on **Composer quota** on the same page when you want it.
|
|
66
|
+
|
|
67
|
+
## Quota display
|
|
68
|
+
|
|
69
|
+
The **Subscription quota** card in **Settings -> Claude subscription** shows the
|
|
70
|
+
quota windows reported by Anthropic. The host reads them; the browser receives
|
|
71
|
+
only a percentage projection, and the access token never leaves the machine.
|
|
72
|
+
Results are cached for 60 seconds, and **Refresh** reads them again immediately.
|
|
73
|
+
|
|
74
|
+
With **Composer quota** on, a Claude model shows the tightest applicable window
|
|
75
|
+
next to the message input (Opus and Sonnet models also count their 7-day
|
|
76
|
+
window). Nothing is rendered when you are signed out or when the account
|
|
77
|
+
reports no quota windows.
|
|
78
|
+
|
|
79
|
+
## Update and uninstall
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
dsh plugin --profile web update dsh-claude-subscription
|
|
83
|
+
dsh plugin --profile web remove dsh-claude-subscription
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage note
|
|
87
|
+
|
|
88
|
+
- Subscriptions are for the subscriber's own use; usage from this plugin
|
|
89
|
+
counts against your subscription quota.
|
|
90
|
+
- Anthropic terms allow third-party access "at Anthropic's discretion" and
|
|
91
|
+
reserve the right to charge such usage against usage credits instead of
|
|
92
|
+
subscription limits. Follow [Anthropic's terms](https://support.claude.com/en/articles/13189465-log-in-to-your-claude-account).
|
|
93
|
+
- This plugin never extracts Claude Code's local OAuth token; sign-in always
|
|
94
|
+
goes through browser authorization.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT License
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# DSH Claude Subscription
|
|
2
|
+
|
|
3
|
+
[](https://github.com/x5427876/dsh-claude-subscription/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-claude-subscription)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
[English](README.en.md)
|
|
8
|
+
|
|
9
|
+
在 DeepSeek Harness 中直接登入 Claude Pro / Max 訂閱並使用 Claude 模型,
|
|
10
|
+
不需要 Anthropic API Key。登入與 token 續期走 Anthropic 官方 OAuth 流程
|
|
11
|
+
(與 Claude Code 相同),憑證保留在 DSH 本機 credential service,
|
|
12
|
+
不抽取、不轉售、不額外計費。
|
|
13
|
+
|
|
14
|
+
[交給 Agent 安裝](#交給-agent推薦) · [手動安裝](#手動安裝) · [更新與解除安裝](#更新與解除安裝)
|
|
15
|
+
|
|
16
|
+
## 能做什麼
|
|
17
|
+
|
|
18
|
+
- 在 DSH 中直接使用 Claude Pro / Max 訂閱,不需要 Anthropic API Key;
|
|
19
|
+
- 在設定頁以官方 OAuth 流程登入 claude.ai,憑證保留在 DSH 本機;
|
|
20
|
+
- access token 過期時自動以 refresh token 續期,不需手動處理;
|
|
21
|
+
- 顯示登入狀態;
|
|
22
|
+
- 顯示**訂閱額度**:5 小時、7 天、Opus 與 Sonnet 的剩餘百分比與重置時間;
|
|
23
|
+
- **輸入框額度**開關(預設關閉):開啟後在對話輸入框右側顯示目前模型的剩餘額度;
|
|
24
|
+
- 訂閱路由不可用時明確報錯,不會靜默切換到其他付費路由。
|
|
25
|
+
|
|
26
|
+
## 準備 DSH
|
|
27
|
+
|
|
28
|
+
本插件適配 DeepSeek Harness `0.1.0-rc.6` 與 `0.1.0-rc.7`,需要一個
|
|
29
|
+
Claude Pro、Max、Team 或 Enterprise 訂閱帳號。
|
|
30
|
+
|
|
31
|
+
已經能正常打開 DSH 的使用者可以直接繼續安裝插件。
|
|
32
|
+
|
|
33
|
+
## 安裝
|
|
34
|
+
|
|
35
|
+
### 交給 Agent(推薦)
|
|
36
|
+
|
|
37
|
+
把下面的連結直接發給 Agent。文件包含安裝、更新、解除安裝與驗收步驟;
|
|
38
|
+
它不會刪除 DSH profile、登入資訊,也不會未經許可重啟 DSH。
|
|
39
|
+
|
|
40
|
+
[開啟 Agent 安裝文件](https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md)
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 手動安裝
|
|
47
|
+
|
|
48
|
+
已有 `dsh` 指令時:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
dsh plugin --profile web add dsh-claude-subscription
|
|
52
|
+
dsh plugin --profile web list dsh-claude-subscription --depth 0
|
|
53
|
+
dsh --profile web --dump-config
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
DSH Desktop(桌面版)時,把 `pnpm pack` 產出的 tarball 放進
|
|
57
|
+
`~/.dsh/profiles/<profile>/`,在該 profile 的 `package.json` 加入
|
|
58
|
+
`file:` 依賴與 `dsh.profile.bundles` 條目,然後在該目錄執行
|
|
59
|
+
`pnpm install`,最後重啟 DSH。安裝後:
|
|
60
|
+
|
|
61
|
+
1. 開啟 DSH 的**設定 → Claude 訂閱**。
|
|
62
|
+
2. 若尚未登入,按**瀏覽器登入**,在 claude.ai 完成授權。
|
|
63
|
+
3. 在模型選單選擇 `anthropic` provider 下的 Claude 模型。
|
|
64
|
+
4. 需要時,在同一頁打開**輸入框額度**開關。
|
|
65
|
+
|
|
66
|
+
## 額度顯示
|
|
67
|
+
|
|
68
|
+
**設定 → Claude 訂閱**的**訂閱額度**卡片顯示 Anthropic 回報的額度視窗。
|
|
69
|
+
資料由 host 端讀取,瀏覽器只收到百分比投影,access token 不會離開本機。
|
|
70
|
+
額度結果快取 60 秒,按**重新整理**可立即重新讀取。
|
|
71
|
+
|
|
72
|
+
打開**輸入框額度**後,選用 Claude 模型時,輸入框右側顯示最緊的那個額度視窗
|
|
73
|
+
(Opus 或 Sonnet 模型會納入對應的 7 天視窗)。未登入、或帳號走 API Key 計費
|
|
74
|
+
而沒有額度視窗時,該處不顯示任何內容。
|
|
75
|
+
|
|
76
|
+
## 更新與解除安裝
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
dsh plugin --profile web update dsh-claude-subscription
|
|
80
|
+
dsh plugin --profile web remove dsh-claude-subscription
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 使用注意
|
|
84
|
+
|
|
85
|
+
- 訂閱方案僅供訂閱者本人使用;本插件產生的用量會計入你的訂閱額度。
|
|
86
|
+
- Anthropic 條款允許「Anthropic 自行決定」是否讓訂閱者透過第三方工具
|
|
87
|
+
存取服務,並保留改從使用額度扣款的權利。請遵守
|
|
88
|
+
[Anthropic 的使用條款](https://support.claude.com/zh-TW/articles/13189465-登入您的-claude-帳戶)。
|
|
89
|
+
- 本插件不抽取 Claude Code 本機的 OAuth token;登入一律透過瀏覽器授權。
|
|
90
|
+
|
|
91
|
+
## 授權
|
|
92
|
+
|
|
93
|
+
MIT License
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported version
|
|
4
|
+
|
|
5
|
+
Security fixes are applied to the latest tagged release. DeepSeek Harness is a developer preview, so compatibility fixes may require upgrading both DSH and this bundle.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Use a private GitHub security advisory at:
|
|
10
|
+
|
|
11
|
+
https://github.com/x5427876/dsh-claude-subscription/security/advisories/new
|
|
12
|
+
|
|
13
|
+
Do not open a public issue containing access tokens, refresh tokens, account identifiers, callback URLs with authorization codes, raw DSH credential data, or private prompts. Include the affected version, operating system, DSH version, a minimal reproduction, and impact. Replace all credentials with unmistakably fake placeholders.
|
|
14
|
+
|
|
15
|
+
## Trust boundary
|
|
16
|
+
|
|
17
|
+
- The plugin runs with the privileges of the DSH host process.
|
|
18
|
+
- OAuth credentials remain in DSH's host credential service.
|
|
19
|
+
- The browser settings client can call only a loopback-authorized, redacted RPC surface.
|
|
20
|
+
- Login links are restricted to the HTTPS `claude.ai` origin before they are returned or opened.
|
|
21
|
+
- Token refresh runs host-side through pi-ai's Anthropic OAuth flow; tokens never enter the browser client.
|
|
22
|
+
- The bundle defines no API-key or cross-provider fallback.
|
|
23
|
+
|
|
24
|
+
Installing any DSH plugin grants its host code access to the services named in its composition. Review the tag or commit you install. Prefer a tagged version or a full commit hash over a moving branch.
|
|
25
|
+
|
|
26
|
+
## Out of scope
|
|
27
|
+
|
|
28
|
+
- availability or policy changes in Claude, claude.ai, Anthropic OAuth, or DeepSeek Harness
|
|
29
|
+
- compromised host machines or compromised DSH installations
|
|
30
|
+
- secrets deliberately pasted into prompts, logs, issues, or screenshots
|
|
31
|
+
- provider billing or quota disputes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This project depends on software distributed under its own terms. The dependency lockfile records the exact resolved graph used for the release.
|
|
4
|
+
|
|
5
|
+
| Project | Role | License | Source |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| DeepSeek Harness packages | Plugin host, client slots, credential and LLM interfaces | MIT | https://github.com/deepseek-ai/deepseek-harness |
|
|
8
|
+
| `@earendil-works/pi-ai` 0.82.1 | Anthropic OAuth (Claude Pro/Max), model catalog, and Messages transport | MIT | https://github.com/earendil-works/pi |
|
|
9
|
+
| React | DSH settings component runtime | MIT | https://github.com/facebook/react |
|
|
10
|
+
| tsdown | Development-time bundler | MIT | https://github.com/rolldown/tsdown |
|
|
11
|
+
|
|
12
|
+
No third-party project endorses this community plugin. See each installed package for its complete license text and transitive dependency notices.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# docs
|
|
2
|
+
|
|
3
|
+
Press material for the DSH Claude subscription plugin.
|
|
4
|
+
|
|
5
|
+
## assets
|
|
6
|
+
|
|
7
|
+
Drop settings-page screenshots here and reference them from the READMEs with
|
|
8
|
+
the release-asset URL pattern used by the CI release workflow:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
https://github.com/x5427876/dsh-claude-subscription/releases/latest/download/settings.png
|
|
12
|
+
```
|