@lklkuu/dsh-prompt-optimizer 0.1.0 → 0.1.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 CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.1.1] - 2026-11-15
6
+
7
+ ### 修复
8
+
9
+ - 插件介绍页(详情页)此前总是显示英文 README,与界面语言无关。原因是包内没有声明
10
+ `meta.detail`,DSH 只能回退到写死的 `README.md`;而 `README.zh.md` 不在它的候选名单里,
11
+ 永远不会被选中。
12
+ - 现在 `locale/en.json` 与 `locale/zh.json` 各自声明了 `meta`(`title` / `description` /
13
+ `detail`),中文界面读 `docs/DETAIL.zh.md`,英文界面读 `docs/DETAIL.md`,日文等其它语言
14
+ 按 DSH 的语言回退链落到英文文档。
15
+
16
+ ### 新增
17
+
18
+ - `docs/DETAIL.zh.md`(中文版详情文档),`docs/DETAIL.md` 改写为英文版,两份内容一一对应。
19
+ - `docs/preview.svg`(640×300,无文字、无脚本、无外部资源,明暗主题都可读),
20
+ 两张详情文档顶部各引用它一次。
21
+ - 插件列表里的名称与一句话说明改为随界面语言切换,不再显示裸包名。
22
+
5
23
  ## [0.1.0] - 2026-11-15
6
24
 
7
25
  首个发布版本。
package/README.md CHANGED
@@ -28,10 +28,10 @@ usage only — no code was copied.
28
28
  dsh plugin --profile desktop add @lklkuu/dsh-prompt-optimizer
29
29
  ```
30
30
 
31
- Or straight from this repository (works before the npm release is live):
31
+ Or from the tarball attached to the latest Release:
32
32
 
33
33
  ```bash
34
- dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer
34
+ dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/latest/download/dsh-prompt-optimizer.tgz
35
35
  ```
36
36
 
37
37
  Restart DSH (or reload the page) so the client module loads.
package/README.zh.md CHANGED
@@ -28,7 +28,7 @@ dsh plugin --profile desktop add @lklkuu/dsh-prompt-optimizer
28
28
  或从 Release 里的 tarball 安装:
29
29
 
30
30
  ```bash
