dsh-cite 0.7.10 → 0.8.0
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 +7 -0
- package/README.en.md +7 -6
- package/README.md +7 -6
- package/docs/WORKBENCH.md +8 -4
- package/lib/citation-errors.js +4 -0
- package/lib/citation-workbench.d.ts +1 -0
- package/lib/citation-workbench.js +16 -2
- package/lib/client.js +1005 -184
- package/lib/tools.d.ts +17 -0
- package/lib/tools.js +19 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.8.0 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
- 新版原生引文工作台包含格式与状态筛选、文献列表和详情三栏,支持在详情复制当前格式的引文或 BibTeX。窄屏可以在列表和详情之间切换。
|
|
6
|
+
- 新增 DOI 核查页,按首次出现的顺序向 Crossref 查询前 50 个唯一 DOI。导入页保留去重预览和冲突恢复,导出页支持按范围检查和下载。
|
|
7
|
+
- The native workbench has panes for format and status filters, the reference list, and details. Copy a formatted citation or BibTeX from the details pane. Narrow layouts let you switch between the list and details.
|
|
8
|
+
- The DOI check tab queries Crossref for the first 50 unique DOIs in order of appearance. The import tab previews duplicates and recovers from save conflicts. The export tab checks and downloads the chosen scope.
|
|
9
|
+
|
|
3
10
|
## 0.7.10 (2026-11-14)
|
|
4
11
|
|
|
5
12
|
- 适配 DSH 0.2.2-rc.3:最低 Harness 版本声明提升至 0.2.2-rc.3,运行时代码未变。
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Cite
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Organize references, check DOIs, and export citations in DeepSeek Harness.**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-cite) [](https://www.npmjs.com/package/dsh-cite) [](https://www.npmjs.com/package/dsh-cite)
|
|
8
8
|
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
20
|
+
- Filter, search, and inspect references in a three-pane library. Copy a formatted citation or its BibTeX entry.
|
|
21
|
+
- Preview duplicates and missing fields locally before importing a DOI list or BibTeX.
|
|
22
|
+
- Check manuscript DOIs against Crossref, or fill gaps in saved references and review differences.
|
|
23
|
+
- Export selected references or the entire library. Download a full backup with the original sources.
|
|
23
24
|
|
|
24
25
|
## Install
|
|
25
26
|
|
|
@@ -58,9 +59,9 @@ Check updates at the bottom of the workbench or native plugin details. Automatic
|
|
|
58
59
|
- [Release notes](https://github.com/STARDUSTLC666/dsh-cite/blob/master/CHANGELOG.md)
|
|
59
60
|
- [Validation scope and history](https://github.com/STARDUSTLC666/dsh-cite/blob/master/docs/VALIDATION.md)
|
|
60
61
|
|
|
61
|
-
## Feedback
|
|
62
|
+
## Feedback
|
|
62
63
|
|
|
63
|
-
If the plugin helps, a Star makes it easier for others to discover. Report problems or suggest improvements in [Issues](https://github.com/STARDUSTLC666/dsh-cite/issues)
|
|
64
|
+
If the plugin helps, a Star makes it easier for others to discover. Report problems or suggest improvements in [Issues](https://github.com/STARDUSTLC666/dsh-cite/issues). Include versions and reproduction steps, and remove credentials from reports.
|
|
64
65
|
|
|
65
66
|
## License
|
|
66
67
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Cite
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**在 DeepSeek Harness 中整理文献、核查 DOI 并导出引文。**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-cite) [](https://www.npmjs.com/package/dsh-cite) [](https://www.npmjs.com/package/dsh-cite)
|
|
8
8
|
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
## 功能
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
20
|
+
- 在三栏文献库筛选、搜索和查看文献,复制引文或 BibTeX。
|
|
21
|
+
- 导入 DOI 列表或 BibTeX 前,在本地预览重复项与缺失字段。
|
|
22
|
+
- 通过 Crossref 核查文稿中的 DOI,或补全已存文献的空字段并查看差异。
|
|
23
|
+
- 导出所选文献或全库引文,下载包含原始来源的完整备份。
|
|
23
24
|
|
|
24
25
|
## 安装
|
|
25
26
|
|
|
@@ -58,9 +59,9 @@ dsh plugin --profile desktop add dsh-cite
|
|
|
58
59
|
- [更新记录](https://github.com/STARDUSTLC666/dsh-cite/blob/master/CHANGELOG.md)
|
|
59
60
|
- [验证范围与历史](https://github.com/STARDUSTLC666/dsh-cite/blob/master/docs/VALIDATION.md)
|
|
60
61
|
|
|
61
|
-
##
|
|
62
|
+
## 反馈
|
|
62
63
|
|
|
63
|
-
如果插件帮到了你,欢迎 Star,让更多人发现它。问题和建议请提交 [Issues](https://github.com/STARDUSTLC666/dsh-cite/issues)
|
|
64
|
+
如果插件帮到了你,欢迎 Star,让更多人发现它。问题和建议请提交 [Issues](https://github.com/STARDUSTLC666/dsh-cite/issues)。反馈时附上版本与复现步骤,并移除凭据。
|
|
64
65
|
|
|
65
66
|
## License
|
|
66
67
|
|
package/docs/WORKBENCH.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# dsh-cite 工作台 / Workbench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
引文库分为格式与状态筛选、文献列表、详情三栏。可按 DOI、标题、作者或引用键搜索,并在详情复制当前格式的引文或 BibTeX。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The library has three panes for format and status filters, references, and details. Search by DOI, title, author, or citation key. Copy the formatted citation or BibTeX from the details pane.
|
|
6
6
|
|
|
7
7
|
## 使用 / Use
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ The UI follows host language and theme without translating user content. Narrow
|
|
|
16
16
|
|
|
17
17
|
## 导出前检查与冲突 / Export checks and conflicts
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
「导出备份」支持切换「全部文献 / 仅所选」。切换范围会更新文献条数、引文预览,以及缺少标题、作者或年份的条目数。完整备份始终包含全库与原始输入。
|
|
20
20
|
|
|
21
21
|
The downloads tab shows a pre-export check before the links: switch between the entire library and the current selection, read the entry count, citation style, counts of entries missing title/authors/year, and the note that full backup always covers the whole library with original sources. Counts come from the local library and recompute when the scope changes; an empty library explains itself instead of showing inert buttons.
|
|
22
22
|
|
|
@@ -24,9 +24,13 @@ The downloads tab shows a pre-export check before the links: switch between the
|
|
|
24
24
|
|
|
25
25
|
A concurrent-save conflict is shown as an error status that names what happened, keeps the input, and offers one recovery path (preview the current input again). Saving stays disabled with a stated reason, so the same stale revision cannot be resubmitted.
|
|
26
26
|
|
|
27
|
+
「DOI 核查」页复用 `cite_check` 的校验逻辑。点击核查后,按首次出现顺序向 Crossref 查询前 50 个唯一 DOI。核查以只读方式运行。
|
|
28
|
+
|
|
29
|
+
The DOI check tab uses the same validation as `cite_check` to look up the first 50 unique DOIs in order of appearance. Checking is read-only.
|
|
30
|
+
|
|
27
31
|
## 源码 / Source
|
|
28
32
|
|
|
29
|
-
编辑 templates/client.js、templates/panels/*.js
|
|
33
|
+
编辑 templates/client.js、templates/panels/*.js 和 templates/workbench.css,运行 pnpm run build。lib/client.js 是确定性产物,请随源码提交。公共组件的规范源位于 dsh-suite/ui/workbench-ui.js,Suite 的同步脚本显式分发副本;单个仓库可独立构建和安装。
|
|
30
34
|
|
|
31
35
|
Edit the template sources and run pnpm run build. Commit generated lib/client.js with source changes. The vendored UI has no Suite runtime dependency.
|
|
32
36
|
|
package/lib/citation-errors.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/** English UI messages; bibliographic content and original source text stay unchanged. */
|
|
2
2
|
export function englishCitationError(raw) {
|
|
3
|
+
if (raw === '请粘贴待核查的文本。')
|
|
4
|
+
return 'Paste text to check.';
|
|
5
|
+
if (raw === '核查文本不能超过 256 KiB。')
|
|
6
|
+
return 'Check up to 256 KiB of text at a time.';
|
|
3
7
|
if (/^Crossref.*超时/.test(raw))
|
|
4
8
|
return 'Crossref timed out. Retry later; your local entries were preserved.';
|
|
5
9
|
if (/^Crossref 请求失败:/.test(raw))
|
|
@@ -94,6 +94,7 @@ export declare class CitationWorkbench {
|
|
|
94
94
|
job(id: unknown): EnrichmentJob;
|
|
95
95
|
cancel(id: unknown): EnrichmentJob;
|
|
96
96
|
dispose(): void;
|
|
97
|
+
private check;
|
|
97
98
|
export(kind: unknown, style: unknown, lang: unknown, rawIds?: unknown): Promise<{
|
|
98
99
|
filename: string;
|
|
99
100
|
type: string;
|
|
@@ -3,7 +3,8 @@ import { lookupDoi } from './crossref.js';
|
|
|
3
3
|
import { buildBibtex, buildCitation, readStyle } from './format.js';
|
|
4
4
|
import { parseCitationInput } from './citation-parser.js';
|
|
5
5
|
import { CitationStore } from './citation-store.js';
|
|
6
|
-
import { LibraryConflict, candidateKey, citationId, normalizeWork, readImportInput, readSelection, workWarnings } from './citation-model.js';
|
|
6
|
+
import { LibraryConflict, MAX_INPUT_BYTES, candidateKey, citationId, normalizeWork, readImportInput, readSelection, workWarnings } from './citation-model.js';
|
|
7
|
+
import { checkDois, MAX_DOI_CHECKS } from './tools.js';
|
|
7
8
|
import { englishCitationError } from './citation-errors.js';
|
|
8
9
|
const message = (e) => (e instanceof Error ? e.message : String(e)).slice(0, 1800);
|
|
9
10
|
const summary = (state) => ({ revision: state.revision, entries: state.entries.map(e => ({ ...e, warnings: workWarnings(e.work) })), sources: state.sources.map(({ text: _text, ...s }) => s) });
|
|
@@ -193,6 +194,15 @@ export class CitationWorkbench {
|
|
|
193
194
|
j.controller.abort(); return structuredClone(j.view); }
|
|
194
195
|
dispose() { this.lifetime.abort(new Error('插件已卸载。')); for (const j of this.jobs.values())
|
|
195
196
|
j.controller.abort(); }
|
|
197
|
+
async check(text, signal) {
|
|
198
|
+
this.live();
|
|
199
|
+
if (typeof text !== 'string' || !text.trim())
|
|
200
|
+
throw new Error('请粘贴待核查的文本。');
|
|
201
|
+
if (Buffer.byteLength(text) > MAX_INPUT_BYTES)
|
|
202
|
+
throw new Error('核查文本不能超过 256 KiB。');
|
|
203
|
+
const { count, results } = await checkDois(text, this.cfg, MAX_DOI_CHECKS, this.fetchImpl, AbortSignal.any([signal, this.lifetime.signal]));
|
|
204
|
+
return { count, results: results.map(row => row.error ? { ...row, errorEn: englishCitationError(row.error) } : row) };
|
|
205
|
+
}
|
|
196
206
|
async export(kind, style, lang, rawIds) {
|
|
197
207
|
this.live();
|
|
198
208
|
const state = await this.store.read(), ids = rawIds === undefined ? undefined : readSelection(rawIds);
|
|
@@ -260,7 +270,11 @@ export class CitationWorkbench {
|
|
|
260
270
|
const text = await request.text();
|
|
261
271
|
if (Buffer.byteLength(text) > 2 * 1024 * 1024)
|
|
262
272
|
throw new Error('请求超过容量限制,请拆分输入。');
|
|
263
|
-
|
|
273
|
+
const input = JSON.parse(text);
|
|
274
|
+
const value = input?.action === 'check'
|
|
275
|
+
? await this.check(input.text, request.signal)
|
|
276
|
+
: await this.dispatch(input, request.signal);
|
|
277
|
+
return Response.json({ ok: true, value }, { headers: { 'cache-control': 'no-store' } });
|
|
264
278
|
}
|
|
265
279
|
catch (e) {
|
|
266
280
|
return Response.json({ ok: false, message: message(e), messageEn: englishCitationError(message(e)) }, { status: e instanceof LibraryConflict ? 409 : 400, headers: { 'cache-control': 'no-store' } });
|