@y1x1n/dsh-prompt-optimizer 0.3.13 → 0.3.15

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Y1X1n
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.en.md CHANGED
@@ -1,14 +1,38 @@
1
1
  # dsh-prompt-optimizer
2
2
 
3
- [中文](README.md) | **English**
3
+ [中文](README.md) | **English** | 🐣 [Beginner guide (中文)](README.simple.md)
4
4
 
5
5
  [![CI](https://github.com/Y1X1n/dsh-prompt-optimizer/actions/workflows/ci.yml/badge.svg)](https://github.com/Y1X1n/dsh-prompt-optimizer/actions/workflows/ci.yml)
6
+ [![npm](https://img.shields.io/npm/v/@y1x1n/dsh-prompt-optimizer?label=npm&color=cb3837)](https://www.npmjs.com/package/@y1x1n/dsh-prompt-optimizer)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Release](https://img.shields.io/github/v/release/Y1X1n/dsh-prompt-optimizer?label=release)](https://github.com/Y1X1n/dsh-prompt-optimizer/releases/latest)
9
+ [![Stars](https://img.shields.io/github/stars/Y1X1n/dsh-prompt-optimizer?logo=github)](https://github.com/Y1X1n/dsh-prompt-optimizer/stargazers)
10
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
6
11
 
7
12
  A DeepSeek Harness plugin that adds an **Optimize** button (✨) next to the composer, one click analyzes and rewrites the prompt draft in your input box, with results **streamed section by section over SSE**. The optimization call reuses the current session's model route by default (read live on every click — switching models in the session takes effect immediately).
8
13
 
9
14
  - **Host side**: registers two routes, `POST /dsh-prompt-optimizer/optimize` (SSE streaming) and `POST /dsh-prompt-optimizer/test-model` (connectivity probe), and drives `ctx.llm` for the "analyze + rewrite" call.
10
15
  - **Client side**: injects the button into the `conversation.input.right` slot, the result panel into `conversation.input.dock` (a full-width row above the input card, same family as TodoDock — renders on the new-session screen too and never covers the input box), and a collapsible settings card into `settings.plugin.item`. UI copy follows the DSH interface language (中文 / English).
11
16
 
17
+ ## Contents
18
+
19
+ - [Features](#features)
20
+ - [Installation](#installation)
21
+ - [From a Release (recommended, no build)](#from-a-release-recommended-no-build)
22
+ - [From source (tarball)](#from-source-tarball)
23
+ - [From GitHub](#from-github)
24
+ - [Uninstall](#uninstall)
25
+ - [Compatibility](#compatibility)
26
+ - [FAQ](#faq)
27
+ - [Verification status](#verification-status)
28
+ - [How it works](#how-it-works)
29
+ - [Development](#development)
30
+ - [Security notes](#security-notes)
31
+ - [Contributors](#contributors)
32
+ - [License](#license)
33
+
34
+ > 🐣 **First time using dsh plugins?** See the [beginner guide](README.simple.md) (in Chinese): three steps to install, one click to use.
35
+
12
36
  ![The result panel: five-dimension diagnosis and the rewrite streamed live, with replace/undo/copy; the badge shows the actual route and duration](docs/screenshots/optimize-panel.png)
13
37
 
14
38
  | | |
@@ -79,7 +103,11 @@ dsh plugin --profile web remove @y1x1n/dsh-prompt-optimizer
79
103
 
80
104
  ## Compatibility
81
105
 
82
- - Development baseline: `@deepseek-ai/*` **0.1.0-rc.7** (matching the packages bundled with `npx @deepseek-ai/dsh@0.1.0-rc.7`); verified on the **0.1.0-rc.8** runtime (2026-08-20, Windows, real-profile install + Web routes / client bundle / session-history RPC / end-to-end LLM call), and re-verified on **0.1.1-rc.2** (2026-08-27, Windows: `--dump-config` composition layer, route registration, client bundle all healthy).
106
+ > **This version targets DeepSeek Harness `0.1.2-rc.1`** | backward compatible with `0.1.0-rc.7` and above | newer alpha builds are unverified.
107
+ > This annotation is maintained in every Release note from v0.3.15 onward; earlier Release notes have been retroactively annotated.
108
+
109
+ - Development baseline: `@deepseek-ai/*` **0.1.0-rc.7** (matching the packages bundled with `npx @deepseek-ai/dsh@0.1.0-rc.7`); verified on the **0.1.0-rc.8** runtime (2026-08-20, Windows, real-profile install + Web routes / client bundle / session-history RPC / end-to-end LLM call), re-verified on **0.1.1-rc.2** (2026-08-27, Windows: `--dump-config` composition layer, route registration, client bundle all healthy), and adapted + verified on **0.1.2-rc.1** (2026-09-05: 0.1.2-rc.1 rewrote the `dsh-settings` API — plugin 0.3.15+ uses the new `SettingsProvider.installSection` interface; real-profile smoke test passed).
110
+ - **dsh-settings API adaptation**: the standalone function `installSettingsSection(ctx, ...)` from 0.1.0-rc.x was removed in 0.1.2-rc.1, replaced by the `installSection(...)` method on the `ctx.settings` service instance. 0.3.15+ awaits the service via `ctx.inject(['settings'])` before mounting; when the settings service is absent (test environments / older versions) it falls back to the composition-layer config, matching the old behavior. **0.3.15+ requires dsh ≥0.1.2-rc.1; to run on 0.1.0-rc.x / 0.1.1-rc.x, use 0.3.14.**
83
111
  - Protocol contract: `/dsh-prompt-optimizer/optimize` returns 400/405/409/413 as plain JSON on pre-check failure and switches to an SSE stream on success (model errors arrive as `error` events); `/dsh-prompt-optimizer/test-model` **always returns HTTP 200** with an `ok` field in the body (a probe is application-level semantics, deliberately not mapped to transport status codes) — integrate against `ok`, not the status code.
84
112
  - The HTTP carrier service name has drifted between releases (`httpServer` in the npm 0.0.1-rc.x type packages, `webServer` in the 0.1.0-rc.x runtime): the plugin waits on both names via `ctx.inject` with no static hard dependency — if the name changes again, only this plugin's routes fail to register (with a log warning after 10s); the Harness startup is never dragged down.
85
113
  - Client and Host must be the same version (the SSE protocol is a private contract): after upgrading, restart `dsh web` and refresh the browser.
@@ -173,6 +201,12 @@ dsh-prompt-optimizer/
173
201
  - Both routes enforce an **origin fence**: requests carrying an `Origin` header (browser POSTs always do) must match `Host`, and `Host` must be a loopback address or the machine's actual local address — cross-site forged requests (CSRF) and DNS rebinding get a 403; command-line calls without `Origin` are unaffected.
174
202
  - The plugin holds no API keys: every model call goes through the Harness-configured `ctx.llm` routes.
175
203
 
204
+ ## Contributors
205
+
206
+ Thanks to the following contributors for improvements to this project (see the [contributing guide](CONTRIBUTING.md)):
207
+
208
+ - [@ruijiaang-lab](https://github.com/ruijiaang-lab) — contributing guide ([#2](https://github.com/Y1X1n/dsh-prompt-optimizer/pull/2))
209
+
176
210
  ## License
177
211
 
178
212
  MIT
package/README.md CHANGED
@@ -1,14 +1,38 @@
1
1
  # dsh-prompt-optimizer
2
2
 
3
- **中文** | [English](README.en.md)
3
+ **中文** | [English](README.en.md) | [🐣 小白版](README.simple.md)
4
4
 
5
5
  [![CI](https://github.com/Y1X1n/dsh-prompt-optimizer/actions/workflows/ci.yml/badge.svg)](https://github.com/Y1X1n/dsh-prompt-optimizer/actions/workflows/ci.yml)
6
+ [![npm](https://img.shields.io/npm/v/@y1x1n/dsh-prompt-optimizer?label=npm&color=cb3837)](https://www.npmjs.com/package/@y1x1n/dsh-prompt-optimizer)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Release](https://img.shields.io/github/v/release/Y1X1n/dsh-prompt-optimizer?label=release)](https://github.com/Y1X1n/dsh-prompt-optimizer/releases/latest)
9
+ [![Stars](https://img.shields.io/github/stars/Y1X1n/dsh-prompt-optimizer?logo=github)](https://github.com/Y1X1n/dsh-prompt-optimizer/stargazers)
10
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
6
11
 
7
12
  DeepSeek Harness 插件:在会话输入框(发送栏)旁提供一个「优化」按钮(✨ 图标),一键分析并优化当前输入的提示词草稿,**结果经 SSE 流式逐段上屏**。优化调用默认复用当前会话的模型路由(每次点击实时读取,会话里切换模型立即生效)。
8
13
 
9
14
  - **Host 半侧**:注册 `POST /dsh-prompt-optimizer/optimize`(SSE 流式)与 `POST /dsh-prompt-optimizer/test-model`(连通性探活)两条路由,调用 `ctx.llm` 完成「分析 + 改写」。
10
15
  - **Client 半侧**:向 `conversation.input.right` 槽位注入按钮,向 `conversation.input.dock` 注入结果面板(输入卡上方整行、与 TodoDock 同族,新会话界面也渲染,且不遮挡输入框),向 `settings.plugin.item` 注入可折叠的设置卡片(设置页自动获得配置界面,无需单独开发页面)。界面文案跟随 DSH 界面语言(中文 / English)。
11
16
 
17
+ ## 目录
18
+
19
+ - [功能](#功能)
20
+ - [安装](#安装)
21
+ - [从 Release 安装(推荐,免构建)](#从-release-安装推荐免构建)
22
+ - [本地源码安装(tarball)](#本地源码安装tarball)
23
+ - [从 GitHub 安装](#从-github-安装)
24
+ - [卸载](#卸载)
25
+ - [兼容性](#兼容性)
26
+ - [常见问题](#常见问题)
27
+ - [验证状态](#验证状态)
28
+ - [工作原理](#工作原理)
29
+ - [开发](#开发)
30
+ - [安全说明](#安全说明)
31
+ - [贡献者](#贡献者)
32
+ - [License](#license)
33
+
34
+ > 🐣 **第一次用 dsh 插件?** 直接看[小白版指南](README.simple.md):三步装好、点按钮就用,全程大白话。
35
+
12
36
  ![结果面板:五维诊断与优化稿流式上屏,可替换/撤回/复制;徽章显示实际路由与用时](docs/screenshots/optimize-panel.png)
13
37
 
14
38
  | | |
@@ -79,7 +103,11 @@ dsh plugin --profile web remove @y1x1n/dsh-prompt-optimizer
79
103
 
80
104
  ## 兼容性
81
105
 
82
- - 开发基线:`@deepseek-ai/*` **0.1.0-rc.7**(与 `npx @deepseek-ai/dsh@0.1.0-rc.7` 内置包一致);已在 **0.1.0-rc.8** 运行时实测通过(2026-08-20,Windows,真实 profile 安装 + Web 路由/客户端 bundle/会话历史 RPC/端到端 LLM 调用),并在 **0.1.1-rc.2** 上复测通过(2026-08-27,Windows:`--dump-config` 组合层、路由注册、client bundle 均正常)。
106
+ > **当前版本适配 DeepSeek Harness `0.1.2-rc.1`** | 向下兼容 `0.1.0-rc.7` 及以上 | 向上未在更新的 alpha 版本上验证。
107
+ > 此标注从 v0.3.15 起在每个 Release 说明中固定维护;更早 Release 的说明已回溯补注。
108
+
109
+ - 开发基线:`@deepseek-ai/*` **0.1.0-rc.7**(与 `npx @deepseek-ai/dsh@0.1.0-rc.7` 内置包一致);已在 **0.1.0-rc.8** 运行时实测通过(2026-08-20,Windows,真实 profile 安装 + Web 路由/客户端 bundle/会话历史 RPC/端到端 LLM 调用),在 **0.1.1-rc.2** 上复测通过(2026-08-27,Windows:`--dump-config` 组合层、路由注册、client bundle 均正常),并在 **0.1.2-rc.1** 上完成适配与实测(2026-09-05:0.1.2-rc.1 重写了 `dsh-settings` API,插件自 0.3.15 起改用 `SettingsProvider.installSection` 新接口,真实 profile 冒烟通过)。
110
+ - **dsh-settings API 适配**:0.1.0-rc.x 的独立函数 `installSettingsSection(ctx, ...)` 在 0.1.2-rc.1 移除,改为 `ctx.settings` 服务实例上的 `installSection(...)` 方法。0.3.15+ 经 `ctx.inject(['settings'])` 等待服务再挂载;settings 服务缺席(测试环境/更老版本)时自动回落组合层配置,行为与旧版一致。**0.3.15+ 需要 dsh ≥0.1.2-rc.1;如需在 0.1.0-rc.x / 0.1.1-rc.x 上运行,请使用 0.3.14。**
83
111
  - HTTP 载体服务名在发布版间漂移过(npm 0.0.1-rc.x 类型包叫 `httpServer`,0.1.0-rc.x 运行时叫 `webServer`):本插件用 `ctx.inject` 同时等待两个名字,且不做静态硬依赖——即使服务名再次变化,也只会使本插件的路由不注册(10 秒后日志告警),不会拖垮整个 Harness 启动。
84
112
  - **客户端协议口径**:`/dsh-prompt-optimizer/optimize` 预校验失败返回 400/405/409/413(普通 JSON),成功后进入 SSE 流,模型错误经 `error` 事件传达;`/dsh-prompt-optimizer/test-model` **无论成败一律 HTTP 200**,由 body 的 `ok` 字段区分(探活是应用层语义,刻意不走传输层状态码)——对接方请以 `ok` 为准。
85
113
  - 客户端与 Host 需同版本(SSE 协议是私有约定):升级插件后请重启 `dsh web` 并刷新浏览器页面。
@@ -175,6 +203,12 @@ dsh-prompt-optimizer/
175
203
  - 两条路由均带**来源围栏**:带 `Origin` 头的请求(浏览器 POST 必带)必须与 `Host` 同源,且 `Host` 必须是回环地址或本机实际地址——网页侧的跨站伪造请求(CSRF)与 DNS rebinding 会被 403 拒绝;不带 `Origin` 的命令行调用不受影响。
176
204
  - 插件不持有任何 API Key:模型调用全部经由 Harness 已配置的 `ctx.llm` 路由。
177
205
 
206
+ ## 贡献者
207
+
208
+ 感谢以下贡献者为本项目提交改进(见 [贡献指南](CONTRIBUTING.md)):
209
+
210
+ - [@ruijiaang-lab](https://github.com/ruijiaang-lab) — 贡献指南([#2](https://github.com/Y1X1n/dsh-prompt-optimizer/pull/2))
211
+
178
212
  ## License
179
213
 
180
214
  MIT
@@ -0,0 +1,136 @@
1
+ # 🐣 小白版:三分钟用上「提示词优化」
2
+
3
+ [← 返回完整中文文档](README.md) | [English](README.en.md)
4
+
5
+ > 这页是写给第一次接触 dsh 插件的朋友的,全程大白话,不讲技术细节。
6
+ > 想看完整功能说明、兼容性、测试覆盖?请回[完整版 README](README.md)。
7
+
8
+ ## 目录
9
+
10
+ - [这是个啥?](#这是个啥)
11
+ - [开始前,你要有这三样东西](#开始前你要有这三样东西)
12
+ - [三步装好](#三步装好)
13
+ - [怎么用](#怎么用)
14
+ - [常见小问题](#常见小问题)
15
+ - [卸载](#卸载)
16
+
17
+ ---
18
+
19
+ ## 这是个啥?
20
+
21
+ 一句话:**帮你把发给 AI 的话写得更好。**
22
+
23
+ 你在 DeepSeek 对话框里打了一句"帮我写周报",总觉得太笼统、AI 回答不给力?
24
+ 装了这个插件,输入框旁边会多一个 ✨「优化」按钮。点一下,它自动把你的话改写成一份表达清晰、要求明确的提示词,像打字机一样一段段显示出来,满意就一键替换。
25
+
26
+ **它长这样:**
27
+
28
+ | 输入框旁的按钮 | 点完之后的效果 |
29
+ |---|---|
30
+ | ![发送栏空闲态](docs/screenshots/composer-idle.png) | ![结果面板](docs/screenshots/optimize-panel.png) |
31
+
32
+ ---
33
+
34
+ ## 开始前,你要有这三样东西
35
+
36
+ 1. **一台装了 Node.js 的电脑**(Node 18 或更新版本)
37
+ 2. **dsh 命令行** —— 就是能在终端跑 `npx @deepseek-ai/dsh web` 的环境
38
+ 3. **配好的模型** —— 在 dsh 网页版的 设置 → 模型 里,已经配好至少一个模型提供方(比如 DeepSeek 官方 API)
39
+
40
+ > 三样里缺哪样?先把 [dsh 本体](https://github.com/deepseek-ai)跑起来 —— 本插件是装在它上面的「小挂件」,本体没有它也无处安放。
41
+
42
+ ---
43
+
44
+ ## 三步装好
45
+
46
+ ### 第 1 步:下载插件包
47
+
48
+ 打开 [Releases 页面](https://github.com/Y1X1n/dsh-prompt-optimizer/releases/latest),下载 `y1x1n-dsh-prompt-optimizer.tgz`。
49
+
50
+ > Windows 用浏览器下载即可;习惯命令行的话:
51
+ >
52
+ > ```sh
53
+ > curl -LO https://github.com/Y1X1n/dsh-prompt-optimizer/releases/latest/download/y1x1n-dsh-prompt-optimizer.tgz
54
+ > ```
55
+
56
+ ### 第 2 步:安装
57
+
58
+ 打开终端,进到下载文件所在的目录,运行:
59
+
60
+ ```sh
61
+ dsh plugin --profile web add ./y1x1n-dsh-prompt-optimizer.tgz
62
+ ```
63
+
64
+ ### 第 3 步:重启
65
+
66
+ 关掉 `dsh web` 重新启动,打开网页版界面。
67
+
68
+ **装好了!** 输入框旁边是不是多了一个 ✨ 按钮?
69
+
70
+ > 也可以直接从 npm 装:`dsh plugin --profile web add @y1x1n/dsh-prompt-optimizer`(装完同样要重启)。
71
+
72
+ ---
73
+
74
+ ## 怎么用
75
+
76
+ 就三下:
77
+
78
+ 1. **打字**:在输入框里随便写一句话,比如"帮我写周报"
79
+ 2. **点按钮**:点 ✨「优化」
80
+ 3. **选结果**:等几秒,面板会出现两段内容 ——「分析诊断」和「优化结果」
81
+ - 觉得好 → 点 **「替换输入框」**,你的草稿就变成优化后的版本了
82
+ - 不满意 → 点 **「重新优化」**,再生成一版
83
+ - 点错了?→ 点 **「撤回」**,一键回到替换前
84
+
85
+ ### 几个实用小开关(可选)
86
+
87
+ 在 设置 → 插件配置 → 「提示词优化」里:
88
+
89
+ - **嫌等待久?** 把「优化模式」切到 **快速**,等待时间约减半
90
+ - **想固定用某个模型优化?** 「优化用模型」里选一个,不选就跟随当前会话
91
+ - **优化出来的结果想换英文?** 「输出语言」里切
92
+
93
+ ---
94
+
95
+ ## 常见小问题
96
+
97
+ <details>
98
+ <summary><b>点了 ✨ 没反应?</b></summary>
99
+
100
+ 多半是模型没配好。去 **设置 → 模型** 配好至少一个提供方,再试。
101
+ 还不行就按 F12 打开浏览器控制台,找 `[dsh-prompt-optimizer]` 开头的红色日志,拿去[提 issue](https://github.com/Y1X1n/dsh-prompt-optimizer/issues)。
102
+ </details>
103
+
104
+ <details>
105
+ <summary><b>装完找不到 ✨ 按钮?</b></summary>
106
+
107
+ 重启 `dsh web` 了吗?插件装完**必须重启**才生效,光刷新网页不够。
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>升级插件后要做什么?</b></summary>
112
+
113
+ 重启 `dsh web`,然后刷新浏览器页面(建议 Ctrl+F5 强刷)。
114
+ </details>
115
+
116
+ <details>
117
+ <summary><b>结果跑到一半断了/被截断?</b></summary>
118
+
119
+ 设置卡里把「最大输出 Token」调高一点(默认 8192,最长 32768)。
120
+ </details>
121
+
122
+ 更多问题看[完整版常见问题](README.md#常见问题)。
123
+
124
+ ---
125
+
126
+ ## 卸载
127
+
128
+ ```sh
129
+ dsh plugin --profile web remove @y1x1n/dsh-prompt-optimizer
130
+ ```
131
+
132
+ 然后重启 `dsh web`。
133
+
134
+ ---
135
+
136
+ 觉得好用?给[仓库](https://github.com/Y1X1n/dsh-prompt-optimizer)点个 ⭐ 就是最大的支持。有问题欢迎[提 issue](https://github.com/Y1X1n/dsh-prompt-optimizer/issues)。
package/lib/client.js CHANGED
@@ -1230,7 +1230,7 @@ function createSettingsCard(ctx, scope) {
1230
1230
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1231
1231
  "a",
1232
1232
  {
1233
- className: "dsh-po-btn",
1233
+ className: "dsh-po-btn dsh-po-repo-link",
1234
1234
  href: REPO_URL,
1235
1235
  target: "_blank",
1236
1236
  rel: "noopener noreferrer",
@@ -1448,7 +1448,7 @@ function ensureFocusStyles() {
1448
1448
  if (document.getElementById(ID)) return;
1449
1449
  const style = document.createElement("style");
1450
1450
  style.id = ID;
1451
- style.textContent = ".dsh-po-btn:focus-visible{outline:2px solid var(--dsw-alias-state-focus-ring, #4f7cf7);outline-offset:2px;border-radius:4px;}";
1451
+ style.textContent = ".dsh-po-btn:focus-visible{outline:2px solid var(--dsw-alias-state-focus-ring, #4f7cf7);outline-offset:2px;border-radius:4px;}.dsh-po-repo-link{transition:color 0.15s ease,background-color 0.15s ease;}.dsh-po-repo-link:hover{color:var(--dsw-alias-label-primary, inherit);background-color:var(--dsw-alias-fill-secondary, rgba(128,128,128,0.12));}";
1452
1452
  document.head.appendChild(style);
1453
1453
  }
1454
1454
  function apply(ctx) {
package/lib/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // src/index.ts
2
2
  import Schema from "@deepseek-ai/schemastery";
3
- import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
4
3
 
5
4
  // src/prompt.ts
6
5
  var MARKERS = {
@@ -241,7 +240,7 @@ var Config = Schema.object({
241
240
  autoMaxTokens: Schema.boolean().default(true),
242
241
  includeContext: Schema.boolean().default(true)
243
242
  });
244
- var NS = settingsNamespace("prompt-optimizer");
243
+ var NS = "prompt-optimizer";
245
244
  var ROUTE_PATH = "/dsh-prompt-optimizer/optimize";
246
245
  var TEST_ROUTE_PATH = "/dsh-prompt-optimizer/test-model";
247
246
  var MAX_BODY_BYTES = 256 * 1024;
@@ -413,12 +412,16 @@ function apply(ctx, config) {
413
412
  return effort;
414
413
  };
415
414
  let current = () => config;
416
- installSettingsSection(ctx, NS, Config, config, {
417
- setSource: (source) => {
418
- current = source;
419
- },
420
- onChange: () => {
421
- }
415
+ ctx.inject(["settings"], (sctx) => {
416
+ const settings = sctx.settings;
417
+ if (!settings) return;
418
+ settings.installSection(ctx, NS, Config, config, {
419
+ setSource: (source) => {
420
+ current = source;
421
+ },
422
+ onChange: () => {
423
+ }
424
+ });
422
425
  });
423
426
  warnUnknownEnumConfig(config);
424
427
  let mounted = false;
package/package.json CHANGED
@@ -1,10 +1,30 @@
1
1
  {
2
2
  "name": "@y1x1n/dsh-prompt-optimizer",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "DeepSeek Harness 插件:在发送栏旁一键分析并优化提示词(复用当前会话模型)",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Y1X1n/dsh-prompt-optimizer.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Y1X1n/dsh-prompt-optimizer/issues"
14
+ },
15
+ "homepage": "https://github.com/Y1X1n/dsh-prompt-optimizer#readme",
16
+ "keywords": [
17
+ "deepseek",
18
+ "dsh",
19
+ "harness",
20
+ "prompt",
21
+ "optimizer",
22
+ "plugin",
23
+ "cordis"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
8
28
  "exports": {
9
29
  ".": "./lib/index.js",
10
30
  "./client": "./lib/client.js",
@@ -38,13 +58,13 @@
38
58
  }
39
59
  },
40
60
  "dependencies": {
41
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.7",
61
+ "@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
42
62
  "@deepseek-ai/schemastery": "^3.18.1"
43
63
  },
44
64
  "devDependencies": {
45
- "@deepseek-ai/cordis": "^4.0.1",
46
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.7",
47
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
65
+ "@deepseek-ai/cordis": "^4.0.2",
66
+ "@deepseek-ai/dsh-host-webserver": "^0.1.2-rc.1",
67
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
48
68
  "@types/node": "^20.0.0",
49
69
  "@types/react": "^18.3.1",
50
70
  "esbuild": "^0.24.0",