dsh-verify-gate 0.1.0 → 0.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.
- package/CHANGELOG.md +44 -23
- package/README.md +132 -105
- package/README.zh.md +103 -80
- package/index.js +164 -122
- package/package.json +4 -4
- package/scripts/repair-session.mjs +274 -0
- package/test/wiring.test.mjs +139 -105
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.1.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.2 — 2026-11-21
|
|
4
|
+
|
|
5
|
+
- Ship `scripts/repair-session.mjs`: repairs session logs that 0.1.0 already broke
|
|
6
|
+
(`user/message` rows carrying a `system` message). Dry-run by default; `--apply` rewrites,
|
|
7
|
+
keeps a `.orig-<timestamp>` backup, verifies the rebuilt log, and leaves every untouched
|
|
8
|
+
frame byte-identical.
|
|
9
|
+
- README (en/zh): how to run the repair, and why it has to happen with DSH closed.
|
|
10
|
+
|
|
11
|
+
## 0.1.1 — 2026-11-21
|
|
12
|
+
|
|
13
|
+
- **Fix: the nudge no longer corrupts session history.** The reminder was injected as a
|
|
14
|
+
`system`-role message; the harness records every non-`runtime-context` `agent/pre-step`
|
|
15
|
+
message as a `user/message` event, so that payload produced logs rejected on load
|
|
16
|
+
(`stored session ... failed validation: message must have role "user"`) and the session
|
|
17
|
+
could not be opened again. The reminder is now a `user`-role message wrapped in
|
|
18
|
+
`<system-reminder>` with `source.kind = "verify-gate"`.
|
|
19
|
+
- Added `assertInjectable()`: an injected message that is not user-role (or that carries a
|
|
20
|
+
retired `plugin`/`system-prompt` source) throws instead of reaching the log.
|
|
21
|
+
- Stop duplicating the call-to-action: the verdict text already carries it (the reminder
|
|
22
|
+
used to repeat the sentence twice).
|
|
23
|
+
|
|
24
|
+
## 0.1.0 — 2026-11-21
|
|
25
|
+
|
|
26
|
+
First release. Published to npm as `dsh-verify-gate@0.1.0`.
|
|
27
|
+
|
|
28
|
+
- Observe tool calls through the `tools/execute` waterfall; track which code files a
|
|
29
|
+
turn touched and whether anything verified them afterwards.
|
|
30
|
+
- Nudge through the `agent/pre-step` waterfall: when a turn edited code and nothing was
|
|
31
|
+
run, one system message is appended to the next step's context.
|
|
32
|
+
- `verify_exemption(reason)` tool so an agent can declare why no check applies
|
|
33
|
+
(reasons under 12 characters are rejected).
|
|
34
|
+
- Single ledger by design: `agent/pre-step` carries no agent identity, so per-agent
|
|
35
|
+
isolation would be fake. Concurrent agents share one conservative judgement.
|
|
36
|
+
- 19 tests: 11 for the ledger, 8 for the wiring.
|
|
37
|
+
|
|
38
|
+
Verified live against DSH 0.2.2-rc.5:
|
|
39
|
+
|
|
40
|
+
| arm | behaviour | nudges |
|
|
41
|
+
|---|---|---:|
|
|
42
|
+
| A | `write` a .js, verify nothing | 1 |
|
|
43
|
+
| B | `write` a .js, then `node --check` | 0 |
|
|
44
|
+
| C | `write` a .mjs, then `verify_exemption` | 0 |
|
package/README.md
CHANGED
|
@@ -1,105 +1,132 @@
|
|
|
1
|
-
# dsh-verify-gate
|
|
2
|
-
|
|
3
|
-
**A completion gate for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH).**
|
|
4
|
-
When a turn changed code files and nothing was run to check them, it says so — once —
|
|
5
|
-
at the next step, and accepts an exemption when no check applies.
|
|
6
|
-
|
|
7
|
-
English · [简体中文](README.zh.md)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Why
|
|
12
|
-
|
|
13
|
-
Measured on a real machine, 49 sessions / 937 turns:
|
|
14
|
-
|
|
15
|
-
| metric | value |
|
|
16
|
-
|---|---:|
|
|
17
|
-
| turns that edited **code** files | 394 |
|
|
18
|
-
| …that never ran a test or type check | **355 (90.1%)** |
|
|
19
|
-
|
|
20
|
-
That is the failure mode Can Bölük catalogued in
|
|
21
|
-
[_The Harness Problem_](https://blog.can.ac/2026/02/12/the-harness-problem/):
|
|
22
|
-
the agent writes, re-reads, decides it looks fine, and stops — without ever asking reality.
|
|
23
|
-
|
|
24
|
-
DSH ships a safety reviewer (`dsh-experimental-auto-review`) and advisory loop reminders,
|
|
25
|
-
but nothing guards the *completion* boundary. This plugin is that guard.
|
|
26
|
-
|
|
27
|
-
## How it works
|
|
28
|
-
|
|
29
|
-
Three harness seams, read out of `@deepseek-ai/dsh-agent-loop/lib/index.js` on DSH
|
|
30
|
-
`0.2.2-rc.5` — not guessed:
|
|
31
|
-
|
|
32
|
-
| seam | kind | role |
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| `tools/execute` | waterfall `(exec, next)` | observe calls; `exec.name` + `exec.arguments` |
|
|
35
|
-
| `agent/pre-step` | waterfall `(payload, next)` | **inject** the reminder into `decision.messages` |
|
|
36
|
-
| `agent/turn-stopping` | serial | settle the turn, reset the ledger |
|
|
37
|
-
|
|
38
|
-
> `turn/start` and `turn/end` are **session records** (`session.append(...)`), not context
|
|
39
|
-
> events. Listening for them silently never fires.
|
|
40
|
-
|
|
41
|
-
The injected message lands in the model's context for the very next step:
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{ "role": "
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
# dsh-verify-gate
|
|
2
|
+
|
|
3
|
+
**A completion gate for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH).**
|
|
4
|
+
When a turn changed code files and nothing was run to check them, it says so — once —
|
|
5
|
+
at the next step, and accepts an exemption when no check applies.
|
|
6
|
+
|
|
7
|
+
English · [简体中文](README.zh.md)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
Measured on a real machine, 49 sessions / 937 turns:
|
|
14
|
+
|
|
15
|
+
| metric | value |
|
|
16
|
+
|---|---:|
|
|
17
|
+
| turns that edited **code** files | 394 |
|
|
18
|
+
| …that never ran a test or type check | **355 (90.1%)** |
|
|
19
|
+
|
|
20
|
+
That is the failure mode Can Bölük catalogued in
|
|
21
|
+
[_The Harness Problem_](https://blog.can.ac/2026/02/12/the-harness-problem/):
|
|
22
|
+
the agent writes, re-reads, decides it looks fine, and stops — without ever asking reality.
|
|
23
|
+
|
|
24
|
+
DSH ships a safety reviewer (`dsh-experimental-auto-review`) and advisory loop reminders,
|
|
25
|
+
but nothing guards the *completion* boundary. This plugin is that guard.
|
|
26
|
+
|
|
27
|
+
## How it works
|
|
28
|
+
|
|
29
|
+
Three harness seams, read out of `@deepseek-ai/dsh-agent-loop/lib/index.js` on DSH
|
|
30
|
+
`0.2.2-rc.5` — not guessed:
|
|
31
|
+
|
|
32
|
+
| seam | kind | role |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `tools/execute` | waterfall `(exec, next)` | observe calls; `exec.name` + `exec.arguments` |
|
|
35
|
+
| `agent/pre-step` | waterfall `(payload, next)` | **inject** the reminder into `decision.messages` |
|
|
36
|
+
| `agent/turn-stopping` | serial | settle the turn, reset the ledger |
|
|
37
|
+
|
|
38
|
+
> `turn/start` and `turn/end` are **session records** (`session.append(...)`), not context
|
|
39
|
+
> events. Listening for them silently never fires.
|
|
40
|
+
|
|
41
|
+
The injected message lands in the model's context for the very next step:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{ "role": "user", "content": [{ "type": "text", "text": "<system-reminder>\nThis turn changed 1 code file(s) but nothing was run to check them. Run the project tests (or a type check) before calling the task done, or call verify_exemption with a concrete reason why no check applies.\n</system-reminder>" }], "source": { "kind": "verify-gate" } }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> **It must be a `user` message.** `agent/pre-step` messages that are not `runtime-context`
|
|
48
|
+
> are recorded by the harness as `user/message` session events no matter their role, so a
|
|
49
|
+
> `system`-role payload there writes a log that fails validation on load
|
|
50
|
+
> (`... message must have role "user"`) and can no longer be opened. The
|
|
51
|
+
> `<system-reminder>` wrapper is the harness's own convention for mid-conversation
|
|
52
|
+
> injections, so the model still reads it as harness guidance, not user speech.
|
|
53
|
+
|
|
54
|
+
## Repairing a session broken by 0.1.0
|
|
55
|
+
|
|
56
|
+
0.1.0 could write one unloadable row into a session log. Upgrading to 0.1.1+ stops new
|
|
57
|
+
damage, but it does not repair logs that are already broken: the session keeps failing to
|
|
58
|
+
open until that row is rewritten. This package ships the repair:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
node node_modules/dsh-verify-gate/scripts/repair-session.mjs # dry run, all sessions
|
|
62
|
+
node node_modules/dsh-verify-gate/scripts/repair-session.mjs --apply # rewrite, with backups
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
It finds `user/message` rows whose payload is a `system` message, rewrites them into the
|
|
66
|
+
canonical `system/message` event the harness itself writes (`turn`/`step` taken from the
|
|
67
|
+
preceding `step/start`), recompresses only the Zstandard frame that held the row, verifies
|
|
68
|
+
the rebuilt log before writing, keeps `session.v4.jsonl.zstd.orig-<timestamp>` beside the
|
|
69
|
+
original, and moves that session's projection cache aside so it rebuilds.
|
|
70
|
+
|
|
71
|
+
Run it **while DSH is closed** — it rewrites session artifacts on disk. `--sessions-dir`
|
|
72
|
+
points it at a different root; `--no-projcache` leaves the cache alone.
|
|
73
|
+
|
|
74
|
+
## Design choices
|
|
75
|
+
|
|
76
|
+
- **Warn, never block.** Blocking turns makes every task slower; a reminder costs one line.
|
|
77
|
+
- **Code files only.** `.md` / `.json` edits do not count, otherwise every doc commit screams.
|
|
78
|
+
- **A failing check still counts as verified.** The plugin cares whether the agent looked at
|
|
79
|
+
reality, not whether reality said yes.
|
|
80
|
+
- **An exemption exists.** `verify_exemption(reason)`, reasons under 12 characters rejected.
|
|
81
|
+
A gate that cries wolf gets uninstalled.
|
|
82
|
+
|
|
83
|
+
## Live verification (DSH 0.2.2-rc.5)
|
|
84
|
+
|
|
85
|
+
| arm | behaviour | nudges |
|
|
86
|
+
|---|---|---:|
|
|
87
|
+
| A | `write` a `.js`, verify nothing | **1** |
|
|
88
|
+
| B | `write` a `.js`, then `node --check` | 0 |
|
|
89
|
+
| C | `write` a `.mjs`, then `verify_exemption` | 0 |
|
|
90
|
+
|
|
91
|
+
The plugin loaded without restarting the host.
|
|
92
|
+
|
|
93
|
+
## Known limits
|
|
94
|
+
|
|
95
|
+
- **Direct `fs` writes inside PTC bypass tool dispatch** and are not seen. Only
|
|
96
|
+
`tools.write` / `tools.edit` inner calls are observed.
|
|
97
|
+
- **Single ledger.** `agent/pre-step` carries no agent identity, so concurrent agents
|
|
98
|
+
share one conservative judgement rather than a fake per-agent isolation.
|
|
99
|
+
- **Verification is a command regex.** A project-specific check script may be missed —
|
|
100
|
+
the failure direction is one extra reminder, never a false pass.
|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
dsh plugin --profile web add dsh-verify-gate # from npm
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or from a source checkout:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
dsh plugin --profile web add /absolute/path/to/dsh-verify-gate
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Test
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
node test/run.mjs # 11 ledger cases
|
|
118
|
+
node test/wiring.test.mjs # 8 wiring cases (fake host context)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`node --test` spawns a child per file; on a sandboxed host that fails with `EPERM`,
|
|
122
|
+
so these are plain in-process runners.
|
|
123
|
+
|
|
124
|
+
## Reproduce the evidence
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
node scripts/evidence.mjs # reads ~/.dsh/sessions/*.jsonl.zstd
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
package/README.zh.md
CHANGED
|
@@ -1,80 +1,103 @@
|
|
|
1
|
-
# dsh-verify-gate
|
|
2
|
-
|
|
3
|
-
**DeepSeek Harness(DSH)的完成闸门。**
|
|
4
|
-
一个 turn 里改过代码文件、却从头到尾没跑过任何检查时,它会在下一步提醒一次;
|
|
5
|
-
确实不需要检查时,可以申报豁免。
|
|
6
|
-
|
|
7
|
-
[English](README.md) · 简体中文
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 为什么有这个东西
|
|
12
|
-
|
|
13
|
-
在一台真实机器上实测,49 个会话 / 937 个 turn:
|
|
14
|
-
|
|
15
|
-
| 指标 | 数值 |
|
|
16
|
-
|---|---:|
|
|
17
|
-
| 改过**代码文件**的 turn | 394 |
|
|
18
|
-
| 其中一次测试/类型检查都没跑 | **355(90.1%)** |
|
|
19
|
-
|
|
20
|
-
这正是 Can Bölük《The Harness Problem》列的头号失败模式:
|
|
21
|
-
模型写完、读一遍、觉得没问题、收工。
|
|
22
|
-
|
|
23
|
-
DSH 自带安全审阅(`dsh-experimental-auto-review`)和循环提示,
|
|
24
|
-
但**完成边界**上没有任何守卫。这个插件补的就是这一块。
|
|
25
|
-
|
|
26
|
-
## 工作方式
|
|
27
|
-
|
|
28
|
-
三个接缝,全部取自 DSH `0.2.2-rc.5` 的 `@deepseek-ai/dsh-agent-loop/lib/index.js` 源码:
|
|
29
|
-
|
|
30
|
-
| 接缝 | 类型 | 作用 |
|
|
31
|
-
|---|---|---|
|
|
32
|
-
| `tools/execute` | waterfall `(exec, next)` | 观察调用;`exec.name` 与 `exec.arguments` |
|
|
33
|
-
| `agent/pre-step` | waterfall `(payload, next)` | **注入**提醒到 `decision.messages` |
|
|
34
|
-
| `agent/turn-stopping` | serial | 收尾结账、清空账本 |
|
|
35
|
-
|
|
36
|
-
> `turn/start` 与 `turn/end` 是 **session 记录**(`session.append(...)`),不是上下文事件。
|
|
37
|
-
> 监听它们永远不会触发——第一版探针就踩了这个坑。
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
##
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
node
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
# dsh-verify-gate
|
|
2
|
+
|
|
3
|
+
**DeepSeek Harness(DSH)的完成闸门。**
|
|
4
|
+
一个 turn 里改过代码文件、却从头到尾没跑过任何检查时,它会在下一步提醒一次;
|
|
5
|
+
确实不需要检查时,可以申报豁免。
|
|
6
|
+
|
|
7
|
+
[English](README.md) · 简体中文
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 为什么有这个东西
|
|
12
|
+
|
|
13
|
+
在一台真实机器上实测,49 个会话 / 937 个 turn:
|
|
14
|
+
|
|
15
|
+
| 指标 | 数值 |
|
|
16
|
+
|---|---:|
|
|
17
|
+
| 改过**代码文件**的 turn | 394 |
|
|
18
|
+
| 其中一次测试/类型检查都没跑 | **355(90.1%)** |
|
|
19
|
+
|
|
20
|
+
这正是 Can Bölük《The Harness Problem》列的头号失败模式:
|
|
21
|
+
模型写完、读一遍、觉得没问题、收工。
|
|
22
|
+
|
|
23
|
+
DSH 自带安全审阅(`dsh-experimental-auto-review`)和循环提示,
|
|
24
|
+
但**完成边界**上没有任何守卫。这个插件补的就是这一块。
|
|
25
|
+
|
|
26
|
+
## 工作方式
|
|
27
|
+
|
|
28
|
+
三个接缝,全部取自 DSH `0.2.2-rc.5` 的 `@deepseek-ai/dsh-agent-loop/lib/index.js` 源码:
|
|
29
|
+
|
|
30
|
+
| 接缝 | 类型 | 作用 |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `tools/execute` | waterfall `(exec, next)` | 观察调用;`exec.name` 与 `exec.arguments` |
|
|
33
|
+
| `agent/pre-step` | waterfall `(payload, next)` | **注入**提醒到 `decision.messages` |
|
|
34
|
+
| `agent/turn-stopping` | serial | 收尾结账、清空账本 |
|
|
35
|
+
|
|
36
|
+
> `turn/start` 与 `turn/end` 是 **session 记录**(`session.append(...)`),不是上下文事件。
|
|
37
|
+
> 监听它们永远不会触发——第一版探针就踩了这个坑。
|
|
38
|
+
|
|
39
|
+
> 注入的消息必须是 `user` 角色:`agent/pre-step` 里除 `runtime-context` 以外的消息,
|
|
40
|
+
> 宿主一律记成 `user/message` 会话事件,角色是 `system` 时写出来的日志在加载校验时会被拒
|
|
41
|
+
> (`... message must have role "user"`),整个会话从此打不开。提醒文本包在
|
|
42
|
+
> `<system-reminder>` 里,模型读到的仍是宿主提醒,不是用户发言。
|
|
43
|
+
|
|
44
|
+
## 修复已被 0.1.0 写坏的会话
|
|
45
|
+
|
|
46
|
+
0.1.0 可能在某条会话日志里留下一行无法加载的记录。升到 0.1.1+ 只止血,**不会修复已经坏掉的日志**:
|
|
47
|
+
在那一行被改写之前,该会话会一直打不开。包里带了修复脚本:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
node node_modules/dsh-verify-gate/scripts/repair-session.mjs # 预演,扫全部会话
|
|
51
|
+
node node_modules/dsh-verify-gate/scripts/repair-session.mjs --apply # 真正改写,自动备份
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
它找出 `user/message` 里装着 `system` 消息的行,改写成宿主自己会写的标准 `system/message`
|
|
55
|
+
事件(`turn`/`step` 取自前面最近的 `step/start`),只重压命中行所在的那一帧 zstd,改写前先
|
|
56
|
+
自检整份日志,原文件原地留一份 `session.v4.jsonl.zstd.orig-<时间戳>`,并把该会话的投影缓存
|
|
57
|
+
挪开让它重建。
|
|
58
|
+
|
|
59
|
+
**请在关闭 DSH 时运行**——它直接改盘上的会话文件。`--sessions-dir` 可指定别的根目录,
|
|
60
|
+
`--no-projcache` 表示不动缓存。
|
|
61
|
+
|
|
62
|
+
## 设计取舍
|
|
63
|
+
|
|
64
|
+
- **只警告,不阻断。** 阻断让每条任务都变慢;提醒只花一行。
|
|
65
|
+
- **只认代码后缀。** 改 `.md` / `.json` 不算,否则文档提交天天刷警告。
|
|
66
|
+
- **验证失败也算验证过。** 在乎的是模型抬头看了现实,不是现实一定说好。
|
|
67
|
+
- **留了豁免出口。** `verify_exemption(reason)`,理由少于 12 字符直接拒。
|
|
68
|
+
会乱叫的闸门只有一个下场:被卸载。
|
|
69
|
+
|
|
70
|
+
## 实测(DSH 0.2.2-rc.5)
|
|
71
|
+
|
|
72
|
+
| 组 | 行为 | 提醒次数 |
|
|
73
|
+
|---|---|---:|
|
|
74
|
+
| A | `write` 一个 `.js`,不做任何验证 | **1** |
|
|
75
|
+
| B | `write` 一个 `.js`,然后 `node --check` | 0 |
|
|
76
|
+
| C | `write` 一个 `.mjs`,然后调 `verify_exemption` | 0 |
|
|
77
|
+
|
|
78
|
+
插件**无需重启宿主**即被加载。
|
|
79
|
+
|
|
80
|
+
## 已知限制
|
|
81
|
+
|
|
82
|
+
- **PTC 里直接 `fs` 写盘绕过工具派发**,看不到。只观察 `tools.write` / `tools.edit` 的内层调用。
|
|
83
|
+
- **单账本。** `agent/pre-step` 的 payload 不含 agent 身份,并发代理共享一次保守判断,
|
|
84
|
+
而不是假装做了隔离。
|
|
85
|
+
- **“验证”靠命令正则。** 项目自定义检查脚本可能漏判——方向是多提醒一次,绝不误放过。
|
|
86
|
+
|
|
87
|
+
## 安装
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
dsh plugin --profile web add dsh-verify-gate # 从 npm 安装
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 测试与复现
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
node test/run.mjs # 11 项账本逻辑
|
|
97
|
+
node test/wiring.test.mjs # 8 项接线(伪宿主上下文)
|
|
98
|
+
node scripts/evidence.mjs # 复现 90.1% 那份统计
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 许可
|
|
102
|
+
|
|
103
|
+
MIT
|