dsh-prompt-customizer 0.1.0
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.md +107 -0
- package/README.zh-CN.md +107 -0
- package/client/client.js +896 -0
- package/client/client.js.map +1 -0
- package/cordis.patch.yml +9 -0
- package/lib/client.js +344 -0
- package/lib/index.js +140 -0
- package/lib/schema.js +27 -0
- package/package.json +61 -0
- package/src/client/PresetsTab.tsx +184 -0
- package/src/client/SectionsTab.tsx +207 -0
- package/src/client/ToolsTab.tsx +62 -0
- package/src/client/index.ts +117 -0
- package/src/client/locales.ts +81 -0
- package/src/client/styles.ts +36 -0
- package/src/client/types.ts +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# dsh-prompt-customizer
|
|
2
|
+
|
|
3
|
+
A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) plugin that lets you control the **system prompt** and the **tool catalog** from a settings-panel UI.
|
|
4
|
+
|
|
5
|
+
Plugin-injected prompt sections (from other plugins) can pollute your system prompt. This plugin lets you **block**, **replace**, **inject**, and **reorder** prompt sections by name, and **hide tools** from the model catalog — all live, without touching the other plugins.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Prompt sections**
|
|
10
|
+
- **Block** a section by name (removed from the assembled system prompt).
|
|
11
|
+
- **Replace** a section's text (the original text is echoed for editing).
|
|
12
|
+
- **Inject** brand-new sections.
|
|
13
|
+
- **Reorder** sections with ↑/↓ arrows or **drag & drop** (HTML5). Order is stored as a virtual 0-based index, so there are never duplicate or fractional orders.
|
|
14
|
+
- **Tools**
|
|
15
|
+
- **Blacklist** (`exclude`): hide the listed tools.
|
|
16
|
+
- **Whitelist** (`include`): keep only the listed tools (wins over exclude).
|
|
17
|
+
- Only the model-facing catalog is affected — tools and routes keep working.
|
|
18
|
+
- **Presets**
|
|
19
|
+
- **Save** the current customization as a preset (full snapshot).
|
|
20
|
+
- **Apply** a preset: same-name sections are overridden, preset-only sections are added, and current sections outside the preset list are disabled by default.
|
|
21
|
+
- **Export / Import** presets as JSON (full snapshot).
|
|
22
|
+
- Presets store **relative order** (each section records the section it follows), so they stay portable across prompts with different section sets.
|
|
23
|
+
- Multiple presets can be stored locally; only one is active at a time.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Install from npm:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin add dsh-prompt-customizer
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or install from a local checkout:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
dsh plugin add /path/to/dsh-prompt-customizer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
After installation, open the dsh web UI → **Settings** → **提示词定制** (Prompt Customizer) in the sidebar.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### Prompt sections tab
|
|
44
|
+
|
|
45
|
+
Each row shows a prompt section with:
|
|
46
|
+
|
|
47
|
+
- A **checkbox** to block/unblock it.
|
|
48
|
+
- A **replace** button to edit its text (the original text is pre-filled).
|
|
49
|
+
- **↑/↓ arrows** and a **drag handle** to reorder it.
|
|
50
|
+
- The `#N` badge shows the section's virtual order (0-based position).
|
|
51
|
+
|
|
52
|
+
The **注入新段** (Inject section) box at the bottom adds a brand-new section by name, order, and text.
|
|
53
|
+
|
|
54
|
+
### Tools tab
|
|
55
|
+
|
|
56
|
+
Toggle tools to hide them (blacklist), or switch to whitelist mode to keep only the checked tools.
|
|
57
|
+
|
|
58
|
+
### Presets tab
|
|
59
|
+
|
|
60
|
+
- **Save current as preset** — capture the current sections/tools customization.
|
|
61
|
+
- **Apply** — activate a preset (overrides same-name sections, adds preset-only sections, disables current sections outside the preset).
|
|
62
|
+
- **Export** — download the preset as JSON.
|
|
63
|
+
- **Import** — load a preset JSON file (same-name presets are skipped).
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
The plugin stores its config in the dsh settings document under the `prompt-customizer` namespace (`~/.dsh/settings.yaml`). You can edit it directly:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
prompt-customizer:
|
|
71
|
+
# Block these prompt sections by name.
|
|
72
|
+
sections:
|
|
73
|
+
- plugin:some-plugin
|
|
74
|
+
# Replace a section's text by name (original order kept).
|
|
75
|
+
replace:
|
|
76
|
+
system: 'You are a helpful coding assistant.'
|
|
77
|
+
# Inject / override sections (name + order + text).
|
|
78
|
+
inject:
|
|
79
|
+
- name: tool:read
|
|
80
|
+
order: 0
|
|
81
|
+
text: ''
|
|
82
|
+
# Tool catalog filtering.
|
|
83
|
+
tools:
|
|
84
|
+
exclude: []
|
|
85
|
+
include: []
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
| Field | Type | Description |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
| `sections` | `string[]` | Prompt section names to block. |
|
|
91
|
+
| `replace` | `Record<string, string>` | Replacement text per section name. |
|
|
92
|
+
| `inject` | `{name, order, text}[]` | Sections to inject or override (order controls splice position). |
|
|
93
|
+
| `tools.exclude` | `string[]` | Tool names to hide. |
|
|
94
|
+
| `tools.include` | `string[]` | When non-empty, keep only these tools (wins over `exclude`). |
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install
|
|
100
|
+
npm run check # typecheck + build
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The browser half is built with [tsdown](https://github.com/rolldown/tsdown) into `client/client.js` (a `__ModuleLoader__` factory bundle). The host half lives in `lib/`.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# dsh-prompt-customizer
|
|
2
|
+
|
|
3
|
+
一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) 插件,让你通过设置面板 UI 控制**系统提示词**和**工具目录**。
|
|
4
|
+
|
|
5
|
+
其他插件注入的提示词段可能会污染你的系统提示词。本插件让你可以按名称**屏蔽**、**替换**、**注入**和**排序**提示词段,并从模型目录中**隐藏工具**——全部实时生效,无需改动其他插件。
|
|
6
|
+
|
|
7
|
+
## 功能特性
|
|
8
|
+
|
|
9
|
+
- **提示词段**
|
|
10
|
+
- **屏蔽**指定名称的段(从组装后的系统提示词中移除)。
|
|
11
|
+
- **替换**某段的文本(编辑时会回显原始文本)。
|
|
12
|
+
- **注入**全新的段。
|
|
13
|
+
- 通过 **↑/↓ 箭头**或**拖拽**(HTML5)排序。顺序以虚拟的 0 起始下标存储,因此不会出现重复或小数 order。
|
|
14
|
+
- **工具**
|
|
15
|
+
- **黑名单**(`exclude`):隐藏列出的工具。
|
|
16
|
+
- **白名单**(`include`):仅保留列出的工具(优先于 exclude)。
|
|
17
|
+
- 只影响面向模型的目录,工具与路由仍正常工作。
|
|
18
|
+
- **预设**
|
|
19
|
+
- **保存**当前定制为预设(完整快照)。
|
|
20
|
+
- **应用**预设:同名段被覆盖、预设独有段被添加、预设名单之外的当前段默认被屏蔽。
|
|
21
|
+
- **导出 / 导入**预设为 JSON(完整快照)。
|
|
22
|
+
- 预设存储**相对顺序**(每段记录它跟在哪个段之后),因此可跨不同段集合的提示词移植。
|
|
23
|
+
- 本地可保存多个预设,同一时间只能激活一个。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
从 npm 安装:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin add dsh-prompt-customizer
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
或从本地目录安装:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
dsh plugin add /path/to/dsh-prompt-customizer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
安装后,打开 dsh Web UI → **设置** → 侧边栏中的 **提示词定制**。
|
|
40
|
+
|
|
41
|
+
## 使用说明
|
|
42
|
+
|
|
43
|
+
### 提示词 Tab
|
|
44
|
+
|
|
45
|
+
每一行代表一个提示词段,包含:
|
|
46
|
+
|
|
47
|
+
- **复选框**:屏蔽 / 取消屏蔽。
|
|
48
|
+
- **替换**按钮:编辑该段文本(默认回显原始文本)。
|
|
49
|
+
- **↑/↓ 箭头**和**拖拽手柄**:调整顺序。
|
|
50
|
+
- `#N` 徽标显示该段的虚拟顺序(0 起始的位置)。
|
|
51
|
+
|
|
52
|
+
底部的 **注入新段** 区域可按名称、顺序和文本添加全新段。
|
|
53
|
+
|
|
54
|
+
### 工具 Tab
|
|
55
|
+
|
|
56
|
+
勾选工具以隐藏(黑名单),或切换到白名单模式仅保留勾选的工具。
|
|
57
|
+
|
|
58
|
+
### 预设 Tab
|
|
59
|
+
|
|
60
|
+
- **保存当前为预设**:捕获当前的提示词 / 工具定制。
|
|
61
|
+
- **应用**:激活某个预设(覆盖同名段、添加预设独有段、屏蔽预设名单之外的当前段)。
|
|
62
|
+
- **导出**:将预设下载为 JSON。
|
|
63
|
+
- **导入**:加载预设 JSON 文件(同名预设会被跳过)。
|
|
64
|
+
|
|
65
|
+
## 配置
|
|
66
|
+
|
|
67
|
+
插件配置存储在 dsh 设置文档的 `prompt-customizer` 命名空间下(`~/.dsh/settings.yaml`)。你也可以直接编辑:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
prompt-customizer:
|
|
71
|
+
# 按名称屏蔽这些提示词段。
|
|
72
|
+
sections:
|
|
73
|
+
- plugin:some-plugin
|
|
74
|
+
# 按名称替换某段文本(保留原始顺序)。
|
|
75
|
+
replace:
|
|
76
|
+
system: 'You are a helpful coding assistant.'
|
|
77
|
+
# 注入 / 覆盖段(名称 + 顺序 + 文本)。
|
|
78
|
+
inject:
|
|
79
|
+
- name: tool:read
|
|
80
|
+
order: 0
|
|
81
|
+
text: ''
|
|
82
|
+
# 工具目录过滤。
|
|
83
|
+
tools:
|
|
84
|
+
exclude: []
|
|
85
|
+
include: []
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
| 字段 | 类型 | 说明 |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
| `sections` | `string[]` | 要屏蔽的提示词段名称。 |
|
|
91
|
+
| `replace` | `Record<string, string>` | 每个段名称对应的替换文本。 |
|
|
92
|
+
| `inject` | `{name, order, text}[]` | 要注入或覆盖的段(order 控制拼接位置)。 |
|
|
93
|
+
| `tools.exclude` | `string[]` | 要隐藏的工具名称。 |
|
|
94
|
+
| `tools.include` | `string[]` | 非空时仅保留这些工具(优先于 `exclude`)。 |
|
|
95
|
+
|
|
96
|
+
## 开发
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install
|
|
100
|
+
npm run check # typecheck + build
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
浏览器端使用 [tsdown](https://github.com/rolldown/tsdown) 打包为 `client/client.js`(`__ModuleLoader__` factory bundle)。宿主端代码位于 `lib/`。
|
|
104
|
+
|
|
105
|
+
## 许可证
|
|
106
|
+
|
|
107
|
+
MIT
|