dsh-response-letter 0.0.0-stage → 0.1.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +201 -0
  3. package/README-zh.md +96 -0
  4. package/README.md +95 -2
  5. package/SECURITY.md +19 -0
  6. package/THIRD_PARTY_NOTICES.md +10 -0
  7. package/cordis.patch.yml +14 -0
  8. package/lib/check.d.ts +41 -0
  9. package/lib/check.d.ts.map +1 -0
  10. package/lib/check.js +90 -0
  11. package/lib/check.js.map +1 -0
  12. package/lib/config.d.ts +30 -0
  13. package/lib/config.d.ts.map +1 -0
  14. package/lib/config.js +39 -0
  15. package/lib/config.js.map +1 -0
  16. package/lib/index.d.ts +36 -0
  17. package/lib/index.d.ts.map +1 -0
  18. package/lib/index.js +49 -0
  19. package/lib/index.js.map +1 -0
  20. package/lib/parse.d.ts +53 -0
  21. package/lib/parse.d.ts.map +1 -0
  22. package/lib/parse.js +126 -0
  23. package/lib/parse.js.map +1 -0
  24. package/lib/report.d.ts +21 -0
  25. package/lib/report.d.ts.map +1 -0
  26. package/lib/report.js +61 -0
  27. package/lib/report.js.map +1 -0
  28. package/lib/runtime.d.ts +107 -0
  29. package/lib/runtime.d.ts.map +1 -0
  30. package/lib/runtime.js +223 -0
  31. package/lib/runtime.js.map +1 -0
  32. package/lib/tools/letter-check.d.ts +12 -0
  33. package/lib/tools/letter-check.d.ts.map +1 -0
  34. package/lib/tools/letter-check.js +80 -0
  35. package/lib/tools/letter-check.js.map +1 -0
  36. package/lib/tools/letter-export.d.ts +12 -0
  37. package/lib/tools/letter-export.d.ts.map +1 -0
  38. package/lib/tools/letter-export.js +64 -0
  39. package/lib/tools/letter-export.js.map +1 -0
  40. package/lib/tools/letter-parse.d.ts +12 -0
  41. package/lib/tools/letter-parse.d.ts.map +1 -0
  42. package/lib/tools/letter-parse.js +71 -0
  43. package/lib/tools/letter-parse.js.map +1 -0
  44. package/lib/tools/shared.d.ts +20 -0
  45. package/lib/tools/shared.d.ts.map +1 -0
  46. package/lib/tools/shared.js +14 -0
  47. package/lib/tools/shared.js.map +1 -0
  48. package/lib/version.d.ts +7 -0
  49. package/lib/version.d.ts.map +1 -0
  50. package/lib/version.js +7 -0
  51. package/lib/version.js.map +1 -0
  52. package/package.json +80 -4
  53. package/src/check.ts +109 -0
  54. package/src/config.ts +58 -0
  55. package/src/index.ts +59 -0
  56. package/src/parse.ts +154 -0
  57. package/src/report.ts +63 -0
  58. package/src/runtime.ts +270 -0
  59. package/src/tools/letter-check.ts +86 -0
  60. package/src/tools/letter-export.ts +62 -0
  61. package/src/tools/letter-parse.ts +70 -0
  62. package/src/tools/shared.ts +14 -0
  63. package/src/version.ts +7 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.1] - 2026-11-08
