dsh-prompt-customizer 0.9.2 → 2.1.2

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.
Files changed (64) hide show
  1. package/README.en.md +49 -234
  2. package/README.md +45 -310
  3. package/build.mjs +27 -10
  4. package/client/client.js +2446 -1364
  5. package/client/client.js.map +4 -4
  6. package/docs/adr/0001-remove-catalog-pool.md +27 -0
  7. package/docs/adr/0002-hide-identity-name-source.md +23 -0
  8. package/docs/adr/0003-destructive-updates-allowed.md +18 -0
  9. package/docs/adr/0004-generalized-filter-model.md +17 -0
  10. package/docs/adr/0005-universal-prompt-takeover.md +109 -0
  11. package/docs/design/prompt-control-consensus.md +103 -0
  12. package/docs/guide.md +280 -0
  13. package/docs/images/prompt.png +0 -0
  14. package/docs/images/tool.png +0 -0
  15. package/docs/testing/feature-matrix.md +142 -0
  16. package/docs/upgrades/1.0.0-sqlite-breaking.md +26 -0
  17. package/docs/upgrades/1.4.0-generalized-model.md +23 -0
  18. package/docs/upgrades/1.4.1-web-preview-fixes.md +15 -0
  19. package/docs/upgrades/2.0.0-remove-workspace-level.md +16 -0
  20. package/docs/upgrades/2.0.1-context-fixes.md +6 -0
  21. package/docs/upgrades/2.0.10-import-and-skill.md +6 -0
  22. package/docs/upgrades/2.0.11-regression-fixes.md +7 -0
  23. package/docs/upgrades/2.0.12-generative-tool-tests.md +5 -0
  24. package/docs/upgrades/2.0.13-runtime-contract.md +8 -0
  25. package/docs/upgrades/2.0.14-tool-execution-guard.md +5 -0
  26. package/docs/upgrades/2.0.15-mask-pool-regression.md +5 -0
  27. package/docs/upgrades/2.0.16-regression-cleanup.md +6 -0
  28. package/docs/upgrades/2.0.17-unhide-source.md +5 -0
  29. package/docs/upgrades/2.0.18-unhide-cleanup.md +4 -0
  30. package/docs/upgrades/2.0.19-mcp-json-edit.md +4 -0
  31. package/docs/upgrades/2.0.2-generic-context-filter.md +6 -0
  32. package/docs/upgrades/2.0.20-preset-isolation.md +4 -0
  33. package/docs/upgrades/2.0.21-isolation-restore-test.md +4 -0
  34. package/docs/upgrades/2.0.22-source-immutability.md +3 -0
  35. package/docs/upgrades/2.0.3-skill-summary.md +6 -0
  36. package/docs/upgrades/2.0.4-tool-draft.md +5 -0
  37. package/docs/upgrades/2.0.5-tool-catalog-robustness.md +13 -0
  38. package/docs/upgrades/2.0.6-tool-restrict.md +6 -0
  39. package/docs/upgrades/2.0.7-tool-stability.md +5 -0
  40. package/docs/upgrades/2.0.8-catalog-row-stability.md +4 -0
  41. package/docs/upgrades/2.0.9-tool-and-write.md +8 -0
  42. package/docs/upgrades/2.1.0-universal-prompt-takeover.md +41 -0
  43. package/docs/upgrades/2.1.1-tool-shadow-detection.md +48 -0
  44. package/docs/upgrades/2.1.2-tool-catalog-scope.md +55 -0
  45. package/docs/upgrades/README.md +298 -0
  46. package/docs/upgrades/dsh-0.2.2-rc1.md +49 -0
  47. package/docs/upgrades/rc2-migration.md +70 -0
  48. package/lib/index.js +4697 -1701
  49. package/lib/index.js.map +4 -4
  50. package/package.json +7 -5
  51. package/scripts/e2e-report.json +221 -0
  52. package/scripts/e2e-terminal.mjs +210 -0
  53. package/scripts/simulate-rescan.mjs +184 -0
  54. package/scripts/smoke-host.mjs +1 -1
  55. package/scripts/verify-apply-all.mjs +64 -0
  56. package/scripts/verify-effect.mjs +153 -0
  57. package/scripts/verify-mcp-edit-ext.mjs +48 -0
  58. package/scripts/verify-mcp-edit.mjs +45 -0
  59. package/scripts/verify-panel-browser.mjs +298 -0
  60. package/scripts/verify-workspace-mcp.mjs +62 -0
  61. package/scripts/test-mcp-layering.mjs +0 -441
  62. package/scripts/test-mcp-tool-disable.mjs +0 -420
  63. package/scripts/test-rc2-runtime.mjs +0 -42
  64. package/scripts/test-skill-toggles.mjs +0 -100
