@surfishs/dsh-prompt-enhance 0.0.7 → 0.0.9
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 +24 -18
- package/README.md +24 -18
- package/cordis.patch.yml +1 -1
- package/icon.svg +14 -0
- package/lib/client.js +343 -383
- package/lib/index.js +67 -56
- package/lib/index.js.map +3 -3
- package/package.json +26 -16
- package/src/client/ActionIcons.tsx +4 -17
- package/src/client/EnhanceButton.tsx +52 -48
- package/src/client/ResultDock.tsx +22 -9
- package/src/client/ResultPanel.tsx +83 -52
- package/src/client/SparkleFishIcon.tsx +25 -20
- package/src/client/UndoBar.tsx +11 -6
- package/src/client/enhance-client.ts +44 -40
- package/src/client/index.tsx +3 -12
- package/src/client/llm-catalog.ts +14 -16
- package/src/client/locales.ts +18 -4
- package/src/client/reasoning-options.ts +7 -15
- package/src/client/settings-page-controls.tsx +449 -0
- package/src/client/settings-page-copy.ts +112 -0
- package/src/client/settings-page-spec.ts +330 -0
- package/src/client/settings-page-styles.ts +161 -0
- package/src/client/settings-page.tsx +113 -1110
- package/src/client/settings-source.ts +41 -31
- package/src/client/settings.ts +17 -12
- package/src/client/shortcut.ts +7 -6
- package/src/client/useDockAlignment.ts +5 -15
- package/src/config.ts +84 -27
- package/src/context.ts +1 -5
- package/src/enhance-routes.ts +8 -8
- package/src/enhancer.ts +43 -34
- package/src/orchestrate.ts +19 -23
- package/src/prompts.ts +4 -4
- package/src/provider-catalog.ts +1 -1
- package/src/reasoning-cache.ts +4 -4
- package/src/reasoning-efforts.ts +4 -9
- package/src/settings-source.ts +37 -23
- package/src/shared/limits.ts +38 -0
- package/src/shared/normalize.ts +4 -1
- package/src/shared/protocol.ts +27 -23
- package/src/shared/reasoning.ts +1 -7
- package/src/shared/stream-text.ts +0 -6
- package/src/shared/validate.ts +3 -9
- package/docs/code-review-2026-09.md +0 -211
- package/docs/handoff-settings-page.md +0 -195
- package/docs/release-0.2.3.md +0 -47
- package/docs/release-0.2.4.md +0 -20
- package/docs/release-0.2.5.md +0 -28
- package/docs/release-0.2.6.md +0 -33
- package/docs/release-0.2.7.md +0 -22
- package/docs/release-0.3.0.md +0 -36
- package/docs/release-0.3.1.md +0 -50
- package/docs/release-0.3.2.md +0 -41
- package/docs/release-0.3.3.md +0 -53
- package/docs/release-0.3.4.md +0 -43
- package/src/client/SparkleIcon.tsx +0 -33
package/README.en.md
CHANGED
|
@@ -12,29 +12,32 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
## Feature overview
|
|
16
|
+
|
|
17
|
+
| Feature | What it does |
|
|
18
|
+
|---|---|
|
|
19
|
+
| 🐋 **One-click enhance** | The composer toolbar button (the DeepSeek whale mark whose upper-left corner carries a sparkle); the shortcut is off by default and can be set in the settings |
|
|
20
|
+
| 🖼️ **Docked result card** | The result appears above the composer without covering the conversation, with the model, timing and `token` usage; a truncated result is marked as possibly incomplete |
|
|
21
|
+
| ↩️ **Apply, copy and undo** | Undo right after applying; once the card is closed, the undo bar remains above the composer |
|
|
22
|
+
| 🔄 **Regenerate** | Requests another version from the current composer text; after applying, it regenerates the enhanced draft as well |
|
|
23
|
+
| 💬 **`/enhance` command** | Rewrites any text from the slash menu; the result never enters model history |
|
|
24
|
+
| 🧭 **Model routing** | A pinned `provider` + `model` pair wins; otherwise it follows the current session model, then the global default model |
|
|
25
|
+
| 🧩 **Context aware** | With `contextAware` on, recent turns resolve references such as "it" or "that"; it can be turned off |
|
|
26
|
+
| 🔑 **Zero credentials** | Calls go through the harness LLM service and its credential store; the plugin neither reads nor stores keys |
|
|
27
|
+
| 🛡️ **Draft safety** | Empty, attachment-only, over-length and command-or-reference drafts are blocked locally before any request; upstream failures map to readable messages; a failure never touches the draft |
|
|
28
|
+
| ⚙️ **Live settings** | Fields save automatically, common rows come first and the rest fold into Advanced settings; changes apply to the next call with no restart |
|
|
27
29
|
|
|
28
30
|
## Requirements
|
|
29
31
|
|
|
30
|
-
| | |
|
|
32
|
+
| Item | Requirement |
|
|
31
33
|
|---|---|
|
|
32
|
-
| dsh | `>= 0.1.1-rc.2 < 0.3.0` |
|
|
34
|
+
| dsh | `>= 0.1.1-rc.2 < 0.3.0`, verified on `0.2.2-rc.3` |
|
|
33
35
|
| Node (source builds only) | `^22.19.0 \|\| >=24.0.0` |
|
|
34
|
-
| Plugin | `0.0.x` |
|
|
35
36
|
|
|
36
37
|
## Install
|
|
37
38
|
|
|
39
|
+
Check the package name first. `dsh-prompt-enhance` on npm (no scope) is the upstream project and this plugin is a rewrite of it; this plugin is `@surfishs/dsh-prompt-enhance`. Install from this repository (`surfishs/dsh-prompt-enhance`) or its entry in the plugin market. **Do not** run `dsh plugin add dsh-prompt-enhance`.
|
|
40
|
+
|
|
38
41
|
### Let an agent install it
|
|
39
42
|
|
|
40
43
|
No command line needed. Send the block below to an agent that can run commands on your machine (DSH desktop or web):
|
|
@@ -56,14 +59,14 @@ dsh plugin --profile <profile> add @surfishs/dsh-prompt-enhance
|
|
|
56
59
|
# restart dsh
|
|
57
60
|
```
|
|
58
61
|
|
|
62
|
+
> Replace `<profile>` with your profile name: usually `desktop` for the desktop app and `web` for the web build.
|
|
63
|
+
|
|
59
64
|
From GitHub (the built `lib/` is committed, so no local build happens):
|
|
60
65
|
|
|
61
66
|
```bash
|
|
62
67
|
dsh plugin --profile <profile> add github:surfishs/dsh-prompt-enhance
|
|
63
68
|
```
|
|
64
69
|
|
|
65
|
-
Replace `<profile>` with your profile name: usually `desktop` for the desktop app and `web` for the web build.
|
|
66
|
-
|
|
67
70
|
From a local checkout (development):
|
|
68
71
|
|
|
69
72
|
```bash
|
|
@@ -88,7 +91,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
88
91
|
3. **Undo**: after applying, click Undo to restore; after closing the card, the undo bar remains above the composer.
|
|
89
92
|
4. **Close**: sending the draft closes the card automatically; Escape also closes it.
|
|
90
93
|
|
|
91
|
-
An empty or attachment-only draft dims the button and makes it unclickable; over-length
|
|
94
|
+
An empty or attachment-only draft dims the button and makes it unclickable; over-length drafts and drafts containing commands or file references are rejected locally. A result that hits the token cap is marked as possibly incomplete.
|
|
92
95
|
|
|
93
96
|
`/enhance <text>`: rewrite any text from the slash menu; the result is copyable and never enters model history.
|
|
94
97
|
|
|
@@ -123,6 +126,7 @@ An empty or attachment-only draft dims the button and starts no request; raise `
|
|
|
123
126
|
- **No model keys stored**: the plugin does not read or store model API keys; calls use the host's existing LLM configuration.
|
|
124
127
|
- **Context sent only when enabled**: with `contextAware` on, the most recent user/assistant text and the current draft are sent to the configured model provider (default: up to 8 messages and 4,000 characters); system messages, reasoning, tool results and attachments are excluded. With it off, only the draft is sent.
|
|
125
128
|
- **Sensitive conversations**: if the content must not leave the machine, turn off `contextAware` or use a local/private model route you trust.
|
|
129
|
+
- **Local tier cache**: the plugin caches "which reasoning tiers does this route declare" in `$DSH_HOME/dsh-prompt-enhance/reasoning-efforts.json` (`~/.dsh/…` when `DSH_HOME` is unset). The file holds only the provider, the model and the tier metadata — no API key, draft or conversation text. The cache has no expiry; refresh it from the settings page's tier-refresh control, or delete the file.
|
|
126
130
|
|
|
127
131
|
## Troubleshooting
|
|
128
132
|
|
|
@@ -139,6 +143,8 @@ An empty or attachment-only draft dims the button and starts no request; raise `
|
|
|
139
143
|
```bash
|
|
140
144
|
npm install
|
|
141
145
|
npm run typecheck
|
|
146
|
+
npm run lint
|
|
147
|
+
npm run format:check
|
|
142
148
|
npm test
|
|
143
149
|
npm run build
|
|
144
150
|
```
|
package/README.md
CHANGED
|
@@ -12,29 +12,32 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
## 功能一览
|
|
16
|
+
|
|
17
|
+
| 功能 | 说明 |
|
|
18
|
+
|---|---|
|
|
19
|
+
| 🐋 **一键增强** | 输入框工具栏按钮(左上角带星芒的 DeepSeek 鲸鱼标识);快捷键默认关闭,可在设置中指定 |
|
|
20
|
+
| 🖼️ **停靠结果卡** | 结果显示在输入框上方,不遮挡对话;附模型、耗时与 `token` 用量,超限时提示结果可能不完整 |
|
|
21
|
+
| ↩️ **回填、复制与撤销** | 回填后可直接撤销;关闭卡片后,输入框上方仍保留撤销条 |
|
|
22
|
+
| 🔄 **重新生成** | 按当前输入框内容再请求一版;回填后也可对增强稿继续生成 |
|
|
23
|
+
| 💬 **`/enhance` 命令** | 斜杠面板直接改写任意文本;结果不进入模型历史 |
|
|
24
|
+
| 🧭 **模型路由** | 设置中同时指定 `provider` 与 `model` 时优先;否则依次跟随当前会话模型、全局默认模型 |
|
|
25
|
+
| 🧩 **上下文感知** | `contextAware` 开启时参考最近几轮对话补全「它 / 这个」这类指代,可随时关闭 |
|
|
26
|
+
| 🔑 **零凭据配置** | 调用走 harness LLM 服务,密钥来自 harness 凭据存储;插件不读取也不保存 |
|
|
27
|
+
| 🛡️ **草稿安全** | 空输入、仅附件、超长、含命令或文件引用都在本地拦截,不发请求;上游失败映射为可读提示;失败绝不改动草稿 |
|
|
28
|
+
| ⚙️ **配置热生效** | 字段改完自动保存,常用项在前、其余收进「高级设置」;改动对下一次调用立即生效,无需重启 |
|
|
27
29
|
|
|
28
30
|
## 环境要求
|
|
29
31
|
|
|
30
|
-
| | |
|
|
32
|
+
| 项目 | 要求 |
|
|
31
33
|
|---|---|
|
|
32
|
-
| dsh | `>= 0.1.1-rc.2 < 0.3.0` |
|
|
34
|
+
| dsh | `>= 0.1.1-rc.2 < 0.3.0`,已在 `0.2.2-rc.3` 验证 |
|
|
33
35
|
| Node(仅源码构建) | `^22.19.0 \|\| >=24.0.0` |
|
|
34
|
-
| 插件 | `0.0.x` |
|
|
35
36
|
|
|
36
37
|
## 安装
|
|
37
38
|
|
|
39
|
+
装之前请确认包名。npm 上的 `dsh-prompt-enhance`(无 scope)是上游原项目,本插件是它的重写分支,包名是 `@surfishs/dsh-prompt-enhance`。本插件的安装源是本仓库 `surfishs/dsh-prompt-enhance` 或它在插件市场里的条目。**不要**执行 `dsh plugin add dsh-prompt-enhance`。
|
|
40
|
+
|
|
38
41
|
### 让 Agent 帮你安装
|
|
39
42
|
|
|
40
43
|
不用自己敲命令。把下面整段发给能操作本机终端的 Agent(DSH 桌面版、Web 版都可以):
|
|
@@ -56,14 +59,14 @@ dsh plugin --profile <profile> add @surfishs/dsh-prompt-enhance
|
|
|
56
59
|
# 重启 dsh
|
|
57
60
|
```
|
|
58
61
|
|
|
62
|
+
> `<profile>` 换成你的 profile 名:桌面版通常是 `desktop`,Web 版通常是 `web`。
|
|
63
|
+
|
|
59
64
|
从 GitHub 安装(`lib/` 已随仓库提交,无需本地构建):
|
|
60
65
|
|
|
61
66
|
```bash
|
|
62
67
|
dsh plugin --profile <profile> add github:surfishs/dsh-prompt-enhance
|
|
63
68
|
```
|
|
64
69
|
|
|
65
|
-
`<profile>` 换成你的 profile 名:桌面版通常是 `desktop`,Web 版通常是 `web`。
|
|
66
|
-
|
|
67
70
|
从本地检出(开发用):
|
|
68
71
|
|
|
69
72
|
```bash
|
|
@@ -88,7 +91,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
88
91
|
3. **撤销**:回填后点「撤销」恢复;关闭卡片后,输入框上方仍保留撤销条。
|
|
89
92
|
4. **关闭**:发送消息时卡片自动收起,按 `Esc` 也可以关闭。
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
输入为空或只有附件时,按钮会变灰、不可点;超长或含命令或文件引用会被本地拒绝。输出达到 Token 上限时,会提示结果可能不完整。
|
|
92
95
|
|
|
93
96
|
`/enhance <文本>`:从斜杠面板改写任意文本,结果可复制,不进入模型历史。
|
|
94
97
|
|
|
@@ -123,6 +126,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
123
126
|
- **不保存模型密钥**:插件不读取或存储模型 API key,调用走宿主已有的 LLM 配置。
|
|
124
127
|
- **上下文按需发送**:`contextAware` 开启时,最近几轮 user/assistant 文本和当前草稿会发给当前配置的模型服务商(默认最多 8 条消息、4000 字符);system、reasoning、工具结果和附件不会进入上下文。关闭后只发送草稿。
|
|
125
128
|
- **敏感会话**:如果内容不能外发,请关闭 `contextAware`,或改用你信任的本地/私有模型服务。
|
|
129
|
+
- **本机档位缓存**:插件会把「当前路由声明了哪些推理档位」的查询结果缓存到 `$DSH_HOME/dsh-prompt-enhance/reasoning-efforts.json`(未设置 `DSH_HOME` 时为 `~/.dsh/…`)。文件内容只有 provider、model 与档位信息,不含 API key、草稿或对话内容;缓存没有过期时间,可在设置页点「重新获取档位」刷新,或直接删除该文件。
|
|
126
130
|
|
|
127
131
|
## 故障排查
|
|
128
132
|
|
|
@@ -139,6 +143,8 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
139
143
|
```bash
|
|
140
144
|
npm install
|
|
141
145
|
npm run typecheck
|
|
146
|
+
npm run lint
|
|
147
|
+
npm run format:check
|
|
142
148
|
npm test
|
|
143
149
|
npm run build
|
|
144
150
|
```
|
package/cordis.patch.yml
CHANGED
package/icon.svg
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
|
2
|
+
<!-- DeepSeek whale with a four-point sparkle at its upper-left corner.
|
|
3
|
+
Arrangement: the whale and the star share one rigid shift, the star is
|
|
4
|
+
scaled to 0.72 and sits further out of the whale's silhouette. The pair is
|
|
5
|
+
drawn at 1.2027 of that arrangement and centred on its ink mass, so the
|
|
6
|
+
glyph fills 94% of this canvas and reads centred instead of drifting to
|
|
7
|
+
the lower right. The star tip keeps a 0.10-unit margin, which leaves the
|
|
8
|
+
mass 0.6 units right of dead centre - invisible at row size, and the
|
|
9
|
+
alternative would clip the tip.
|
|
10
|
+
src/client/SparkleFishIcon.tsx draws the composer mark in its own 26x20
|
|
11
|
+
glyph box; keep the two in sync when the mark changes. -->
|
|
12
|
+
<path d="M22.9168 1.43018C22.6713 1.31018 22.5658 1.53918 22.4223 1.65519C22.3733 1.69269 22.3318 1.74169 22.2903 1.78669C21.9317 2.1697 21.5127 2.42121 20.9657 2.39121C20.1657 2.34621 19.4827 2.59771 18.8787 3.20973C18.7502 2.45521 18.3236 2.0047 17.6746 1.71569C17.3351 1.56568 16.9916 1.41518 16.7536 1.08867C16.5876 0.856163 16.5421 0.597155 16.4591 0.341647C16.4061 0.187643 16.3536 0.0301382 16.1761 0.00363739C15.9836 -0.0263635 15.9081 0.135141 15.8326 0.270145C15.5306 0.822162 15.4136 1.43018 15.4251 2.0462C15.4516 3.43174 16.0366 4.53527 17.1991 5.3203C17.3311 5.4103 17.3651 5.5003 17.3236 5.63181C17.2441 5.90231 17.1501 6.16482 17.0671 6.43533C17.0141 6.60784 16.9351 6.64584 16.7501 6.57033C16.1121 6.30383 15.5611 5.90931 15.074 5.4328C14.2475 4.63328 13.5 3.75075 12.568 3.05973C12.349 2.89822 12.13 2.74822 11.9034 2.60522C10.9524 1.68169 12.028 0.923165 12.277 0.833162C12.5375 0.739159 12.3675 0.41615 11.5259 0.42015C10.6844 0.42365 9.91439 0.705658 8.93286 1.08117C8.78935 1.13767 8.63835 1.17867 8.48384 1.21267C7.59332 1.04367 6.66829 1.00617 5.70226 1.11517C3.88321 1.31768 2.43016 2.1777 1.36213 3.64575C0.0790928 5.4103 -0.222916 7.41536 0.146595 9.50642C0.535106 11.7105 1.66014 13.535 3.38869 14.9616C5.18125 16.4406 7.24581 17.1657 9.60138 17.0266C11.0319 16.9441 12.6245 16.7526 14.421 15.2321C14.874 15.4576 15.3496 15.5476 16.1381 15.6151C16.7456 15.6716 17.3306 15.5851 17.7836 15.4911C18.4931 15.3411 18.4441 14.6841 18.1876 14.5636C16.1081 13.595 16.5646 13.9891 16.1496 13.67C17.2061 12.42 18.8202 10.1979 19.3182 7.17235C19.3672 6.83834 19.4297 6.36783 19.4222 6.09732C19.4182 5.93231 19.4562 5.86831 19.6447 5.84931C20.1657 5.78931 20.6712 5.64681 21.1357 5.3913C22.4833 4.65528 23.0268 3.44624 23.1548 1.9972C23.1738 1.77569 23.1508 1.54668 22.9168 1.43018ZM11.1749 14.4736C9.15936 12.889 8.18184 12.3675 7.77832 12.39C7.40081 12.4125 7.46881 12.8445 7.55182 13.126C7.63882 13.404 7.75182 13.5955 7.91033 13.8396C8.01983 14.0011 8.09533 14.2411 7.80083 14.4216C7.15181 14.8231 6.02327 14.2866 5.97027 14.2601C4.65673 13.4865 3.5587 12.4655 2.78467 11.069C2.03715 9.72493 1.60314 8.28289 1.53164 6.74384C1.51264 6.37233 1.62214 6.24082 1.99215 6.17332C2.47916 6.08332 2.98118 6.06432 3.46769 6.13582C5.52476 6.43633 7.27581 7.35586 8.74385 8.8129C9.58188 9.64243 10.2159 10.634 10.8689 11.6025C11.5634 12.631 12.3105 13.611 13.262 14.4146C13.598 14.6961 13.866 14.9101 14.1225 15.0681C13.349 15.1546 12.058 15.1731 11.1749 14.4746L11.1749 14.4736ZM12.141 8.25988C12.141 8.09488 12.273 7.96338 12.439 7.96338C12.4765 7.96338 12.5105 7.97088 12.541 7.98188C12.5825 7.99688 12.6205 8.01938 12.6505 8.05338C12.7035 8.10588 12.7335 8.18088 12.7335 8.25988C12.7335 8.42489 12.6015 8.55639 12.4355 8.55639C12.2695 8.55639 12.141 8.42489 12.141 8.25988ZM15.1415 9.79893C14.949 9.87793 14.7565 9.94544 14.5715 9.95294C14.2845 9.96794 13.9715 9.85143 13.8015 9.70893C13.5375 9.48742 13.3485 9.36342 13.2695 8.97691C13.2355 8.8119 13.2545 8.55639 13.2845 8.40989C13.3525 8.09438 13.277 7.89187 13.0545 7.70787C12.8735 7.55786 12.643 7.51636 12.39 7.51636C12.2955 7.51636 12.209 7.47486 12.1445 7.44136C12.039 7.38886 11.9519 7.25735 12.035 7.09585C12.0615 7.04335 12.19 6.91584 12.22 6.89334C12.5635 6.69784 12.9595 6.76184 13.326 6.90834C13.6655 7.04735 13.9225 7.30236 14.292 7.66287C14.6695 8.09838 14.7375 8.21838 14.9525 8.54539C15.1225 8.8009 15.277 9.06341 15.3831 9.36392C15.4471 9.55142 15.3641 9.70493 15.1415 9.79893Z" transform="translate(7.7334 9.8278) scale(1.13114)" fill="#1C1E24"/>
|
|
13
|
+
<path d="M5.715 0 L7.2 4.2 L11.43 5.715 L7.2 7.2 L5.715 11.43 L4.2 7.2 L0 5.715 L4.2 4.2 Z" transform="translate(0.0921 4.7040) scale(0.86594)" fill="#1C1E24"/>
|
|
14
|
+
</svg>
|