dsh-cite 0.7.10 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.8.1 (2026-11-17)
4
+
5
+ - 在工作台单独检查和安装兼容版本。自动安装默认关闭,可为该插件开启空闲时的稳定补丁更新。
6
+ - Check and install compatible versions separately from the workbench. Automatic installation is off by default. Enable it for this plugin to apply stable patches while idle.
7
+
8
+ ## 0.8.0 (2026-11-16)
9
+
10
+ - 新版原生引文工作台包含格式与状态筛选、文献列表和详情三栏,支持在详情复制当前格式的引文或 BibTeX。窄屏可以在列表和详情之间切换。
11
+ - 新增 DOI 核查页,按首次出现的顺序向 Crossref 查询前 50 个唯一 DOI。导入页保留去重预览和冲突恢复,导出页支持按范围检查和下载。
12
+ - 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.
13
+ - 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.
14
+
3
15
  ## 0.7.10 (2026-11-14)
4
16
 
5
17
  - 适配 DSH 0.2.2-rc.3:最低 Harness 版本声明提升至 0.2.2-rc.3,运行时代码未变。
package/README.en.md CHANGED
@@ -2,24 +2,28 @@
2
2
 
3
3
  # Cite
4
4
 
5
- **Turn scattered DOIs and BibTeX into a reference library.**
5
+ **Organize references, check DOIs, and export citations in DeepSeek Harness.**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/dsh-cite)](https://www.npmjs.com/package/dsh-cite) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-cite-downloads.svg)](https://www.npmjs.com/package/dsh-cite) [![total downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-cite-total-downloads.svg)](https://www.npmjs.com/package/dsh-cite)
8
8
 
9
9
  **[Install](#install) · [Workflow](#start-using-it) · [Full guide](https://github.com/STARDUSTLC666/dsh-cite/blob/master/docs/REFERENCE.en.md)**
10
10
 
11
- <picture>
12
- <source media="(prefers-color-scheme: dark) and (max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-mobile-dark.svg">
13
- <source media="(max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-mobile-light.svg">
14
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-dark.svg">
15
- <img src="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-light.svg" alt="Turn scattered DOIs and BibTeX into a reference library. · workflow illustration" width="100%">
16
- </picture>
11
+ ## Screenshots
12
+
13
+ [![Three-pane reference library with a citation preview and BibTeX entry](docs/assets/screenshots/library-en.jpg)](docs/assets/screenshots/library-en.jpg)
14
+
15
+ | Import preview and deduplication | DOI check |
16
+ | --- | --- |
17
+ | [![Import preview flags DOIs already in the library or repeated in the batch](docs/assets/screenshots/import-en.jpg)](docs/assets/screenshots/import-en.jpg) | [![Crossref lookup results for three public DOIs](docs/assets/screenshots/doi-check-en.jpg)](docs/assets/screenshots/doi-check-en.jpg) |
18
+
19
+ *Captured with `dsh-cite 0.8.0` running in Harness Web `0.2.2-rc.3`.*
17
20
 
18
21
  ## Features
19
22
 
20
- - Inspect duplicates and missing fields before saving.
21
- - Explicitly enrich through Crossref and inspect differences.
22
- - Export reference text, BibTeX or a full backup with sources.
23
+ - Filter, search, and inspect references in a three-pane library. Copy a formatted citation or its BibTeX entry.
24
+ - Preview duplicates and missing fields locally before importing a DOI list or BibTeX.
25
+ - Check manuscript DOIs against Crossref, or fill gaps in saved references and review differences.
26
+ - Export selected references or the entire library. Download a full backup with the original sources.
23
27
 
24
28
  ## Install
25
29
 
@@ -33,6 +37,13 @@ For the web profile, replace `desktop` with `web`. Restart that DSH profile afte
33
37
 
34
38
  ## Start using it
35
39
 
40
+ <picture>
41
+ <source media="(prefers-color-scheme: dark) and (max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-mobile-dark.svg">
42
+ <source media="(max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-mobile-light.svg">
43
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-dark.svg">
44
+ <img src="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-en-light.svg" alt="Turn scattered DOIs and BibTeX into a reference library. · workflow illustration" width="100%">
45
+ </picture>
46
+
36
47
  1. Open Citations in the sidebar and prepare DOI entries or a BibTeX file.
37
48
  2. Preview the import locally; inspect entries, duplicates and fields before saving selected references.
38
49
  3. Select entries and explicitly request Crossref enrichment when needed, then review the returned fields.
package/README.md CHANGED
@@ -2,24 +2,28 @@
2
2
 
3
3
  # Cite
4
4
 
5
- **把零散 DOI 和 BibTeX 整理成可用的文献库。**
5
+ **在 DeepSeek Harness 中整理文献、核查 DOI 并导出引文。**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/dsh-cite)](https://www.npmjs.com/package/dsh-cite) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-cite-downloads.svg)](https://www.npmjs.com/package/dsh-cite) [![total downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-cite-total-downloads.svg)](https://www.npmjs.com/package/dsh-cite)
8
8
 
9
9
  **[安装使用](#安装) · [使用流程](#开始使用) · [完整说明](https://github.com/STARDUSTLC666/dsh-cite/blob/master/docs/REFERENCE.zh.md)**
10
10
 
11
- <picture>
12
- <source media="(prefers-color-scheme: dark) and (max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-mobile-dark.svg">
13
- <source media="(max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-mobile-light.svg">
14
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-dark.svg">
15
- <img src="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-light.svg" alt="把零散 DOI 和 BibTeX 整理成可用的文献库。 · 流程示意" width="100%">
16
- </picture>
11
+ ## 界面截图
12
+
13
+ [![三栏文献库显示文献列表、引文预览和 BibTeX](docs/assets/screenshots/library-zh.jpg)](docs/assets/screenshots/library-zh.jpg)
14
+
15
+ | 导入预览与去重 | DOI 核查 |
16
+ | --- | --- |
17
+ | [![导入预览标出库内重复和同批重复的 DOI](docs/assets/screenshots/import-zh.jpg)](docs/assets/screenshots/import-zh.jpg) | [![Crossref 返回三条公开 DOI 的核查结果](docs/assets/screenshots/doi-check-zh.jpg)](docs/assets/screenshots/doi-check-zh.jpg) |
18
+
19
+ *截图来自 Harness Web `0.2.2-rc.3` 中运行的 `dsh-cite 0.8.0`。*
17
20
 
18
21
  ## 功能
19
22
 
20
- - 导入前查看重复项与缺失字段。
21
- - 主动从 Crossref 补全,核对差异后保留。
22
- - 导出引用文本、BibTeX 或包含来源的完整备份。
23
+ - 在三栏文献库筛选、搜索和查看文献,复制引文或 BibTeX。
24
+ - 导入 DOI 列表或 BibTeX 前,在本地预览重复项与缺失字段。
25
+ - 通过 Crossref 核查文稿中的 DOI,或补全已存文献的空字段并查看差异。
26
+ - 导出所选文献或全库引文,下载包含原始来源的完整备份。
23
27
 
24
28
  ## 安装
25
29
 
@@ -33,6 +37,13 @@ dsh plugin --profile desktop add dsh-cite
33
37
 
34
38
  ## 开始使用
35
39
 
40
+ <picture>
41
+ <source media="(prefers-color-scheme: dark) and (max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-mobile-dark.svg">
42
+ <source media="(max-width: 640px)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-mobile-light.svg">
43
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-dark.svg">
44
+ <img src="https://raw.githubusercontent.com/STARDUSTLC666/dsh-cite/master/docs/assets/intro/workflow-zh-light.svg" alt="把零散 DOI 和 BibTeX 整理成可用的文献库。 · 流程示意" width="100%">
45
+ </picture>
46
+
36
47
  1. 从左侧栏打开“引文库”,准备 DOI 列表或 BibTeX 文件。
37
48
  2. 先做本地导入预览,检查条目、重复项和字段,再保存选中的文献。
38
49
  3. 需要联网补全时,选择条目后主动执行 Crossref 补全,核对返回字段。
package/docs/WORKBENCH.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # dsh-cite 工作台 / Workbench
2
2
 
3
- 引文主工作台,文献列表、元数据、来源与引文预览分栏;搜索与导入后的选中状态一致。
3
+ 引文库分为格式与状态筛选、文献列表、详情三栏。可按 DOI、标题、作者或引用键搜索,并在详情复制当前格式的引文或 BibTeX。
4
4
 
5
- Reference workbench with list/detail metadata, sources and matching citation previews after search or import.
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 与 templates/workbench-ui.js,运行 pnpm run build。lib/client.js 是确定性产物,请随源码提交。公共组件的规范源位于 dsh-suite/ui/workbench-ui.js,Suite 的同步脚本显式分发副本;单个仓库可独立构建和安装。
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
 
@@ -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
- return Response.json({ ok: true, value: await this.dispatch(JSON.parse(text), request.signal) }, { headers: { 'cache-control': 'no-store' } });
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' } });