package/README.en.md CHANGED
@@ -5,8 +5,8 @@
5
5
  <h1 align="center">dsh-prompt-customizer</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>System-prompt &amp; tool-catalog customizer for DeepSeek Harness.<br>
9
- Block / replace / inject / reorder prompt sections by name, layered by session phase and agent preset — all from a settings-panel UI.</strong>
8
+ <strong>The DeepSeek Harness capability desk: prompt customization + skill collection management + MCP server integration.<br>
9
+ Manage prompt sections, import and toggle skills, and connect MCP servers from the sidebar "Capabilities" panel.</strong>
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -15,288 +15,103 @@
15
15
  </p>
16
16
 
17
17
  <p align="center">
18
- <a href="#installation">Installation</a> •
19
- <a href="#features">Features</a> •
20
- <a href="#usage">Usage</a> •
21
- <a href="#how-it-works">How it works</a> •
22
- <a href="#known-limitations">Known limitations</a>
23
- </p>
24
-
25
- <p align="center">
26
- <a href="https://github.com/DreamsTOF/dsh-prompt-customizer/releases"><img src="https://img.shields.io/badge/version-0.4.2-blue.svg" alt="Version"></a>
18
+ <a href="https://github.com/DreamsTOF/dsh-prompt-customizer/releases"><img src="https://img.shields.io/npm/v/dsh-prompt-customizer" alt="npm version"></a>
27
19
  <a href="https://github.com/DreamsTOF/dsh-prompt-customizer/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT License"></a>
28
20
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek_Harness-Plugin-blueviolet.svg" alt="DeepSeek Harness Plugin"></a>
29
- <a href="https://www.npmjs.com/package/dsh-prompt-customizer"><img src="https://img.shields.io/npm/v/dsh-prompt-customizer" alt="npm version"></a>
30
- <a href="https://www.npmjs.com/package/dsh-prompt-customizer"><img src="https://img.shields.io/npm/dm/dsh-prompt-customizer" alt="npm downloads"></a>
31
21
  <a href="https://github.com/DreamsTOF/dsh-prompt-customizer/stargazers"><img src="https://img.shields.io/github/stars/DreamsTOF/dsh-prompt-customizer?style=social" alt="GitHub Stars"></a>
32
22
  </p>
33
23
 
34
- <p align="center">
35
- <b>⭐ GitHub repo: <a href="https://github.com/DreamsTOF/dsh-prompt-customizer">DreamsTOF/dsh-prompt-customizer</a></b> — if you find it useful, please drop a star; bug reports and feature requests go to <a href="https://github.com/DreamsTOF/dsh-prompt-customizer/issues">Issues</a>
36
- </p>
37
-
38
24
  <p align="center">
39
25
  <img src="assets/banner.svg" alt="system prompt → block · replace · inject · sort" width="900">
40
26
  </p>
41
27
 
42
28
  ---
43
29
 
