dsh-coding-enhanced 0.8.3 → 0.8.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/CHANGELOG.md +10 -0
- package/README.md +4 -2
- package/docs/review-prompts-and-chain.md +350 -0
- package/lib/client.js +23 -2
- package/lib/index.js +150 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.5
|
|
4
|
+
|
|
5
|
+
- Native `bash` is denied while Pre-review is on; shell commands go through
|
|
6
|
+
`review_bash`, which detects writes and asks for a second confirmation.
|
|
7
|
+
- Build/test artifacts (`dist`, `build`, `node_modules`, ...) are allowed;
|
|
8
|
+
writes to source are blocked.
|
|
9
|
+
- Audit changes at `turn/end` against the turn-start snapshot and warn about
|
|
10
|
+
files changed outside review.
|
|
11
|
+
- Update the review prompt to read / review tools / review_bash.
|
|
12
|
+
|
|
3
13
|
## 0.5.15
|
|
4
14
|
|
|
5
15
|
- Restore the native tool gate: while AI Change Review and the input-bar Auto
|
package/README.md
CHANGED
|
@@ -272,6 +272,7 @@ Open **Settings → Coding Enhanced** (the same controls appear on the plugin's
|
|
|
272
272
|
| **Automatic cleanup** | on | run `git gc` on shadow snapshots after pruning or withdrawing |
|
|
273
273
|
| **Clean up now** | — | prune extra snapshots and compact every shadow repository |
|
|
274
274
|
| **Updates** | — | check npm for the latest release and install it from the settings card; restart DSH after updating |
|
|
275
|
+
| **Review shell** | on | native `bash` is denied while Pre-review is on; commands go through `review_bash` (write detection + confirmation) |
|
|
275
276
|
|
|
276
277
|
Settings apply immediately and persist in `$DSH_HOME/coding-enhanced/settings.json`.
|
|
277
278
|
|
|
@@ -407,8 +408,9 @@ already covers the “beautiful diff panel” case. Next:
|
|
|
407
408
|
- **P4 — external AI adversarial cross-review**: review-scoped tokens,
|
|
408
409
|
participants, verdicts, proposals.
|
|
409
410
|
|
|
410
|
-
See [the architecture](docs/web-review-architecture.md)
|
|
411
|
-
survey](docs/prior-art.md).
|
|
411
|
+
See [the architecture](docs/web-review-architecture.md), [the prior-art
|
|
412
|
+
survey](docs/prior-art.md), and [the review contract](docs/review-prompts-and-chain.md)
|
|
413
|
+
for the exact prompts and the full chain.
|
|
412
414
|
|
|
413
415
|
## 🛠️ Development
|
|
414
416
|
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Review contract: prompts & chain
|
|
2
|
+
|
|
3
|
+
> Version: **0.8.5** · Date: 2026-11-22 · Source: `dsh-coding-enhanced`
|
|
4
|
+
>
|
|
5
|
+
> This document records the exact prompts, tool contracts and execution chain
|
|
6
|
+
> of the AI change-review workflow. It is intended as a reference for
|
|
7
|
+
> documentation and blog posts; the code is authoritative if the two differ.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Positioning
|
|
12
|
+
|
|
13
|
+
`dsh-coding-enhanced` is **not another AI PR reviewer**. It is a workflow layer
|
|
14
|
+
for DSH agents:
|
|
15
|
+
|
|
16
|
+
- **Pre-write change gate** — native file tools are refused while Pre-review is on;
|
|
17
|
+
the agent queues `review_write` / `review_patch`; nothing lands until the user
|
|
18
|
+
finishes.
|
|
19
|
+
- **Workspace time machine** — per-turn shadow-git snapshots and multi-turn withdraw.
|
|
20
|
+
- **Non-blocking review handoff** — the plugin starts a persistent waiter child;
|
|
21
|
+
the main agent continues or ends its turn and is woken when the review finishes.
|
|
22
|
+
- **Remote + cross-AI** — planned: passkey web review and an external cross-review API.
|
|
23
|
+
|
|
24
|
+
The direct prior art is [`9087/dsh-diff-approval`](https://github.com/9087/dsh-diff-approval)
|
|
25
|
+
(a post-edit review panel). The differentiator is the **gate + withdraw + handoff**,
|
|
26
|
+
not the diff pixels. See [`prior-art.md`](prior-art.md).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Architecture
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
┌──────────────────────────── DSH host ────────────────────────────┐
|
|
34
|
+
│ main agent (session) │
|
|
35
|
+
│ ├─ system prompt (the velvet rope) │
|
|
36
|
+
│ ├─ native tools: read / write / edit / ... │
|
|
37
|
+
│ └─ review tools: review_write / review_patch / review_wait │
|
|
38
|
+
│ │
|
|
39
|
+
│ plugin: coding-enhanced (host, lib/index.js) │
|
|
40
|
+
│ ├─ native gate: tools/pre-execute │
|
|
41
|
+
│ ├─ review state: entries / notes / decisions / waitKey │
|
|
42
|
+
│ ├─ per-file notes validation │
|
|
43
|
+
│ ├─ auto waiter: ensureReviewWaiter → ctx.subagents │
|
|
44
|
+
│ ├─ shadow-git snapshots / withdraw │
|
|
45
|
+
│ ├─ settings / updates / RPC /api/coding-enhanced │
|
|
46
|
+
│ └─ client bundle (lib/client.js) │
|
|
47
|
+
│ │
|
|
48
|
+
│ ctx.subagents (manager) │
|
|
49
|
+
│ ├─ spawn provider: a fresh child agent │
|
|
50
|
+
│ └─ fork provider: a child seeded with the parent conversation │
|
|
51
|
+
│ │
|
|
52
|
+
│ review waiter child (spawn) ── review_wait ──► review state │
|
|
53
|
+
│ │ │
|
|
54
|
+
│ └── completion message ──► main agent wakes │
|
|
55
|
+
│ │
|
|
56
|
+
│ client │
|
|
57
|
+
│ ├─ input Review tools: Pre-review / AI explanations │
|
|
58
|
+
│ ├─ Code review tab: diff / AI rows / decisions / Finish │
|
|
59
|
+
│ └─ Settings / plugin page: Updates / About │
|
|
60
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Components
|
|
64
|
+
|
|
65
|
+
| Layer | File | Responsibility |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| Host | `lib/index.js` | system prompt, tools, gate, review state, validation, waiter, settings, snapshots, RPC |
|
|
68
|
+
| Client | `lib/client.js` | Review tools popover, review tab, settings, plugin page, diff and AI rows |
|
|
69
|
+
| DSH | `ctx.tools`, `ctx.subagents`, `ctx.sessions` | tool registry, subagent manager, sessions |
|
|
70
|
+
| Bridge | `/api/coding-enhanced` | authenticated RPC between client and host |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 3. The prompts
|
|
75
|
+
|
|
76
|
+
### 3.1 System prompt (injected every turn while the gate is on)
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change.
|
|
80
|
+
Queue every change with review_write (new file / full file) or review_patch
|
|
81
|
+
(unified diff) and include at least one note per changed file while AI
|
|
82
|
+
explanations are on; add line-level notes for user-requested, key or
|
|
83
|
+
hard-to-understand changes (no upper limit). Do not use write/edit/apply_patch/
|
|
84
|
+
str_replace_editor. The plugin starts or reuses the review waiter automatically:
|
|
85
|
+
after queueing, just continue or end the turn; never call review_wait and do
|
|
86
|
+
not manage a subagent. If a file is rejected, read the comment and revise.
|
|
87
|
+
This is house rules. 💅
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3.2 `review_write`
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Queue a new file or a full-file rewrite for the user's review. This does not
|
|
94
|
+
write the file: the change is held in the Code review tab until the user
|
|
95
|
+
finishes. Use review_patch for edits to existing files. At least one notes
|
|
96
|
+
entry per changed file is required while AI explanations are on; prefer
|
|
97
|
+
line-level notes (line/hunk) for user-requested, key or hard-to-understand
|
|
98
|
+
changes. Each note is 1-2 sentences explaining why. The plugin starts or
|
|
99
|
+
reuses the review waiter automatically; just queue and continue, and never
|
|
100
|
+
call review_wait from the main agent.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3.3 `review_patch`
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
Queue a unified diff for the user's review. The patch must use ---/+++ headers
|
|
107
|
+
and @@ hunks with paths relative to the working directory; a/ and b/ prefixes
|
|
108
|
+
and diff --git headers are accepted. Use one patch per file when possible;
|
|
109
|
+
multiple files are allowed. This does not modify the workspace: the change is
|
|
110
|
+
held in the Code review tab until the user finishes. At least one notes entry
|
|
111
|
+
per changed file is required while AI explanations are on; prefer line-level
|
|
112
|
+
notes (line/hunk) for user-requested, key or hard-to-understand changes. Each
|
|
113
|
+
note is 1-2 sentences explaining why. The plugin starts or reuses the review
|
|
114
|
+
waiter automatically; just queue and continue, and never call review_wait
|
|
115
|
+
from the main agent.
|
|
116
|
+
|
|
117
|
+
Example:
|
|
118
|
+
--- a/src/app.ts
|
|
119
|
+
+++ b/src/app.ts
|
|
120
|
+
@@ -10,7 +10,9 @@
|
|
121
|
+
const app = createApp()
|
|
122
|
+
- app.use(oldRouter)
|
|
123
|
+
+ app.use(newRouter)
|
|
124
|
+
+ app.use(logger)
|
|
125
|
+
app.listen(3000)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 3.4 `review_wait`
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Wait for a review. Only a review waiter subagent should call this: pass the
|
|
132
|
+
reviewId and waitKey from review_write/review_patch. The main agent must not
|
|
133
|
+
call it; if it does, the call is refused so the turn never blocks. Returns one
|
|
134
|
+
structured result per file: applied, rejected (with the user's comment),
|
|
135
|
+
edited, or failed.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 3.5 Native gate denial
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
File changes must go through the review gate while Pre-review is on. Use
|
|
142
|
+
review_write (new file / full file) or review_patch (unified diff) with at
|
|
143
|
+
least one note per changed file; the plugin starts or reuses the review waiter
|
|
144
|
+
automatically; just continue. Never call review_wait from the main agent.
|
|
145
|
+
Shell commands are outside the review.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3.6 Per-file validation errors
|
|
149
|
+
|
|
150
|
+
Multi-file patch:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
AI explanations are on: add at least one note for each changed file.
|
|
154
|
+
Missing: <file1>, <file2>.
|
|
155
|
+
Turn off AI explanations in the input bar to queue without notes.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Single-file write:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
AI explanations are on: add at least one note for this file. Use line-level
|
|
162
|
+
notes for user-requested, key or hard-to-understand changes. Turn off AI
|
|
163
|
+
explanations in the input bar to queue without notes.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 3.7 UI strings (0.8.4)
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
AI explanations
|
|
170
|
+
Require at least one note per changed file. Off: queue changes without notes.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
AI 解释
|
|
175
|
+
每个改动文件至少一条说明。关闭后排队不再要求解释。
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 4. The chain
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
[input Review tools]
|
|
184
|
+
AI explanations toggle
|
|
185
|
+
│ setSettings({ aiExplain })
|
|
186
|
+
▼
|
|
187
|
+
[plugin host featureFlags]
|
|
188
|
+
│ system prompt + tool descriptions
|
|
189
|
+
▼
|
|
190
|
+
[main AI]
|
|
191
|
+
review_write / review_patch (notes)
|
|
192
|
+
│
|
|
193
|
+
▼
|
|
194
|
+
[host validation]
|
|
195
|
+
aiExplain on?
|
|
196
|
+
every changed file covered?
|
|
197
|
+
│
|
|
198
|
+
▼
|
|
199
|
+
[review state]
|
|
200
|
+
entries / notes / decisions / waitKey
|
|
201
|
+
│
|
|
202
|
+
├──────────────► [Code review tab]
|
|
203
|
+
│ diff + AI rows
|
|
204
|
+
│ Approve / Reject / Edit / Finish
|
|
205
|
+
│ │
|
|
206
|
+
│ ▼
|
|
207
|
+
│ host applies files
|
|
208
|
+
│
|
|
209
|
+
└──────────────► [ensureReviewWaiter]
|
|
210
|
+
scoped subagent tool → spawn child
|
|
211
|
+
child: review_wait(reviewId, waitKey)
|
|
212
|
+
│
|
|
213
|
+
▼
|
|
214
|
+
review finishes
|
|
215
|
+
│
|
|
216
|
+
▼
|
|
217
|
+
child returns per-file results
|
|
218
|
+
│
|
|
219
|
+
▼
|
|
220
|
+
parent completion → main agent wakes
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Steps
|
|
224
|
+
|
|
225
|
+
1. The user toggles **AI explanations** in the input bar; the client calls
|
|
226
|
+
`setSettings({ aiExplain })`; the host stores `featureFlags.aiExplain`.
|
|
227
|
+
2. The host injects the system prompt and the tool descriptions on the next turn.
|
|
228
|
+
3. The main agent calls `review_write` / `review_patch` with notes.
|
|
229
|
+
4. The host validates: when `aiExplain` is on, every changed file needs at least
|
|
230
|
+
one non-empty note; a multi-file patch names the missing files and refuses.
|
|
231
|
+
5. The change is staged in the review state; nothing is written to disk.
|
|
232
|
+
6. `ensureReviewWaiter` starts a waiter child through the agent-scoped
|
|
233
|
+
`subagent` tool (spawn), or reuses the persistent child with `sendMessage`.
|
|
234
|
+
7. The child calls `review_wait` with the reviewId and waitKey.
|
|
235
|
+
8. The user reviews in the Code review tab; **Finish** applies the files.
|
|
236
|
+
9. The child's `review_wait` returns the per-file outcomes; the child reports to
|
|
237
|
+
its parent; the main agent's next turn receives the result.
|
|
238
|
+
10. The next review reuses the same child; one persistent waiter per conversation.
|
|
239
|
+
|
|
240
|
+
### Endpoints and slots
|
|
241
|
+
|
|
242
|
+
- RPC: `POST /api/coding-enhanced` with `{ endpoint, payload }`
|
|
243
|
+
- Client slots: `conversation.input.right` (Review tools),
|
|
244
|
+
`conversation.chat.assistant-actions` (withdraw), review tab type,
|
|
245
|
+
`settings.section`, `plugins.bundle.config`.
|
|
246
|
+
- Host services: `tools`, `subagents`, `sessions`, `connection`, `systemPrompt`.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 5. Subagent design
|
|
251
|
+
|
|
252
|
+
### 5.1 spawn vs fork
|
|
253
|
+
|
|
254
|
+
| | spawn | fork |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| Tool | `subagent` | `subagent_fork` |
|
|
257
|
+
| Provider | `spawn` | `fork` |
|
|
258
|
+
| Child context | fresh; only the prompt | inherited completed conversation |
|
|
259
|
+
| Project understanding | needs a brief / reads files | has the conversation |
|
|
260
|
+
| Token cost | prompt + brief + output | inherited prefix (provider cache) + output |
|
|
261
|
+
| Isolation | high | lower |
|
|
262
|
+
| Use | review waiter; independent tasks | project-aware explanation; follow-ups |
|
|
263
|
+
|
|
264
|
+
### 5.2 What the waiter uses
|
|
265
|
+
|
|
266
|
+
**spawn.** The waiter only needs `reviewId` / `waitKey` and `review_wait`;
|
|
267
|
+
it does not need project detail. The child is persistent: the host stores
|
|
268
|
+
`reviewWaiters[sessionId]` and reuses it with `sendMessage`.
|
|
269
|
+
|
|
270
|
+
### 5.3 Why the parent explains, not a comment subagent
|
|
271
|
+
|
|
272
|
+
An earlier option (“Line AI B”) used a dedicated comment subagent. It was
|
|
273
|
+
dropped:
|
|
274
|
+
|
|
275
|
+
- the parent already has the full project and user intent;
|
|
276
|
+
- a fresh comment child needs a brief and still risks missing context;
|
|
277
|
+
- the parent's notes cost less than a second child context;
|
|
278
|
+
- the waiter child stays a pure `review_wait` observer.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 6. Design decisions
|
|
283
|
+
|
|
284
|
+
- **The model writes; the host enforces.** Notes are required at the tool
|
|
285
|
+
boundary, not only in a prompt.
|
|
286
|
+
- **One explanation per changed file is the floor**, not the ceiling. Line-level
|
|
287
|
+
notes are recommended for user-requested, key or hard-to-understand changes.
|
|
288
|
+
- **No upper limit** on notes; the reviewer can ask for more.
|
|
289
|
+
- **The main agent cannot block.** `review_wait` is refused for the owner
|
|
290
|
+
session; only a child may wait.
|
|
291
|
+
- **One persistent waiter per conversation**, reused with `sendMessage`.
|
|
292
|
+
- **The gate covers native file tools**; shell writes are documented as outside
|
|
293
|
+
the review.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 7. Caveats
|
|
298
|
+
|
|
299
|
+
- Shell commands can still write files outside the gate; a post-turn warning is
|
|
300
|
+
planned.
|
|
301
|
+
- The auto waiter uses the agent-scoped `subagent` tool; if the provider is
|
|
302
|
+
unavailable it falls back to a direct `spawn` activation, then to a manual
|
|
303
|
+
`review_wait` fallback.
|
|
304
|
+
- npm publishing uses Trusted Publishing (OIDC); the registry CDN may lag a few
|
|
305
|
+
minutes after the workflow succeeds.
|
|
306
|
+
- The review contract is versioned with the plugin; this document describes
|
|
307
|
+
0.8.5.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 7.1 Shell gate (0.8.5)
|
|
312
|
+
|
|
313
|
+
Native `bash` is denied while Pre-review is on. All commands go through the
|
|
314
|
+
plugin tool `review_bash`:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
review_bash({ command, confirmed?, cwd? })
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
- First call: write detection only, no execution. Returns the reasons and a
|
|
321
|
+
self-check prompt.
|
|
322
|
+
- The agent self-checks whether the command creates/modifies/deletes files.
|
|
323
|
+
- If it writes source: use `review_write` / `review_patch`.
|
|
324
|
+
- If it writes nothing: call again with `confirmed: true`.
|
|
325
|
+
- Second call: re-detect, then run `/bin/sh -c` with the session cwd.
|
|
326
|
+
|
|
327
|
+
Write detection covers shell redirection, `tee`, `sed -i`, `perl -i`,
|
|
328
|
+
`cp/mv/rm/rmdir/mkdir/touch/ln/chmod`, `git apply`, `patch`, dependency
|
|
329
|
+
installs, and inline Python/Node writes. Writes under `dist`, `build`, `out`,
|
|
330
|
+
`target`, `node_modules`, `.next`, `.cache`, `coverage`, `.vitest`,
|
|
331
|
+
`__pycache__`, `.pytest_cache`, `.turbo` are build/test artifacts and pass.
|
|
332
|
+
|
|
333
|
+
### Post-turn audit
|
|
334
|
+
|
|
335
|
+
At `turn/end` the host diffs the turn-start snapshot against the current
|
|
336
|
+
workspace, subtracts reviewed paths and artifact paths, and stores the
|
|
337
|
+
remaining files as `audits[sessionId].outside`. The review tab shows a warning
|
|
338
|
+
listing them; the user can withdraw the turn or accept. The audit is a
|
|
339
|
+
backstop for writes the shell detection missed; it does not auto-revert.
|
|
340
|
+
|
|
341
|
+
## 8. Version history (review workflow)
|
|
342
|
+
|
|
343
|
+
| Version | Change |
|
|
344
|
+
|---|---|
|
|
345
|
+
| 0.6.0 | Non-blocking review waiter; per-file decisions |
|
|
346
|
+
| 0.7.0 | Gate coverage for `str_replace_editor` / `multi_edit` / `notebook_edit`; main `review_wait` refused; notes required; AI explanations toggle; wrap all rows |
|
|
347
|
+
| 0.8.0–0.8.2 | Plugin-owned persistent waiter via `ctx.subagents` (agent-scoped tool, `spawn`) |
|
|
348
|
+
| 0.8.3 | Parent-written explanations; per-file notes validation; comment subagent dropped |
|
|
349
|
+
| 0.8.4 | Copy fixes; this document |
|
|
350
|
+
| 0.8.5 | Native bash denied; `review_bash` with two-step confirmation and write detection; post-turn audit; read/edit/run prompt |
|
package/lib/client.js
CHANGED
|
@@ -41,7 +41,7 @@ window.__ModuleLoader__.load({
|
|
|
41
41
|
reviewTools: 'Review tools',
|
|
42
42
|
autoReview: 'Pre-review',
|
|
43
43
|
aiExplain: 'AI explanations',
|
|
44
|
-
aiExplainDesc: 'Require
|
|
44
|
+
aiExplainDesc: 'Require at least one note per changed file. Off: queue changes without notes.',
|
|
45
45
|
autoReviewDesc: 'The agent must queue every edit with review_write / review_patch before it lands. Off: native write/edit.',
|
|
46
46
|
reviewFeatureOff: 'AI Change Review is off in Settings. Enable it first, then use this switch.',
|
|
47
47
|
reviewOn: 'On',
|
|
@@ -123,6 +123,8 @@ window.__ModuleLoader__.load({
|
|
|
123
123
|
settingsAboutTitle: 'Coding Enhanced',
|
|
124
124
|
settingsAboutDesc: 'The DSH change gate: pre-write review, multi-turn withdraw, and a non-blocking review handoff. The full README lives on the plugin page and in the repository.',
|
|
125
125
|
settingsReadme: 'Open the full README',
|
|
126
|
+
auditTitle: 'Changed outside review',
|
|
127
|
+
auditDesc: 'Files changed outside review: {files}. Withdraw the turn or accept the change.',
|
|
126
128
|
settingsUpdates: 'Plugin updates',
|
|
127
129
|
settingsUpdatesDesc: 'Check npm for the latest release and install it from here.',
|
|
128
130
|
settingsCurrentVersion: 'Current version',
|
|
@@ -153,7 +155,7 @@ window.__ModuleLoader__.load({
|
|
|
153
155
|
reviewTools: 'Review 工具',
|
|
154
156
|
autoReview: 'AI 改动预审查',
|
|
155
157
|
aiExplain: 'AI 解释',
|
|
156
|
-
aiExplainDesc: '
|
|
158
|
+
aiExplainDesc: '每个改动文件至少一条说明。关闭后排队不再要求解释。',
|
|
157
159
|
autoReviewDesc: 'AI 的每次改动都必须先进入 review(review_write / review_patch)才能落盘。关闭后走原生 write/edit。',
|
|
158
160
|
reviewFeatureOff: '设置里的 AI Change Review 处于关闭状态,先启用后再用这个开关。',
|
|
159
161
|
reviewOn: '开',
|
|
@@ -234,6 +236,8 @@ window.__ModuleLoader__.load({
|
|
|
234
236
|
settingsAboutTitle: 'Coding Enhanced',
|
|
235
237
|
settingsAboutDesc: 'DSH 变更闸门:写入前审查、多轮回退、非阻塞 review 交接。完整 README 在插件页和仓库里。',
|
|
236
238
|
settingsReadme: '打开完整 README',
|
|
239
|
+
auditTitle: 'review 外改动',
|
|
240
|
+
auditDesc: '以下文件在 review 外被修改:{files}。可撤回这一轮或接受改动。',
|
|
237
241
|
settingsUpdates: '插件更新',
|
|
238
242
|
settingsUpdatesDesc: '检查 npm 最新版本,并在这里安装。',
|
|
239
243
|
settingsCurrentVersion: '当前版本',
|
|
@@ -334,6 +338,9 @@ window.__ModuleLoader__.load({
|
|
|
334
338
|
.wr-diff-resize{flex:none;height:.75em;min-height:10px;cursor:ns-resize;background:linear-gradient(to bottom,transparent,color-mix(in srgb,var(--dsw-alias-border-l1,rgba(0,0,0,.08)) 60%,transparent));position:relative}
|
|
335
339
|
.wr-diff-resize::after{content:'';position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:2.4em;height:.25em;border-radius:999px;background:var(--dsw-alias-border-l3,rgba(0,0,0,.18))}
|
|
336
340
|
.wr-diff-resize:hover{background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#4d6bfe) 12%,transparent)}
|
|
341
|
+
.wr-audit{margin:.55em .7em .2em;padding:.55em .7em;border-radius:.5em;border:1px solid color-mix(in srgb,var(--dsw-alias-state-warn-primary,#9a6700) 35%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#9a6700) 8%,transparent);font-size:.82em;line-height:1.5}
|
|
342
|
+
.wr-audit-title{font-weight:600;color:var(--dsw-alias-state-warn-primary,#9a6700)}
|
|
343
|
+
.wr-audit-desc{margin-top:.2em;color:var(--dsw-alias-label-secondary,#555);white-space:pre-wrap;overflow-wrap:anywhere}
|
|
337
344
|
.wr-ai-line{background:linear-gradient(90deg,rgba(124,58,237,.10),rgba(217,70,239,.07) 55%,rgba(34,211,238,.05));box-shadow:inset 2px 0 0 #a855f7;cursor:help}
|
|
338
345
|
.wr-ai-line:hover{background:linear-gradient(90deg,rgba(124,58,237,.15),rgba(217,70,239,.10) 55%,rgba(34,211,238,.07))}
|
|
339
346
|
.wr-ai-line .wr-no{background:rgba(168,85,247,.10);color:transparent}
|
|
@@ -858,6 +865,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
858
865
|
const feed = {
|
|
859
866
|
version: -1,
|
|
860
867
|
reviews: [],
|
|
868
|
+
audits: {},
|
|
861
869
|
loaded: false,
|
|
862
870
|
error: null,
|
|
863
871
|
listeners: new Set(),
|
|
@@ -889,6 +897,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
889
897
|
}
|
|
890
898
|
feed.version = result.value.version
|
|
891
899
|
feed.reviews = result.value.reviews ?? []
|
|
900
|
+
feed.audits = result.value.audits ?? {}
|
|
892
901
|
feed.error = null
|
|
893
902
|
feed.loaded = true
|
|
894
903
|
feedNotify()
|
|
@@ -964,6 +973,8 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
964
973
|
const state = useReviews()
|
|
965
974
|
const tabs = useOpenTabs()
|
|
966
975
|
const review = pendingReview(state.reviews)
|
|
976
|
+
const audit = state.audits?.[sessionId]
|
|
977
|
+
const auditOutside = Array.isArray(audit?.outside) ? audit.outside : []
|
|
967
978
|
const opened = React.useRef(null)
|
|
968
979
|
const tabOpen = tabs.some((tab) => tab.kind === REVIEW_KIND && tab.sessionId === sessionId)
|
|
969
980
|
|
|
@@ -1004,6 +1015,8 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1004
1015
|
const { tab } = useTabInfo()
|
|
1005
1016
|
const state = useReviews()
|
|
1006
1017
|
const review = pendingReview(state.reviews)
|
|
1018
|
+
const audit = state.audits?.[sessionId]
|
|
1019
|
+
const auditOutside = Array.isArray(audit?.outside) ? audit.outside : []
|
|
1007
1020
|
const [local, setLocal] = React.useState({})
|
|
1008
1021
|
const [submitting, setSubmitting] = React.useState(false)
|
|
1009
1022
|
const [error, setError] = React.useState(null)
|
|
@@ -1377,6 +1390,14 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1377
1390
|
: `${review.entries.length} files`,
|
|
1378
1391
|
),
|
|
1379
1392
|
),
|
|
1393
|
+
auditOutside.length > 0
|
|
1394
|
+
? React.createElement(
|
|
1395
|
+
'div',
|
|
1396
|
+
{ className: 'wr-audit' },
|
|
1397
|
+
React.createElement('div', { className: 'wr-audit-title' }, typeof t === 'function' ? t('auditTitle') : 'Changed outside review'),
|
|
1398
|
+
React.createElement('div', { className: 'wr-audit-desc' }, typeof t === 'function' ? t('auditDesc', { files: auditOutside.join(', ') }) : `Files changed outside review: ${auditOutside.join(', ')}`),
|
|
1399
|
+
)
|
|
1400
|
+
: null,
|
|
1380
1401
|
!submitted
|
|
1381
1402
|
? React.createElement('div', { className: 'wr-collecting' }, typeof t === 'function' ? t('collecting') : 'Waiting for the agent to submit.')
|
|
1382
1403
|
: null,
|
package/lib/index.js
CHANGED
|
@@ -867,11 +867,47 @@ export function apply(ctx) {
|
|
|
867
867
|
|
|
868
868
|
// ------------------------------------------------------- review gate ---
|
|
869
869
|
const REVIEW_TOOLS = new Set(['write', 'edit', 'apply_patch', 'str_replace_editor', 'multi_edit', 'notebook_edit'])
|
|
870
|
+
const ARTIFACT_DIRS = ['dist', 'build', 'out', 'target', 'node_modules', '.next', '.cache', 'coverage', '.vitest', '__pycache__', '.pytest_cache', '.turbo', '.parcel-cache']
|
|
871
|
+
const isArtifactPath = (value) => {
|
|
872
|
+
const cleaned = String(value).replace(/^['"]|['"]$/g, '').replace(/^\.\//, '')
|
|
873
|
+
if (cleaned === '/dev/null' || cleaned.startsWith('/tmp/') || cleaned === '/tmp') return true
|
|
874
|
+
return ARTIFACT_DIRS.some((dir) => cleaned === dir || cleaned.startsWith(`${dir}/`) || cleaned.includes(`/${dir}/`))
|
|
875
|
+
}
|
|
876
|
+
const detectShellWrites = (command) => {
|
|
877
|
+
const reasons = []
|
|
878
|
+
const targets = []
|
|
879
|
+
const add = (reason, target) => {
|
|
880
|
+
reasons.push(reason)
|
|
881
|
+
if (typeof target === 'string' && target !== '') targets.push(target)
|
|
882
|
+
}
|
|
883
|
+
for (const match of command.matchAll(/(?:^|[^>])>{1,2}\s*([^\s;&|]+)/g)) add('shell redirection', match[1])
|
|
884
|
+
const tee = /\btee\s+(?:-[A-Za-z]+\s+)*([^\s;&|]+)/.exec(command)
|
|
885
|
+
if (tee !== null) add('tee', tee[1])
|
|
886
|
+
const sed = /\bsed\s+(?:[^;&|]*\s)?-i(?:\.\w+)?\s+([^\s;&|]+)/.exec(command)
|
|
887
|
+
if (sed !== null) add('in-place edit', sed[1])
|
|
888
|
+
const perl = /\bperl\s+-i\s+([^\s;&|]+)/.exec(command)
|
|
889
|
+
if (perl !== null) add('in-place edit', perl[1])
|
|
890
|
+
for (const op of ['cp', 'mv', 'rm', 'rmdir', 'mkdir', 'touch', 'ln', 'chmod']) {
|
|
891
|
+
const match = new RegExp(`\\b${op}\\b([^;&|]*)`).exec(command)
|
|
892
|
+
if (match === null) continue
|
|
893
|
+
const args = match[1].split(/\s+/).filter((part) => part !== '' && !part.startsWith('-') && !part.includes('='))
|
|
894
|
+
add(op, args.length > 0 ? args[args.length - 1] : undefined)
|
|
895
|
+
}
|
|
896
|
+
if (/\bgit\s+apply\b/.test(command)) add('git apply')
|
|
897
|
+
if (/\bpatch\b/.test(command)) add('patch')
|
|
898
|
+
if (/\b(npm\s+(install|ci)|pnpm\s+add|yarn\s+add)\b/.test(command)) add('dependency install')
|
|
899
|
+
if (/\b(python3?|node)\b/.test(command) && /\b(open|writeFileSync|writeFile|write_text|to_csv|savefig|fs\.write)/.test(command)) add('inline write')
|
|
900
|
+
const sourceTargets = targets.filter((target) => !isArtifactPath(target))
|
|
901
|
+
const blocked = reasons.length > 0 && (sourceTargets.length > 0 || targets.length < reasons.length)
|
|
902
|
+
return { blocked, reasons, targets }
|
|
903
|
+
}
|
|
904
|
+
|
|
870
905
|
const MAX_REVIEW_FILE_BYTES = 2 * 1024 * 1024
|
|
871
906
|
const MAX_EDITABLE_BYTES = 200 * 1024
|
|
872
907
|
/** sessionId -> review { id, sessionId, entries, virtual, submitted, finished, canceled, waiters } */
|
|
873
908
|
const reviews = new Map()
|
|
874
909
|
const reviewWaiters = new Map()
|
|
910
|
+
const audits = new Map()
|
|
875
911
|
let reviewVersion = 0
|
|
876
912
|
|
|
877
913
|
const bumpReview = () => {
|
|
@@ -1445,7 +1481,7 @@ export function apply(ctx) {
|
|
|
1445
1481
|
|
|
1446
1482
|
ctx.tools.register(defineTool({
|
|
1447
1483
|
name: 'review_patch',
|
|
1448
|
-
description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes. At least one notes entry per changed file is required while AI explanations are on; prefer line-level notes (line/hunk) for user-requested, key or hard-to-understand changes. Each note is 1-2 sentences explaining why. The plugin starts or reuses the review waiter automatically; just queue and continue, and never call review_wait from the main agent. Example:\n--- a/src/app.ts\n+++ b/src/app.ts\n@@ -10,7 +10,9 @@\n const app = createApp()\n- app.use(oldRouter)\n+ app.use(newRouter)\n+ app.use(logger)\n app.listen(3000)
|
|
1484
|
+
description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes. At least one notes entry per changed file is required while AI explanations are on; prefer line-level notes (line/hunk) for user-requested, key or hard-to-understand changes. Each note is 1-2 sentences explaining why. The plugin starts or reuses the review waiter automatically; just queue and continue, and never call review_wait from the main agent. Example:\n--- a/src/app.ts\n+++ b/src/app.ts\n@@ -10,7 +10,9 @@\n const app = createApp()\n- app.use(oldRouter)\n+ app.use(newRouter)\n+ app.use(logger)\n app.listen(3000)',
|
|
1449
1485
|
parameters: {
|
|
1450
1486
|
patch: { type: 'string', required: true, description: 'A unified diff (---/+++/@@) to queue for review.' },
|
|
1451
1487
|
notes: {
|
|
@@ -1537,15 +1573,95 @@ export function apply(ctx) {
|
|
|
1537
1573
|
}), { when: () => featureFlags.review === true && featureFlags.autoReview === true })
|
|
1538
1574
|
}
|
|
1539
1575
|
|
|
1576
|
+
const execShell = (command, cwd) => new Promise((resolve) => {
|
|
1577
|
+
execFile('/bin/sh', ['-c', command], { cwd, timeout: 120000, maxBuffer: 8 * 1024 * 1024, env: process.env }, (error, stdout, stderr) => {
|
|
1578
|
+
resolve({ code: error === null ? 0 : (typeof error.code === 'number' ? error.code : 1), stdout: String(stdout ?? ''), stderr: String(stderr ?? '') })
|
|
1579
|
+
})
|
|
1580
|
+
})
|
|
1581
|
+
|
|
1582
|
+
const registerBashTool = () => {
|
|
1583
|
+
ctx.tools.register(defineTool({
|
|
1584
|
+
name: 'review_bash',
|
|
1585
|
+
description: 'Run a shell command for inspection or tests. The first call does not execute: it returns the write-detection result and asks you to self-check whether the command creates, modifies or deletes files. If it does, use review_write / review_patch instead. If it does not, call again with confirmed:true. The second call re-checks, then runs /bin/sh -c. Build/test artifacts under dist, build, node_modules and similar directories are allowed; writes to source are blocked.',
|
|
1586
|
+
parameters: {
|
|
1587
|
+
command: { type: 'string', required: true, description: 'Shell command to run.' },
|
|
1588
|
+
confirmed: { type: 'boolean', description: 'Set true only after you have checked that the command does not create, modify or delete source files.' },
|
|
1589
|
+
cwd: { type: 'string', description: 'Optional working directory; defaults to the session workspace.' },
|
|
1590
|
+
},
|
|
1591
|
+
output: {
|
|
1592
|
+
schema: {
|
|
1593
|
+
type: 'object',
|
|
1594
|
+
additionalProperties: false,
|
|
1595
|
+
properties: {
|
|
1596
|
+
status: { type: 'string' },
|
|
1597
|
+
command: { type: 'string' },
|
|
1598
|
+
writes: { type: 'boolean' },
|
|
1599
|
+
reasons: { type: 'array', items: { type: 'string' } },
|
|
1600
|
+
exitCode: { type: 'integer' },
|
|
1601
|
+
stdout: { type: 'string' },
|
|
1602
|
+
stderr: { type: 'string' },
|
|
1603
|
+
message: { type: 'string' },
|
|
1604
|
+
},
|
|
1605
|
+
},
|
|
1606
|
+
render: (_args, value) => [{ type: 'text', text: JSON.stringify(value, null, 2) }],
|
|
1607
|
+
},
|
|
1608
|
+
async execute(args, exec) {
|
|
1609
|
+
const session = exec.agent?.session
|
|
1610
|
+
if (session === undefined) return { status: 'error', command: '', writes: false, message: 'No active session.' }
|
|
1611
|
+
const command = typeof args?.command === 'string' ? args.command : ''
|
|
1612
|
+
if (command.trim() === '') return { status: 'error', command, writes: false, message: 'command is required.' }
|
|
1613
|
+
const base = typeof session.header?.cwd === 'string' && session.header.cwd !== '' ? session.header.cwd : process.cwd()
|
|
1614
|
+
const cwd = typeof args?.cwd === 'string' && args.cwd !== '' ? path.resolve(base, args.cwd) : base
|
|
1615
|
+
const detection = detectShellWrites(command)
|
|
1616
|
+
if (args?.confirmed !== true) {
|
|
1617
|
+
return {
|
|
1618
|
+
status: 'confirm',
|
|
1619
|
+
command,
|
|
1620
|
+
writes: detection.blocked,
|
|
1621
|
+
reasons: detection.reasons,
|
|
1622
|
+
message: detection.blocked
|
|
1623
|
+
? 'This command appears to write source files. Use review_write / review_patch for file changes.'
|
|
1624
|
+
: 'Self-check: does this command create, modify or delete files? If yes, use review_write / review_patch. If no, call review_bash again with confirmed:true.',
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
if (detection.blocked === true) {
|
|
1628
|
+
return {
|
|
1629
|
+
status: 'blocked',
|
|
1630
|
+
command,
|
|
1631
|
+
writes: true,
|
|
1632
|
+
reasons: detection.reasons,
|
|
1633
|
+
message: 'Write detection blocked this command. Use review_write / review_patch for file changes.',
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
const result = await execShell(command, cwd)
|
|
1637
|
+
return {
|
|
1638
|
+
status: result.code === 0 ? 'ok' : 'error',
|
|
1639
|
+
command,
|
|
1640
|
+
writes: false,
|
|
1641
|
+
reasons: detection.reasons,
|
|
1642
|
+
exitCode: result.code,
|
|
1643
|
+
stdout: result.stdout,
|
|
1644
|
+
stderr: result.stderr,
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
}), { when: () => featureFlags.review === true && featureFlags.autoReview === true })
|
|
1648
|
+
}
|
|
1540
1649
|
|
|
1541
1650
|
registerReviewTools()
|
|
1651
|
+
registerBashTool()
|
|
1542
1652
|
|
|
1543
1653
|
const nativeGate = async (exec, next) => {
|
|
1544
1654
|
if (featureFlags.review !== true || featureFlags.autoReview !== true) return next()
|
|
1655
|
+
if (exec.name === 'bash') {
|
|
1656
|
+
return {
|
|
1657
|
+
kind: 'deny',
|
|
1658
|
+
reason: 'Use review_bash for shell commands while Pre-review is on. It self-checks writes and asks for a second confirmation; file changes must use review_write / review_patch. Do not use bash to write files.',
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1545
1661
|
if (!REVIEW_TOOLS.has(exec.name)) return next()
|
|
1546
1662
|
return {
|
|
1547
1663
|
kind: 'deny',
|
|
1548
|
-
reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff) with at least one note per changed file; the plugin starts or reuses the review waiter automatically; just continue. Never call review_wait from the main agent.
|
|
1664
|
+
reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff) with at least one note per changed file; the plugin starts or reuses the review waiter automatically; just continue. Never call review_wait from the main agent. Run shell commands with review_bash.',
|
|
1549
1665
|
}
|
|
1550
1666
|
}
|
|
1551
1667
|
|
|
@@ -1556,17 +1672,46 @@ export function apply(ctx) {
|
|
|
1556
1672
|
name: 'tool:review-gate',
|
|
1557
1673
|
order: 110,
|
|
1558
1674
|
text: () => featureFlags.review === true && featureFlags.autoReview === true
|
|
1559
|
-
? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change.
|
|
1675
|
+
? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change. Read with read; change files with review_write (new file / full file) or review_patch (unified diff); run commands with review_bash. Do not use write/edit/apply_patch/str_replace_editor. Never use bash to write files: review_bash first returns the write-detection result, you self-check whether the command creates/modifies/deletes files, and only a second call with confirmed:true runs it when it writes no source files. Include at least one note per changed file while AI explanations are on; add line-level notes for user-requested, key or hard-to-understand changes (no upper limit). The plugin starts or reuses the review waiter automatically: after queueing, just continue or end the turn; never call review_wait and do not manage a subagent. If a file is rejected, read the comment and revise. This is house rules. 💅'
|
|
1560
1676
|
: '',
|
|
1561
1677
|
}), 'coding-enhanced: review prompt')
|
|
1562
1678
|
})
|
|
1563
1679
|
|
|
1680
|
+
const runAudit = async (session, turn) => {
|
|
1681
|
+
try {
|
|
1682
|
+
const snapshot = snapshotOf(session.id, turn)
|
|
1683
|
+
if (snapshot === undefined) return
|
|
1684
|
+
const cwd = typeof session.header?.cwd === 'string' && session.header.cwd !== '' ? session.header.cwd : process.cwd()
|
|
1685
|
+
const review = reviews.get(session.id)
|
|
1686
|
+
const reviewed = review === undefined ? [] : [...review.entries.values()].map((entry) => entry.display)
|
|
1687
|
+
const base = await captureWorkspace(session.id, cwd)
|
|
1688
|
+
if (base === undefined) return
|
|
1689
|
+
const diff = await runGit(['diff', '--name-status', snapshot.tree, base.tree], { gitDir: snapshot.gitDir, workTree: cwd })
|
|
1690
|
+
const changed = diff.split('\n').map((line) => line.trim()).filter((line) => line !== '').map((line) => {
|
|
1691
|
+
const parts = line.split('\t')
|
|
1692
|
+
return parts.length >= 2 ? parts[parts.length - 1] : ''
|
|
1693
|
+
}).filter((value) => value !== '')
|
|
1694
|
+
const outside = changed.filter((file) => !reviewed.includes(file) && !isArtifactPath(file))
|
|
1695
|
+
audits.set(session.id, {
|
|
1696
|
+
turn,
|
|
1697
|
+
outside,
|
|
1698
|
+
reviewed,
|
|
1699
|
+
artifacts: changed.filter((file) => isArtifactPath(file)),
|
|
1700
|
+
at: Date.now(),
|
|
1701
|
+
})
|
|
1702
|
+
bumpReview()
|
|
1703
|
+
} catch (error) {
|
|
1704
|
+
ctx.logger?.warn?.(`coding-enhanced: audit failed: ${String(error)}`)
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1564
1708
|
ctx.on('session/event', (session, event) => {
|
|
1565
1709
|
if (event.type === 'turn/start') {
|
|
1566
1710
|
const cwd = session.header?.cwd
|
|
1567
1711
|
if (typeof cwd !== 'string' || cwd === '' || isSubagent(session)) return
|
|
1568
1712
|
const turn = event.data?.turn
|
|
1569
1713
|
activeTurns.set(session.id, turn)
|
|
1714
|
+
audits.delete(session.id)
|
|
1570
1715
|
if (featureFlags.withdraw === true) {
|
|
1571
1716
|
const promise = captureSnapshot(session.id, cwd, turn).catch((error) => {
|
|
1572
1717
|
ctx.logger?.warn?.(`coding-enhanced: cannot snapshot ${cwd}: ${String(error)}`)
|
|
@@ -1580,6 +1725,7 @@ export function apply(ctx) {
|
|
|
1580
1725
|
}
|
|
1581
1726
|
if (event.type === 'turn/end') {
|
|
1582
1727
|
const turn = event.data?.turn
|
|
1728
|
+
void runAudit(session, turn)
|
|
1583
1729
|
activeTurns.delete(session.id)
|
|
1584
1730
|
const review = reviews.get(session.id)
|
|
1585
1731
|
if (review !== undefined) {
|
|
@@ -2162,6 +2308,7 @@ export function apply(ctx) {
|
|
|
2162
2308
|
version: reviewVersion,
|
|
2163
2309
|
unchanged: false,
|
|
2164
2310
|
reviews: [...reviews.values()].map(serializeReview),
|
|
2311
|
+
audits: Object.fromEntries(audits),
|
|
2165
2312
|
})
|
|
2166
2313
|
}
|
|
2167
2314
|
if (endpoint === 'decide') return decideReview(payload?.reviewId, payload?.decisions)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-coding-enhanced",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "The DSH change gate: queue AI edits before write, rewind turns with shadow-git snapshots, and hand review to a non-blocking waiter subagent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|