dsh-batch-review 0.0.0-stage → 1.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.
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ > This file keeps the English summaries; the detailed per-version history for 1.0.0–1.0.2 lives in [CHANGELOG.md](CHANGELOG.md).
4
+
5
+ ## 1.1.2 — 2026-12-04
6
+
7
+ ### Added
8
+
9
+ - Collapse / expand the panel from its top-right toggle.
10
+ - Drag the panel's top edge to resize its height.
11
+
12
+ ### Fixed
13
+
14
+ - Fixed a vulnerability that let the panel be called remotely.
15
+ - Review results are saved more reliably; a failed write no longer damages an existing file.
16
+ - Web fallback now uses a safer verification method.
17
+ - Submissions are now checked against the review and session they belong to, avoiding cross-talk.
18
+ - The automated test suite covers Windows and Linux on Node 20/22/24.
19
+
20
+ ## 1.1.1 — 2026-11-29
21
+
22
+ ### Fixed
23
+
24
+ - Fixed a loop-waiting problem where the agent could, in some cases, end the panel before the total limit and wrongly resend the review.
25
+
26
+ ### Changed
27
+
28
+ - Strengthened the "write the prose before calling `batch_review`" rule: it now lives in the system prompt, the tool description and the skill's hard rules.
29
+ - Total wait now grows with the item count on top of the default.
30
+
31
+ ## 1.1.0 — 2026-11-14
32
+
33
+ > Only 1.1.0 is published remotely (there is no 1.0.3–1.0.9 release). This version summarizes every change since 1.0.1; older entries stay in [CHANGELOG.md](CHANGELOG.md) as detailed records.
34
+
35
+ ### Fixed
36
+
37
+ - Fixed the panel being cut off by the default wait rule in PTC mode.
38
+ - Fixed duplicated numbering and scrambled order when the caller numbers the options itself.
39
+ - Fixed silent panel degradation truncating multi-item reviews.
40
+ - Fixed relative `persist` paths landing in the profile directory.
41
+
42
+ ### Changed
43
+
44
+ - Reworked multi-select handling.
45
+ - A single item now uses the review panel by default too (it adds a note field and cannot be cut off); the native card is only a fallback when the panel is offline or the user raises the threshold.
46
+
47
+ ### Known
48
+
49
+ - `batch_review` does not support plan-review / approval intents yet.
package/CHANGELOG.md ADDED
@@ -0,0 +1,236 @@
1
+ # Changelog
2
+
3
+ ## 1.1.2 — 2026-12-04
4
+
5
+ ### 新增
6
+
7
+ - 右上角面板收起 / 展开。
8
+ - 面板高度可拖拽。
9
+
10
+ ### 修复
11
+
12
+ - 修复了一个面板可被远程调用的漏洞。
13
+ - 批阅结果保存更可靠;写入失败时不会破坏已有文件。
14
+ - 网页回传改用更安全的校验方式。
15
+ - 批阅提交现在会核对所属的批阅与会话,避免串单。
16
+ - 自动测试集覆盖 Windows 与 Linux、Node 20/22/24。
17
+
18
+ ## 1.1.1 — 2026-11-29
19
+
20
+ ### 修复
21
+
22
+ - 修复了循环等待时,Agent某些情况会在总上限时间前就提前结束面板、错误重发面板的问题。
23
+
24
+ ### 变更
25
+
26
+ - 强化「调用 `batch_review` 前先写正文说明」的规则:写进系统提示、工具描述、技能铁律。
27
+ - 总等待时长现在会在默认时间上随条目数增长。
28
+
29
+ ## 1.1.0 — 2026-11-14
30
+
31
+ > 远端只有 1.1.0 这一个 release(没有中间的 1.0.3–1.0.9);本版汇总 1.0.1 以来的全部改动,下方各版本条目是各自的详细记录。
32
+
33
+ ### 修复
34
+
35
+ - 修复了 PTC 模式下,面板会被默认等待规则强行掐断的问题。
36
+ - 修复了工具调用方在给选项自行编号时,面板重复编号和顺序混乱的问题。
37
+ - 修复了面板静默降级、多条目被截断的问题。
38
+ - 修复了相对 persist 落到 profile 目录的问题。
39
+
40
+ ### 变更
41
+
42
+ - 优化了多选的调用逻辑。
43
+ - 现在默认 1 条也走批阅面板(相比原生多一栏备注、且不会被掐断),只在面板不在线 / 用户手动调高阈值时降级为原生面板。
44
+
45
+ ### 已知
46
+
47
+ - batch_review 暂不支持 plan-review / 审批类 intent。
48
+
49
+ ## 1.0.1 — 2026-11-07
50
+
51
+ ### 修复
52
+
53
+ - **跨会话串台**:修复了提问面板在其他会话也一直显示的问题。
54
+ - **界面语言跟随**:英文界面下按钮现在能正常显示英文,切换语言设置时立即跟随。
55
+
56
+ ### 变更
57
+
58
+ - `engines.dsh`:`>=0.2.1-rc.3 <=0.2.1-rc.5` → `>=0.2.1-rc.3 <=0.2.2`。
59
+
60
+ ## 1.0.0 — 2026-11-01
61
+
62
+ First public release, merging the former `batch-review-tool` plugin and the
63
+ `batch-review-table` skill into one package.
64
+
65
+ ### Tool
66
+
67
+ - `batch_review`: one call, one batch, structured `items[].{verdict,note,filled}`,
68
+ `summary` and `report_text` back.
69
+ - Two surfaces, one contract: a single item uses the paged native card; 2+ items use the
70
+ one-screen panel when its client half is mounted, and fall back to the card when it
71
+ is not. The result's `surface` field says which one answered.
72
+ - Item types: `confirm`, `bool`, `choice`, `text`, `scale`.
73
+ - Multi-select: `multiSelect: true` on an item keeps every chosen label in `verdict`
74
+ (joined by 、) and in the new `selected[]` array; the report lists them together.
75
+ - The third confirm state is now 待定 (formerly 未测); the HTML page and CSV header
76
+ follow the same wording, and the client still tones the legacy 未测 label.
77
+ - Choice options render with A/B/C prefixes in the panel; fixed verdict/bool/scale
78
+ sets do not.
79
+ - Fail-closed blanks: an unanswered item returns `filled: false` and is listed in the report.
80
+ - Cancelled sessions return `cancelled: true` with no items instead of throwing.
81
+ - Optional `persist` path writes the result as UTF-8 JSON (with `answered_at`) so verdicts
82
+ survive the session; a write failure lands in `persist_error` and never loses the review.
83
+ - Item ids are validated and must be unique; duplicate ids would otherwise fold the
84
+ wrong verdict, so the call is rejected before the user is asked.
85
+ - Host error codes are preserved on the thrown error (`code`, `cause`) instead of
86
+ being flattened into a message.
87
+ - `header` is capped at 24 characters so a long id cannot crowd the card.
88
+ - Item cap: a review above `maxItems` (100 by default) is rejected with a
89
+ split-the-batch message instead of being rendered. Tunables live in three
90
+ layers, lowest first: built-in defaults, the `cordis.patch.yml` `config` block,
91
+ then `~/.dsh/dsh-batch-review.config.json` written by the Settings section
92
+ (Settings → left-nav “批阅面板”). A save writes only the keys that changed, so
93
+ the cordis layer keeps applying to everything else. Hard limits: `maxItems`
94
+ 1–500, `virtualThreshold` 50–2000, `maxBodyBytes` 1 KB–128 MB.
95
+ - Panel rows above `virtualThreshold` (500 by default) render with
96
+ `content-visibility: auto`: the browser skips layout/paint for off-screen rows
97
+ while every row keeps its real height, so group headings and 全通过/全待定 keep
98
+ working and nothing is clipped.
99
+ - The panel request body cap defaults to 64 MB and can be raised to 128 MB.
100
+ - The item detail line is 12px so the expectation reads as secondary text instead
101
+ of competing with the title.
102
+ - Tool description no longer claims a "three or more" floor: the skill's routing rules
103
+ decide which surface to use, and the tool itself accepts any item count.
104
+ - Tool description shortened (~390 → ~250 chars) since it is paid on every request.
105
+ - **Removed** the unused `mode: sequential | independent` parameter. The native card
106
+ pages through items one at a time, so a per-item sequencing mode could not be
107
+ honoured and the field only advertised behaviour it did not have.
108
+
109
+ ### Settings
110
+
111
+ - New `lib/config.js` and a Settings → left-nav “批阅面板” section: edit
112
+ `panelThreshold`, `maxItems`, `panelTimeoutMs` (plus the advanced
113
+ `virtualThreshold`, `maxBodyBytes`, `allowExternalPersist`) without editing YAML
114
+ and without a restart. Writes go to `~/.dsh/dsh-batch-review.config.json`.
115
+ - Per-option notes: a choice option's `d` renders beside its label; `v` is the
116
+ stored value, not a note, so it is no longer shown as fallback text.
117
+ - The 重置 button says what it does: it fills the defaults in and saves them as
118
+ explicit settings (which override the cordis layer). To hand a tunable back to
119
+ the cordis layer, clear its input and save — the cleared field is sent as `null`
120
+ and the stored override is dropped.
121
+
122
+ ### Panel
123
+
124
+ - New client half (`lib/client.js`) registers a one-screen review panel in
125
+ `conversation.input.dock`; the host half (`lib/panel.js`) serves
126
+ `/api/batch-review/{state,submit,cancel,health}` and holds the single waiting review.
127
+ - Presence-gated: the tool only waits for the panel while it has polled within the last
128
+ 15 seconds (2.5× the idle poll interval plus the request timeout), so a missing client
129
+ degrades to the native card instead of blocking.
130
+ - Every route checks the Host header against the loopback names the panel can be
131
+ reached by (DNS-rebinding defence), cross-origin state changes are refused, the
132
+ review id is checked on submit; a panel
133
+ review times out after the configured base plus 6 s per item (capped at
134
+ 45 minutes; `PANEL_TIMEOUT`) and is reported as `cancelled: true`, never as a pass.
135
+ - Large batches: consecutive items with the same `group` (falling back to `header`)
136
+ collapse under one heading, and each heading has 全通过 / 全待定 batch buttons. From
137
+ 50 items up the panel hints at the CSV/Excel path; 1000 items are not a panel job.
138
+ - Styling now matches the host question card (title 16px, options/detail/notes 14px,
139
+ statistics 12px) so the paged card and the panel no longer look like different apps.
140
+ - Option buttons wrap inside the card instead of scrolling horizontally, and the note
141
+ field follows the wrap.
142
+ - The panel is used from 2 items up (was 5).
143
+ - A reverse proxy or tunnel gets no panel: the routes only accept a loopback `Host`,
144
+ so a GUI reached through one falls back to the native card. The browser console
145
+ says so once — otherwise "the panel never appears" was undiagnosable.
146
+ - An item's explanation is folded into the native card's title (e.g. “重启 — 不白屏”)
147
+ instead of using the host card's separate `detail` row: that row is indented 2px
148
+ against the title's 24px header padding and keeps the primary colour, so it read
149
+ as a line sticking out to the left of the title. The panel still renders the
150
+ explanation on its own indented, secondary-coloured line.
151
+
152
+ ### Internationalization
153
+
154
+ - English and Chinese ship in one package. The panel and the Settings section
155
+ follow the GUI language through the host's locale service and switch without a
156
+ reload; the client reports the active language on every `/state` poll, and the
157
+ host (which has no locale service of its own) uses it for option labels,
158
+ validation errors and `report_text`. Without a mounted panel the host falls
159
+ back to Chinese.
160
+ - Confirm/bool options now carry a `tone` (`pass`/`fail`/`pending`/`yes`/`no`)
161
+ next to their translated label, so the panel no longer recognises verdict
162
+ buttons by their Chinese text.
163
+ - The skill ships `SKILL.md` (Chinese) and `SKILL.en.md` (English).
164
+ - `batch_review` accepts an explicit `lang` (`en`/`zh`) for the panel-less case
165
+ (a script, or a host where the panel never mounted); without it the host uses
166
+ the language the panel last reported, then Chinese. A tag the package does not
167
+ ship (`fr`) falls through to that next preference instead of pinning Chinese, so
168
+ an invalid explicit value cannot override a panel already showing English.
169
+ - Dictionaries register with the per-locale signature the client runner declares
170
+ (`register(ns, locale, dict)`) and are retried when the locale service appears
171
+ after the plugin applies; the disposers go back to `ctx.effect`. A re-entry
172
+ guard keeps the retry from registering the dictionaries twice when the service
173
+ is already present the first time the effect runs.
174
+ - Verdict tones fall back to the shipped label wording on a host that predates
175
+ the `tone` field, so the group bulk buttons keep working there.
176
+ - Placeholders are substituted in a single pass (`tr`/`fillText`): text that
177
+ itself contains `{total}` stays literal instead of being expanded again.
178
+
179
+ ### Hardening
180
+
181
+ - Submit token: the panel hands a per-process token to the polling page through
182
+ `GET /state`; a POST without it (or with a stale one) is refused with 403, so a
183
+ cross-origin page cannot read the review or forge an answer even if it finds the route.
184
+ - The tool call's abort signal reaches the panel: an aborted call returns without
185
+ destroying the review — a submit, an explicit cancel, or the total deadline still
186
+ settles it, so a half-filled panel is not lost to a host deadline. A panel that
187
+ answers `BUSY` for any other reason falls back to the native card instead of
188
+ failing the call with "向用户提问失败:BUSY".
189
+ - `persist` is confined to the host process cwd subtree; writing elsewhere needs
190
+ `allowExternalPersist: true` in the profile config. A refused path returns
191
+ `persist_error` and the verdicts are still returned.
192
+ - Item ids must be strings or finite numbers: empty strings, booleans, objects and `NaN`
193
+ are rejected with the item index (an empty id used to drop its answer silently).
194
+ `scale` ranges that would render more than 100 options are rejected, and a `choice`
195
+ option that is `null` or a bare string no longer crashes the mapping.
196
+ - Presence window widened to 15 s (was 6 s): one slow poll can no longer make a live panel
197
+ look unmounted.
198
+ - HTML fallback: item ids are escaped in every DOM sink, `build_review.py` rejects
199
+ non-integer ids and escapes U+2028/U+2029 (it already escaped `</`), and
200
+ `collect_server.py` refuses POSTs whose Origin/Referer is not absent, `null` or
201
+ `file://`.
202
+ - CI fails on a non-zero `fail`/`cancelled` count instead of trusting a pipeline's exit
203
+ code, and asserts that reviewer text cannot close the page's inline `<script>`.
204
+
205
+ ### Routing
206
+
207
+ - `lib/prompt.js` registers a short system-prompt section so the "use batch_review vs
208
+ ask_user_question, a blank is never an approval" rule ships with the plugin instead of
209
+ living only in one user's AGENTS.md. The section can be switched off with
210
+ `injectRoutingRule: false` (Settings → Advanced → "Inject the routing rule into the
211
+ system prompt"), which takes effect after a restart; the rule then lives in your own
212
+ `AGENTS.md` and the tool is only reached when named explicitly.
213
+ - A panel review is bound to the session that asked for it: the client reports its
214
+ session id on every poll and the host hides a pending review from any other session,
215
+ so switching sessions (or workspaces) no longer shows someone else's review.
216
+
217
+ ### Skill
218
+
219
+ - The `batch-review-table` skill is now bundled and registered by the plugin itself
220
+ (`ctx.skills.registerProvider()`), so one `dsh plugin add` installs both halves.
221
+ - SKILL.md now documents what the card actually looks like (one question at a time,
222
+ paged) and routes 10+ item reviews, overview reviews and persisted reviews to the
223
+ HTML fallback instead of stuffing them into native cards.
224
+ - SKILL.md gained the previously undocumented pieces: the HTML result contract
225
+ (`state` enum, `blocked_by`, `assumed_pass`, `summary`), the local collector protocol
226
+ (ports, `/health`, `/submit`, CORS/Private-Network headers, grace window), a
227
+ one-shot lifecycle warning (browser-only page, temp dir wiped on restart, copy-JSON
228
+ fallback), and the CSV offline path (`--format csv`).
229
+ - `build_review.py`, `collect_server.py` and `assets/review.html` keep the same items
230
+ schema; the review page now escapes item ids, and the collector only accepts
231
+ `file://`-originated submissions.
232
+
233
+ ### Packaging
234
+
235
+ - Renamed from `@local/batch-review-tool` to `dsh-batch-review`; added MIT license,
236
+ `engines.dsh`, repository/keywords metadata, tests and CI.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 palx666
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.en.md ADDED
@@ -0,0 +1,207 @@
1
+ # dsh-batch-review
2
+
3
+ [![ci](https://github.com/palx666/dsh-batch-review/actions/workflows/ci.yml/badge.svg)](https://github.com/palx666/dsh-batch-review/actions/workflows/ci.yml) [![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness)
4
+
5
+ [English](README.en.md) | [中文](README.md)
6
+
7
+ ## Overview
8
+
9
+ Multi-item review for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): the upgraded version of the native question card, built to improve how an agent asks the user to confirm, choose, or approve multiple things at once. A review panel can hold several groups or items; the user answers by clicking options or typing text — in bulk or one by one — and structured results come back to the agent without breaking the workflow.
10
+
11
+ ## Hard rule: if the user owes a decision, call `batch_review`
12
+
13
+ **The plugin injects this rule automatically — no setup needed.** It registers a `dsh-batch-review:routing` section in the system prompt (present on every request) and ships a `batch-review-table` skill carrying the same judgement.
14
+
15
+ - **Whenever the user owes an answer** — a confirmation, a choice, an approval, a rejection, a rating, a comment — give them a clickable surface instead of asking in prose.
16
+ - **Whenever the user owes a decision → `batch_review`** — a single item also uses the panel (default threshold 1); **only plan approval / host approval prompts** → `ask_user_question` (only the native API can emit those intents; `batch_review` cannot render them).
17
+ - **An unanswered item is not an approval**: `filled: false` must be followed up, never assumed passed.
18
+
19
+ **Prefer not to have it injected?** Settings → left-nav Batch review → Advanced, clear "Inject the routing rule into the system prompt" (equivalently `injectRoutingRule: false`); it takes effect after a **restart**. Nothing is written to the system prompt then — and you should **keep the rule yourself**: state in your own `AGENTS.md` **when `batch_review` should be used** (ordinary decisions take `batch_review`; only plan approval / approval prompts take `ask_user_question`), otherwise the agent will not reach for the tool on its own (it still works when you name it explicitly).
20
+
21
+ ## How it works
22
+
23
+ One `batch_review` tool call hands the agent's checklist to the Web UI — the one-screen panel in the input dock by default (panel threshold 1, so a single item uses it too; the native card is only the fallback when the panel is offline) — and returns one structured result: a verdict and a note per item, plus a ready-to-read report. The panel is served by the host's own web server under `/api/batch-review/*`, so there is no separate app to open and no extra port — and a blank item never counts as approved. Drag the grip on the panel's top edge to make it taller or shorter, so a long review does not have to be scrolled row by row.
24
+
25
+ ```text
26
+ agent → batch_review({ title, items: [6 items] })
27
+ → one-screen panel (default threshold 1, panel mounted) or native cards (degraded)
28
+ → { items:[{verdict,note,filled}], summary, report_text }
29
+ ```
30
+
31
+ ## What it does
32
+
33
+ - **`batch_review` tool.** The agent sends the whole batch in one call. Each item becomes one `AskUserQuestionItem` (on the panel by default); the answers come back as `items[].{id,title,type,verdict,note,filled}` plus `summary` and a `report_text` the model can paste into its reply.
34
+ - **Fail-closed blanks.** An item the user skipped or left blank returns `filled: false`. The report lists it under "Not answered" with the explicit note that it is not a pass. A cancelled session returns `cancelled: true` and no items at all — never a silent pass.
35
+ - **Five item types.** `confirm` (Pass / Fail / Pending), `bool`, `choice`, `text`, `scale`.
36
+ - **Multi-select on request.** Set `multiSelect: true` on any item that accepts more than one label; the answer keeps every label in `verdict` (joined with `、`) and in the new `selected[]` array.
37
+ - **Bundled skill.** The package also registers the `batch-review-table` skill (decision-channel routing: when to use `ask_user_question` vs `batch_review` vs a full HTML page) so one install covers both halves.
38
+ - **HTML fallback.** For large reviews or when a persisted result is needed, the skill ships a self-contained `review.html` + `build_review.py` + `collect_server.py`.
39
+
40
+ ## Relationship to native cards
41
+
42
+ `batch_review` builds on DSH's native question cards — think of it as the upgraded version: it fully replaces the native card in normal use, and only falls back to the card in specific cases (the panel call fails, a manual setting, and so on). If you want the native card for small batches, raise the panel trigger threshold in Settings.
43
+
44
+ The panel polls `GET /api/batch-review/state` only while it is mounted; if it is not (the user is on another page, the client bundle is not loaded, or the host has no web server), `batch_review` degrades to the native card instead of blocking. The returned `surface` field says which one answered.
45
+
46
+ Both surfaces return the same contract — `items[].{verdict,note,filled}`, `summary`, `report_text` — so the skill and the agent do not care which one was used.
47
+
48
+ A review belongs to the **session that asked for it**: switching to another session or workspace does not show someone else's pending review.
49
+
50
+ ## Settings
51
+
52
+ Settings → left-nav Batch review has three basic settings:
53
+
54
+ | Setting | Default | Range | What it does |
55
+ |---|---|---|---|
56
+ | Panel threshold | 1 | 1–100 | Item count from which the panel takes over; the default 1 means everything uses the panel — set it to 2+ to send small batches to the native card |
57
+ | Item cap | 100 | 1–500 | Most items in one review; above that the call is rejected with a split-the-batch message and nothing renders |
58
+ | Timeout (ms) | 15 min | 1 s – 24 h | Base budget for one review to stay on the panel; the effective ceiling is this base plus 6 s per item, capped at 45 min (a larger configured base is respected). A timeout comes back as cancelled (never a pass). One tool call waits only ~90 s, then returns `pending: true` + `review_id`; call again to resume |
59
+
60
+ Under **Advanced** there are also `virtualThreshold`, `maxBodyBytes`, `allowExternalPersist` and `injectRoutingRule` (whether the routing rule is injected into the system prompt). The panel **only serves loopback peers**: the former `allowNonLoopback` option is gone; a leftover key in the config file is ignored and logged at startup, and a GUI reached through a reverse proxy or tunnel gets no panel. These **rarely need changing**; check the effect before you touch them.
61
+
62
+ ## Install
63
+
64
+ **Requirements**: DeepSeek Harness `>=0.2.1-rc.3 <0.2.2 || >=0.2.2-rc.1 <=0.2.2` (0.2.2-rc.1 and newer prereleases included; host APIs and client slots checked on 0.2.2-rc.1, no full manual re-test), Node.js `>=20`. No runtime dependencies, no build step — plain ESM.
65
+
66
+ ```sh
67
+ # the current release (recommended for reproducibility; the tag points at the shipped commit)
68
+ dsh plugin --profile <profile> add github:palx666/dsh-batch-review#v1.1.2
69
+
70
+ # or the pinned tarball
71
+ dsh plugin --profile <profile> add https://github.com/palx666/dsh-batch-review/archive/refs/tags/v1.1.2.tar.gz
72
+ ```
73
+
74
+ > `main` may lag behind the tags (the release flow commits first, then tags); installing `github:palx666/dsh-batch-review` without a ref gets whatever `main` currently is, not necessarily the latest release. If the marketplace entry uses a tarball, the Release asset is authoritative.
75
+
76
+ Restart the host (`dsh web` / the desktop app) so the plugin loads. To verify, check that the agent's tool list contains `batch_review`.
77
+
78
+ ## Usage
79
+
80
+ ```json
81
+ {
82
+ "title": "Acceptance: file copy / download buttons",
83
+ "persist": "review/acceptance.json",
84
+ "items": [
85
+ { "id": 1, "type": "confirm", "op": "Restart DSH and reload the page", "expect": "No white screen" },
86
+ { "id": 2, "type": "choice", "label": "Connection mode", "options": [{ "v": "A", "t": "Direct 18080" }, { "v": "B", "t": "Via DSH subagent" }] },
87
+ { "id": 3, "type": "bool", "label": "Keep the gateway task resident", "boolDesc": "Accept" },
88
+ { "id": 4, "type": "scale", "label": "Overall rating", "min": 1, "max": 5 },
89
+ { "id": 5, "type": "text", "label": "Describe anything that looked off" }
90
+ ]
91
+ }
92
+ ```
93
+
94
+ A relative `persist` path resolves against the **agent workspace** (falling back to the host process cwd when the host exposes none); writes are confined to the workspace / process cwd subtree unless `allowExternalPersist` is enabled in Settings.
95
+
96
+ Result (truncated):
97
+
98
+ ```json
99
+ {
100
+ "cancelled": false,
101
+ "items": [
102
+ { "id": "1", "type": "confirm", "verdict": "Pass", "note": "", "filled": true },
103
+ { "id": "3", "type": "bool", "verdict": "", "note": "", "filled": false }
104
+ ],
105
+ "summary": { "total": 5, "filled": 4 },
106
+ "persisted": "/abs/path/review/acceptance.json",
107
+ "report_text": "[Batch review] Acceptance: file copy / download buttons\n5 items · 4 answered · 1 open\n…\nNot answered: 3 (a blank is never a pass; ask again)"
108
+ }
109
+ ```
110
+
111
+ Rules the tool enforces for the model:
112
+
113
+ - `items` must be a non-empty array and `id`s must be unique — answers are folded back by id, so a duplicate is rejected instead of silently overwriting;
114
+ - `persist` (optional) writes the result as UTF-8 JSON so the verdicts survive the session; the returned `persisted` field holds the absolute path, and a write failure lands in `persist_error` without affecting the review result;
115
+ - the tool suspends until the user answers; the model must not call it twice for the same batch;
116
+ - `filled: false` must be followed up, never read as approval;
117
+ - `cancelled: true` means there is no verdict at all — re-ask.
118
+
119
+ ## Large batches
120
+
121
+ Three channels, one per size range: **panel → HTML review page → Excel sheet**.
122
+
123
+ - The panel groups **consecutive** items by `group` (falling back to `header`); every group heading carries a Clear button, and a group of confirm items also gets the Pass / Fail / Pending batch buttons (only the verdict types the group actually offers — bool/choice/scale groups show none of these). A 100-item batch is workable when the agent sorts it into groups first; a flat 100-item list is not.
124
+ - **From 50 items up** the panel shows a hint pointing at the Excel sheet. `build_review.py --format xlsx` writes a sheet whose status column already has a dropdown (通过 / 不通过 / 待定 / 跳过), which suits dozens to a thousand rows — clicking through the HTML page a thousand times is not viable, while Excel takes a dropdown plus a drag-fill.
125
+ - xlsx needs `openpyxl`; without it the script says so and **falls back to csv** automatically (fillable, just no dropdown).
126
+ - Item `group` is optional and free-form; the agent decides the split.
127
+
128
+ ## What ships in the package
129
+
130
+ | Path | Purpose |
131
+ |---|---|
132
+ | `index.js` | Host plugin: registers the tool, the skill provider and the panel routes |
133
+ | `lib/tool.js` | Item validation, `AskUserQuestionItem` mapping, answer folding, report, panel/card routing |
134
+ | `lib/panel.js` | Panel channel: one waiting review, `/api/batch-review` routes, presence |
135
+ | `lib/client.js` | Browser half: the one-screen review panel in `conversation.input.dock` |
136
+ | `lib/prompt.js` | System-prompt routing section (batch_review vs ask_user_question) |
137
+ | `lib/skill.js` | Skill provider for the bundled `batch-review-table` skill |
138
+ | `lib/config.js` | Three-layer config parsing and validation (defaults / cordis / settings file) |
139
+ | `lib/i18n.js` | English/Chinese dictionaries, placeholder substitution, error localisation |
140
+ | `skills/batch-review-table/SKILL.md` | Decision-channel routing rules and the HTML fallback workflow |
141
+ | `skills/batch-review-table/SKILL.en.md` | English skill (same judgement as `SKILL.md`) |
142
+ | `skills/batch-review-table/references/html-fallback.md` | HTML fallback details (protocol, result contract, xlsx/csv export) — read only when needed |
143
+ | `skills/batch-review-table/assets/review.html` | Self-contained review page (progress, paging, “only unfinished”, copy/download JSON) |
144
+ | `skills/batch-review-table/scripts/build_review.py` | Render a review page (or an xlsx/csv sheet) from an items JSON |
145
+ | `skills/batch-review-table/scripts/collect_server.py` | Local 127.0.0.1 collector: page → `POST /submit` → result file + stdout |
146
+ | `locale/zh.json`, `locale/en.json` | Dictionaries for the host locale service (used when the client switches language) |
147
+ | `cordis.patch.yml` | Plugin declaration (bundle patch, read at install time) |
148
+
149
+ ## Languages
150
+
151
+ English and Chinese are both supported, defaulting to the GUI language and switching without a reload. The skill ships `SKILL.md` (Chinese) and `SKILL.en.md` (English).
152
+
153
+ ## Known limitations
154
+
155
+ - **The panel needs its client half.** It lives in `conversation.input.dock` and only polls while mounted. A host without `webServer`, a client build that does not load the bundle, or a user on another page all mean “no panel”, and the tool degrades to the native card rather than waiting forever.
156
+ - **The native card has no resume.** Its wait is one-shot; in PTC mode a host execution budget (e.g. `run_code`'s 2-minute default) can cut it off before the user answers — one more reason everything now defaults to the panel.
157
+ - **The panel only accepts a loopback peer and a loopback Host.** Its routes first refuse a non-loopback TCP peer, then any `Host` that does not normalise to loopback (`localhost`, all of `127/8`, `::1`, IPv4-mapped `::ffff:127.x.x.x`, or the address the socket itself is bound to); a GUI reached through a reverse proxy or tunnel gets no panel — the tool falls back to the native card and no verdict is lost. The browser console says so once.
158
+ - **On the native card, the explanation is part of the title.** `expect` / `boolDesc` / `detail` are appended to the title with an em dash (“重启 — 不白屏”) rather than sent as the card's own `detail` row: that row is indented 2px against the title's 24px header padding and keeps the primary colour, so it read as a line sticking out to the left of the title. The panel still shows the explanation on its own indented, secondary-coloured line.
159
+ - **Native cards are root-agent only.** `userQuestions.ask()` accepts only the live runtime root, so a subagent that lands on the native card fails with `DELEGATED_CALLER`. The panel path does not go through that host call, so a subagent can still ask through the panel while it is mounted.
160
+ - **Persistence is opt-in.** Nothing about a review is written to disk by default; pass `persist: "<path>"` and the verdicts are saved as UTF-8 JSON (the returned `persisted` field is the absolute path actually written). `persist` is confined to the agent workspace / host process cwd subtree unless the profile sets `allowExternalPersist: true`. Without `persist`, a session that ends mid-review returns `cancelled: true` and the batch must be asked again. The Settings section keeps its own config file (see the cap entry below).
161
+ - **Item cap (100 by default).** A review above it is **rejected** with a message telling the caller to split the batch; nothing renders. To change the cap, see [Settings](#settings).
162
+ - **Large batches skip off-screen paint.** Above `virtualThreshold` rows the panel applies `content-visibility: auto`, so the browser skips layout and paint for rows outside the viewport while every row keeps its real height — no fixed row height, nothing clipped. The defaults (`maxItems: 100`, `virtualThreshold: 500`) keep this path off; lower `virtualThreshold` in Settings → Advanced to exercise it.
163
+ - **Chinese is only the fallback.** With no panel report and no explicit `lang`, option labels (`confirm`: 通过 / 不通过 / 待定, `bool`: 是 / 否) and `report_text` fall back to Chinese. Anywhere else they follow the UI language, or the `lang` argument.
164
+ - **Theme tokens only.** Native cards are styled entirely by DSH; the panel's own CSS uses `--dsw-*` theme tokens exclusively (no literal colors), so it follows the host's light/dark switch. Verified readable on DSH `0.2.1-rc.5` with orca-maid 0.1.1, maid-atelier 0.1.9, orca-link 0.1.9, deep-whale-manager 0.1.8 and maid-whale-webui 0.1.1 (DeepSeek Cloud Paper).
165
+
166
+ ## Security boundaries
167
+
168
+ - **The session id is UI isolation, not user authentication.** A review is shown only to the session that asked for it, but it is not a cross-user permission control: another session or page of the same DSH user can still reach the local routes' responses.
169
+ - **Same-user local processes can reach the local routes.** `/api/batch-review/*` is served by the host webServer and, by default, accepts only loopback peers (`127.0.0.1` / `::1` / IPv4-mapped). Other programs running as the same user on the same machine can call these routes; putting the GUI behind a reverse proxy or tunnel does not make the panel reachable (loopback only). For remote reviews, use a separate scheme with network authentication rather than relying on the Host header.
170
+ - **The HTML collector trusts only a page it generated locally.** `collect_server.py` authenticates submissions with a one-shot token embedded in the page; do not expose the collector port to a LAN and do not hand a generated page to someone you do not trust.
171
+ - **Settings file.** `$DSH_HOME/dsh-batch-review.config.json` (default `~/.dsh/dsh-batch-review.config.json`). Uninstalling the plugin leaves it in place, and it never removes results you wrote with `persist`.
172
+ - **The routing rule is injected by default.** `injectRoutingRule` writes "use batch_review when the user owes a decision" into the system prompt; text-only users can switch it off, or edit the injected text in `lib/prompt.js` locally to narrow the trigger.
173
+
174
+ ## Development
175
+
176
+ ```sh
177
+ node --test # mapping, folding, report and plugin registration (Node 20/22/24)
178
+ python -m unittest discover -s skills/batch-review-table/scripts -p 'test_review_collect.py' -v # collector
179
+ ```
180
+
181
+ The HTML fallback has its own smoke path:
182
+
183
+ ```sh
184
+ python skills/batch-review-table/scripts/build_review.py --data examples/items.json --out review/demo.html
185
+ python skills/batch-review-table/scripts/build_review.py --data examples/items.json --format xlsx --out review/demo.xlsx
186
+ python skills/batch-review-table/scripts/collect_server.py # then open review/demo.html
187
+ ```
188
+
189
+ ## Upgrade and uninstall
190
+
191
+ ```sh
192
+ # upgrade: install the new tag (read the CHANGELOG first)
193
+ dsh plugin --profile <profile> add github:palx666/dsh-batch-review#v1.1.2
194
+
195
+ # uninstall
196
+ dsh plugin --profile <profile> remove dsh-batch-review
197
+ ```
198
+
199
+ Uninstalling leaves `$DSH_HOME/dsh-batch-review.config.json` in place and never removes results you wrote with `persist`. To reset the settings, press 重置 in the Settings section, or delete that file and restart.
200
+
201
+ ## License
202
+
203
+ MIT — see [LICENSE](LICENSE).
204
+
205
+ ## Built with
206
+
207
+ Built with [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh): the tool, the panel and the skill are written against its host APIs.