44
- 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.
45
-
46
- Plugin-injected prompt sections can pollute your system prompt. This plugin lets you **block**, **replace**, **inject** and **reorder** prompt sections by name, and **hide tools** from the model-facing catalog — live, without touching any other plugin.
47
-
48
- Two ideas run through the whole design:
49
-
50
- - **Per session phase.** Bootstrap (before promotion) / resident (after promotion) / compaction-controlled (after a compaction, before re-promotion) each get their **own block list, their own ordering space and their own tool catalog**. One preset can therefore show the model 1 tool and a handful of sections on the first turn, then open everything up after promotion.
51
- - **Per agent preset.** The selector at the top chooses where edits land: `Target: global default` edits the defaults; picking an agent preset writes a field-level override for that preset only (set fields take over, unset fields keep falling back to global).
52
-
53
- ## How the session phases flow
54
-
55
- The phases are not a fixed three-beat rhythm — they are **derived from durable session
56
- events**: the first durable `tool/call` or `assistant/message` promotes, and a
57
- `compaction/end` resets that promotion. The three parts of the panel map to those states.
58
-
59
- <table>
60
- <tr align="center">
61
- <td width="28%"><b>① Session starts</b><br><code>bootstrap</code><br><b>Guide period</b></td>
62
- <td width="6%">→</td>
63
- <td width="28%"><b>② First durable signal</b><br><code>tool/call</code> · <code>assistant/message</code><br><b>Resident period</b> <code>active</code></td>
64
- <td width="6%">→</td>
65
- <td width="32%"><b>③ A compaction</b><br><code>compaction/end</code><br><b>Compaction-controlled</b> <code>compaction</code></td>
66
- </tr>
67
- <tr>
68
- <td colspan="5" align="center">
69
- ④ another durable signal after the compaction → <b>back to the resident period</b>; compact again and it falls back to compaction-controlled
70
- </td>
71
- </tr>
72
- </table>
73
-
74
- Every transition (note the guide period can reach compaction-controlled without passing through resident):
75
-
76
- | Current phase | Event | Next |
77
- | --------------------- | ----------------------------------------------- | ------------------------- |
78
- | Guide | first durable `tool/call` / `assistant/message` | **Resident** |
79
- | Guide | `compaction/end` | **Compaction-controlled** |
80
- | Resident | `compaction/end` (promotion reset) | **Compaction-controlled** |
81
- | Compaction-controlled | a new durable signal after the compaction | **Resident** |
82
- | Any | subagent session (`delegationDepth > 0`) | always **Resident** |
83
- | Any | read with no session (inventory, preview) | always **Resident** |
84
-
85
- What each phase resolves to — the three panel parts map one-to-one onto config fields:
86
-
87
- | Panel part | Effective section blocks | Injected `phase` | Effective tool blacklist |
88
- | -------------------------------------- | ------------------------ | ------------------------- | ------------------------------------------------------------------ |
89
- | Guide-period sections / tools | `sectionsBootstrap` | `bootstrap` (+ `always`) | `tools.bootstrap.exclude`, falling back to static when unset |
90
- | Resident-period sections / tools | `sections` | `active` (+ `always`) | `tools.exclude` (static) |
91
- | Compaction-controlled sections / tools | `sectionsCompaction` | `compaction` (+ `always`) | `tools.compaction.exclude`, falling back to bootstrap, then static |
92
-
93
- Two things that bite:
94
-
95
- - **`always` injections are present in all three phases**, and each phase has its own ordering space — which is why this plugin emits phase entries _after_ the `always` group: the assembly applies inject records in array order and the last write wins, so the phase order is what survives.
96
- - **A phase view is "what this state resolves to", not "what the session has been".** Native preset phase rules (zero-tool bootstrap, warmup, …) are in play at the same moment and may still change the result after other plugins — see [Known limitations](#known-limitations).
30
+ ## What it is
97
31
 
98
- ## What's in the box
32
+ A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) plugin. It adds an independent "Capabilities" panel to the sidebar that brings three otherwise configuration-heavy jobs into one visual surface:
99
33
 
100
- One sidebar entry — **capability panel** — with three top-level tabs:
34
+ - **Prompt customization**: block, replace, inject and reorder system-prompt sections by name + source — across every scope, including session-level sections that plugins register dynamically on the active agent's own scope (universal takeover, ADR-0005);
35
+ - **Skill collection management**: import, group and toggle skills;
36
+ - **MCP server integration**: add MCP servers and apply preset-level or tool-level masking.
101
37
 
102
- - **SKILL** — skill bundles (grouping, categories, import from ZIP/folder, rename/delete), per-skill and per-bundle toggles on a global layer plus a per-agent-preset layer, skill-root health, and a `/` slash source that feeds skills into a session.
103
- - **MCP** — paste-to-add MCP servers (JSON / native `mcpServers` YAML / `mcp-client` line), per-preset server rows, layered masking (global row + per-preset own/inherit ledgers, with a global veto), per-server and per-tool enable/disable, and a recommended-server catalog.
104
- - **Prompt** — everything documented below.
105
-
106
- > The Chinese README is the primary one and covers the SKILL / MCP tabs in more detail(见「功能特性 → 技能集合管理 / MCP Server 接入」)。
107
-
108
- ## UI
109
-
110
- ![Prompt tab: four tabs, edit-target selector, section rows](docs/images/prompt-sections.png)
111
-
112
- ![Three phase parts, each with its own section list](docs/images/prompt-resident.png)
113
-
114
- ![Tools tab: three phase catalogs with enabled/total counts](docs/images/tools-phases.png)
115
-
116
- ![Config tab: save current config / save as agent preset / import](docs/images/config-tab.png)
117
-
118
- ![Preview tab: model-view prompt switchable per phase, with the yellow warning for a complete-section takeover](docs/images/preview-tab.png)
38
+ All changes go through documented plugin extension points. No DSH source is modified, and prompt/tool changes take effect for the model as soon as they are saved.
119
39
 
