dsh-personal-system-rules 0.0.0-stage → 0.5.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/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +89 -2
- package/client.js +703 -0
- package/cordis.patch.yml +3 -0
- package/file.js +45 -0
- package/icon.svg +11 -0
- package/index.js +421 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/loop-guard.js +90 -0
- package/package.json +79 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
## 0.5.0 — 2026-10-31
|
|
4
|
+
|
|
5
|
+
- 新增循环检测守卫:连续执行完全相同的工具调用达到 `repeatLimit` 时,按 `repeatAction` 提醒或中止本轮。
|
|
6
|
+
- 静默提醒与循环检测合并到同一个 `agent/pre-step` 钩子和同一个「守卫」设置卡片,一次保存全部守卫参数。
|
|
7
|
+
- 检测逻辑独立为 `loop-guard.js`,新增 `test/loop-guard.test.js` 与 `test/guards.test.js`。
|
|
8
|
+
|
|
9
|
+
## 0.4.6 — 2026-10-31
|
|
10
|
+
|
|
11
|
+
- 静默提醒的提醒文案改为紧凑的自动增高多行输入框,长文案和占位符完整可见。
|
|
12
|
+
|
|
13
|
+
## 0.4.5 — 2026-10-31
|
|
14
|
+
|
|
15
|
+
- 提醒文案改为单行输入,去掉「默认文案:」前缀;规则正文编辑框恢复 280px 高度。
|
|
16
|
+
|
|
17
|
+
## 0.4.4 — 2026-10-31
|
|
18
|
+
|
|
19
|
+
- 默认规则文件改名为 `PERSONAL-SYSTEM-RULES.md`,与包名对应;默认 `file`、header、路径提示与文档同步。
|
|
20
|
+
|
|
21
|
+
## 0.4.3 — 2026-10-31
|
|
22
|
+
|
|
23
|
+
- 去掉设置页的文件路径输入,路径固定为 `$DSH_HOME/PERSONAL-SYSTEM-RULES.md`;`Config.file` 改为普通配置。
|
|
24
|
+
- 页面简化为「规则正文 + 守卫」两块。
|
|
25
|
+
|
|
26
|
+
## 0.4.2 — 2026-10-31
|
|
27
|
+
|
|
28
|
+
- 插件详情页与设置弹窗统一为同一个完整页面。
|
|
29
|
+
|
|
30
|
+
## 0.4.1 — 2026-10-31
|
|
31
|
+
|
|
32
|
+
- 分层语义调整:`AGENTS.md` 保持 dsh 出厂 user 基线,`PERSONAL-SYSTEM-RULES.md` 由本插件注入系统层。
|
|
33
|
+
|
|
34
|
+
## 0.4.0 — 2026-10-31
|
|
35
|
+
|
|
36
|
+
- 显示名改为「个性化规则」;新增设置弹窗分区,规则正文、文件路径、守卫参数可编辑并热更新。
|
|
37
|
+
|
|
38
|
+
## 0.3.x — 2026-10
|
|
39
|
+
|
|
40
|
+
- 0.3.0 首个带插件详情页编辑区的版本;0.3.3/0.3.4 完成分层与包名迁移。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NingYuanLee
|
|
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,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-personal-system-rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/NingYuanLee/dsh-personal-system-rules/actions/workflows/ci.yml) [](https://www.npmjs.com/package/dsh-personal-system-rules) [](LICENSE)
|
|
4
|
+
|
|
5
|
+
把个性化规则文件注入 DeepSeek Harness(dsh)的**系统提示**,并提供**静默提醒**与**重复操作循环检测**;规则正文与守卫参数都能在设置弹窗「个性化规则」里编辑。
|
|
6
|
+
|
|
7
|
+
A dsh plugin that injects a personal rules file as a system-prompt section and adds silent-step / repeated-action loop guards. The rules body and guard options are editable from the dsh settings dialog.
|
|
8
|
+
|
|
9
|
+
## 功能
|
|
10
|
+
|
|
11
|
+
1. **系统提示段**:把 `~/.dsh/PERSONAL-SYSTEM-RULES.md`(或 `config.file` 指定文件)注册成段 `user:agents-md`,order 默认 10150,原样注入;`watchFile` 1 秒轮询,改完下一次模型请求生效,不用重启。
|
|
12
|
+
2. **静默提醒**:连续 `maxSilentSteps`(默认 2)步没有可见文本时,注入一条提醒要求模型说明进展;同一条链只提醒一次,`0` 关闭。
|
|
13
|
+
3. **循环检测**:连续 `repeatLimit` 步执行**完全相同**的工具调用(工具名 + 归一化参数)时触发,`repeatAction` 可选 `remind`(提醒)或 `stop`(像用户点停止一样中止本轮并保留排队输入);默认 0 关闭。
|
|
14
|
+
4. **设置弹窗页面**:`设置 → 个性化规则` 与插件详情页是同一个页面,含「规则正文」和「守卫」两块;保存经官方 `settings` 机制写回 profile patch 并热更新。
|
|
15
|
+
|
|
16
|
+
静默提醒与循环检测共用同一个 `agent/pre-step` 钩子;检测逻辑是纯函数,独立测试。
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
**从 npm(推荐):**
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
dsh --profile my-profile --from-default-profile web --dump-config
|
|
24
|
+
dsh plugin --profile my-profile add dsh-personal-system-rules
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**从 git(固定 tag):**
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
dsh plugin --profile my-profile add "git+https://github.com/NingYuanLee/dsh-personal-system-rules.git#v0.5.0"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**从 GitHub Release tarball:**
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
dsh plugin --profile my-profile add "https://github.com/NingYuanLee/dsh-personal-system-rules/releases/download/v0.5.0/dsh-personal-system-rules-0.5.0.tgz"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
包没有 `prepare` / `postinstall` 脚本,安装不执行构建代码。
|
|
40
|
+
|
|
41
|
+
## 配置
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
- id: system-agents-md
|
|
45
|
+
name: dsh-personal-system-rules
|
|
46
|
+
config:
|
|
47
|
+
# file 缺省为 $DSH_HOME/PERSONAL-SYSTEM-RULES.md
|
|
48
|
+
header: |
|
|
49
|
+
# 用户全局系统层规则
|
|
50
|
+
以下内容来自用户全局 PERSONAL-SYSTEM-RULES.md,是系统层指令,必须遵守。
|
|
51
|
+
maxSilentSteps: 2
|
|
52
|
+
silentReminder: ''
|
|
53
|
+
repeatLimit: 0
|
|
54
|
+
repeatAction: remind
|
|
55
|
+
repeatReminder: ''
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- `maxSilentSteps`、`silentReminder`、`repeatLimit`、`repeatAction`、`repeatReminder` 是 `volatile()` 字段,可在设置弹窗编辑并热更新。
|
|
59
|
+
- `file`、`header`、`order` 是普通配置,只在 `cordis.patch.yml` 里改;改 `file` 后需要重载插件。
|
|
60
|
+
- `repeatLimit: 0` 关闭循环检测;文本回复或新用户轮次会重置重复计数。
|
|
61
|
+
- 设置弹窗保存会写回 profile 的 `cordis.patch.yml`。
|
|
62
|
+
|
|
63
|
+
## 兼容性
|
|
64
|
+
|
|
65
|
+
- Node.js `>=22.19.0`。
|
|
66
|
+
- dsh `>=0.2.1-rc.2 <0.3.0-0`。
|
|
67
|
+
- 极简预设不生效(该预设把系统提示截成一句);插件停用或加载失败时不注入任何内容。
|
|
68
|
+
|
|
69
|
+
## 开发
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
git clone https://github.com/NingYuanLee/dsh-personal-system-rules.git
|
|
73
|
+
cd dsh-personal-system-rules
|
|
74
|
+
npm install --ignore-scripts
|
|
75
|
+
npm test
|
|
76
|
+
npm run check
|
|
77
|
+
npm run build # 重新生成 client.js,需提交
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`client.js` 是构建产物(web 模块加载器信封),修改 `client-src.js` 后必须重新构建并提交。
|
|
81
|
+
|
|
82
|
+
## 说明与限制
|
|
83
|
+
|
|
84
|
+
- 循环检测只识别「工具名 + 参数完全相同」的连续工具调用;参数变化、文本步骤、新用户轮次都会重置。
|
|
85
|
+
- `stop` 走 `agent.cancel({ kind: 'user' }, { keepInbox: true })`,与用户停止同一条取消路径,不是强制杀进程。
|
|
86
|
+
- 安装任何 dsh 插件都会以用户权限运行第三方代码;请先阅读源码。
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
[MIT](LICENSE) © 2026 NingYuanLee
|