dsh-plugin-tool-management 0.19.0 → 0.19.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/README_EN.md CHANGED
@@ -1,223 +1,223 @@
1
- # dsh-plugin-tool-management
2
-
3
- [![npm version](https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837)](https://www.npmjs.com/package/dsh-plugin-tool-management)
4
- [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
5
- [![Node](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js)](package.json)
6
- [![GitHub](https://img.shields.io/badge/GitHub-ouli--1242%2Fdsh--plugin--tool--management-181717?logo=github)](https://github.com/ouli-1242/dsh-plugin-tool-management)
7
-
8
- [![DSH Market](https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-en.svg)](https://dsh.market/)
9
- [![awesome-dsh-plugin](https://img.shields.io/badge/awesome--dsh--plugin-listed-3fb950)](https://awesome-dsh-plugin.com)
10
- [![dshfind](https://dshfind.com/api/badge/ouli-1242/dsh-plugin-tool-management?lang=en)](https://dshfind.com/en/plugins/ouli-1242/dsh-plugin-tool-management)
11
- [![0xsline](https://img.shields.io/badge/0xsline-listed-3fb950)](https://github.com/0xsline/awesome-deepseek-harness)
12
-
13
- [简体中文](README.md) · **English** · [Changelog](CHANGELOG.md) · [Release overview](docs/update.md)
14
-
15
- An **MCP, skills, scenes, memories, subagents, prompts & archived sessions** manager for DeepSeek Harness. Eight tabs: Scenes / MCP / Skills / Subagents / Prompts / Memories / Sessions / Host.
16
-
17
- ```sh
18
- dsh plugin --profile web add dsh-plugin-tool-management@latest
19
- ```
20
-
21
- Hard-refresh the browser (Cmd/Ctrl+Shift+R) afterwards — a **Tools** panel in Settings means it worked. The plugin only writes its own files, never touches skill sources, and your configuration survives restarts and upgrades.
22
-
23
- ---
24
-
25
- ## Screenshots
26
-
27
- | | |
28
- |:---------------------------------:|:----------------------------------:|
29
- | ![Scenes](docs/images/1-EN.png) | ![MCP](docs/images/2-EN.png) |
30
- | **Scenes** | **MCP** |
31
- | ![Skills](docs/images/3-EN.png) | ![Subagents](docs/images/4-EN.png) |
32
- | **Skills** | **Subagents** |
33
- | ![Prompts](docs/images/5-EN.png) | ![Memories](docs/images/6-EN.png) |
34
- | **Prompts** | **Memories** |
35
- | ![Sessions](docs/images/7-EN.png) | ![Host](docs/images/8-EN.png) |
36
- | **Sessions** | **Host** |
37
-
38
- ## Highlights
39
-
40
- In one line: **configure "work / writing / coding" each as a scene and switch the whole stack with one click — and the model always sees whatever this plugin manages.**
41
-
42
- | Highlight | What it means |
43
- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------- |
44
- | One-click scene switch | Each scene carries its own MCP / skills / personas / memories; entering applies them, leaving restores. The model can switch for you too |
45
- | Manage without leaving chat | Type `/` for a "Tools" section and toggle any domain's items — one click, done |
46
- | Memories reach the model | A few `.md` files under a scene become its knowledge base, injected automatically |
47
- | Notes for MCP servers | A note you write is seen by the model every turn and acted on |
48
- | Disable a single tool | Mute one tool on a server: invisible to the model and uncallable |
49
- | Skills at a glance | The copy in effect is marked "preferred"; shadowed ones name the winning source |
50
- | Subagent = one file, one role | Write a role file and delegate to it; only the result comes back, never in History |
51
- | Several prompt presets | Keep multiple `AGENTS.md` baselines and switch with one click; each scene can bind its own |
52
- | Sessions no longer lost | Archives grouped by project, searchable, batch-restorable; imports Claude Code / Cursor / Codex transcripts |
53
- | The model always sees it | One context message per domain, republished only when the content changes |
54
- | Lock it and relax | Locking a scene makes create/update/delete across the five domains read-only |
55
- | Deleted is not gone | Skills / memories / personas / presets / scenes land in a recycle bin (permanent session deletion excepted) |
56
- | Safe by default | Only the plugin's own files are written; secrets masked, plaintext needs a token |
57
-
58
- ## Quick start
59
-
60
- Prerequisites: DSH installed (`dsh web` runs), Node.js ≥ 18.
61
-
62
- ```sh
63
- dsh plugin --profile web add dsh-plugin-tool-management@latest # install / update
64
- dsh plugin --profile web remove dsh-plugin-tool-management # uninstall
65
- ```
66
-
67
- Hard-refresh the browser — a **Tools** panel with eight tabs means it worked. Client changes hot-reload; host-side changes need `dsh web` restarted.
68
-
69
- You can also ask the model:
70
-
71
- ```text
72
- Install the dsh-plugin-tool-management plugin:
73
- dsh plugin --profile web add dsh-plugin-tool-management@latest
74
- Then remind me to hard-refresh the browser.
75
- ```
76
-
77
- ## Features
78
-
79
- ### Slash commands (manage from the chat box)
80
-
81
- - **Type `/` for a "Tools" section**: six rows — scenes / skills / MCP servers / subagents / prompts / memories. Click a row to enter that domain, click an item to apply it; the menu stays open.
82
- - **State is visible**: enabled items carry a green check, disabled ones an empty box, the grey text on the right is the item's note, and each domain row shows a summary.
83
- - **Long lists stay usable**: every domain lists all of its items and the panel scrolls; skills group by source directory, memories by scene, enabled rows first. Each external skill directory gets one row that toggles the whole source.
84
- - **Only reversible actions**: entering a scene and the various toggles; create / delete / edit / import / export stay on their own pages.
85
- - **Built on the host's official channel**: registered through DSH's input-trigger interface, no patching of official packages; two checkboxes under "Compatibility → Injection".
86
- - **"Tools › Prompts" holds both kinds**: the global group picks which baseline goes into `AGENTS.md` (single choice), the quick group is on/off.
87
- - **A separate "Quick prompts" section is for reuse**: only the enabled ones appear; one click inserts the saved text and sends nothing.
88
-
89
- ### Scenes & memories
90
-
91
- - **A scene = a group, a memory = a `.md` file**: `memories/<scene>/<name>.md`, the whole body is injected; file names may be non-ASCII.
92
- - **"Enabled" and "entered" are two axes**: enabled decides which scene the injection follows (single-select; none enabled = only `global` and `_shared`); entering applies the scene's whole MCP / skills / personas set and writes its bound prompt into `AGENTS.md`.
93
- - **Scene profile**: each scene combines MCP tools / skills / subagents / memories; ticked = on, unchecked = off, a section never created means that domain is off, and leaving restores the pre-scene state.
94
- - **Scene lock**: create/update/delete across MCP / skills / subagents / memories / prompts becomes read-only.
95
- - **Deleting a scene deletes its memories too**: record, profile and every memory land in one recycle-bin entry and come back as a whole; a running scene refuses deletion.
96
- - **Import / export**: `.md` / `.zip` (directory name = scene, bundles carry attachments); same names are skipped, never overwritten.
97
- - **Injection budget**: 128 KiB by default; oversized memories are skipped with a list.
98
- - **Subagent sessions have no separate switches**: which domains inject is decided by the same table, but scene and memory are top-level only.
99
-
100
- ### Subagents
101
-
102
- - **One file per persona**: `subagents/<persona>.md`, frontmatter entirely optional; `output:` takes one requirement per line.
103
- - **The persona reaches the child inside a role frame**: the body is used verbatim under a `# Persona: <name>` heading with an authorization line and a boundary line.
104
- - **Delegation**: `subagent_manager_run` runs with the persona, returns only its final result, and never enters History; by default the child starts fresh, with `inherit: true` it is seeded with this conversation's finished turns.
105
- - **On/off and catalog**: a disabled persona is neither injected nor visible to the model (file untouched); new / imported / restored personas start disabled. The catalog lists names and descriptions only.
106
- - **Catalog injection depth (`catalogDepth`)**: default `1` = top-level sessions only, `99` = any depth; it does not limit nesting.
107
- - **Tool limits per agent preset**: one allow or deny list per preset (mutually exclusive); the candidates are only that preset's own tools, grouped as "plugin tools / official tools / other tools", and an allow list is merged back with every currently running `mcp__*` tool (ticking only `read` will not stop an MCP shell). The reserved name `run_code` is stripped with a note.
108
- - **Model and provider** are both picked from the host LLM catalogue (choosing a provider narrows the model list to it); empty means inherit the main session.
109
- - **Reasoning effort**: the available levels are declared by the selected model; leaving it empty while a model is set falls back to that model's default.
110
-
111
- ### MCP servers
112
-
113
- - **CRUD with immediate effect**: written into `cordis.patch.yml`, backed up before every change; levels are global / project.
114
- - **Per-tool switches**: disable individual tools (invisible to the model and blocked at call); whole servers support bulk.
115
- - **Stopped servers still show their tools**: one that is not running keeps the names and descriptions last seen; one that never ran can be probed.
116
- - **Status and notes enter the context**: a server that connected before but cannot right now is listed and labelled; your notes travel along as decision hints.
117
- - **Secret masking**: a credential is replaced as a whole, and "Reveal" needs a token; a masked value is never written back into the patch file.
118
- - **Migrate & back up**: cross-level migration rolls back on failure; JSON export/import.
119
-
120
- ### Skills
121
-
122
- - **Sources at a glance**: project / DSH / Agents / Codex / Claude / custom directories, grouped by source.
123
- - **Opposite permissions**: default sources are readable and their skills deletable; external directories can be disabled or removed but their files stay read-only.
124
- - **Remove ≠ disable**: removing stops scanning the directory at all (nothing is written, restorable); disabling keeps it listed but uncallable.
125
- - **Who wins a shared name**: the winning copy is marked "preferred", shadowed ones name the source that wins.
126
- - **Custom directories / ZIP import & export / recycle bin.**
127
-
128
- ### Prompt presets
129
-
130
- - Multiple `~/.dsh/AGENTS.md` baselines, applied with one click (next turn), with 5 generations of backups.
131
- - **It remembers the last applied preset**: even after you hand-edit `AGENTS.md`, the origin is still reported.
132
- - Each preset can carry a one-line description that lives in a sibling `meta.json` — shown in this panel, never injected.
133
- - **A referenced preset cannot be deleted** (scene binding / current `AGENTS.md` content); deletes go to the recycle bin.
134
- - **The switch on the left of a card is the answer to "is this one in effect"**: flip it on and that preset is written into `AGENTS.md`; a baseline has no "apply nothing" state, so light up a different one instead (single choice).
135
- - **While a scene drives the baseline, flipping another one rebinds that scene** to the chosen preset; it is refused only while the scene is locked.
136
- - **Quick prompts** (the second section on the same page): save a piece of text you keep typing, then hit `/` and click it — it lands verbatim in the input. It is never injected; its switch only controls whether the row still shows up in the `/` "Quick prompts" section.
137
- - **A scene can bind a set of quick prompts**: entering that scene enables exactly the checked ones and disables the rest, and leaving restores the switches as they were before entering.
138
- - **Both groups are collapsible cards** (click the header to fold); the quick group's header carries a "Select all / Deselect all" button, the global group has none — that one is single choice.
139
-
140
- ### Archived sessions
141
-
142
- - Grouped by project, searchable, batch restore / delete, retention auto-cleanup; a workspace whose registration was deleted can be re-registered in one click.
143
- - Import Claude Code / Cursor / Codex / any text (pick a registered workspace, browse to a folder, or give a path directly); export Markdown / JSONL in three cumulative modes: text only → plus tool calls → plus reasoning. **An export is a transcript, not a backup** — use archiving when you need the full record.
144
-
145
- ### Host compatibility
146
-
147
- - **Host tab**: host version, usable capability count, per-action routing (native / adapter / unavailable), degradations and reasons; three write entries: access token, injection settings, model tool table.
148
- - **Command line**: `node scripts/doctor.mjs` (health check), `node scripts/host-deps.mjs --fix` (align dependencies).
149
- - Under a **suppressing preset** such as `minimal`, this plugin's injection is off by default; the Host tab can force any domain back on.
150
- - **Unchecking "Skills" or "Prompt" really stops them** — under standard presets the host delivers those two itself; the other three domains are only ever sent by this plugin, so their toggles work as written.
151
- - **What an injection looks like**: one `<system-reminder>` per domain — a `#` section title, then the body. Any `</system-reminder>` inside your content is escaped.
152
-
153
- ---
154
-
155
- ## Where data lives
156
-
157
- | Content | Location |
158
- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
159
- | MCP definitions | `~/.dsh/cordis.patch.yml` (written by the plugin; pre-write copies land in the hub's `backups/`) |
160
- | Skill policy / custom dirs | `~/.dsh/tool-management/skills-state.json` |
161
- | Skills / memories / personas / presets | `~/.dsh/tool-management/{skills,memories,subagents,prompts}/` |
162
- | Subagent toggles | `~/.dsh/tool-management/subagents-index.json` |
163
- | Recycle bin (skills / personas / presets / scenes) | `~/.dsh/tool-management/trash/{skills,subagents,prompts,scenes}-trash/` |
164
- | Memory recycle bin | `~/.dsh/tool-management/memories-trash/` (a directory at the hub root, not under `trash/`) |
165
- | Archive ledger / retention | `~/.dsh/tool-management/history-*.json` |
166
- | Memory index / scenes / profiles | `~/.dsh/tool-management/memories-index.json` |
167
- | MCP sidecars (disabled tools / known tools / notes / settings) | `~/.dsh/tool-management/mcp-*.json` |
168
- | Injection settings (six domain switches) | `~/.dsh/tool-management/inject-settings.json` |
169
- | Model tool table (switched-off tools + saved sets) | `~/.dsh/tool-management/tool-table.json` |
170
- | Scene page preference (preview card before entering a scene) | `~/.dsh/tool-management/scene-settings.json` |
171
- | Runtime log / patch backups | `~/.dsh/tool-management/tool-management.log` · `backups/` |
172
-
173
- **No user data is stored inside the plugin's install directory** (`dsh plugin update` replaces it wholesale). `backups/` keeps **5 copies per patch file** — the global patch and each profile patch count separately.
174
-
175
- ## Configuration & security
176
-
177
- | Field | What it does |
178
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
179
- | `token` | Access token. Once set, **every write and every plaintext credential** requires `x-dsh-token`; with no token the plaintext endpoints are closed entirely. Prefer not to keep it in the config? Use the `DSH_PLUGIN_TOOL_MANAGEMENT_TOKEN` environment variable. |
180
- | `tokenDisabled` | `true` = the token stays in the config but is not enforced (this is the line written by "Turn protection off"). Writes no longer need it; revealing plaintext still does. |
181
- | `maxBodyBytes` | Request body cap, 88 MiB by default. |
182
-
183
- **Plaintext on disk (read this)**: masking is **display-only**; MCP `env` / `headers` and the plugin's own `token` stay in cleartext inside `cordis.patch.yml` (and each profile copy), and every config change copies the whole file into `~/.dsh/tool-management/backups/` — unencrypted, never rotated, not reclaimed on uninstall. One secret can therefore exist as `5 × (patch files holding it) + 1` plaintext copies. The token gate decides *who may read plaintext over HTTP*; it does nothing about *reading the files*, where the only defence is your filesystem permissions. **To clean up: Settings → Tools → Host → "Clean old backups"**.
184
-
185
- - **Browser**: reads and writes go through cookies, no token needed; **plaintext credentials** (reveal / export) do. The token is managed in the **Access token** block on the Host tab — filling it once unlocks the current run, writing it into the config needs a restart.
186
- - **Every destructive direction asks for the current token again** (turn protection off / change / delete). Being unlocked this run does not count.
187
- - **curl / scripts**: send `x-dsh-token`, or carry the browser cookie.
188
- - **HTTP status convention**: except for the fence's 401 / 403, a missing token or a business failure is **HTTP 200 + `{ ok: false, error }`** — branch on `body.ok`, not on the status code.
189
- - **Port forwarding**: when the host has no `connection` service the fence falls back to "loopback Host + same origin", which any local process can imitate with `Host: localhost`. If you forward the port to a LAN or the public internet, **configure a token** — a stranger injecting MCP commands is remote code execution. The `dir-list` call behind the folder picker lists any absolute path (read-only) under the same precondition.
190
- - **Avoid `__` in a server name (naming advice)**: a tool's full name is `mcp__<server>__<tool>`, so an extra `__` inside a server name makes it ambiguous and a checkbox in the UI may fail to land on the key used in the disabled-tools table. This release does not tighten validation; the Host tab shows an informational note instead.
191
-
192
- ## FAQ
193
-
194
- | Symptom | Fix |
195
- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
196
- | Pages missing after install | Hard refresh; restart DSH if that fails. |
197
- | Duplicate MCP tabs | Remove the stale loader row from `cordis.patch.yml`, restart. |
198
- | Broken config, DSH won't boot | Restore the newest `cordis.patch.yml.<level>.bak-<timestamp>` from `~/.dsh/tool-management/backups/` (5 per patch file). |
199
- | Action stopped working after a DSH upgrade | Settings → Tools → **Host** for the reason; `doctor.mjs` → `host-deps.mjs --fix`. |
200
- | The model cannot call a tool it should have | Check the **Model tool table** on the Host tab — 15 tools ship switched off. The panel and scripts are unaffected either way. |
201
- | Still asked to confirm with `approval=never`? | No card appears — straight through with a log line. Switch back to "workspace write" to get the questions again. |
202
- | `subagent_manager_run` reports provider unavailable | The provider is not registered: `spawn` (default) / `fork` (`inherit`) come from `@deepseek-ai/dsh-subagent-spawn-in-process` / `-fork-in-process` — mount and restart. |
203
- | Scene binds persona A, but the official `subagent` ran something else | Those two are host tools and this plugin cannot hide them; work matching a persona goes to `subagent_manager_run`, host tools only when no persona fits or a background job is needed. |
204
-
205
- ---
206
-
207
- ## Development
208
-
209
- ```bash
210
- npm install
211
- npm run build # tsc + sync client
212
- npm test # build + i18n + contract tests (pure-function invariants & host contracts)
213
- npm run check:i18n # dictionary self-check
214
- npm run doctor # host compatibility check
215
- ```
216
-
217
- `lib/` is not tracked — run `npm run build` after cloning. Changes need `dsh web` restarted. Runtime deps: `fflate` (export bundling) and `js-yaml` (parse check before writing host patches, loaded lazily); `@deepseek-ai/*` all come from the host.
218
-
219
- > **Deployment note**: the profile mirror produced by `npm run build` does **not** include `node_modules`, so a runtime dependency added locally (e.g. `js-yaml`) must either be installed on the profile side or accepted as "patch-write check skipped and reported". Regular `npm install` deployments are unaffected.
220
-
221
- ## License
222
-
223
- MIT
1
+ <p align="center">
2
+ <img src="docs/images/logo.png" width="120" height="120" alt="dsh-plugin-tool-management">
3
+ </p>
4
+
5
+ # dsh-plugin-tool-management
6
+
7
+ [![npm version](https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837)](https://www.npmjs.com/package/dsh-plugin-tool-management)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
9
+ [![Node](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js)](package.json)
10
+ [![GitHub](https://img.shields.io/badge/GitHub-ouli--1242%2Fdsh--plugin--tool--management-181717?logo=github)](https://github.com/ouli-1242/dsh-plugin-tool-management)
11
+
12
+ [![DSH Market](https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-en.svg)](https://dsh.market/)
13
+ [![awesome-dsh-plugin](https://img.shields.io/badge/awesome--dsh--plugin-listed-3fb950)](https://awesome-dsh-plugin.com)
14
+ [![dshfind](https://dshfind.com/api/badge/ouli-1242/dsh-plugin-tool-management?lang=en)](https://dshfind.com/en/plugins/ouli-1242/dsh-plugin-tool-management)
15
+ [![0xsline](https://img.shields.io/badge/0xsline-listed-3fb950)](https://github.com/0xsline/awesome-deepseek-harness)
16
+
17
+ [简体中文](README.md) · **English** · [Changelog](CHANGELOG.md) · [Release overview](docs/update.md)
18
+
19
+ An **MCP, skills, scenes, memories, subagents, prompts & archived sessions** manager for DeepSeek Harness. Eight tabs: Scenes / MCP / Skills / Subagents / Prompts / Memories / Sessions / Host.
20
+
21
+ ```sh
22
+ dsh plugin --profile web add dsh-plugin-tool-management@latest # web
23
+ dsh plugin --profile desktop add dsh-plugin-tool-management@latest # desktop
24
+ ```
25
+
26
+ Hard-refresh the browser after installing for web (Cmd/Ctrl+Shift+R), or restart the desktop app after installing for desktop — a **Tools** panel in Settings means it worked. The plugin only writes its own files, never touches skill sources, and your configuration survives restarts and upgrades.
27
+
28
+ ---
29
+
30
+ ## Demo
31
+
32
+ <video controls src="https://github.com/user-attachments/assets/91b9673d-d201-462a-83de-8bc663c7629d"></video>
33
+
34
+ Every interface shown is a real screenshot of the running product — no redrawn UI, no fabricated controls.
35
+
36
+ Music: Kevin MacLeod「Limit 70」, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
37
+
38
+ ---
39
+
40
+ ## Screenshots
41
+
42
+ | | |
43
+ |:---------------------------------:|:----------------------------------:|
44
+ | ![Scenes](docs/images/1-EN.png) | ![MCP](docs/images/2-EN.png) |
45
+ | **Scenes** | **MCP** |
46
+ | ![Skills](docs/images/3-EN.png) | ![Subagents](docs/images/4-EN.png) |
47
+ | **Skills** | **Subagents** |
48
+ | ![Prompts](docs/images/5-EN.png) | ![Memories](docs/images/6-EN.png) |
49
+ | **Prompts** | **Memories** |
50
+ | ![Sessions](docs/images/7-EN.png) | ![Host](docs/images/8-EN.png) |
51
+ | **Sessions** | **Host** |
52
+
53
+ ## Highlights
54
+
55
+ In one line: **configure "work / writing / coding" each as a scene and switch the whole stack with one click — and the model always sees whatever this plugin manages.**
56
+
57
+ | Highlight | What it means |
58
+ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | One-click scene switch | Each scene carries its own MCP / skills / personas / memories; entering applies them, leaving restores. The model can switch for you too |
60
+ | Manage without leaving chat | Type `/` for a "Tools" section and toggle any domain's items — one click, done |
61
+ | Memories reach the model | A few `.md` files under a scene become its knowledge base, injected automatically |
62
+ | Notes for MCP servers | A note you write is seen by the model every turn and acted on |
63
+ | Disable a single tool | Mute one tool on a server: invisible to the model and uncallable |
64
+ | Skills at a glance | The copy in effect is marked "preferred"; shadowed ones name the winning source |
65
+ | Subagent = one file, one role | Write a role file and delegate to it; only the result comes back, never in History |
66
+ | Several prompt presets | Keep multiple `AGENTS.md` baselines and switch with one click; each scene can bind its own, or none |
67
+ | Sessions no longer lost | Archives grouped by project, searchable, batch-restorable; imports Claude Code / Cursor / Codex transcripts |
68
+ | The model always sees it | One context message per domain, republished only when the content changes |
69
+ | Lock it and relax | Locking a scene makes create/update/delete across the five domains read-only |
70
+ | Deleted is not gone | Skills / memories / personas / presets / scenes land in a recycle bin (permanent session deletion excepted); tick items to delete in bulk, or set a retention period so it cleans itself (keep-forever by default) |
71
+ | Safe by default | Only the plugin's own files are written; secrets masked, plaintext needs a token |
72
+
73
+ ## Quick start
74
+
75
+ Prerequisites: DSH installed (`dsh web` runs), Node.js ≥ 18. Pick the profile matching your client: `--profile web` for the browser app, `--profile desktop` for the desktop app. The desktop profile is initialized by DSH Desktop itself — open the app once, then quit it completely before running the command.
76
+
77
+ ```sh
78
+ dsh plugin --profile web add dsh-plugin-tool-management@latest # web · install / update
79
+ dsh plugin --profile web remove dsh-plugin-tool-management # web · uninstall
80
+ dsh plugin --profile desktop add dsh-plugin-tool-management@latest # desktop · install / update
81
+ dsh plugin --profile desktop remove dsh-plugin-tool-management # desktop · uninstall
82
+ ```
83
+
84
+ Hard-refresh the browser (web) or restart the desktop app, then a **Tools** panel with eight tabs means it worked. Client changes hot-reload; host-side changes need the client restarted (`dsh web` / the desktop app).
85
+
86
+ You can also ask the model:
87
+
88
+ ```text
89
+ Install the dsh-plugin-tool-management plugin:
90
+ dsh plugin --profile web add dsh-plugin-tool-management@latest
91
+ Then remind me to hard-refresh the browser.
92
+ ```
93
+
94
+ For the desktop app, swap `web` for `desktop` and end with "remind me to restart the desktop app" instead.
95
+
96
+ ## Features
97
+
98
+ ### Slash commands (manage from the chat box)
99
+
100
+ - **Type `/` for a "Tools" section**: scenes / skills / MCP servers / subagents / prompts / memories. Click a row to enter that domain, click an item to apply it; the menu stays open.
101
+ - **State is visible** (green check / empty box / note in grey), and long lists scroll on their own; each external skill directory gets one row that toggles the whole source.
102
+ - **Only reversible actions**: entering a scene and the various toggles; create / delete / edit / import / export stay on their own pages.
103
+
104
+ ### Scenes & memories
105
+
106
+ - **A scene = a group, a memory = a `.md` file**: `memories/<scene>/<name>.md`, the whole body is injected.
107
+ - **"Enabled" and "entered" are two axes**: enabled decides which scene the injection follows (single-select; none enabled = only `global` and `_shared`); entering applies the scene's whole MCP / skills / personas set and writes its bound prompt into `AGENTS.md`.
108
+ - **Scene profile**: ticked = on, unchecked = off, a section never created means that domain is off; leaving restores the pre-scene state.
109
+ - **Every domain offers "None"**: for MCP / skills / personas / memories / global prompt it means the scene leaves that domain alone; for quick prompts it means none are enabled while the scene is on, and it is the default for a new scene.
110
+ - **Scene lock** makes those five domains read-only; deleting a scene takes its memories with it into one recycle-bin entry. Import / export `.md` / `.zip`, same names skipped.
111
+
112
+ ### Subagents
113
+
114
+ - **One file per persona**: `subagents/<persona>.md`, frontmatter entirely optional.
115
+ - **Delegation**: `subagent_manager_run` runs with the persona, returns only its final result, and never enters History; `inherit: true` seeds the child with this conversation's finished turns.
116
+ - **On/off**: a disabled persona is neither injected nor visible to the model; new / imported / restored personas start disabled.
117
+ - **Tool limits per agent preset**: one allow or deny list per preset (mutually exclusive). Model and provider are picked from the host LLM catalogue; empty means inherit the main session.
118
+
119
+ ### MCP servers
120
+
121
+ - **CRUD with immediate effect**: written into `cordis.patch.yml`, backed up before every change.
122
+ - **Per-tool switches**: disable individual tools, or a whole server; a stopped server still shows the tools last seen.
123
+ - **Secret masking**: a credential is replaced as a whole, and "Reveal" needs a token; a masked value is never written back.
124
+ - A per-server note travels along as a decision hint; migration rolls back on failure, with JSON export/import.
125
+
126
+ ### Skills
127
+
128
+ - **Sources at a glance**: project / DSH / Agents / Codex / Claude / custom directories, grouped by source.
129
+ - **Opposite permissions**: default sources are readable and their skills deletable; external directories can be disabled or removed but their files stay read-only.
130
+ - **Remove ≠ disable**: removing stops scanning the directory at all (nothing is written, restorable); disabling keeps it listed but uncallable.
131
+ - The winning copy of a shared name is marked "preferred"; custom directories, ZIP import/export and the recycle bin are all here.
132
+
133
+ ### Prompt presets
134
+
135
+ - Multiple `~/.dsh/AGENTS.md` baselines, applied with one click (next turn), with 5 generations of backups; each preset can carry a one-line description that is never injected.
136
+ - **The switch on the left of a card is the answer to "is this one in effect"**: flip it on and that preset is written into `AGENTS.md`; flip it off to **un-apply**, which restores the state from before you started applying (and deletes the file if there was none back then). The confirmation says which one it will be, and a receipt afterwards states what happened.
137
+ - **Two kinds cannot be deleted directly**: a scene-bound preset, and the one currently applied. The copy auto-created on first open can be deleted. Deletes always go to the recycle bin.
138
+ - **Quick prompts** (the second section on the same page): save a piece of text you keep typing, then hit `/` and click it; a scene can bind a set of them.
139
+ - **This page's recycle bin is split in two by domain**, each half scrolling on its own with its own batch bar.
140
+
141
+ ### Archived sessions
142
+
143
+ - Grouped by project, searchable, batch restore / delete, retention auto-cleanup; a workspace whose registration was deleted can be re-registered in one click.
144
+ - Import Claude Code / Cursor / Codex / any text; export Markdown / JSONL in three cumulative modes: text only → plus tool calls → plus reasoning. **An export is a transcript, not a backup**.
145
+
146
+ ### Host compatibility
147
+
148
+ - **Host tab**: host version, usable capability count, per-action routing (native / adapter / unavailable), degradations and reasons; three write entries: access token, injection settings, model tool table.
149
+ - **Command line**: `node scripts/doctor.mjs` (health check), `node scripts/host-deps.mjs --fix` (align dependencies).
150
+ - Under a **suppressing preset** such as `minimal`, this plugin's injection is off by default; the Host tab can force any domain back on.
151
+ - Unchecking "Skills" or "Prompt" really stops them — under standard presets the host delivers those two itself.
152
+
153
+ ---
154
+
155
+ ## Where data lives
156
+
157
+ | Content | Location |
158
+ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
159
+ | MCP definitions | `~/.dsh/cordis.patch.yml` (written by the plugin; pre-write copies land in the hub's `backups/`) |
160
+ | Skill policy / custom dirs | `~/.dsh/tool-management/skills-state.json` |
161
+ | Skills / memories / personas / presets | `~/.dsh/tool-management/{skills,memories,subagents,prompts}/` |
162
+ | Subagent toggles | `~/.dsh/tool-management/subagents-index.json` |
163
+ | Recycle bin (skills / personas / presets / scenes) | `~/.dsh/tool-management/trash/{skills,subagents,prompts,scenes}-trash/` |
164
+ | Memory recycle bin | `~/.dsh/tool-management/memories-trash/` (a directory at the hub root, not under `trash/`) |
165
+ | Archive ledger / retention | `~/.dsh/tool-management/history-*.json` |
166
+ | Recycle-bin retention | `~/.dsh/tool-management/trash-retention.json` (`0` = keep forever) |
167
+ | Memory index / scenes / profiles | `~/.dsh/tool-management/memories-index.json` |
168
+ | MCP sidecars (disabled tools / known tools / notes / settings) | `~/.dsh/tool-management/mcp-*.json` |
169
+ | Injection settings (six domain switches) | `~/.dsh/tool-management/inject-settings.json` |
170
+ | Model tool table (switched-off tools + saved sets) | `~/.dsh/tool-management/tool-table.json` |
171
+ | Scene page preference (preview card before entering a scene) | `~/.dsh/tool-management/scene-settings.json` |
172
+ | Runtime log / patch backups | `~/.dsh/tool-management/tool-management.log` · `backups/` |
173
+
174
+ **No user data is stored inside the plugin's install directory** (`dsh plugin update` replaces it wholesale). `backups/` keeps **5 copies per patch file** — the global patch and each profile patch count separately.
175
+
176
+ ## Configuration & security
177
+
178
+ | Field | What it does |
179
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
+ | `token` | Access token. Once set, **every write and every plaintext credential** requires `x-dsh-token`; with no token the plaintext endpoints are closed entirely. Prefer not to keep it in the config? Use the `DSH_PLUGIN_TOOL_MANAGEMENT_TOKEN` environment variable. |
181
+ | `tokenDisabled` | `true` = the token stays in the config but is not enforced (this is the line written by "Turn protection off"). Writes no longer need it; revealing plaintext still does. |
182
+ | `maxBodyBytes` | Request body cap, 88 MiB by default. |
183
+
184
+ **Plaintext on disk (read this)**: masking is **display-only**; MCP `env` / `headers` and the plugin's own `token` stay in cleartext inside `cordis.patch.yml` (and each profile copy), and every config change copies the whole file into `~/.dsh/tool-management/backups/` — unencrypted, never rotated, not reclaimed on uninstall. One secret can therefore exist as `5 × (patch files holding it) + 1` plaintext copies. The token gate decides *who may read plaintext over HTTP*; it does nothing about *reading the files*, where the only defence is your filesystem permissions. **To clean up: Settings → Tools → Host → "Clean old backups"**.
185
+
186
+ - **Browser**: reads and writes go through cookies, no token needed; **plaintext credentials** (reveal / export) do. The token is managed in the **Access token** block on the Host tab.
187
+ - **Every destructive direction asks for the current token again** (turn protection off / change / delete). Being unlocked this run does not count.
188
+ - **curl / scripts**: send `x-dsh-token`, or carry the browser cookie. Except for the fence's 401 / 403, failures come back as **HTTP 200 + `{ ok: false, error }`** — branch on `body.ok`.
189
+ - **Port forwarding**: when the host has no `connection` service the fence falls back to "loopback Host + same origin", which any local process can imitate. If you forward the port to a LAN or the public internet, **configure a token**.
190
+ - **Avoid `__` in a server name**: a tool's full name is `mcp__<server>__<tool>`, so an extra `__` inside a server name makes it ambiguous; the Host tab shows an informational note.
191
+
192
+ ## FAQ
193
+
194
+ | Symptom | Fix |
195
+ | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
196
+ | Pages missing after install | Hard refresh; restart DSH if that fails. |
197
+ | Duplicate MCP tabs | Remove the stale loader row from `cordis.patch.yml`, restart. |
198
+ | Broken config, DSH won't boot | Restore the newest `cordis.patch.yml.<level>.bak-<timestamp>` from `~/.dsh/tool-management/backups/` (5 per patch file). |
199
+ | Action stopped working after a DSH upgrade | Settings → Tools → **Host** for the reason; `doctor.mjs` → `host-deps.mjs --fix`. |
200
+ | The model cannot call a tool it should have | Check the **Model tool table** on the Host tab — 15 tools ship switched off. The panel and scripts are unaffected either way. |
201
+ | Still asked to confirm with `approval=never`? | No card appears — straight through with a log line. Switch back to "workspace write" to get the questions again. |
202
+ | `subagent_manager_run` reports provider unavailable | The provider is not registered: `spawn` (default) / `fork` (`inherit`) come from `@deepseek-ai/dsh-subagent-spawn-in-process` / `-fork-in-process` — mount and restart. |
203
+ | Scene binds persona A, but the official `subagent` ran something else | Those two are host tools and this plugin cannot hide them; work matching a persona goes to `subagent_manager_run`, host tools only when no persona fits or a background job is needed. |
204
+
205
+ ---
206
+
207
+ ## Development
208
+
209
+ ```bash
210
+ npm install
211
+ npm run build # tsc + sync client
212
+ npm test # build + i18n + contract tests (pure-function invariants & host contracts)
213
+ npm run check:i18n # dictionary self-check
214
+ npm run doctor # host compatibility check
215
+ ```
216
+
217
+ `lib/` is not tracked — run `npm run build` after cloning. Changes need `dsh web` restarted. Runtime deps: `fflate` (export bundling) and `js-yaml` (parse check before writing host patches, loaded lazily); `@deepseek-ai/*` all come from the host.
218
+
219
+ > **Deployment note**: the profile mirror produced by `npm run build` does **not** include `node_modules`, so a runtime dependency added locally (e.g. `js-yaml`) must either be installed on the profile side or accepted as "patch-write check skipped and reported". Regular `npm install` deployments are unaffected.
220
+
221
+ ## License
222
+
223
+ MIT
Binary file
Binary file
Binary file