120
40
  ## Features
121
41
 
122
- ### Prompt sections
123
-
124
- - **Block** — remove a section by name. A blocked row does not disappear: it stays draggable and editable and can be restored at any time. Blocking only means "not injected into the model".
125
- - **Replace** — edit a section's text; the editor is pre-filled with the text currently in effect (dynamically generated sections are resolved first so you see real content).
126
- - **Inject** — every phase part has its own name + text box to add a brand-new section, badged `manual` and deletable.
127
- - **Reorder** — drag the handle at the row's left edge (an insert line shows where it will land) or use ↑/↓. Order is stored as a contiguous 0-based virtual index, so there are never duplicate or fractional orders and no number to type by hand. Dragging a row out onto _All system sections_ removes it from the current phase (an injected section is un-injected, a native one becomes blocked); dropping it on a phase button in the header copies it into that phase.
128
- - **Independent per phase** — bootstrap blocks go to `sectionsBootstrap`, compaction blocks to `sectionsCompaction`, resident blocks to `sections`; each phase has its own ordering space, so "5 sections during bootstrap, everything when resident" is expressible.
129
- - **Sync phases** (header switch, off by default) — ticking it immediately overwrites the other two phases with the resident period's **union row set** (written to the edit draft; press Save to apply). From then on all three phases share one section list and text: add / remove / reorder / check / text edits are written to all three at once. The resident period is the backbone order, sections that only exist in the other two phases are appended and also injected into the resident period (a same-named row follows the phase where it natively exists), and the three block lists are unified into one. Runtime-generated dynamic sections cannot be materialised into the other phases; the list says so. Tool hiding / showing and adding back also apply to all three phases.
130
-
131
- ### Tool catalog
132
-
133
- - **Blacklist only** (`exclude`) — unchecking a tool hides it **in that phase**; checking it back restores it. There is no whitelist mode: it silenced `exclude` entirely, and a single drag could quietly switch off every other tool in the phase while offering no expressive gain.
134
- - **Dragging in = make that one tool visible in the phase** (remove it from the phase blacklist); dragging back to _All system tools_ hides it there. Every action touches only the tool you dragged.
135
- - **Phase catalogs** — bootstrap and compaction each have their own blacklist. Runtime precedence is **compaction > bootstrap > static**: after a compaction with a compaction catalog configured, it applies; otherwise an un-promoted session uses the bootstrap catalog; everything else uses the static filter.
136
- - **Narrowing only, never widening** — the filter operates on the catalog the assembly already produced. A tool a phase never had cannot be made to appear here; that means editing the preset's composition.
137
- - Only the model-facing catalog is affected; the tools themselves and routing keep working.
138
-
139
- ### Model-view preview
140
-
141
- The Preview tab shows the final system prompt and tool catalog after **all** plugins have filtered, switchable per phase. It reads the same assembly as the prompt and tools tabs, so what you see is what the model sees. The tools view reports "visible to the model / registry total" side by side — presets such as PTC or Code Mode wrap the whole catalog into a single `run_code`, so the registry alone misleads.
142
-
143
- ### Prompt template variables
144
-
145
- The host registers only `provider` / `model` / `cwd` as template variables; referencing any other `{{name}}` in section text makes the whole assembly fail. This plugin adds two more families through the official extension point:
146
-
147
- - **Built-in system facts**: `date` / `time` / `datetime` / `weekday` / `hostname` / `platform` / `arch` / `username` / `home` / `shell` / `locale` / `node_version`, computed fresh at every assembly.
148
- - **Every environment variable**: each `process.env` key maps to `env_<lowercase, non-alphanumerics collapsed to _>`, e.g. `PATH` → `{{env_path}}`, `USER.NAME` → `{{env_user_name}}`.
149
-
150
- **Blocklist (`envBlocklist`)**: environment variables often carry secrets, and anything in the prompt is sent to the model with every request, so keys matching the blocklist are never registered. The prefilled entries cover common credential-style keys (`SECRET` / `TOKEN` / `PASSWORD` / `API_KEY` / `*_DSN` and friends); entries support `*` wildcards and are case-insensitive. The environment variable blocklist card in the panel lets you add or remove entries at any time, and its collapsible list shows the variables actually registered right now. Blocklist changes take effect at the next assembly (whether you edit the panel or `config.yaml` by hand).
151
-
152
- **Carried by export / import**: exporting a preset writes the current blocklist along with it; import merges it in by union (grow-only), consistent with the snapshot library semantics.
42
+ - **Prompt sections**: block / replace / inject / drag-reorder prompt sections, with a live preview of the final system prompt the model receives. The editable inventory and preview merge the selected preset with the same-preset active agent's real assembly, so plugin-injected session-level sections are enumerated and controllable. The host also exposes a read-only `/api/prompt-customizer/session` route reporting the latest active root session's own real assembly (there is no separate "Current session" panel tab).
43
+ - **Phase and preset layering**: bootstrap, resident and compaction-controlled phases each have their own section lists, ordering space and tool catalog; the top preset selector scopes edits to one agent preset.
44
+ - **Single-preset editing (2.0.0)**: prompt/tool customization is stored and applied only per **agent preset**. The workspace-level prompt/tool layer has been removed (source archived, data dormant, neither read nor backed up). Workspaces still apply to MCP / skills / cwd.
45
+ - **Tool catalog**: hide or add back tools per phase, with a "model-visible / registry total" comparison that also handles PTC / Code Mode `run_code` wrapping.
46
+ - **Tool prompt sections**: the Tools view links each `tool:*` prompt section to its tool group (for example `tool:jobs` covers `job_kill/job_list/job_output`), while the Prompt view can block / replace / reorder those sections independently. Tool descriptions stay read-only and JSON Schema is not part of prompt editing.
47
+ - **Skill management**: skill bundles, ZIP / folder import, global and preset toggles, skill-root and membership health checks.
48
+ - **MCP management**: paste JSON / YAML to connect, preset-owned server rows, global / preset masking, per-tool enable/disable, recommended templates.
49
+ - **Prompt variables**: built-in date / host / environment facts plus `process.env` mapping with a secret blocklist.
153
50
 
