@surfishs/dsh-prompt-enhance 0.0.3 → 0.0.5
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.en.md +36 -5
- package/README.md +36 -5
- package/docs/images/panel.png +0 -0
- package/lib/client.js +179 -130
- package/lib/index.js +2 -2
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
- package/src/client/ResultDock.tsx +3 -93
- package/src/client/ResultPanel.tsx +27 -25
- package/src/client/UndoBar.tsx +14 -7
- package/src/client/locales.ts +2 -2
- package/src/client/styles.ts +47 -10
- package/src/client/useDockAlignment.ts +103 -0
- package/src/context.ts +1 -1
- package/src/prompts.ts +1 -1
package/README.en.md
CHANGED
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
[简体中文](./README.md) | English
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
---
|
|
12
14
|
|
|
13
15
|
## Features
|
|
14
16
|
|
|
15
|
-
- **One-click enhance**: the
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
17
|
+
- **One-click enhance**: the enhance button in the composer toolbar (DeepSeek fish mark with a sparkle); the shortcut is off by default and can be set in the settings. The original draft is preserved, and a failure never touches it.
|
|
18
|
+
- **Docked result card**: the result appears above the composer without covering the conversation, with model, timing and token usage. Apply, copy, regenerate or undo; sending the draft closes it automatically, Escape closes it too.
|
|
19
|
+
- **Apply and undo**: after applying, the card stays open with a Replaced chip and an undo action; once closed, the undo bar remains above the composer.
|
|
20
|
+
- **Regenerate**: re-runs the current composer text; after applying, it can regenerate the enhanced draft as well.
|
|
21
|
+
- **Empty-draft dimming**: with no text (or attachments only), the icon dims and neither clicks nor the shortcut start a request.
|
|
22
|
+
- **Truncation warning**: when the output hits the token cap, the partial result is kept and marked as possibly incomplete.
|
|
18
23
|
- **`/enhance <text>`**: rewrite any text from the slash menu; the result never enters model history.
|
|
19
24
|
- **Model routing**: pinned settings pair → current session model → harness default, in that order.
|
|
20
25
|
- **Context aware**: uses recent conversation to resolve references; can be turned off.
|
|
@@ -30,6 +35,20 @@
|
|
|
30
35
|
|
|
31
36
|
## Install
|
|
32
37
|
|
|
38
|
+
### Let an agent install it
|
|
39
|
+
|
|
40
|
+
No command line needed. Send the block below to an agent that can run commands on your machine (DSH desktop or web):
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Install the DeepSeek Harness plugin @surfishs/dsh-prompt-enhance.
|
|
44
|
+
|
|
45
|
+
1. First confirm my DSH profile name: usually desktop for the desktop app and web for the web build; ask me if unsure.
|
|
46
|
+
2. Run: dsh plugin --profile <profile> add @surfishs/dsh-prompt-enhance
|
|
47
|
+
3. If the npm install fails, use: dsh plugin --profile <profile> add github:surfishs/dsh-prompt-enhance
|
|
48
|
+
4. After installing, ask me to restart DSH and confirm the plugin appears in the plugin list.
|
|
49
|
+
5. Do not change my other plugins or DSH configuration.
|
|
50
|
+
```
|
|
51
|
+
|
|
33
52
|
From npm:
|
|
34
53
|
|
|
35
54
|
```bash
|
|
@@ -61,9 +80,17 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
61
80
|
|
|
62
81
|
## Usage
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
1. **Start**: leave a draft in the composer and click the enhance button in the toolbar (or your configured shortcut).
|
|
84
|
+
2. **Review**: the result appears in a card docked above the composer. You can:
|
|
85
|
+
- **Apply**: write it back; the card stays open with a Replaced chip;
|
|
86
|
+
- **Copy**: copy the result;
|
|
87
|
+
- **Regenerate**: run the current draft again.
|
|
88
|
+
3. **Undo**: after applying, click Undo to restore; after closing the card, the undo bar remains above the composer.
|
|
89
|
+
4. **Close**: sending the draft closes the card automatically; Escape also closes it.
|
|
65
90
|
|
|
66
|
-
|
|
91
|
+
An empty or attachment-only draft dims the button and makes it unclickable; over-length or reference-chip drafts are rejected locally. A result that hits the token cap is marked as possibly incomplete.
|
|
92
|
+
|
|
93
|
+
`/enhance <text>`: rewrite any text from the slash menu; the result is copyable and never enters model history.
|
|
67
94
|
|
|
68
95
|
## Configuration
|
|
69
96
|
|
|
@@ -88,6 +115,8 @@ Edit in **Settings → dsh-prompt-enhance** (or Plugins → `dsh-prompt-enhance`
|
|
|
88
115
|
| `maxConcurrent` | `2` | Concurrent enhancement limit; a new request past the limit is told to retry later |
|
|
89
116
|
| `rateLimitPerMinute` | `10` | Successful enhancements per minute (sliding window); past the limit the request is told to retry later |
|
|
90
117
|
|
|
118
|
+
An empty or attachment-only draft dims the button and starts no request; raise `maxOutputTokens` when a result is truncated.
|
|
119
|
+
|
|
91
120
|
## Security
|
|
92
121
|
|
|
93
122
|
The enhance route is served by your own local dsh host and accepts loopback addresses with a local `Host` / `Origin` only. With `contextAware` on, recent conversation history is sent with the draft to the configured model provider — do not send context from sensitive sessions.
|
|
@@ -95,6 +124,8 @@ The enhance route is served by your own local dsh host and accepts loopback addr
|
|
|
95
124
|
## Troubleshooting
|
|
96
125
|
|
|
97
126
|
- No button: make sure `enabled` is `true` and `dsh web` was restarted after installing.
|
|
127
|
+
- The button is dimmed: the composer is empty or has attachments only; type some text to restore it.
|
|
128
|
+
- Incomplete result: check the truncation warning and raise `maxOutputTokens`.
|
|
98
129
|
- "No model resolved for the enhancement": set `provider` / `model` as a pair, or send a message in the current session first.
|
|
99
130
|
- Authentication failed: check the provider's API key in the harness.
|
|
100
131
|
|
package/README.md
CHANGED
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
简体中文 | [English](./README.en.md)
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
---
|
|
12
14
|
|
|
13
15
|
## 功能
|
|
14
16
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
17
|
+
- **一键增强**:输入框工具栏的增强按钮(DeepSeek 鱼形标识 + 星芒);快捷键默认关闭,可在设置中指定。原文保留,失败不改草稿。
|
|
18
|
+
- **停靠结果卡**:结果显示在输入框上方,不遮挡对话;附模型、耗时与 token 用量,可回填、复制、重新生成或撤销;发送消息时自动收起,`Esc` 关闭。
|
|
19
|
+
- **回填与撤销**:回填后结果卡保持打开并显示「已替换」,可直接撤销;关闭后输入框上方仍保留撤销条。
|
|
20
|
+
- **重新生成**:按当前输入框内容重新请求;回填后也可对增强稿再生成。
|
|
21
|
+
- **空输入灰态**:没有文字或只有附件时图标变浅,点击和快捷键都不发起请求。
|
|
22
|
+
- **截断提示**:输出达到 Token 上限时保留已生成内容,并提示结果可能不完整。
|
|
18
23
|
- **`/enhance <文本>`**:从斜杠面板改写任意文本,结果不进入模型历史。
|
|
19
24
|
- **模型路由**:设置成对覆盖 → 当前会话模型 → 全局默认模型,逐级回退。
|
|
20
25
|
- **上下文感知**:参考当前会话近况消解指代;可关闭。
|
|
@@ -30,6 +35,20 @@
|
|
|
30
35
|
|
|
31
36
|
## 安装
|
|
32
37
|
|
|
38
|
+
### 让 Agent 帮你安装
|
|
39
|
+
|
|
40
|
+
不用自己敲命令。把下面整段发给能操作本机终端的 Agent(DSH 桌面版、Web 版都可以):
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
帮我安装 DeepSeek Harness 插件 @surfishs/dsh-prompt-enhance。
|
|
44
|
+
|
|
45
|
+
1. 先确认我的 DSH profile 名:桌面版通常是 desktop,Web 版通常是 web;不确定就问我。
|
|
46
|
+
2. 执行:dsh plugin --profile <profile> add @surfishs/dsh-prompt-enhance
|
|
47
|
+
3. 如果 npm 安装失败,改用:dsh plugin --profile <profile> add github:surfishs/dsh-prompt-enhance
|
|
48
|
+
4. 安装完成后提示我重启 DSH,并让我确认插件出现在插件列表中。
|
|
49
|
+
5. 不要修改我的其他插件或 DSH 配置。
|
|
50
|
+
```
|
|
51
|
+
|
|
33
52
|
从 npm 安装:
|
|
34
53
|
|
|
35
54
|
```bash
|
|
@@ -61,9 +80,17 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
61
80
|
|
|
62
81
|
## 使用
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
1. **开始**:在输入框写下草稿,点工具栏的增强按钮(或你设置的快捷键)。
|
|
84
|
+
2. **查看结果**:结果出现在输入框上方的停靠卡里,可以:
|
|
85
|
+
- **回填**:写回输入框,卡片保持打开并显示「已替换」;
|
|
86
|
+
- **复制**:复制结果;
|
|
87
|
+
- **重新生成**:按当前输入再生成一版。
|
|
88
|
+
3. **撤销**:回填后点「撤销」恢复;关闭卡片后,输入框上方仍保留撤销条。
|
|
89
|
+
4. **关闭**:发送消息时卡片自动收起,按 `Esc` 也可以关闭。
|
|
65
90
|
|
|
66
|
-
|
|
91
|
+
输入为空或只有附件时,按钮会变灰、不可点;超长或含引用块会被本地拒绝。输出达到 Token 上限时,会提示结果可能不完整。
|
|
92
|
+
|
|
93
|
+
`/enhance <文本>`:从斜杠面板改写任意文本,结果可复制,不进入模型历史。
|
|
67
94
|
|
|
68
95
|
## 配置
|
|
69
96
|
|
|
@@ -88,6 +115,8 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
88
115
|
| `maxConcurrent` | `2` | 同时进行的增强上限;达到上限时新请求会提示稍后再试 |
|
|
89
116
|
| `rateLimitPerMinute` | `10` | 每分钟增强次数上限(滑动窗口);超限时提示稍后再试 |
|
|
90
117
|
|
|
118
|
+
输入为空或只有附件时按钮灰掉,不发起请求;结果被截断时调高 `maxOutputTokens`。
|
|
119
|
+
|
|
91
120
|
## 安全
|
|
92
121
|
|
|
93
122
|
增强路由只由本机 dsh 宿主提供,仅接受回环地址与本地 `Host` / `Origin`。`contextAware` 开启时,会话历史会随草稿发给当前配置的模型服务商——不要把敏感会话的上下文外发。
|
|
@@ -95,6 +124,8 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
95
124
|
## 故障排查
|
|
96
125
|
|
|
97
126
|
- 按钮不出现:确认 `enabled` 为 `true`,且安装后重启了 `dsh web`。
|
|
127
|
+
- 按钮是灰的:输入框为空或只有附件;输入文字后恢复。
|
|
128
|
+
- 结果不完整:查看截断提示,并调高 `maxOutputTokens`。
|
|
98
129
|
- 「尚未确定增强用的模型」:成对填写 `provider` / `model`,或先在当前会话发一条消息。
|
|
99
130
|
- 鉴权失败:检查对应 provider 在 harness 中的 API Key。
|
|
100
131
|
|
|
Binary file
|