dsh-cursor-subscription 0.5.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/AGENTS.md +71 -0
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/README_zh.md +91 -0
- package/cordis.patch.yml +5 -0
- package/lib/client.js +853 -0
- package/lib/index.js +2883 -0
- package/lib/proto.js +254 -0
- package/package.json +74 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Agent installation guide
|
|
2
|
+
|
|
3
|
+
Use this guide when a user asks an Agent to install, update, verify, or remove
|
|
4
|
+
`dsh-cursor-subscription`.
|
|
5
|
+
|
|
6
|
+
## Safety
|
|
7
|
+
|
|
8
|
+
- Confirm the target DSH profile; use `web` only when it is the user's target.
|
|
9
|
+
- Never print OAuth credentials, refresh tokens, authorization callbacks, or
|
|
10
|
+
the credential store.
|
|
11
|
+
- Do not start, stop, or restart DSH without explicit permission.
|
|
12
|
+
- Preserve the DSH profile, unrelated plugins, and stored OAuth credentials.
|
|
13
|
+
Signing out requires explicit permission.
|
|
14
|
+
- Do not delete any DSH profile during install, update, verification, or uninstall.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
When `dsh`, Node.js, and pnpm are available, install the package directly:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
dsh plugin --profile web add dsh-cursor-subscription
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For a local checkout (development), add it to the profile as a file dependency:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cd "%USERPROFILE%\.dsh\profiles\web"
|
|
28
|
+
pnpm add file:D:/mcp/dsh-cursor-subscription
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then ensure `dsh-cursor-subscription` is listed in the profile
|
|
32
|
+
`package.json` under `dsh.profile.bundles` (the `dsh plugin add` command does
|
|
33
|
+
this automatically for published packages).
|
|
34
|
+
|
|
35
|
+
Update with `dsh plugin --profile web update dsh-cursor-subscription`.
|
|
36
|
+
Uninstall with `dsh plugin --profile web remove dsh-cursor-subscription`.
|
|
37
|
+
|
|
38
|
+
## Verify
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
dsh plugin --profile web list dsh-cursor-subscription --depth 0
|
|
42
|
+
dsh --profile web --dump-config
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Success requires:
|
|
46
|
+
|
|
47
|
+
1. The requested package version appears once.
|
|
48
|
+
2. `cursor-subscription` appears once in the composed config after install
|
|
49
|
+
or update, and is absent after uninstall.
|
|
50
|
+
3. No unrelated profile or plugin changed.
|
|
51
|
+
4. A running DSH process was not restarted by the operation.
|
|
52
|
+
|
|
53
|
+
Do not treat `dsh plugin --profile web peers check` as the completion test.
|
|
54
|
+
If the user authorizes a live check, restart DSH manually, open
|
|
55
|
+
**Settings -> Cursor**, and verify the page loads. The Cursor provider route
|
|
56
|
+
(`cursor-subscription`) must appear in the model picker. Only when the user
|
|
57
|
+
explicitly requests a live check, run one simple chat message and confirm the
|
|
58
|
+
streamed reply appears in the conversation.
|
|
59
|
+
|
|
60
|
+
## Failure handling
|
|
61
|
+
|
|
62
|
+
- If the settings page reports "无法读取 Cursor 状态" the loopback RPC failed;
|
|
63
|
+
confirm the plugin bundle is listed once in the composed config.
|
|
64
|
+
- A "Cursor subscription is not signed in" error on a model call means the
|
|
65
|
+
credential store is empty; the user must complete the browser login flow.
|
|
66
|
+
- Cursor's Agent protocol is undocumented and changes; a transport or
|
|
67
|
+
`CURSOR_ERROR` failure on the chat path is expected to need a plugin update.
|
|
68
|
+
|
|
69
|
+
On any failure, report the sanitized command error, DSH version, selected
|
|
70
|
+
profile, what changed, and what remains unverified. Do not patch DSH, wipe
|
|
71
|
+
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-cursor-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.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# DSH Cursor Subscription
|
|
2
|
+
|
|
3
|
+
**English** | [简体中文](README_zh.md)
|
|
4
|
+
|
|
5
|
+
Sign in to your Cursor account and use your Cursor subscription directly from DeepSeek Harness—without an API key and without depending on the Cursor IDE or Cursor CLI. The plugin preserves DSH's existing session, tool, and permission systems: once signed in, you can select Cursor subscription models from the model picker, while agent tool calls are executed through DSH's local toolset.
|
|
6
|
+
|
|
7
|
+
> ⚠️ This plugin integrates with Cursor's unpublished Agent protocol (`agent.v1.AgentService/Run`). It is a community reverse-engineering project and may stop working when Cursor changes its server-side implementation. This project is not affiliated with or endorsed by Anysphere or Cursor. Please comply with Cursor's terms of service.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Use a Cursor subscription directly in DSH through browser-based PKCE sign-in—no API key required.
|
|
12
|
+
- Store credentials in DSH's local credential store and refresh access tokens automatically.
|
|
13
|
+
- Discover models available to the current account dynamically through Cursor's `GetUsableModels`, with a built-in fallback list if discovery fails.
|
|
14
|
+
- Stream conversations with reasoning output and DSH tool calls.
|
|
15
|
+
- View sign-in status and token expiration in the settings page.
|
|
16
|
+
- View and manually refresh subscription usage, including requests, Auto + Composer usage, other-model (API) usage, per-model spend, on-demand spend, and billing cycle.
|
|
17
|
+
- View and manually refresh the models available to the current account.
|
|
18
|
+
- Configure the per-run tool-round limit and HTTP retry count, interval, and status codes from the settings page.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Install with an Agent (Recommended)
|
|
23
|
+
|
|
24
|
+
Send the agent a link to [AGENTS.md](AGENTS.md). It contains the instructions for installation, updates, removal, and verification.
|
|
25
|
+
|
|
26
|
+
### Manual Installation with the `dsh` Command
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
dsh plugin --profile web add dsh-cursor-subscription
|
|
30
|
+
dsh plugin --profile web list dsh-cursor-subscription --depth 0
|
|
31
|
+
dsh --profile web --dump-config
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The installed package list should contain exactly one `dsh-cursor-subscription`, and the composed configuration should contain exactly one `cursor-subscription` entry.
|
|
35
|
+
|
|
36
|
+
### Local Development Installation
|
|
37
|
+
|
|
38
|
+
Run the following command in the profile directory, such as `%USERPROFILE%\.dsh\profiles\web`:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpm add file:D:/mcp/dsh-cursor-subscription
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then add `dsh-cursor-subscription` to the `dsh.profile.bundles` array in `package.json` and restart DSH.
|
|
45
|
+
|
|
46
|
+
## Sign-in and Usage
|
|
47
|
+
|
|
48
|
+
1. Open **Settings -> Cursor Subscription** in DSH.
|
|
49
|
+
2. Select **Browser Sign-in**. Your browser will open the Cursor sign-in page.
|
|
50
|
+
3. Complete sign-in and authorization. The settings page will automatically show that you are signed in.
|
|
51
|
+
4. Select a Cursor model from the model picker, such as `composer-2` or `claude-4-sonnet`.
|
|
52
|
+
|
|
53
|
+
When a tool is required, the agent converts Cursor's tool request into a local DSH tool execution. The result is returned to the model through the conversation history; Cursor's filesystem tools are not used.
|
|
54
|
+
|
|
55
|
+
The **Runtime settings** card controls the maximum tool rounds in one Cursor run and the HTTP retry policy. Retry count means additional attempts and defaults to `0` (disabled). Cursor's streaming POST protocol cannot prove that a failed attempt was not processed remotely, so enabling retries may repeat model work or usage. Retries occur only before any response output when the initial HTTP status matches the configured list.
|
|
56
|
+
|
|
57
|
+
## Updating and Removing
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
dsh plugin --profile web update dsh-cursor-subscription # Update
|
|
61
|
+
dsh plugin --profile web remove dsh-cursor-subscription # Remove
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If DSH is running, restart it manually after installation or an update.
|
|
65
|
+
|
|
66
|
+
## Troubleshooting
|
|
67
|
+
|
|
68
|
+
- **DSH still reports that you are signed out after sign-in:** Make sure the browser completed the entire authorization flow and redirected to the completion page. Polling waits for up to approximately 2.5 minutes.
|
|
69
|
+
- **The model list is empty:** `GetUsableModels` depends on the account type. If discovery fails, the plugin uses its built-in model list, and you can still enter a model name manually.
|
|
70
|
+
- **Requests return 401:** If the access token has expired and the refresh token is no longer valid, sign in again from the settings page.
|
|
71
|
+
- **The server protocol changed:** Cursor's Agent protocol is unpublished. If requests fail, check for a plugin update.
|
|
72
|
+
|
|
73
|
+
## Scope and Support
|
|
74
|
+
|
|
75
|
+
- Cursor-native features such as image generation and web search are outside this plugin's scope.
|
|
76
|
+
- Report problems through the repository's Issues page.
|
|
77
|
+
|
|
78
|
+
[MIT](LICENSE)
|
package/README_zh.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# DSH Cursor Subscription
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
在 DeepSeek Harness 中直接登录 Cursor 账户并使用 Cursor 订阅,不需要 API Key,
|
|
6
|
+
也不依赖 Cursor IDE 或 Cursor CLI。保留 DSH 原有的会话、工具和权限体系:
|
|
7
|
+
登录后在模型选择器中即可选择 Cursor 订阅模型,Agent 的工具调用走 DSH 本地的
|
|
8
|
+
工具集。
|
|
9
|
+
|
|
10
|
+
> ⚠️ 本插件接入的是 Cursor 未公开的 Agent 协议(`agent.v1.AgentService/Run`),
|
|
11
|
+
> 属于社区逆向工程成果,可能随 Cursor 服务端变化而失效。本项目与 Anysphere /
|
|
12
|
+
> Cursor 无隶属或背书关系,请遵守 Cursor 的服务条款。
|
|
13
|
+
|
|
14
|
+
## 能做什么
|
|
15
|
+
|
|
16
|
+
- 在 DSH 中直接使用 Cursor 订阅(浏览器 PKCE 登录,无 API Key);
|
|
17
|
+
- 登录凭据保存在本机 DSH credential 存储中,自动刷新访问令牌;
|
|
18
|
+
- 通过 Cursor 的 `GetUsableModels` 动态发现当前账户可用的模型(失败时回退到内置列表);
|
|
19
|
+
- 流式对话,支持思考过程(reasoning)与 DSH 工具调用;
|
|
20
|
+
- 设置页可查看登录状态与令牌有效期;
|
|
21
|
+
- 设置页可查询订阅用量(包含请求、Auto + Composer、其他模型占比、各模型消费、按需消费、账单周期)并手动刷新;
|
|
22
|
+
- 设置页可查看当前账户可用的模型列表并手动刷新;
|
|
23
|
+
- 可在设置页调整单次任务工具轮次上限,以及 HTTP 重试次数、间隔和状态码。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
### 交给 Agent(推荐)
|
|
28
|
+
|
|
29
|
+
把 `AGENTS.md` 的链接发给 Agent 即可完成安装、更新、卸载与验收。
|
|
30
|
+
|
|
31
|
+
### 手动安装(已有 dsh 命令)
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
dsh plugin --profile web add dsh-cursor-subscription
|
|
35
|
+
dsh plugin --profile web list dsh-cursor-subscription --depth 0
|
|
36
|
+
dsh --profile web --dump-config
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
安装列表中应只有一个 `dsh-cursor-subscription`,配置中应只有一个
|
|
40
|
+
`cursor-subscription` 条目。
|
|
41
|
+
|
|
42
|
+
### 本地开发安装
|
|
43
|
+
|
|
44
|
+
在 profile 目录(如 `%USERPROFILE%\.dsh\profiles\web`)执行:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pnpm add file:D:/mcp/dsh-cursor-subscription
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
并把 `dsh-cursor-subscription` 加入 `package.json` 的
|
|
51
|
+
`dsh.profile.bundles` 列表,然后重启 DSH。
|
|
52
|
+
|
|
53
|
+
## 登录与使用
|
|
54
|
+
|
|
55
|
+
1. 打开 DSH 的 **设置 -> Cursor 订阅**;
|
|
56
|
+
2. 点击「浏览器登录」,浏览器会打开 Cursor 登录页;
|
|
57
|
+
3. 登录并授权后,设置页自动显示「已登录」;
|
|
58
|
+
4. 在模型选择器中选择 Cursor 模型(如 `composer-2`、`claude-4-sonnet`)。
|
|
59
|
+
|
|
60
|
+
需要调用工具时,Agent 会把 Cursor 侧的工具请求转成 DSH 本地工具执行,结果通过
|
|
61
|
+
对话历史回传给模型,全程不经过 Cursor 的文件系统工具。
|
|
62
|
+
|
|
63
|
+
「运行设置」卡片可以调整单次 Cursor 任务的最大工具轮次和 HTTP 重试策略。重试次数指
|
|
64
|
+
首次请求之外的额外尝试次数,默认 `0`(关闭)。Cursor 的流式 POST 协议无法证明失败请求
|
|
65
|
+
未被远端处理,因此启用重试可能重复模型工作或用量;仅当尚未产生任何输出且初始 HTTP
|
|
66
|
+
状态码匹配列表时才会重试。
|
|
67
|
+
|
|
68
|
+
## 更新与卸载
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
dsh plugin --profile web update dsh-cursor-subscription # 更新
|
|
72
|
+
dsh plugin --profile web remove dsh-cursor-subscription # 卸载
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
如果 DSH 正在运行,安装或更新后请手动重启。
|
|
76
|
+
|
|
77
|
+
## 常见问题
|
|
78
|
+
|
|
79
|
+
- **登录后仍提示未登录**:确认浏览器完成了整个授权流程(登录页跳转回完成页);
|
|
80
|
+
轮询最长等待约 2.5 分钟。
|
|
81
|
+
- **模型列表为空**:`GetUsableModels` 依赖账户类型,失败时插件会使用内置模型列表,
|
|
82
|
+
仍可手动输入模型名。
|
|
83
|
+
- **请求报 401**:令牌过期且 refresh token 失效时,需要在设置页重新登录。
|
|
84
|
+
- **服务端协议变更**:Cursor 的 Agent 协议是未公开接口,若请求失败请检查插件更新。
|
|
85
|
+
|
|
86
|
+
## 边界与支持
|
|
87
|
+
|
|
88
|
+
- 图片生成、联网搜索等 Cursor 内置能力不在本插件范围内;
|
|
89
|
+
- 问题反馈请在仓库 Issues 中提交。
|
|
90
|
+
|
|
91
|
+
[MIT](LICENSE)
|