dsh-preset-workbench 0.0.0-stage → 1.0.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 (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -2
  3. package/cordis.patch.yml +4 -0
  4. package/lib/client.js +792 -0
  5. package/lib/index.js +1234 -0
  6. package/lib/yaml-lite.js +398 -0
  7. package/package.json +47 -4
  8. package/templates/bare/README.md +34 -0
  9. package/templates/bare/agent.cordis.yml +43 -0
  10. package/templates/bare/persona-file.mjs +100 -0
  11. package/templates/bare/preset.yml +3 -0
  12. package/templates/bare/sections.json +1 -0
  13. package/templates/cetacea/README.md +18 -0
  14. package/templates/cetacea/agent.cordis.yml +126 -0
  15. package/templates/cetacea/persona-file.mjs +76 -0
  16. package/templates/cetacea/persona.md +33 -0
  17. package/templates/cetacea/preset.yml +3 -0
  18. package/templates/cetacea/section.01-/346/240/270/345/277/203/344/272/272/350/256/276.md +15 -0
  19. package/templates/cetacea/section.02-/350/220/214/347/202/271/344/270/216/350/257/264/350/257/235/346/226/271/345/274/217.md +8 -0
  20. package/templates/cetacea/section.03-/344/272/272/346/240/274/345/274/200/345/205/263.md +3 -0
  21. package/templates/cetacea/section.04-/345/267/245/345/205/267/344/275/277/347/224/250.md +4 -0
  22. package/templates/cetacea/sections.json +6 -0
  23. package/templates/liangshen/NOTICE +8 -0
  24. package/templates/liangshen/agent.cordis.yml +485 -0
  25. package/templates/liangshen/dispatcher-rules.mjs +121 -0
  26. package/templates/liangshen/fact-ledger.mjs +141 -0
  27. package/templates/liangshen/guard.mjs +526 -0
  28. package/templates/liangshen/minimal-prompt.mjs +926 -0
  29. package/templates/liangshen/paging.mjs +232 -0
  30. package/templates/liangshen/preset.yml +3 -0
  31. package/templates/liangshen/tool-activate.mjs +176 -0
  32. package/templates/liangshen/tool-catalog.mjs +1060 -0
  33. package/templates/liangshen/working-context.mjs +222 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-preset-workbench contributors
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.md CHANGED
@@ -1,3 +1,206 @@
1
- # Temporary Holding Version
1
+ # dsh-preset-workbench
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > 在 DSH(DeepSeek Harness)设置页里,创建与编辑 Agent 预设的可视化工作台——不用写 YAML,不用求创造模式代劳。
4
+ > A visual workbench on the DSH (DeepSeek Harness) Settings page for creating and editing agent presets — no YAML, no asking the "creation mode" to do it for you.
5
+
6
+ ---
7
+
8
+ **[中文](#中文) · [English](#english)**
9
+
10
+ ---
11
+
12
+ ## 中文
13
+
14
+ ## 简介
15
+
16
+ 预设是 DSH 新会话的“开局配置包”:选定哪个预设,会话里的 AI 就是什么人设、什么能力。本插件把预设的编辑变成设置页里的一页可视化工具:
17
+
18
+ - **分段提示词**:每段独立标题与内容,勾选框控制这段是否进入系统提示词(不勾 = 文字保留但不给 AI 看)
19
+ - **能力开关**:15 项可选工具能力,勾选即写入组合文件、取消即移除,每次切换自动做挂载校验
20
+ - **内置模板**:随插件自带“鲸鱼娘”“梁神模式”“空提示词”三套预设,任何机器安装即用
21
+ - **安全边界**:系统预设只读;绝不覆盖本机已有预设;高权限能力带环境预检
22
+
23
+ ## 功能
24
+
25
+ | 功能 | 说明 |
26
+ | --- | --- |
27
+ | 分段提示词编辑 | 每段:启用勾选 / 标题 / 内容,可增删段落 |
28
+ | **来源徽章** | 每个预设标注 📦 内置模板 / 📦·✏️ 已改动 / 👤 自定义 / 官方预设,一眼分清“随插件发布的模板”和“你自己创作的” |
29
+ | 新建预设 | 选择内置模板或本机已有预设,一键复制(自带分段装载器) |
30
+ | 能力开关 | 15 项能力:勾选写入、取消移除、自动校验;含“预留接线(disabled)”模式 |
31
+ | 打开目录 | 一键在资源管理器中打开该预设文件夹 |
32
+ | 校验挂载 | 模拟会话加载,报告组合错误 |
33
+ | 删除预设 | 两击确认防误删;仅限用户预设 |
34
+
35
+ ### 来源徽章怎么看
36
+
37
+ | 徽章 | 含义 |
38
+ | --- | --- |
39
+ | 📦 **内置模板** | id 与插件 `templates/` 里的模板同名,且内容与模板**逐字节一致**——这些内容已随插件公开 |
40
+ | 📦 **内置模板 · ✏️ 已改动** | 名字是模板,但内容有你自己的东西——**不要假定它和模板一样可以公开** |
41
+ | 👤 **自定义** | 不在内置模板之列,是你自己创作的预设 |
42
+ | **官方预设** | 由 DSH 官方或第三方插件声明,磁盘上没有目录,本工作台只能查看 |
43
+
44
+ **判定规则**:只比对一个方向——模板里的每个文件,在你的目录里是否都存在且内容相同。多出来的文件会被忽略,因为 `sections.json` 是预设唯一的段落清单(没有自动发现机制):你真正用到的内容要么改动了模板文件,要么改动了 `sections.json`,两种都会被判为「已改动」;而未被引用的多余文件不会进入预设渲染,据此报警只会产生误报。
45
+
46
+ ## 安装
47
+
48
+ ```bash
49
+ # 从本地目录安装
50
+ dsh plugin add --profile web <本插件目录的绝对路径>
51
+
52
+ # 或从 GitHub 仓库安装
53
+ dsh plugin add --profile web github:<你的用户名>/dsh-preset-workbench
54
+ ```
55
+
56
+ 安装后**重启 dsh**,打开 **设置 → 预设工作台** 即可使用。包内含 `templates/`(鲸鱼娘、梁神、空提示词三套内置模板),所以 `npm install dsh-preset-workbench` 或 `dsh plugin add dsh-preset-workbench` 安装后开箱即用。
57
+
58
+ ## 使用
59
+
60
+ 1. 打开设置 → 预设工作台
61
+ 2. 下拉框选择一个用户预设(鲸鱼娘 / 梁神 / 空提示词 / 你自己建的)
62
+ 3. 编辑各段提示词 → 点「💾 保存全部」→ **下次新开的会话**生效
63
+ 4. 新建自己的预设:填 id(英文小写)与显示名 → 从模板创建 → 改内容 → 保存
64
+ 5. 给预设加能力:展开「🧰 能力开关」打勾,每次切换自动校验
65
+
66
+ ## 能力开关
67
+
68
+ 15 项可分三档:
69
+
70
+ | 档位 | 能力 |
71
+ | --- | --- |
72
+ | 🟢 安全 | 联网搜索+抓取、标准文件工具、AGENTS.md 工作区指令、技能库、提问确认、任务清单、后台任务、长期目标、规划模式 |
73
+ | 🟡 中等 | 子代理+工作流(含 Ralph 迭代代理) |
74
+ | 🔴 高危(带预检) | PPT/代码模式演示(需宿主 codeRuntime,否则安全拒绝)、插件改制工具 cordis_* |
75
+ | 🔌 预留接线 | Codex、Claude Code 产品子代理(写入官方同款 disabled 行,启用需另装捆绑)、一次性 bash/pwsh |
76
+
77
+ 地基能力(命令 shell、文件编辑器、长对话压缩)永远在,不设开关、不受勾选影响。
78
+
79
+ ## 内置模板
80
+
81
+ | 模板 | 说明 |
82
+ | --- | --- |
83
+ | `cetacea`(鲸鱼娘) | 极简角色扮演模板:持久 shell + 文件编辑器 + 压缩 + 分段人设(自带分段装载器) |
84
+ | `liangshen`(梁神模式) | 全功能预设:文件/搜索/技能/目标/规划/压缩/子代理/workflow/Ralph/联网等 |
85
+ | `bare`(空提示词) | 裸模模板:没有系统提示词、也没有工具(装配阶段清空工具表);人设分段初始为空,加一段就有提示词 |
86
+
87
+ 模板随插件打包发布,安装即用;创建时复制到新 id 名下,**不影响本机已有同名预设**。
88
+
89
+ ## 工作原理
90
+
91
+ - 预设 = `.agent-presets/<id>` 下的一个文件夹(组合文件 + 提示词分段 + 元数据)
92
+ - 本插件 = 设置页新页 + 一个 loopback HTTP 桥(`/api/preset-workbench`)
93
+ - 能力开关 = 在组合文件里插入/移除带标记的工具行;每次切换后自动跑挂载校验
94
+ - 模板复制 = 插件内 `templates/` 只读素材 → 复制到新 id,重写显示名;id 被占用即拒绝,绝不覆盖
95
+ - 只改用户预设;官方内置预设(standard/code/minimal/cordis)一律只读
96
+
97
+ ## 常见问题
98
+
99
+ - **会覆盖我已有的同名预设吗?** 不会。创建时检查 id,冲突则拒绝并提示“预设 id 已被占用”。
100
+ - **能改官方系统预设吗?** 不能,所有写操作仅限用户预设。
101
+ - **改动什么时候生效?** 保存后对**之后新开的会话**生效,当前会话不变。
102
+
103
+
104
+
105
+ ## 许可
106
+
107
+ [MIT](./LICENSE)
108
+
109
+ ---
110
+
111
+ ## English
112
+
113
+ ## Intro
114
+
115
+ Presets are DSH's "starting config pack" for new sessions: choosing a preset defines who the session's AI is and what it can do. This plugin turns preset editing into one visual page inside Settings:
116
+
117
+ - **Sectioned prompts**: each section has its own title/content; the checkbox decides whether it enters the system prompt (unchecked = text kept but hidden from the AI)
118
+ - **Capability toggles**: 15 optional tool capabilities — check to write the rows into the composition, uncheck to remove, auto-validated on every toggle
119
+ - **Built-in templates**: ships with three presets ("鲸鱼娘 / Whale Girl", "梁神模式 / Liangshen Mode", "空提示词 / Bare"), ready on any machine after install
120
+ - **Safety boundaries**: system presets are read-only; existing local presets are never overwritten; high-power capabilities carry environment pre-checks
121
+
122
+ ## Features
123
+
124
+ | Feature | Description |
125
+ | --- | --- |
126
+ | Sectioned prompt editor | Per-section: enabled checkbox / title / content; add & remove sections |
127
+ | **Provenance badge** | Every preset is labelled 📦 built-in template / 📦·✏️ modified / 👤 custom / official, so "ships with the plugin" and "you wrote it" are never confused |
128
+ | Create presets | From built-in template or any existing user preset, one-click copy (with section loader) |
129
+ | Capability toggles | 15 capabilities, write-on-check / remove-on-uncheck, auto mount validation, plus "wired but disabled" mode |
130
+ | Open directory | One click to reveal the preset folder in the file explorer |
131
+ | Validate mount | Simulates session loading and reports composition errors |
132
+ | Delete preset | Double-click confirm (anti-mistake); user presets only |
133
+
134
+ ### Reading the provenance badge
135
+
136
+ | Badge | Meaning |
137
+ | --- | --- |
138
+ | 📦 **Built-in template** | The id matches a template in the plugin's `templates/`, and the content matches it **byte for byte** — that content is already public with the plugin |
139
+ | 📦 **Built-in template · ✏️ modified** | The name is a template's, but the content contains your own additions — **do not assume it is as public as the template** |
140
+ | 👤 **Custom** | Not one of the built-in templates; a preset you authored |
141
+ | **Official preset** | Declared by DSH or a third-party plugin with no directory on disk; view-only here |
142
+
143
+ **How "modified" is decided**: only one direction is compared — for every file in the shipped template, does your directory contain it with identical content? Extra files are ignored, because `sections.json` is the preset's only section manifest (there is no auto-discovery): anything you actually use either changes a template file or changes `sections.json`, and both are detected, while unreferenced leftovers never reach the rendered preset and would only cause false alarms.
144
+
145
+ ## Install
146
+
147
+ ```bash
148
+ # local directory
149
+ dsh plugin add --profile web /absolute/path/to/this/plugin
150
+
151
+ # or from GitHub
152
+ dsh plugin add --profile web github:<your-username>/dsh-preset-workbench
153
+ ```
154
+
155
+ **Restart dsh** after installing, then open **Settings → 预设工作台 (Preset Workbench)**. The package ships `templates/` (Whale Girl, Liangshen & Bare built-in templates), so `npm install dsh-preset-workbench` or `dsh plugin add dsh-preset-workbench` works out of the box.
156
+
157
+ ## Usage
158
+
159
+ 1. Open Settings → Preset Workbench
160
+ 2. Pick a user preset from the dropdown (Whale Girl / Liangshen / Bare / yours)
161
+ 3. Edit prompt sections → click「💾 Save All」→ takes effect on **new** sessions
162
+ 4. Create your own: fill in an id (lowercase english) + display name → create from template → edit → save
163
+ 5. Add capabilities: open「🧰 Capability Toggles」and check any item — each toggle auto-validates
164
+
165
+ ## Capabilities
166
+
167
+ 15 items in three risk tiers:
168
+
169
+ | Tier | Items |
170
+ | --- | --- |
171
+ | 🟢 Safe | Web search + fetch, standard file tools, AGENTS.md, skills, ask-user confirmations, todo, background jobs, long-term goals, plan mode |
172
+ | 🟡 Medium | Subagents + workflows (incl. Ralph iterative agent) |
173
+ | 🔴 High (pre-checked) | PPT/code-mode presentation (requires host codeRuntime, otherwise safely refused), cordis_* plugin tooling |
174
+ | 🔌 Wired-but-disabled | Codex & Claude Code product subagents (official-style `disabled` rows; enable needs bundles), one-shot bash/pwsh |
175
+
176
+ Base capabilities (shell, file editor, compaction) are always on and not togglable.
177
+
178
+ ## Built-in Templates
179
+
180
+ | Template | Description |
181
+ | --- | --- |
182
+ | `cetacea`(鲸鱼娘 / Whale Girl) | Minimal roleplay preset: persistent shell + file editor + compaction + sectioned persona (ships its own loader) |
183
+ | `liangshen`(梁神模式 / Liangshen Mode) | Full-featured preset: files, search, skills, goals, planning, compaction, subagents, workflows, Ralph, web... |
184
+ | `bare`(空提示词 / Bare) | Raw-model template: no system prompt and no tools (the tool surface is emptied at assembly); the section list starts empty, so adding one section is what gives it a prompt |
185
+
186
+ Templates are packed with the plugin; creation copies them to a new id and never touches local presets with the same name.
187
+
188
+ ## How It Works
189
+
190
+ - A preset is a folder under `.agent-presets/<id>` (composition + prompt sections + metadata)
191
+ - This plugin = one new Settings page + a loopback HTTP bridge (`/api/preset-workbench`)
192
+ - Capability toggles insert/remove marked tool rows in the composition file; every toggle runs a mount validation
193
+ - Template creation copies read-only assets from `templates/` to the new id and rewrites the display name; occupied ids are refused — never overwritten
194
+ - Only user presets are writable; official presets (standard/code/minimal/cordis) are always read-only
195
+
196
+ ## FAQ
197
+
198
+ - **Will it overwrite an existing preset with the same id?** No. Creation checks for occupied ids and refuses with "预设 id 已被占用".
199
+ - **Can I edit the official system presets?** No; every write is restricted to user presets.
200
+ - **When do changes take effect?** Saved changes apply to **newly opened sessions**; the current session is unchanged.
201
+
202
+
203
+
204
+ ## License
205
+
206
+ [MIT](./LICENSE)
@@ -0,0 +1,4 @@
1
+ # dsh-preset-workbench - 设置页“预设工作台”:用户自己创建/编辑预设提示词。
2
+ - insert:
3
+ - id: preset-workbench
4
+ name: dsh-preset-workbench