154
- The cost of strict rendering: referencing an unregistered name (such as a key the blocklist blocks) makes the **whole assembly fail** rather than rendering empty — only use names that appear in the panel's variable list.
155
-
156
- ### Config snapshots and agent presets
157
-
158
- - **Save current config** — capture the complete customization of the current scope (per-phase block lists, per-phase ordering and phase tool catalogs) as a reusable snapshot.
159
- - **Apply** — same-name sections are overridden, current sections outside the snapshot list are blocked, and snapshot sections that do not match the current system are skipped (cross-system imports never fabricate sections). Phase fields the snapshot does not carry keep your current values instead of being wiped. Only one snapshot is active at a time.
160
- - **Export / import** — snapshots round-trip as JSON (native save/open dialogs under Tauri, download / file picker on web); same-name presets are skipped. Order is stored relatively (each section records which section it follows), so snapshots stay portable across different section sets.
161
- - **Save as agent preset** — **copy** the whole preset directory of the current edit target (composition file, companion scripts, skill directories) into the user preset root, then write the current customization into its override. The new preset immediately appears in the target selector: a real switchable agent preset, not merely a config copy.
162
-
163
- ### Cross-preset registry pool
164
-
165
- _All system sections_ / _All system tools_ do not follow the edit target: they are a **union across presets that only ever grows** (same name — last seen wins; new name — appended), stored in the derived cache `catalog.yaml`, which rebuilds itself if deleted.
166
-
167
- The pool is filled from three sources, and **the first two hold the moment the panel opens**:
168
-
169
- - **the current scope's registry** (the preset you are editing);
170
- - **sections registered in the agent scope**: several plugins register their section per agent (`tool:subagent`, `context:file-reference`, …). Those live in neither the global layer nor any preset scope — they only exist in a real session assembly. They hold for *every* agent and belong to no particular mode, so the inventory merges the live agents' scopes on request: they are listed as soon as you open the panel, with no session round needed;
171
- - **presets you have browsed**: sections and tools registered only inside one preset (`tools:ptc-only`, `raw-html-v2:vcp`, …) join as you switch edit targets. That part grows on demand — mounting every preset tree eagerly takes tens of seconds each, which is not worth doing on every panel open.
172
-
173
- A real session assembly also feeds the registry, as the fallback for when no agent is alive.
174
-
175
- ## How it works
176
-
177
- The full path a change takes from the panel to the model:
178
-
179
- <table>
180
- <tr align="center">
181
- <td width="19%"><b>① Settings panel</b><br>sections / tools / config / preview<br><i>edits an in-memory draft only</i></td>
182
- <td width="3%">→</td>
183
- <td width="19%"><b>② Plugin routes</b><br><code>/config</code> · <code>/config/apply</code><br><code>/preview</code> · <code>/inventory</code> · <code>/presets</code></td>
184
- <td width="3%">→</td>
185
- <td width="19%"><b>③ config.yaml</b><br>global fields + <code>overrides[preset]</code><br><i>mtime-lazy reload, hand edits apply at once</i></td>
186
- <td width="3%">→</td>
187
- <td width="34%"><b>④ Assembly waterfall</b><br>the <code>system-prompt/assemble</code> hook derives the phase from the session, resolves the effective config and filters</td>
188
- </tr>
189
- <tr>
190
- <td colspan="9" align="center"><b>inside ④, in order</b>: <code>mergeConfig(global, overrides[session preset])</code> → sections: block → replace → inject → sort by <code>order</code>; tools: <code>pickToolsFilter</code> (compaction &gt; bootstrap &gt; static) → <code>applyToolFilter</code></td>
191
- </tr>
192
- <tr>
193
- <td colspan="9" align="center">
194
- <b>⑤ one last move before handing in</b>: after the waterfall the host restores the single <code>complete: true</code> section as the whole <code>sections</code> array when one exists — exactly why the panel shows a yellow warning for such presets (the tool catalog is unaffected)
195
- </td>
196
- </tr>
197
- <tr>
198
- <td colspan="9" align="center"><b>⑥ the model receives</b>: the final system prompt + visible tool catalog; the Preview tab reads this very result</td>
199
- </tr>
200
- </table>
51
+ ## UI
201
52
 
202
- Code map:
53
+ Open **Capabilities** in the sidebar. The panel has three tabs: **SKILL**, **MCP** and **Prompts**.
203
54
 
204
- | Path | Role |
205
- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
206
- | `lib/index.js` | host half: assembly hook, five HTTP routes, agent-preset fork, one-off legacy cleanup |
207
- | `lib/effective.js` | pure functions: field-level override merge, phase selection (injections / tool catalogs), blacklist filtering |
208
- | `lib/promotion.js` | derives `{promoted, boundary}` from durable events — compaction resets, subagents always promoted |
209
- | `lib/vars.js` | prompt variables: built-in system facts + full env mapping / blocklist, lazily re-synced at the assembly entry by signature |
210
- | `lib/sectionOps.mjs` | phase-state pure functions **shared by the panel and the unit tests** (which list to write, injection identity, reorder, per-phase persistence) |
211
- | `lib/store.js` / `lib/catalog.js` | atomic write + last-good fallback config store; cross-preset section/tool accumulation cache |
212
- | `src/client/` | the panel (React written with `h()`, no JSX sugar), bundled into `client/client.js` |
55
+ ![Prompt mode: checkbox list on the left, live preview on the right](docs/images/prompt.png)
213
56
 
214
- The key convention: phase logic exists once. `lib/sectionOps.mjs` is both bundled into the
215
- browser by tsdown and imported directly by `node --test`, so there is no second
216
- implementation standing between "tests pass" and "the UI behaves".
57
+ ![Tool mode: phase catalog checkboxes and model-visible tool preview](docs/images/tool.png)
217
58
 
218
59
  ## Installation
219
60
 
61
+ Web profile:
62
+
220
63
  ```bash
221
64
  dsh plugin --profile web add dsh-prompt-customizer
222
65
  ```
223
66
 
224
- Or from a local checkout:
67
+ Desktop (DeepSeek Harness Desktop):
225
68
 
226
69
  ```bash
227
- dsh plugin --profile web add /path/to/dsh-prompt-customizer
70
+ dsh plugin --profile desktop add dsh-prompt-customizer
228
71
  ```
229
72
 
230
- Then open the dsh web UI → **Settings** → **提示词定制** (Prompt Customizer) in the sidebar.
231
-
232
- ## Usage
233
-
234
- ### Prompt tab
235
-
236
- The three phase parts (bootstrap / resident / compaction-controlled) are **always rendered** — if a preset has no such phase, that part is simply empty rather than hidden. Each row offers:
237
-
238
- - a **checkbox** to block / unblock (`未屏蔽` / `已屏蔽` badge)
239
- - **Edit** to replace the section text; replaced rows carry an `已替换` badge and a restore button
240
- - **↑/↓** and a **drag handle** to reorder within the phase; `#N` is the current virtual index
241
- - a `system` / `manual` badge for provenance — only `manual` sections can be deleted
242
-
243
- `阶段可见 N` next to each title is the number of rows in that part. The name + text box at the bottom injects into that part, with the phase already fixed.
73
+ Or install from a local checkout:
244
74
 
245
- ### Tools tab
246
-
247
- One part per phase, chip-listing the catalog entering that phase's filter, titled `阶段可见 enabled / total`. Check to keep a tool visible in that phase, uncheck to hide it; dragging a tool in from _All system tools_ only makes **that one tool** visible in the phase, and dragging it back hides it there. For what the model actually receives, use the tools view in the Preview tab.
248
-
249
- ### Config tab
250
-
251
- Five cards: **Save current config** (snapshot), **Save as agent preset** (fork the current target's preset directory), **Import config**, **Environment variable blocklist** (add/remove entries, inspect the variables actually registered right now), **Force override switch**. Each snapshot row is Apply / Export / Delete, and the active row carries an "in use" badge.
252
-
253
- ### Edit target and saving
75
+ ```bash
76
+ dsh plugin --profile web add /path/to/dsh-prompt-customizer
77
+ ```
254
78
 
255
- The selector at the top decides where changes land. The prompt and tools tabs share one unsaved draft, and **Save** writes it in a single request; switching to the config / preview tabs or changing the edit target discards the draft (after confirming). Nothing you mistype reaches the file until you press Save.
79
+ Current release **2.1.2** (single-preset editing; **universal system-prompt takeover** — the inventory and preview merge the selected preset with the same-preset active agent's real assembly so plugin-injected session-level sections can be enumerated and blocked; **tool catalog matches the live session** — the visible tool list now comes from `ctx.tools.schemas(agent)` instead of the preset-only assembly; **same-name shadow detection** — inherited tools displaced by a same-name plugin tool enter the read-only masked pool, and plugin-only session-level tools are listed honestly as such; DSH runtime tool/prompt contracts, mask pool, workspace skill status, provider summary cache and write serialization; MCP global edit keeps JSON/YAML; live agent preset resolution via `composedPreset`; A/B preset, uninstall-restore and source-immutability regressions), targeting **DSH 0.2.2-rc.1**. Version compatibility, per-release changes and migration notes live in [docs/upgrades/README.md](docs/upgrades/README.md).
256
80
 
257
- ## Where the config lives
81
+ ## Quick start
258
82
 
259
- - `~/.dsh/prompt-customizer/config.yaml` — the single source of truth. On first start, if this file is missing but the legacy `settings.yaml` has the section, it is migrated once (the master document is left intact and stays rollback-able). Hand edits take effect on the next read, no restart needed.
260
- - `~/.dsh/prompt-customizer/catalog.yaml` — the cross-preset accumulation cache for the pools above. Purely derived; delete it and it rebuilds as you browse.
83
+ 1. Open the dsh Web UI and click **Capabilities** in the sidebar.
84
+ 2. Switch to the **Prompts** tab and choose an agent preset at the top.
85
+ 3. Edit in Prompt / Tool / Config mode, then click **Save**. The right-hand preview shows exactly what the model will receive.
261
86
 
262
- ## Known limitations
87
+ Prompt sections and tools can be configured separately for the bootstrap, compaction-controlled and resident phases; switch the phase tab to see that phase's own checkbox state and preview.
263
88
 
264
- All of the below are measured, and the panel shows a yellow warning in exactly these situations rather than leaving you to guess:
89
+ ## Where the configuration lives
265
90
 
266
- - **Some presets have no section-composed prompt.** If a section is registered with `complete: true` (dsh-persona's wholesale takeover), the host restores that single section as the entire `sections` array **after** the assembly waterfall — so this plugin's blocking / replacement / injection / ordering never reaches the model (tool filtering still applies). The panel says so explicitly ("taken over wholesale by `deployment:persona`"). The only way to make section customization work is to turn off `complete` in that agent preset.
267
- - **Dropping sections has more than one cause.** Besides `complete` takeover, a preset can also trim sections itself for a specific phase (measured: 20 → 1 sections during bootstrap, with no `complete` section in the registry). The panel therefore also compares names mechanically: it diffs the sections this plugin emitted against the final assembly and reports "emitted N, model sees M" when they disagree.
268
- - **The synthetic session behind a preview can degrade.** Phase views are driven by a fabricated session; some preset plugins throw on it, so that phase falls back to an agent-less assembly and is marked degraded — i.e. it shows the result _without_ native phase narrowing.
269
- - **Replacing a dynamically generated section freezes its content.** Sections like `app:web-surface` are generated at assembly time (embedding the current web port and so on). After replacing, the text is fixed at the value you edited and no longer tracks runtime state. To keep following it, block the section instead.
270
- - **Dynamic text resolution is best-effort.** The panel calls a dynamic section's generator with a minimal context to echo real content; sections that need richer context and throw fall back to `<动态生成>`, with no other effect. Also, sections containing `{{model}}` / `{{cwd}}` style variables show the **unsubstituted template** in the list — the Preview tab is where the substituted final text appears.
271
- - **Export depends on the host allowing downloads.** The web fallback uses a browser download: if the host webview silently drops it, the panel still reports "exported" while no file lands. Import (file picker) is unaffected.
272
- - **Tool catalogs cannot be widened** — see "narrowing only" above.
91
+ - **A single SQLite file**: `~/.dsh/prompt-customizer/prompt-customizer.db` (WAL, using the built-in `node:sqlite`, no external dependency). Preset customizations and the MCP / skill ledgers live in this one DB; workspace-level prompt/tool data is retained as dormant fields without reads or writes. Host config files (`cordis.patch.yml` / `.mcp.json`) and per-skill-root `.bundles.json` remain files.
92
+ - **Breaking change (1.0.0)**: the old `config.yaml` / `catalog.yaml` and JSON ledgers are **no longer read or migrated** (files are left untouched); upgrading to 1.0.0 requires **re-configuring**. See [docs/upgrades/1.0.0-sqlite-breaking.md](docs/upgrades/1.0.0-sqlite-breaking.md).
273
93
 
274
94
  ## Development
275
95
 
276
96
  ```bash
277
97
  npm install
278
- npm run check # typecheck + build + full test suite
98
+ npm run check # build + full unit tests + host / client smoke
279
99
  ```
280
100
 
281
- 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/`. Phase state logic sits in `lib/sectionOps.mjs`: the same pure functions are bundled into the UI and exercised directly by `node --test`, so the tests are the shipped code.
101
+ Build artifacts: `lib/index.js` (host half) and `client/client.js` (browser half).
102
+
103
+ ## Documentation
104
+
105
+ - [Full usage and implementation guide (Chinese)](docs/guide.md)
106
+ - [Version upgrade and migration records](docs/upgrades/README.md)
107
+ - [DSH 0.2.2-rc.1 migration record](docs/upgrades/dsh-0.2.2-rc1.md)
108
+ - [DSH 0.2.1-rc.2 migration record](docs/upgrades/rc2-migration.md)
282
109
 
283
110
  ## Credits
284
111
 
285
- - The **SKILL and MCP halves (UI and host modules) come from [Kr-ATG/dsh-triad](https://github.com/Kr-ATG/dsh-triad)** — skill bundle management, global/per-preset toggles, layered MCP masking and per-tool enable/disable, the sidebar capability entry, and the `/` skill source all follow that project. Since 0.6.0 they ship merged with the prompt customizer in this plugin.
286
- - The prompt panel derives from this repository's own 0.5.x implementation.
112
+ - The SKILL and MCP UI and host modules reference [Kr-ATG/dsh-triad](https://github.com/Kr-ATG/dsh-triad).
113
+ - The prompt panel derives from this repository's standalone 0.5.x implementation.
287
114
 
288
115
  ## License
289
116
 
290
117
  [MIT](LICENSE) © 2026 DreamsTOF
291
-
292
- ---
293
-
294
- ## Star History
295
-
296
- [![Star History Chart](https://api.star-history.com/svg?repos=DreamsTOF/dsh-prompt-customizer&type=Date)](https://star-history.com/#DreamsTOF/dsh-prompt-customizer&Date)
297
-
298
- ---
299
-
300
- <p align="center">
301
- <strong>⭐ If this plugin keeps your system prompt cleaner and your tool catalog tamer, give it a star!</strong>
302
- </p>