31
- dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/download/v0.1.0/dsh-prompt-optimizer-0.1.0.tgz
31
+ dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/latest/download/dsh-prompt-optimizer.tgz
32
32
  ```
33
33
 
34
34
  安装后需要重启 DSH(或刷新页面)让客户端模块加载。
package/docs/DETAIL.md CHANGED
@@ -1,57 +1,65 @@
1
+ ![A loose draft on the left, a star-shaped Optimize button in the composer, and a structured prompt on the right](preview.svg)
2
+
1
3
  # dsh-prompt-optimizer
2
4
 
3
- 在 DeepSeek Harness 的对话框右侧加一个「优化」按钮:拿输入框里的草稿,交给当前选中的模型,按
4
- [linshenkx/prompt-optimizer](https://github.com/linshenkx/prompt-optimizer) 的「基础优化」
5
- (`user-optimize/user-prompt-basic`,v2.0.0)模板改写,然后把结果写回输入框。
5
+ Adds an **Optimize** button to the right of the DeepSeek Harness composer: it takes the draft
6
+ you have typed, hands it to the model currently selected in the conversation, rewrites it with the
7
+ "basic optimize" template from
8
+ [linshenkx/prompt-optimizer](https://github.com/linshenkx/prompt-optimizer)
9
+ (`user-optimize/user-prompt-basic`, v2.0.0), and writes the result straight back into the composer.
6
10
 
7
- 不安装 prompt-optimizer 本体,不依赖 Docker / Bun / 浏览器扩展,也不需要任何额外的 API Key ——
8
- 用的是你在 DSH 里已经选好的那个模型。
11
+ It does not install prompt-optimizer itself, and it needs no Docker, Bun, browser extension, or
12
+ extra API key — it uses the model you already have selected in DSH.
9
13
 
10
- ## 用法
14
+ ## Usage
11
15
 
12
- 1. 在输入框里写点东西(空的时候按钮是灰的)。
13
- 2. 点「优化」。按钮变成「优化中…」,再点一次可以取消。
14
- 3. 结果直接替换输入框内容,旁边出现「已优化 · 撤销」,点一下回到原文。
16
+ 1. Type something into the composer (the button is greyed out while it is empty).
17
+ 2. Click **Optimize**. The button turns into "Optimizing…"; click it again to cancel.
18
+ 3. The result replaces the composer content, and an "Optimized · Undo" chip appears next to it —
19
+ one click restores the original text.
15
20
 
16
- 超过 150 秒没返回会自己取消并提示超时。
21
+ If no answer comes back within 150 seconds the request cancels itself and reports a timeout.
17
22
 
18
- ## 它做了什么
23
+ ## What it does
19
24
 
20
- | 环节 | 实现 |
25
+ | Step | Implementation |
21
26
  | --- | --- |
22
- | 按钮位置 | `conversation.input.right` 槽位,`order: 12`(在图片提供方 10 与 Codex 配额 15 之间) |
23
- | 读草稿 | 槽位标准 prop `useInput(s => s.draft)` |
24
- | 调模型 | host 半 `POST /api/prompt-optimizer/optimize` → `ctx.get('llm').stream()` |
25
- | 选模型 | `agentDefaultModel.currentSelection()`,即你当前对话选中的模型 |
26
- | 写回 | `inputActions.setDraft(text)` + `persistDraft()` |
27
+ | Button placement | `conversation.input.right` slot, `order: 12` (between the image-provider pill at 10 and the Codex quota at 15) |
28
+ | Read the draft | The slot's standard prop `useInput(s => s.draft)` |
29
+ | Call the model | Host half `POST /api/prompt-optimizer/optimize` → `ctx.get('llm').stream()` |
30
+ | Pick the model | `agentDefaultModel.currentSelection()`, i.e. the model selected for this conversation |
31
+ | Write back | `inputActions.setDraft(text)` + `persistDraft()` |
27
32
 
28
- 提示词就是 linshenkx/prompt-optimizer 的原文,唯一改动是把模板里的 Mustache
29
- `{{#helpers.toJson}}{{{originalPrompt}}}{{/helpers.toJson}}` 换成本地 `JSON.stringify(draft)`
30
- —— 效果一样,但不需要引入模板引擎。
33
+ The prompt is the linshenkx/prompt-optimizer text verbatim; the only change is replacing the
34
+ Mustache placeholder `{{#helpers.toJson}}{{{originalPrompt}}}{{/helpers.toJson}}` with a local
35
+ `JSON.stringify(draft)` — same effect, without pulling in a template engine.
31
36
 
32
- 这一路是**旁路调用**,不进会话记录,不消耗会话轮次,不改动任何会话文件。
37
+ The call runs **out of band**: it is not appended to the session transcript, does not consume a
38
+ conversation turn, and does not touch any session file.
33
39
 
34
- ## 配置
40
+ ## Configuration
35
41
 
36
- 没有配置项。想做更激进的改写(分析型、结构化、面向输出格式等),改 `index.js` 里的
37
- `SYSTEM_PROMPT` 与 `renderUserPrompt` 即可 —— 上游仓库有 144 个模板可选。
42
+ There are no settings. To try a more aggressive rewrite (analytical, structured, output-format
43
+ oriented, …), edit `SYSTEM_PROMPT` and `renderUserPrompt` in `index.js` — the upstream repository
44
+ ships 144 templates to choose from.
38
45
 
39
- ## 已知边界
46
+ ## Known limits
40
47
 
41
- - 只在**有浏览器界面**的 profile 生效(desktop / web)。headless、tui、sdk 下 host 半照常加载,
42
- 但 `/api` 路由不注册,前端也拿不到按钮。
43
- - 依赖宿主的 `llm`、`agentDefaultModel`、`connection` 三个服务;任何一项缺失时按钮不渲染或报错,
44
- 不会静默失败。
45
- - `inputActions.setDraft` 会整段替换草稿,光标位置不保留。
48
+ - Only works in a profile **with a browser UI** (desktop / web). Under headless, tui and sdk the
49
+ host half still loads, but the `/api` route is never registered and the front end has no button.
50
+ - Depends on the host's `llm`, `agentDefaultModel` and `connection` services; if one is missing the
51
+ button is not rendered or an error is reported — it never fails silently.
52
+ - `inputActions.setDraft` replaces the whole draft, so the caret position is not preserved.
46
53
 
47
- ## 卸载
54
+ ## Uninstall
48
55
 
49
56
  ```bash
50
57
  dsh plugin --profile desktop remove @lklkuu/dsh-prompt-optimizer
51
58
  ```
52
59
 
53
- 或在本机 profile 的插件管理里停用该条目。
60
+ Or disable the entry in the plugin manager of your local profile.
54
61
 
55
- ## 许可
62
+ ## License
56
63
 
57
- MIT。提示词模板来自 linshenkx/prompt-optimizer(AGPL-3.0),此处仅作提示词文本引用。
64
+ MIT. The prompt template comes from linshenkx/prompt-optimizer (AGPL-3.0); only the prompt text is
65
+ quoted here.
@@ -0,0 +1,59 @@
1
+ ![左边是一段随手写的草稿,输入框里有一颗星形的「优化」按钮,右边是整理好的提示词](preview.svg)
2
+
3
+ # dsh-prompt-optimizer
4
+
5
+ 在 DeepSeek Harness 的对话框右侧加一个「优化」按钮:拿输入框里的草稿,交给当前选中的模型,按
6
+ [linshenkx/prompt-optimizer](https://github.com/linshenkx/prompt-optimizer) 的「基础优化」
7
+ (`user-optimize/user-prompt-basic`,v2.0.0)模板改写,然后把结果写回输入框。
8
+
9
+ 不安装 prompt-optimizer 本体,不依赖 Docker / Bun / 浏览器扩展,也不需要任何额外的 API Key ——
10
+ 用的是你在 DSH 里已经选好的那个模型。
11
+
12
+ ## 用法
13
+
14
+ 1. 在输入框里写点东西(空的时候按钮是灰的)。
15
+ 2. 点「优化」。按钮变成「优化中…」,再点一次可以取消。
16
+ 3. 结果直接替换输入框内容,旁边出现「已优化 · 撤销」,点一下回到原文。
17
+
18
+ 超过 150 秒没返回会自己取消并提示超时。
19
+
20
+ ## 它做了什么
21
+
22
+ | 环节 | 实现 |
23
+ | --- | --- |
24
+ | 按钮位置 | `conversation.input.right` 槽位,`order: 12`(在图片提供方 10 与 Codex 配额 15 之间) |
25
+ | 读草稿 | 槽位标准 prop `useInput(s => s.draft)` |
26
+ | 调模型 | host 半 `POST /api/prompt-optimizer/optimize` → `ctx.get('llm').stream()` |
27
+ | 选模型 | `agentDefaultModel.currentSelection()`,即你当前对话选中的模型 |
28
+ | 写回 | `inputActions.setDraft(text)` + `persistDraft()` |
29
+
30
+ 提示词就是 linshenkx/prompt-optimizer 的原文,唯一改动是把模板里的 Mustache
31
+ `{{#helpers.toJson}}{{{originalPrompt}}}{{/helpers.toJson}}` 换成本地 `JSON.stringify(draft)`
32
+ —— 效果一样,但不需要引入模板引擎。
33
+
34
+ 这一路是**旁路调用**,不进会话记录,不消耗会话轮次,不改动任何会话文件。
35
+
36
+ ## 配置
37
+
38
+ 没有配置项。想做更激进的改写(分析型、结构化、面向输出格式等),改 `index.js` 里的
39
+ `SYSTEM_PROMPT` 与 `renderUserPrompt` 即可 —— 上游仓库有 144 个模板可选。
40
+
41
+ ## 已知边界
42
+
43
+ - 只在**有浏览器界面**的 profile 生效(desktop / web)。headless、tui、sdk 下 host 半照常加载,
44
+ 但 `/api` 路由不注册,前端也拿不到按钮。
45
+ - 依赖宿主的 `llm`、`agentDefaultModel`、`connection` 三个服务;任何一项缺失时按钮不渲染或报错,
46
+ 不会静默失败。
47
+ - `inputActions.setDraft` 会整段替换草稿,光标位置不保留。
48
+
49
+ ## 卸载
50
+
51
+ ```bash
52
+ dsh plugin --profile desktop remove @lklkuu/dsh-prompt-optimizer
53
+ ```
54
+
55
+ 或在本机 profile 的插件管理里停用该条目。
56
+
57
+ ## 许可
58
+
59
+ MIT。提示词模板来自 linshenkx/prompt-optimizer(AGPL-3.0),此处仅作提示词文本引用。
@@ -9,11 +9,13 @@
9
9
 
10
10
  ## 安装
11
11
 
12
+ npm(推荐):
13
+
12
14
  ```bash
13
- dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer
15
+ dsh plugin --profile desktop add @lklkuu/dsh-prompt-optimizer
14
16
  ```
15
17
 
16
- 或直接用本页附件(版本无关的稳定链接,推荐):
18
+ 或直接用本页附件(版本无关的稳定链接):
17
19
 
18
20
  ```bash
19
21
  dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/latest/download/dsh-prompt-optimizer.tgz
@@ -21,6 +23,8 @@ dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/
21
23
 
22
24
  安装后重启 DSH(或刷新页面)让客户端模块加载。
23
25
 
26
+ > 注意:npm 上的 `dsh-prompt-optimizer`(不带 scope)是**别人的同名包**,不是本插件。
27
+
24
28
  ## 用法
25
29
 
26
30
  1. 输入框写点东西(空时按钮是灰的)。
@@ -51,6 +55,8 @@ dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/
51
55
  | `dsh-prompt-optimizer.tgz` | 版本无关,`latest/download/` 可直接引用 |
52
56
  | `dsh-prompt-optimizer-0.1.0.tgz` | 钉住本版本,内容相同 |
53
57
 
54
- SHA-256(`.tgz`,两者相同):`7cf95d36ca059a7dc58fa2f4549b2fa59baa58313e7f3df25f6504a5140833ed`
58
+ SHA-256(`.tgz`,两者相同):`14b8fdf5f0cd6fe3dc90baf06c28e626b4c73bb2732c2d1b4526f33fe22b5751`
59
+
60
+ 与 npm 上 `@lklkuu/dsh-prompt-optimizer@0.1.0` 的 tarball 字节完全一致。
55
61
 
56
62
  MIT License.
@@ -0,0 +1,57 @@
1
+ # dsh-prompt-optimizer 0.1.1
2
+
3
+ 「优化」按钮的功能与 0.1.0 完全一致,这一版只修了一件事:**插件介绍页不再一律显示英文**。
4
+
5
+ ## 修了什么
6
+
7
+ 装好插件后点开它的介绍页,之前不管界面语言是什么,看到的都是英文 `README.md`。
8
+
9
+ 原因不在本插件,而在 DSH 的查找顺序:详情页会先读 `locale/<语言>.json` 里的 `meta.detail`,
10
+ 只有那里没声明时,才回退到包里的 README。而那个兜底名单是写死的
11
+ `README.md` / `readme.md` / `Readme.md` / `README.markdown` / `README` ——
12
+ `README.zh.md` 既不在名单里,也不匹配它的匹配规则,所以中文版永远轮不到。
13
+
14
+ 这一版按 DSH 的约定,把文案和文档分开声明:
15
+
16
+ | 界面语言 | 读哪份文档 |
17
+ | --- | --- |
18
+ | 简体中文 | `docs/DETAIL.zh.md` |
19
+ | English | `docs/DETAIL.md` |
20
+ | 其它语言 | 按回退链落到 `docs/DETAIL.md` |
21
+
22
+ 插件列表里显示的名称与一句话说明也一并跟着界面语言切换,不再显示裸包名。
23
+
24
+ ## 顺带加的
25
+
26
+ - `docs/DETAIL.zh.md`:中文版详情文档(原有内容)。
27
+ - `docs/DETAIL.md`:改写为英文版,与中文版逐段对应。
28
+ - `docs/preview.svg`:640×300 示意图,不含文字、脚本与外部资源,明暗主题下都能看。
29
+ 两份详情文档顶部各引用它一次。
30
+
31
+ ## 安装 / 升级
32
+
33
+ ```bash
34
+ dsh plugin --profile desktop add @lklkuu/dsh-prompt-optimizer
35
+ ```
36
+
37
+ 也可以直接指向本 Release 里的 tarball:
38
+
39
+ ```bash
40
+ dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/download/v0.1.1/dsh-prompt-optimizer.tgz
41
+ ```
42
+
43
+ 升级后刷新页面即可看到中文介绍页,不需要重启 DSH。
44
+
45
+ ## 校验
46
+
47
+ - `npm test` → 15 tests / 15 pass / 0 fail
48
+ - `npm pack --dry-run` → 15 个文件,包体 18.0 kB,含 `docs/DETAIL.md`、`docs/DETAIL.zh.md`、
49
+ `docs/preview.svg`、`locale/en.json`、`locale/zh.json`
50
+ - 用 DSH 自己的语言链规则离线复算:`zh-CN → zh-cn > zh > en → docs/DETAIL.zh.md`,
51
+ `en-US → en-us > en → docs/DETAIL.md`,`ja-JP → ja-jp > ja > en → docs/DETAIL.md`
52
+
53
+ ## 许可
54
+
55
+ 本插件代码 MIT。改写用的提示词模板逐字取自
56
+ [linshenkx/prompt-optimizer](https://github.com/linshenkx/prompt-optimizer) 的
57
+ `user-optimize/user-prompt-basic`(AGPL-3.0),本仓库不含该项目的代码。
@@ -0,0 +1,32 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300">
2
+ <rect width="640" height="300" rx="20" fill="#f3f5f9"/>
3
+
4
+ <!-- left: the loose draft -->
5
+ <rect x="48" y="82" width="248" height="136" rx="16" fill="#ffffff" stroke="#b7c3d2" stroke-width="2"/>
6
+ <rect x="72" y="108" width="150" height="8" rx="4" fill="#d6dde7"/>
7
+ <rect x="72" y="130" width="196" height="8" rx="4" fill="#e0e5ed"/>
8
+ <rect x="72" y="152" width="112" height="8" rx="4" fill="#e0e5ed"/>
9
+ <rect x="72" y="174" width="164" height="8" rx="4" fill="#e8edf3"/>
10
+ <circle cx="262" cy="192" r="16" fill="#e7edf5"/>
11
+ <path d="M262.00 182.00 L264.25 188.91 L271.51 188.91 L265.63 193.18 L267.88 200.09 L262.00 195.82 L256.12 200.09 L258.37 193.18 L252.49 188.91 L259.75 188.91Z" fill="none" stroke="#63758c" stroke-width="1.8" stroke-linejoin="round"/>
12
+
13
+ <!-- middle: the action -->
14
+ <path d="M312 150h24" fill="none" stroke="#9aa9bb" stroke-width="2" stroke-linecap="round"/>
15
+ <path d="M330 144l6 6-6 6" fill="none" stroke="#9aa9bb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
16
+
17
+ <!-- right: the structured prompt -->
18
+ <rect x="352" y="82" width="240" height="136" rx="16" fill="#ffffff" stroke="#247bbf" stroke-width="2"/>
19
+ <circle cx="376" cy="110" r="4" fill="#247bbf"/>
20
+ <rect x="390" y="106" width="128" height="8" rx="4" fill="#c8d6e5"/>
21
+ <circle cx="376" cy="134" r="4" fill="#247bbf"/>
22
+ <rect x="390" y="130" width="164" height="8" rx="4" fill="#d6e0ea"/>
23
+ <circle cx="376" cy="158" r="4" fill="#247bbf"/>
24
+ <rect x="390" y="154" width="146" height="8" rx="4" fill="#d6e0ea"/>
25
+ <circle cx="376" cy="182" r="4" fill="#247bbf"/>
26
+ <rect x="390" y="178" width="112" height="8" rx="4" fill="#e0e8f0"/>
27
+ <circle cx="568" cy="192" r="16" fill="#247bbf"/>
28
+ <path d="M568.00 182.00 L570.25 188.91 L577.51 188.91 L571.63 193.18 L573.88 200.09 L568.00 195.82 L562.12 200.09 L564.37 193.18 L558.49 188.91 L565.75 188.91Z" fill="#ffffff"/>
29
+
30
+ <!-- orbit ring: the call goes out and comes back -->
31
+ <path d="M176 236c60 34 228 34 288 0" fill="none" stroke="#c3cede" stroke-width="2" stroke-linecap="round" stroke-dasharray="7 9"/>
32
+ </svg>
package/locale/en.json CHANGED
@@ -1,4 +1,9 @@
1
1
  {
2
+ "meta": {
3
+ "title": "Prompt Optimizer",
4
+ "description": "Adds a star-shaped Optimize button to the right of the composer: with a draft in the input, one click has the model currently selected for this conversation rewrite it using the \"basic optimize\" template from linshenkx/prompt-optimizer, and the result is written straight back into the composer with an \"Optimized · Undo\" chip to restore the original. Click again to cancel; it times out after 150 seconds. It uses the model you already selected, needs no extra API key, and never enters the session transcript. The button is greyed out while the draft is empty, and it only appears in a profile with a browser UI (desktop / web).",
5
+ "detail": "docs/DETAIL.md"
6
+ },
2
7
  "btn.label": "Optimize",
3
8
  "btn.title": "Rewrite this prompt with prompt-optimizer basic-optimize",
4
9
  "btn.running": "Optimizing…",
package/locale/zh.json CHANGED
@@ -1,4 +1,9 @@
1
1
  {
2
+ "meta": {
3
+ "title": "提示词优化",
4
+ "description": "在对话框右侧加一个星形「优化」按钮:输入框有草稿时点它,当前选中的模型会按 linshenkx/prompt-optimizer 的「基础优化」模板改写这段提示词,结果直接写回输入框,旁边出现「已优化 · 撤销」可一键还原。再点一次按钮可取消,超过 150 秒自动超时。用的是你已选好的模型,不需要额外 API Key,也不会写进会话记录。输入框为空时按钮是灰的;只在有浏览器界面的 profile(desktop / web)显示。",
5
+ "detail": "docs/DETAIL.zh.md"
6
+ },
2
7
  "btn.label": "优化",
3
8
  "btn.title": "用 prompt-optimizer 的「基础优化」改写这段提示词",
4
9
  "btn.running": "优化中…",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lklkuu/dsh-prompt-optimizer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },