@lmzhen/dsh-evolution-approval 0.32.4 → 0.32.5
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.md +9 -63
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,73 +1,19 @@
|
|
|
1
1
|
# @lmzhen/dsh-evolution-approval
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
one-shot; this service adds the Hermes staged queue: `request()` stores background writes,
|
|
5
|
-
`approve()` replays them through a runner, `reject()` discards them. The model-facing write tools
|
|
6
|
-
register their own runners (`tool-memory` via `registerRunner('memory', …)`, `tool-skill-manage`
|
|
7
|
-
via `registerRunner('skill', …)`), so staged writes are replayable only when the corresponding
|
|
8
|
-
tool package is composed. The pending window is also reachable from the browser half over four
|
|
9
|
-
loopback routes (§HTTP surface), so the settings panel can list, decide and PREVIEW staged writes
|
|
10
|
-
without the console command.
|
|
3
|
+
> 审批窗口:让记忆/技能写入等你批准。
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
## 你会看到
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
node node_modules/vitest/vitest.mjs run packages/evolution-approval/tests # overlay: packages/evolution/evolution-approval/tests
|
|
16
|
-
```
|
|
7
|
+
`/evolution pending`、`approve`、`reject`,以及设置页待批卡。
|
|
17
8
|
|
|
18
|
-
##
|
|
9
|
+
## 什么时候会用到
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
- **Prompt prefix / KV cache:** unchanged by this package: family-level rules single-sourced in `packages/README.md` §"Model-visible prompt prefix and the KV cache".
|
|
22
|
-
- **Mount it?** yes — the `evolution-approval` row, in `evolution-host`/`evolution-all`/one-click `evolution-preset` (`enabled: false` there).
|
|
11
|
+
你打开审批后,每次可暂存的写入。
|
|
23
12
|
|
|
24
|
-
##
|
|
13
|
+
## 默认 / 前提
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
- `stageForeground` (default `true`): stage foreground writes too.
|
|
15
|
+
默认关闭;打开后生效。
|
|
28
16
|
|
|
29
|
-
##
|
|
17
|
+
## 边界
|
|
30
18
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| route | what it does |
|
|
34
|
-
|---|---|
|
|
35
|
-
| `GET /api/dsh-evolution/approval/pending?status=` | the staged rows the settings card renders (id, kind, summary, staged-at, age) — never the staged `args` |
|
|
36
|
-
| `POST …/approve`, `POST …/reject` | forward to `approve(id)` / `reject(id)`; a refusal is HTTP 200 carrying the service's own sentence |
|
|
37
|
-
| `GET …/preview?id=` | what that write WOULD store, resolved read-only |
|
|
38
|
-
|
|
39
|
-
The fence is the family's shared loopback check (`evolution-core`'s `http-routes.ts`, one home for every
|
|
40
|
-
route surface), and every "cannot answer" path is a JSON body with a `code` and a `message` rather than an
|
|
41
|
-
empty response.
|
|
42
|
-
|
|
43
|
-
**Previews** come from the package that OWNS the replay: `registerRunner(kind, runner, preview?)` takes an
|
|
44
|
-
optional read-only companion that resolves the same `args` into `{path, before, after}`, and the route turns
|
|
45
|
-
that into the same diff facts the history panel's diff route uses (`textDiffFacts`). A kind without a
|
|
46
|
-
preview, or a resolver that cannot answer (a stale anchor, an operation with no byte-level change), answers
|
|
47
|
-
`{available: false, reason}` — the card prints that sentence instead of an empty diff.
|
|
48
|
-
|
|
49
|
-
## Known limitations
|
|
50
|
-
|
|
51
|
-
- **Freshness re-validation is per KIND:** a skill write carries `staged_from_sha256`, so its replay (and its
|
|
52
|
-
preview) refuses a target that changed after staging; kinds that carry no anchor replay the `args` snapshot
|
|
53
|
-
as-is. `/evolution pending --detail` shows what will be replayed.
|
|
54
|
-
- **A preview is a read, not a reservation:** it resolves the bytes on disk right now, so a target that
|
|
55
|
-
changes between the preview and the approve is refused by the replay's own anchor check rather than by the
|
|
56
|
-
preview that was shown.
|
|
57
|
-
- **Previews exist only where a resolver is registered** (`skill` today; `tool-skill-manage` supplies it). Every
|
|
58
|
-
other kind answers `{available: false, reason}`.
|
|
59
|
-
- `approve()` dedupes inside one process and providers resolve the record atomically, but the replay runner executes BEFORE that resolution: two OS processes approving one id can both write while one wins the audit transition. Run approvals from one writer process, or make runners idempotent.
|
|
60
|
-
- **Approve + reject on one id** are not serialized inside a process: a reject can resolve a still-executing record while the runner completes and the write still lands: verify the write state, or reject only when no approve is in flight.
|
|
61
|
-
|
|
62
|
-
- **The HTTP face is loopback-only by design.** The fence is the family's shared loopback check, authoritative on the socket (`X-Forwarded-For` is never trusted), so a deployment that opens the host to a LAN — where the platform's own `/api` answers normally — gets **403** on all four routes from any non-loopback client. Reach the host over loopback (a local browser, or an SSH tunnel). Whether the family should follow the platform's `trustedHosts` instead is an open decision (v46 `决策 3`; the mechanism lives in `evolution-core`'s `http-routes.ts`).
|
|
63
|
-
|
|
64
|
-
**Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
|
|
65
|
-
|
|
66
|
-
## Notes and history
|
|
67
|
-
|
|
68
|
-
- **The HTTP face + preview seam (G3, 2026-09-30).** The routes exist so a reader can act on the window
|
|
69
|
-
without the console; the preview is registered BESIDE the runner because a preview derived anywhere else
|
|
70
|
-
would drift from what the replay writes (the write path owns its own normalization).
|
|
71
|
-
|
|
72
|
-
- **Concurrent approve + reject on the same id (F-204).** Inside one process the dedupe keys are `approve:<id>` / `reject:<id>`, so the two paths are not serialized against each other. When an approve runner is slow, a reject resolves the still-executing record to `rejected` **without holding a claim**; the runner may then complete and the write can still land while the audit history reads `rejected`: the write effect, not the audit verdict, is what actually persists (`写效果以实际为准`). `reject` on an executing record reports this and asks you to verify the write state manually. Only reject a write after confirming no approve is in flight, or verify the write effect manually afterwards.
|
|
73
|
-
- **No freshness re-validation for kinds WITHOUT an anchor (F-328, corrected).** The staged record stores the `args` snapshot captured at request time and replays exactly those args. Kinds that carry no anchor — **`memory` today** — replay that snapshot as-is, so a target that changed after staging is not re-checked. A skill write is NOT in that class: it carries `staged_from_sha256`, so its replay and its preview refuse a changed target (the per-kind rule above). The pending surface (`/evolution pending --detail`) exposes the staged `args` so you can review what will actually be replayed before approving.
|
|
19
|
+
批准/拒绝是人工决定;`release` 不是批准。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-approval",
|
|
3
3
|
"description": "Stage/pending approval service for Hermes-style self-evolution writes (community build)",
|
|
4
|
-
"version": "0.32.
|
|
4
|
+
"version": "0.32.5",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.32.
|
|
30
|
+
"@lmzhen/dsh-evolution-core": "^0.32.5"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
34
|
-
"@lmzhen/dsh-evolution-core": "^0.32.
|
|
35
|
-
"@lmzhen/dsh-evolution-state": "^0.32.
|
|
36
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.32.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.32.5",
|
|
35
|
+
"@lmzhen/dsh-evolution-state": "^0.32.5",
|
|
36
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.32.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@lmzhen/dsh-evolution-core": "^0.32.
|
|
40
|
-
"@lmzhen/dsh-evolution-state": "^0.32.
|
|
41
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.32.
|
|
39
|
+
"@lmzhen/dsh-evolution-core": "^0.32.5",
|
|
40
|
+
"@lmzhen/dsh-evolution-state": "^0.32.5",
|
|
41
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.32.5"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"dsh": ">=0.2.1-rc.2 <0.2.2-0"
|