dsh-prompt-rewriter 1.7.0 → 1.7.1
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/CHANGELOG.md +5 -0
- package/README.en.md +16 -1
- package/README.md +16 -1
- package/docs/images/03-settings-en.png +0 -0
- package/docs/images/03-settings.png +0 -0
- package/index.js +13 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
记录每个**已发布**版本对使用者可见的变化。插件内只维护中文条目;对外发布(GitHub Release / npm)的双语正文由发布方据此撰写,其中中文以本文件为准。
|
|
4
4
|
|
|
5
|
+
## 1.7.1
|
|
6
|
+
|
|
7
|
+
**中文**
|
|
8
|
+
|
|
9
|
+
- **OpenCode 渠道的增强请求不再返回 400**:此前请求没有把会话号透传给模型层,OpenCode 目标缺少 `x-opencode-session` 路由头,接口直接返回 `400 MissingSessionID`;现在会话号随请求一起下发,其余渠道的行为不变。(感谢 @xutiannuo 报告并给出修复方向)
|
|
5
10
|
## 1.7.0
|
|
6
11
|
|
|
7
12
|
**中文**
|
package/README.en.md
CHANGED
|
@@ -5,6 +5,10 @@ English | [中文](README.md)
|
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-prompt-rewriter)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://dsh-plugin.org/plugins/huaguoxingkong/dsh-prompt-rewriter)
|
|
8
|
+
[](https://awesome-dsh-plugin.com)
|
|
9
|
+
[](https://dshpluginhub.ai/plugins/dsh-prompt-rewriter)
|
|
10
|
+
[](https://deepseekharnessplugins.com/plugins/huaguoxingkong/dsh-prompt-rewriter)
|
|
11
|
+
[](https://www.dsh.so/artifact/dsh-prompt-rewriter/?ref=badge)
|
|
8
12
|
|
|
9
13
|
Turns the half-formed draft in your composer into a task instruction you can actually run.
|
|
10
14
|
**It rewrites the box, it never sends.** Don't like it? `Ctrl+Z` and you're back.
|
|
@@ -53,6 +57,14 @@ Come back and the result is already in the composer; if it hasn't finished, the
|
|
|
53
57
|
|
|
54
58
|
That wasn't true in 1.0.x: switching sessions aborted the task, and coming back showed nothing.
|
|
55
59
|
|
|
60
|
+
### When the composer has attachments or links
|
|
61
|
+
|
|
62
|
+
Attachments and links are things you already said — the rewrite only touches the sentence beside them.
|
|
63
|
+
|
|
64
|
+
- Attachment references and link chips stay in place when the rewritten text lands in the composer.
|
|
65
|
+
- Undo restores only the words you typed; your attachments are not swept away with it.
|
|
66
|
+
- What goes into the prompt is the **readable file name**, not the full `@D:\...` path, and a link keeps only its host name. Your local directory layout never travels with the prompt.
|
|
67
|
+
|
|
56
68
|
### Keyboard shortcut (off by default)
|
|
57
69
|
|
|
58
70
|
Turn it on at **Settings → Prompt Enhance → Shortcut**. Desktop uses `Ctrl+E` (`Cmd+E` on macOS); the browser uses `Ctrl+Alt+E` (`Cmd+Alt+E`).
|
|
@@ -95,7 +107,7 @@ Only images **currently sitting in the composer** — **never images from earlie
|
|
|
95
107
|
|
|
96
108
|
## Settings
|
|
97
109
|
|
|
98
|
-
`Settings → Prompt Enhance`. Four switches and one dropdown, affecting **only this button, never normal sending**.
|
|
110
|
+
`Settings → Prompt Enhance`. Four switches and one dropdown, affecting **only this button, never normal sending**. The changelog sits at the bottom of the page.
|
|
99
111
|
|
|
100
112
|

|
|
101
113
|
|
|
@@ -110,6 +122,7 @@ Only images **currently sitting in the composer** — **never images from earlie
|
|
|
110
122
|
- Turning the model switch off does not clear your selection; flipping it back on shows the same choice.
|
|
111
123
|
- Images still uploading are skipped, and the status area tells you how many were missed. A rewrite never fails because of an image.
|
|
112
124
|
- The **current version** sits in the top-right of the settings page; clicking it opens the project home page. Check it before reporting a problem — it makes the issue much easier to pin down.
|
|
125
|
+
- The **changelog** at the bottom folds by version, newest open by default; it is read from the shipped `CHANGELOG.md`, so it works offline.
|
|
113
126
|
|
|
114
127
|
## Install
|
|
115
128
|
|
|
@@ -144,6 +157,8 @@ Download the zip from [Releases](https://github.com/huaguoxingkong/dsh-prompt-re
|
|
|
144
157
|
|
|
145
158
|
**Can I undo the whole rewrite?** One `Ctrl+Z`. It's an ordinary edit step in the composer.
|
|
146
159
|
|
|
160
|
+
**Do my attachments survive a rewrite?** Yes. Attachment references and links stay as they were; only the text is replaced.
|
|
161
|
+
|
|
147
162
|
**Does it change messages I already sent?** No. It only edits the draft, and it never sends.
|
|
148
163
|
|
|
149
164
|
## Configuration
|
package/README.md
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-prompt-rewriter)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://dsh-plugin.org/plugins/huaguoxingkong/dsh-prompt-rewriter)
|
|
8
|
+
[](https://awesome-dsh-plugin.com)
|
|
9
|
+
[](https://dshpluginhub.ai/plugins/dsh-prompt-rewriter)
|
|
10
|
+
[](https://deepseekharnessplugins.com/plugins/huaguoxingkong/dsh-prompt-rewriter)
|
|
11
|
+
[](https://www.dsh.so/artifact/dsh-prompt-rewriter/?ref=badge)
|
|
8
12
|
|
|
9
13
|
把输入框里那句没头没尾的草稿,原地改成能直接执行的任务说明。
|
|
10
14
|
**只改内容,不发送、不运行。** 不满意就 `Ctrl+Z` 回去。
|
|
@@ -54,6 +58,14 @@
|
|
|
54
58
|
|
|
55
59
|
这一点在 1.0.x 里不是这样:那时切换会话会直接中断任务,回来什么也没有。
|
|
56
60
|
|
|
61
|
+
### 输入框里有附件或链接时
|
|
62
|
+
|
|
63
|
+
附件和链接算「你已经说过的东西」——改写只动旁边那句文字,不会把它们吃掉。
|
|
64
|
+
|
|
65
|
+
- 附件引用、链接芯片原样保留;改写结果落回输入框时它们还在原位。
|
|
66
|
+
- 撤销也只恢复你自己敲的字,不会把附件一起删掉。
|
|
67
|
+
- 写进提示词的是**可读的文件名**,不是 `@D:\...` 这样的完整路径;链接同样只保留域名。你本机的目录结构不会跟着提示词被复制出去。
|
|
68
|
+
|
|
57
69
|
### 键盘快捷键(默认关闭)
|
|
58
70
|
|
|
59
71
|
到 **设置 → 提示词增强 → 快捷键** 打开开关。桌面端为 `Ctrl+E`(macOS `Cmd+E`),浏览器端为 `Ctrl+Alt+E`(macOS `Cmd+Alt+E`)。
|
|
@@ -96,7 +108,7 @@
|
|
|
96
108
|
|
|
97
109
|
## 设置
|
|
98
110
|
|
|
99
|
-
`设置 →
|
|
111
|
+
`设置 → 提示词增强`。四个开关一个下拉,**只影响这个按钮,不影响正常发送**。页面底部是更新日志。
|
|
100
112
|
|
|
101
113
|

|
|
102
114
|
|
|
@@ -111,6 +123,7 @@
|
|
|
111
123
|
- 关掉模型开关不会清空你的选择,重新打开还是同一个。
|
|
112
124
|
- 上传中的图片会被跳过,状态区会告诉你少读了几张。不会因为一张图让整次改写失败。
|
|
113
125
|
- 设置页右上角显示**当前版本号**,点一下会打开项目主页。遇到问题时先看一眼版本,反馈时也更好定位。
|
|
126
|
+
- 底部「更新日志」按版本折叠,默认展开当前版本;内容取自随包发布的 `CHANGELOG.md`,不联网也能看。
|
|
114
127
|
|
|
115
128
|
## 安装
|
|
116
129
|
|
|
@@ -145,6 +158,8 @@ dsh plugin --profile web add github:huaguoxingkong/dsh-prompt-rewriter
|
|
|
145
158
|
|
|
146
159
|
**改写完想全撤?** 一次 `Ctrl+Z` 就回到原文,它只是输入框里一个普通编辑步。
|
|
147
160
|
|
|
161
|
+
**改写完,我贴的附件还在吗?** 在。附件引用和链接原样保留,改写只替换文字部分。
|
|
162
|
+
|
|
148
163
|
**会把我已经发出去的消息也改了吗?** 不会。它只改草稿,从不发送。
|
|
149
164
|
|
|
150
165
|
## 配置
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -867,9 +867,11 @@ async function admitComposerImage(scope, image, signal) {
|
|
|
867
867
|
* @param history - collected conversation context.
|
|
868
868
|
* @param images - model-ready composer image parts.
|
|
869
869
|
* @param signal - combined cancellation for this request.
|
|
870
|
+
* @param windowCache - per-route context-window cache.
|
|
871
|
+
* @param sessionId - the browser-reported Session id, when present.
|
|
870
872
|
* @returns the rewritten prompt text.
|
|
871
873
|
*/
|
|
872
|
-
async function generate(scope, config, route, draft, history, images, signal, windowCache) {
|
|
874
|
+
async function generate(scope, config, route, draft, history, images, signal, windowCache, sessionId) {
|
|
873
875
|
const llm = scope.llm;
|
|
874
876
|
if (llm === undefined) throw new EnhanceFailure('UNAVAILABLE', '当前运行的 Harness 未提供模型服务,无法增强提示词。');
|
|
875
877
|
const providers = llm.listProviders();
|
|
@@ -907,7 +909,15 @@ async function generate(scope, config, route, draft, history, images, signal, wi
|
|
|
907
909
|
let finish;
|
|
908
910
|
// Reasoning is counted for diagnosis only; it is never part of the prompt.
|
|
909
911
|
let reasoningChars = 0;
|
|
910
|
-
|
|
912
|
+
// Some routes key request routing by Session. OpenCode requires the
|
|
913
|
+
// `x-opencode-session` header and only emits it when `options.sessionId`
|
|
914
|
+
// reaches the provider, so without the id those targets answer 400 and the
|
|
915
|
+
// whole enhancement fails. Providers that ignore the field are unaffected,
|
|
916
|
+
// and an absent id leaves the request exactly as it was.
|
|
917
|
+
for await (const chunk of call.stream({
|
|
918
|
+
...call.config, system, messages, signal,
|
|
919
|
+
...(sessionId === undefined ? {} : { sessionId }),
|
|
920
|
+
})) {
|
|
911
921
|
signal.throwIfAborted();
|
|
912
922
|
if (chunk.type === 'text-delta') {
|
|
913
923
|
text += chunk.text;
|
|
@@ -1062,7 +1072,7 @@ async function handle(scope, config, request, lifetime, windowCache) {
|
|
|
1062
1072
|
}
|
|
1063
1073
|
}
|
|
1064
1074
|
|
|
1065
|
-
const text = await generate(scope, config, route, draft, history, images, signal, windowCache);
|
|
1075
|
+
const text = await generate(scope, config, route, draft, history, images, signal, windowCache, sessionId);
|
|
1066
1076
|
return Response.json({
|
|
1067
1077
|
ok: true,
|
|
1068
1078
|
text,
|
package/package.json
CHANGED