8
+
9
+ ### Changed
10
+
11
+ - Release-engineering refresh: CHANGELOG accuracy, package metadata and authors; no runtime changes.
12
+
13
+ ## [0.1.0] - 2026-11-08
14
+
15
+ ### Fixed
16
+
17
+ - `R1`/`R2` reviewer headers are now recognized; the README, module docs and
18
+ changelog promised them but the header regex only matched Reviewer/Referee/
19
+ 审稿人/专家.
20
+ - Malformed `comments`/`responses` JSON now returns `INVALID_INPUT` from
21
+ `letter_check`/`letter_export` instead of leaking a `TypeError`.
22
+ - `letter_export` shows the same (first) answer for a repeated response number
23
+ that `letter_check` reported on; it previously rendered the last duplicate.
24
+ - Corrected the `letter_export` response parameter type (`ParsedResponse[]`).
25
+ - CRLF review and letter text is now parsed: the numbered-line regex rejected
26
+ the trailing `\r`, so Windows files silently fell back to paragraph mode and
27
+ produced no response matches.
28
+ - Duplicate response numbers are warned about even when no comment has that
29
+ number (previously the duplicate was only reported for matched numbers).
30
+
31
+ ### Added
32
+
33
+ - Tests for `R1` headers, CRLF text, duplicate-answer consistency, symlink
34
+ escape, malformed JSON payloads and the function-plugin mount contract (21
35
+ tests total).
36
+
37
+ First release: reviewer-comment parsing and response coverage.
38
+
39
+ ### Added
40
+
41
+ - `letter_parse`: reviewer headers (`Reviewer`/`Referee`/`审稿人`/`R`) and
42
+ numbered markers, global numbering with character locators, paragraph
43
+ fallback with an explicit warning.
44
+ - `letter_check`: coverage by response number — missing, shorter than 20
45
+ characters, duplicate, extra — with a coverage ratio.
46
+ - `letter_export`: Markdown point-by-point table, unanswered points in bold,
47
+ and the coverage table.
48
+ - REP v1 integration: the parsed review becomes immutable evidence with parse
49
+ checks and a valid record.
50
+ - 15 tests.
51
+
52
+ ### Notes
53
+
54
+ - Coverage counts answers; it does not judge whether an answer is adequate.
55
+ - Numbering must be global (1..N across reviewers); per-reviewer numbering is
56
+ reported as a mismatch rather than silently remapped.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README-zh.md ADDED
@@ -0,0 +1,96 @@
1
+ # dsh-response-letter
2
+
3
+ **每一条审稿意见都有回复——而且可以按编号核实。**
4
+
5
+ *解析审稿意见(Reviewer/Referee/审稿人 标题行,编号模式或段落模式),按回复编号检查逐条回复信(缺失、过短、多余、重复),并导出带覆盖表的 Markdown 回复信。*
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24.9-brightgreen.svg)]()
9
+
10
+ [English](README.md) · 简体中文
11
+
12
+ ---
13
+
14
+ ## 它做什么
15
+
16
+ - **`letter_parse`** — 识别 `Reviewer 1`、`Referee #2`、`审稿人 2`、`R1` 标题行以及编号标记(`1.`、`2)`、`Comment 3:`、`Q4:`),为每条意见分配一个**全局编号**(也就是回复必须引用的编号)、一个审稿人标签和一个字符位置。没有编号时回退到按段落解析,并给出明确警告。
17
+ - **`letter_check`** — 把回复编号与意见编号对应起来,并报告:缺失的编号、少于 20 个字符的回复、重复的回复编号,以及引用了不存在意见编号的回复。
18
+ - **`letter_export`** — 输出一张 Markdown 表格(#、审稿人、意见、回复),未回答的条目加粗,并附覆盖表。Markdown 就是交付物;不发送邮件,也不上传任何内容。
19
+
20
+ ## 它不做什么
21
+
22
+ - **不做充分性判断。** 覆盖统计只计入带编号的回复,不判断回复是否有说服力、是否礼貌、是否有证据支撑。
23
+ - **不改动审稿意见文本。** 意见原样转载,回复由作者撰写。
24
+ - **不处理 DOCX/PDF。** 请先转换为 `.md`/`.txt`(PDF 文本可用 `dsh-doc-anchor`)。
25
+ - **不负责投稿。** 不会接触期刊系统。
26
+ - **不生成 AI 反驳信。** 插件只做解析和检查,措辞始终由作者自己写。
27
+
28
+ ## 编号规则
29
+
30
+ 意见按文档顺序在所有审稿人之间统一编号为 1..N(不是每位审稿人各自编号),回复信必须引用同一套全局编号。如果回复信使用自己的按审稿人编号,编号就对不上,检查会直接指出这一点,而不是猜测。
31
+
32
+ ## 工具
33
+
34
+ ### `letter_parse`
35
+
36
+ `{ text? | path?, persist? }` → `{ ok, parse: {comments, reviewers, mode, warnings}, evidenceId?, recordPath? }`.
37
+
38
+ ### `letter_check`
39
+
40
+ `{ comments? | reviewText? | reviewPath?, letterText? | letterPath? }` → `{ ok, coverage, comments, responses, warnings }`.
41
+
42
+ ### `letter_export`
43
+
44
+ `{ comments, responses? | letterText?, title? }` → `{ ok, markdown, coverage }`.
45
+
46
+ ### 错误码
47
+
48
+ `INVALID_INPUT` · `NOT_FOUND` · `PATH_ESCAPE` · `NOT_A_FILE` · `TOO_LARGE` · `UNSUPPORTED_FILE` · `STORE_ERROR`
49
+
50
+ ## 兼容性与安装
51
+
52
+ | | |
53
+ |---|---|
54
+ | DeepSeek Harness | **`dsh-v0.2.1-rc.5`**(2026-11-08 实测);peer `>=0.2.1-0 <0.3.0 \|\| >=0.2.2-0 <0.3.0` |
55
+ | Node | `^22.19.0 \|\| >=24.9.0`(实测 `24.22.1`),仅 ESM |
56
+ | Peer 依赖 | `@perrylink/dsh-research-core ^0.1.0`、`@deepseek-ai/cordis ^4.0.5-alpha.1`、`@deepseek-ai/dsh-tools`、`@deepseek-ai/schemastery ^3.18.5-alpha.1` |
57
+ | 运行时依赖 | **零** |
58
+
59
+ ```sh
60
+ dsh plugin --profile <name> add @perrylink/dsh-research-core dsh-response-letter
61
+ dsh --profile <name> --dump-config | grep dsh-response-letter
62
+ ```
63
+
64
+ ## 配置
65
+
66
+ | 键 | 默认值 | 含义 |
67
+ |---|---|---|
68
+ | `enabled` | `true` | `false` 时不挂载任何内容 |
69
+ | `root` | `.response-letter` | 存储/记录根目录 |
70
+ | `workspaceRoot` | `process.cwd()` | 路径必须解析到该目录内 |
71
+ | `maxChars` | `1000000` | 字符上限(超限即失败,绝不截断) |
72
+ | `persist` | `true` | 把解析后的审稿意见存为 REP 证据 + 记录 |
73
+
74
+ ## 安全边界
75
+
76
+ - 对审稿意见和回复信文件只读;只在 `root` 下写入。
77
+ - 用 `realpath` 做包含性校验,拒绝符号链接逃逸。
78
+ - 超出字符上限时明确失败;DOCX/PDF 会被拒绝并给出转换提示。
79
+ - 审稿意见一律视为数据;其中的任何指令性文本都不会被执行(插件没有执行器)。
80
+
81
+ ## 评测
82
+
83
+ **21 个测试**:带审稿人标题(含 `R1`)和 CRLF 文本的编号解析、段落回退及警告、空文本拒绝、回复提取、完整/部分覆盖(缺失、过短、多余)、重复编号与重复导出的一致性、运行时(有效的 REP 记录、文件和文本路径、路径穿越/符号链接/DOCX/超大文件拒绝、畸形 JSON 载荷)、工具(schema、parse→check→export 端到端、失败分支)、插件契约、包契约。
84
+
85
+ 不宣称任何基准成绩:这里的正确性指的是解析器在明确格式上的行为,由 fixture 校验;并不存在真实回复信的人工标注语料。
86
+
87
+ ## 已知限制(v0.1)
88
+
89
+ - 解析器要求每条编号行/块对应一条意见;跨多个无编号段落的意见会被拆开。
90
+ - 不会自动重映射按审稿人各自的编号;检查会报告不匹配。
91
+ - 回复质量(语气、证据)不在范围内。
92
+ - 仅支持英文/中文标记;其他语言需要新增模式。
93
+
94
+ ## 许可
95
+
96
+ Apache-2.0。运行时零第三方代码。
package/README.md CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
1
+ # dsh-response-letter
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Every reviewer comment answered — and provably so, by number.**
4
+
5
+ *Parses reviewer comments (Reviewer/Referee/审稿人 headers, numbered or paragraph mode), checks the point-by-point letter by response number (missing, too short, extra, duplicates), and exports a Markdown letter with a coverage table.*
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24.9-brightgreen.svg)]()
9
+
10
+ English · [简体中文](README-zh.md)
11
+
12
+ ---
13
+
14
+ ## What it does
15
+
16
+ - **`letter_parse`** — recognizes `Reviewer 1`, `Referee #2`, `审稿人 2`, `R1` headers and numbered markers (`1.`, `2)`, `Comment 3:`, `Q4:`), assigning a **global number** to every comment (the number a response must cite), a reviewer label and a character locator. Falls back to paragraphs with an explicit warning.
17
+ - **`letter_check`** — matches response numbers to comment numbers and reports: missing numbers, answers shorter than 20 characters, duplicate response numbers, and responses citing a number that no comment has.
18
+ - **`letter_export`** — a Markdown table (#, reviewer, comment, response) with unanswered points in bold, plus the coverage table. Markdown is the deliverable; nothing is emailed or uploaded.
19
+
20
+ ## What it does not do
21
+
22
+ - **No adequacy judgement.** Coverage counts numbered answers; it does not say whether an answer is convincing, polite or evidence-based.
23
+ - **No reviewer text editing.** Comments are reproduced verbatim; the author writes the responses.
24
+ - **No DOCX/PDF.** Convert to `.md`/`.txt` (PDF text: `dsh-doc-anchor`).
25
+ - **No submission.** It does not touch the journal system.
26
+ - **No AI-generated rebuttals.** The plugin parses and checks; the words stay the author's.
27
+
28
+ ## How numbering works
29
+
30
+ Comments are numbered 1..N in document order across reviewers (not per reviewer). The response letter must cite the same global numbers. If the letter uses its own per-reviewer numbering, the numbers will not match and the check says so rather than guessing.
31
+
32
+ ## Tools
33
+
34
+ ### `letter_parse`
35
+
36
+ `{ text? | path?, persist? }` → `{ ok, parse: {comments, reviewers, mode, warnings}, evidenceId?, recordPath? }`.
37
+
38
+ ### `letter_check`
39
+
40
+ `{ comments? | reviewText? | reviewPath?, letterText? | letterPath? }` → `{ ok, coverage, comments, responses, warnings }`.
41
+
42
+ ### `letter_export`
43
+
44
+ `{ comments, responses? | letterText?, title? }` → `{ ok, markdown, coverage }`.
45
+
46
+ ### Error codes
47
+
48
+ `INVALID_INPUT` · `NOT_FOUND` · `PATH_ESCAPE` · `NOT_A_FILE` · `TOO_LARGE` · `UNSUPPORTED_FILE` · `STORE_ERROR`
49
+
50
+ ## Compatibility & install
51
+
52
+ | | |
53
+ |---|---|
54
+ | DeepSeek Harness | **`dsh-v0.2.1-rc.5`** (verified 2026-11-08); peer `>=0.2.1-0 <0.3.0 \|\| >=0.2.2-0 <0.3.0` |
55
+ | Node | `^22.19.0 \|\| >=24.9.0` (tested `24.22.1`), ESM only |
56
+ | Peers | `@perrylink/dsh-research-core ^0.1.0`, `@deepseek-ai/cordis ^4.0.5-alpha.1`, `@deepseek-ai/dsh-tools`, `@deepseek-ai/schemastery ^3.18.5-alpha.1` |
57
+ | Runtime dependencies | **zero** |
58
+
59
+ ```sh
60
+ dsh plugin --profile <name> add @perrylink/dsh-research-core dsh-response-letter
61
+ dsh --profile <name> --dump-config | grep dsh-response-letter
62
+ ```
63
+
64
+ ## Configuration
65
+
66
+ | Key | Default | Meaning |
67
+ |---|---|---|
68
+ | `enabled` | `true` | `false` mounts nothing |
69
+ | `root` | `.response-letter` | store/record root |
70
+ | `workspaceRoot` | `process.cwd()` | paths must resolve inside it |
71
+ | `maxChars` | `1000000` | character cap (fails, never truncates) |
72
+ | `persist` | `true` | store parsed reviews as REP evidence + record |
73
+
74
+ ## Security boundaries
75
+
76
+ - Read-only on review and letter files; writes only under `root`.
77
+ - `realpath` containment rejects symlink escapes.
78
+ - Character cap fails loudly; DOCX/PDF rejected with a conversion hint.
79
+ - Comments are treated as data; any instruction-like text in them is never executed (the plugin has no executor).
80
+
81
+ ## Evaluation
82
+
83
+ **21 tests**: numbered parsing with reviewer headers (including `R1`) and CRLF text, paragraph fallback with warning, empty-text rejection, response extraction, full/partial coverage (missing, short, extra), duplicate numbers and duplicate-export consistency, runtime (valid REP record, file and text paths, traversal/symlink/DOCX/oversize rejection, malformed JSON payloads), tools (schemas, parse→check→export end-to-end, failure branch), plugin contract, package contract.
84
+
85
+ No benchmark is claimed: correctness here is parsing behavior on explicit formats, checked with fixtures; there is no labelled corpus of real review letters.
86
+
87
+ ## Known limitations (v0.1)
88
+
89
+ - The parser expects one comment per numbered line/block; a comment spanning several unnumbered paragraphs is split.
90
+ - Per-reviewer numbering is not auto-remapped; the check reports the mismatch instead.
91
+ - Response quality (tone, evidence) is out of scope.
92
+ - English/Chinese markers only; other languages need new patterns.
93
+
94
+ ## License
95
+
96
+ Apache-2.0. No third-party runtime code.
package/SECURITY.md ADDED
@@ -0,0 +1,19 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ The latest published `0.1.x` release of this package receives security fixes.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Please use GitHub's private vulnerability reporting (Security → Advisories) on
10
+ the repository, or open a minimal issue asking for a private channel if
11
+ advisories are unavailable. Do not include credentials, personal data or
12
+ working exploits in a public issue.
13
+
14
+ ## Scope notes
15
+
16
+ - This package performs local file analysis only unless its README documents a
17
+ network provider; when it does, only the documented hosts are contacted.
18
+ - Inputs are treated as untrusted data: document text is never executed.
19
+ - No secrets are read or written by the package.
@@ -0,0 +1,10 @@
1
+ # Third-party notices
2
+
3
+ This package contains **no third-party runtime code**: `dependencies` is empty.
4
+
5
+ Development-only tooling (TypeScript, Vitest, `@deepseek-ai/*` type packages and
6
+ the shared `@perrylink/dsh-research-core` peer, when present) is not bundled and
7
+ is not distributed in the published tarball.
8
+
9
+ If that ever changes, the affected license texts must be added here before a
10
+ release.
@@ -0,0 +1,14 @@
1
+ # dsh-response-letter bundle patch: mount the review-response tools.
2
+ #
3
+ # Every key below is a Config field (Schemastery schema); invalid values fail the
4
+ # profile load loudly. Local text only; nothing is sent anywhere.
5
+ - insert:
6
+ - id: dsh-response-letter
7
+ name: dsh-response-letter
8
+ config:
9
+ enabled: true
10
+ root: .response-letter
11
+ # Character cap: over-limit fails, never truncates.
12
+ maxChars: 1000000
13
+ # Store parsed reviews as REP evidence + record.
14
+ persist: true
package/lib/check.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Coverage of reviewer comments by a point-by-point response letter.
3
+ *
4
+ * Matching is by the response's cited number. The check reports missing numbers,
5
+ * responses that are too short to be a real answer, responses that cite a number
6
+ * with no matching comment, and duplicate response numbers. It never scores the
7
+ * quality of an answer.
8
+ *
9
+ * @module dsh-response-letter/check
10
+ */
11
+ import type { ParsedResponse, ReviewComment } from './parse.ts';
12
+ /** One finding. */
13
+ export interface CoverageFinding {
14
+ readonly commentNumber: number;
15
+ readonly reviewer?: string;
16
+ readonly status: 'answered' | 'missing' | 'empty' | 'extra';
17
+ readonly detail: string;
18
+ readonly responsePreview?: string;
19
+ }
20
+ /** The coverage result. */
21
+ export interface CoverageResult {
22
+ readonly total: number;
23
+ readonly answered: number;
24
+ readonly missing: number;
25
+ readonly empty: number;
26
+ readonly extra: number;
27
+ /** answered / total, rounded to 4 decimals. */
28
+ readonly coverage: number;
29
+ readonly findings: readonly CoverageFinding[];
30
+ readonly warnings: readonly string[];
31
+ }
32
+ /** Shortest text that counts as an answer (characters). */
33
+ export declare const MIN_RESPONSE_CHARS = 20;
34
+ /**
35
+ * Compare comments with parsed responses.
36
+ * @param comments - parsed reviewer comments.
37
+ * @param responses - parsed responses.
38
+ * @returns coverage, findings and warnings.
39
+ */
40
+ export declare function checkCoverage(comments: readonly ReviewComment[], responses: readonly ParsedResponse[]): CoverageResult;
41
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/D,mBAAmB;AACnB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAA;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAED,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAAE,SAAS,EAAE,SAAS,cAAc,EAAE,GAAG,cAAc,CAgEtH"}
package/lib/check.js ADDED
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Coverage of reviewer comments by a point-by-point response letter.
3
+ *
4
+ * Matching is by the response's cited number. The check reports missing numbers,
5
+ * responses that are too short to be a real answer, responses that cite a number
6
+ * with no matching comment, and duplicate response numbers. It never scores the
7
+ * quality of an answer.
8
+ *
9
+ * @module dsh-response-letter/check
10
+ */
11
+ /** Shortest text that counts as an answer (characters). */
12
+ export const MIN_RESPONSE_CHARS = 20;
13
+ /**
14
+ * Compare comments with parsed responses.
15
+ * @param comments - parsed reviewer comments.
16
+ * @param responses - parsed responses.
17
+ * @returns coverage, findings and warnings.
18
+ */
19
+ export function checkCoverage(comments, responses) {
20
+ if (comments.length === 0)
21
+ throw new RangeError('there are no comments to check');
22
+ const byNumber = new Map();
23
+ for (const response of responses) {
24
+ const list = byNumber.get(response.number) ?? [];
25
+ list.push(response);
26
+ byNumber.set(response.number, list);
27
+ }
28
+ const findings = [];
29
+ const warnings = [];
30
+ let answered = 0;
31
+ let missing = 0;
32
+ let empty = 0;
33
+ for (const [number, list] of byNumber) {
34
+ if (list.length > 1)
35
+ warnings.push(`response number ${number} appears ${list.length} times; the first is used`);
36
+ }
37
+ const commentNumbers = new Set(comments.map(comment => comment.number));
38
+ for (const comment of comments) {
39
+ const list = byNumber.get(comment.number) ?? [];
40
+ if (list.length === 0) {
41
+ missing += 1;
42
+ findings.push({ commentNumber: comment.number, ...(comment.reviewer === '' ? {} : { reviewer: comment.reviewer }), status: 'missing', detail: `no response cites number ${comment.number}` });
43
+ continue;
44
+ }
45
+ const response = list[0];
46
+ if (response.text.trim().length < MIN_RESPONSE_CHARS) {
47
+ empty += 1;
48
+ findings.push({
49
+ commentNumber: comment.number,
50
+ ...(comment.reviewer === '' ? {} : { reviewer: comment.reviewer }),
51
+ status: 'empty',
52
+ detail: `the response is shorter than ${MIN_RESPONSE_CHARS} characters`,
53
+ responsePreview: response.text.slice(0, 80),
54
+ });
55
+ continue;
56
+ }
57
+ answered += 1;
58
+ findings.push({
59
+ commentNumber: comment.number,
60
+ ...(comment.reviewer === '' ? {} : { reviewer: comment.reviewer }),
61
+ status: 'answered',
62
+ detail: 'a numbered response was found',
63
+ responsePreview: response.text.slice(0, 80),
64
+ });
65
+ }
66
+ let extra = 0;
67
+ for (const [number] of byNumber) {
68
+ if (commentNumbers.has(number))
69
+ continue;
70
+ extra += 1;
71
+ findings.push({ commentNumber: number, status: 'extra', detail: `a response cites number ${number}, but no comment has that number` });
72
+ }
73
+ if (missing > 0)
74
+ warnings.push(`${missing} comment(s) have no numbered response`);
75
+ if (empty > 0)
76
+ warnings.push(`${empty} response(s) are shorter than ${MIN_RESPONSE_CHARS} characters`);
77
+ if (extra > 0)
78
+ warnings.push(`${extra} response number(s) do not match any comment`);
79
+ return {
80
+ total: comments.length,
81
+ answered,
82
+ missing,
83
+ empty,
84
+ extra,
85
+ coverage: Number((answered / comments.length).toFixed(4)),
86
+ findings,
87
+ warnings,
88
+ };
89
+ }
90
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0BH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,QAAkC,EAAE,SAAoC;IACpG,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,gCAAgC,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAA;IACpD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;QAChD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnB,QAAQ,CAA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