papersearch 0.4.6 → 0.4.8

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 (51) hide show
  1. package/.env.example +3 -0
  2. package/README.en.md +36 -12
  3. package/README.md +36 -12
  4. package/assets/logo.svg +15 -0
  5. package/assets/overview.en.png +0 -0
  6. package/assets/overview.png +0 -0
  7. package/assets/progress-capsule.en.png +0 -0
  8. package/assets/progress-capsule.png +0 -0
  9. package/carsi/paper_search_carsi/assets/capsule.html +23 -6
  10. package/carsi/paper_search_carsi/assets/icon-32.png +0 -0
  11. package/carsi/paper_search_carsi/assets/icon-512.png +0 -0
  12. package/carsi/paper_search_carsi/assets/icon-64.png +0 -0
  13. package/carsi/paper_search_carsi/assets/icon.svg +13 -16
  14. package/carsi/paper_search_carsi/assets/quiet-browser/api.js +24 -1
  15. package/carsi/paper_search_carsi/cli.py +27 -0
  16. package/carsi/paper_search_carsi/engine/batch.py +5 -1
  17. package/carsi/paper_search_carsi/engine/batch_diagnostics.py +50 -35
  18. package/carsi/paper_search_carsi/engine/batch_login.py +10 -6
  19. package/carsi/paper_search_carsi/engine/batch_waits.py +13 -2
  20. package/carsi/paper_search_carsi/engine/bridge.py +5 -0
  21. package/carsi/paper_search_carsi/engine/page_activity.py +14 -0
  22. package/carsi/paper_search_carsi/failure_export.py +239 -0
  23. package/carsi/paper_search_carsi/issues.py +8 -6
  24. package/carsi/paper_search_carsi/page_snapshot.py +64 -0
  25. package/carsi/paper_search_carsi/progress_view.py +7 -6
  26. package/carsi/paper_search_carsi/report_sanitizer.py +248 -0
  27. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +1 -1
  28. package/dist/cli.js +56 -5
  29. package/dist/cli.js.map +1 -1
  30. package/dist/config/ConfigService.d.ts +1 -1
  31. package/dist/config/ConfigService.d.ts.map +1 -1
  32. package/dist/config/ConfigService.js +1 -0
  33. package/dist/config/ConfigService.js.map +1 -1
  34. package/dist/management/failures/exportReport.d.ts +20 -0
  35. package/dist/management/failures/exportReport.d.ts.map +1 -0
  36. package/dist/management/failures/exportReport.js +73 -0
  37. package/dist/management/failures/exportReport.js.map +1 -0
  38. package/dist/management/failures/index.d.ts +20 -0
  39. package/dist/management/failures/index.d.ts.map +1 -1
  40. package/dist/management/failures/index.js +69 -43
  41. package/dist/management/failures/index.js.map +1 -1
  42. package/dist/management/updates/index.d.ts +37 -0
  43. package/dist/management/updates/index.d.ts.map +1 -0
  44. package/dist/management/updates/index.js +185 -0
  45. package/dist/management/updates/index.js.map +1 -0
  46. package/package.json +2 -1
  47. package/skills/paper-search/SKILL.md +3 -1
  48. package/skills/paper-search/references/browser-download.md +17 -4
  49. package/skills/paper-search/references/carsi-setup.md +1 -1
  50. package/skills/paper-search/references/cli-contract.md +2 -1
  51. package/skills/paper-search/references/management-layer.md +8 -0
package/.env.example CHANGED
@@ -185,6 +185,9 @@ PAPER_SEARCH_CARSI_EXECUTABLE=
185
185
  # ==============================================================================
186
186
  NODE_ENV=production
187
187
  LOG_LEVEL=info
188
+ # CLI update checks/notices (default enabled; exact false disables).
189
+ # This is separate from capsule/system notifications.
190
+ # PAPER_SEARCH_UPDATE_NOTIFY=false
188
191
 
189
192
  # Google Scholar is a best-effort HTML source and is intentionally excluded
190
193
  # from `--sources all`. Configure this only with an authorized proxy when the
package/README.en.md CHANGED
@@ -1,8 +1,19 @@
1
- # PaperSearch
1
+ <p align="center">
2
+ <img src="assets/logo.svg" width="112" alt="PaperSearch logo">
3
+ </p>
2
4
 
3
- [简体中文](README.md) | English
5
+ <h1 align="center">PaperSearch</h1>
4
6
 
5
- **Let your AI tools search the literature, verify citations, and download full texts and supplementary files.**
7
+ <p align="center"><b>Let your AI tools search the literature, verify citations, and download full texts and supplementary files.</b></p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/papersearch"><img src="https://img.shields.io/npm/v/papersearch" alt="npm"></a>
11
+ <img src="https://img.shields.io/node/v/papersearch" alt="Node.js">
12
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
13
+ <a href="https://linux.do"><img src="https://img.shields.io/badge/LinuxDo-community-1f6feb" alt="LinuxDo"></a>
14
+ </p>
15
+
16
+ <p align="center"><a href="README.md">简体中文</a> | English</p>
6
17
 
7
18
  PaperSearch provides the `paper-search` command and a bundled Skill. Once installed, Claude Code, Codex, Cursor, Kimi Code, Qwen Code, CodeBuddy, TRAE and other AI tools that can run local commands can search more than 20 scholarly sources for you, verify DOIs, and download and organize paper PDFs and supplementary files. You can also use it directly in a terminal or a script; output is JSON by default.
8
19
 
@@ -11,10 +22,7 @@ PaperSearch provides the `paper-search` command and a bundled Skill. Once instal
11
22
  - **Every paper checked**: each PDF's first page is checked against the DOI and title; a file of another article is not counted as a success.
12
23
  - **Ready to use**: one folder per paper named journal_year_title, with the main text and supplementary files together; papers not downloaded come with a reason.
13
24
 
14
- [![npm](https://img.shields.io/npm/v/papersearch)](https://www.npmjs.com/package/papersearch)
15
- ![Node.js](https://img.shields.io/node/v/papersearch)
16
- ![License](https://img.shields.io/badge/license-MIT-blue.svg)
17
- [![LinuxDo](https://img.shields.io/badge/LinuxDo-community-1f6feb)](https://linux.do)
25
+ <p align="center"><img src="assets/overview.en.png" width="900" alt="What PaperSearch does: search papers, verify and trace citations, journal metrics, text snippets, full texts and supplementary files"></p>
18
26
 
19
27
  [What you get](#what-you-get) | [Quick start](#quick-start) | [Common tasks](#common-tasks) | [How it works](#how-it-works) | [Institutional download extension](#institutional-download-extension) | [Search sources](#search-sources) | [Configuration](#configuration) | [Agent Skill](#agent-skill) | [Commands](#commands) | [Troubleshooting](#troubleshooting)
20
28
 
@@ -38,7 +46,9 @@ downloads/
38
46
  └── diagnostics/ run records, file manifests, screenshots
39
47
  ```
40
48
 
41
- <!-- Screenshot: the institutional download progress window. Keep images outside docs/ (e.g. assets/progress-window.png); docs/ is not published to the public repository -->
49
+ During institutional downloads, a progress capsule in a corner of the screen shows progress, turns amber when you need to sign in or complete a verification, and opens into a card when you hover over it (its interface is in Chinese).
50
+
51
+ <p align="center"><img src="assets/progress-capsule.en.png" width="820" alt="Progress capsule: downloading, sign in to your school, hover to expand, settings"></p>
42
52
 
43
53
  ## Quick start
44
54
 
@@ -155,9 +165,9 @@ paper-search carsi status --format text
155
165
  - Downloads show a small progress capsule in a corner of the screen: progress, whether the main text or the supplementary files are being fetched, and the publisher; it turns amber with a gentle breathing glow and sends a system notification, if enabled, when you need to sign in or complete a verification. Click the reminder to switch to the current task’s download browser. Hover to open it: skip this paper, mark the journal or publisher as no access, stop the whole task, report a problem, change wait times and the default download folder (the gear at the top right), or minimize it (–). Drag the pill or a non-control area of the expanded card to move it. On the school's login page a paper waits up to 3 minutes by default; anywhere else (human checks, publisher pages, ...) it ends after 1 minute.
156
166
  - The default download browser keeps running in the background without requesting foreground focus on startup, clicks, or navigation. It does not automatically minimize or hide its window. The capsule alerts you when intervention is needed; click the reminder to switch to the browser when ready. A completed check with no listed supplementary files is not a failure. Incomplete sign-in, unsupported discovery, and download failures remain distinct results.
157
167
  - Choose or type the default download folder in capsule settings, or run `paper-search config set DEFAULT_DOWNLOAD_PATH "/absolute/path/papers"`. New tasks use the saved folder; `--save-path` or `savePath` overrides it for one task. A running batch keeps its original folder.
158
- - Current source (not yet released): capsule settings include “页面持续无进展” (page inactivity), defaulting to 30 seconds, adjustable from 1 to 600 seconds, with a restore-default action. School sign-in prompts appear immediately. Other pages prompt with an amber breathing glow only after making no progress for the selected interval. Automatic passage stays quiet, resumed progress clears the reminder, and active main-document navigation stays quiet within the existing page timeout. Receiving file data does not count as a stalled page. This setting changes the reminder delay without extending page timeouts.
159
- - Current source (not yet released): typing, selecting or clicking a control in the dedicated sign-in page, or taking over through the capsule, pauses the remaining sign-in budget, including pauses between inputs. The timer resumes after leaving the manual sign-in step; an untouched sign-in still times out.
160
- - Current source (not yet released): macOS notifications use PaperSearch’s name and icon. Notification clicks share the capsule reminder’s action for restoring the current task’s browser. The initial extension setup offers a notification choice; new configurations default to off, and upgrades preserve existing preferences. The System notifications switch in the capsule’s settings saves immediately. Turning it off keeps the amber reminder. No separate notification tool is required; enabled notifications still follow macOS notification permissions and Focus settings.
168
+ - capsule settings include “页面持续无进展” (page inactivity), defaulting to 30 seconds, adjustable from 1 to 600 seconds, with a restore-default action. School sign-in prompts appear immediately. Other pages prompt with an amber breathing glow only after making no progress for the selected interval. Automatic passage stays quiet, resumed progress clears the reminder, and active main-document navigation stays quiet within the existing page timeout. Receiving file data does not count as a stalled page. This setting changes the reminder delay without extending page timeouts.
169
+ - typing, selecting or clicking a control in the dedicated sign-in page, or taking over through the capsule, pauses the remaining sign-in budget, including pauses between inputs. The timer resumes after leaving the manual sign-in step; an untouched sign-in still times out.
170
+ - macOS notifications use PaperSearch’s name and icon. Notification clicks share the capsule reminder’s action for restoring the current task’s browser. The initial extension setup offers a notification choice; new configurations default to off, and upgrades preserve existing preferences. The System notifications switch in the capsule’s settings saves immediately. Turning it off keeps the amber reminder. No separate notification tool is required; enabled notifications still follow macOS notification permissions and Focus settings.
161
171
  - Which publishers' main texts and supplementary files it can fetch is in the [publisher support table](skills/paper-search/references/publisher-support.md) (Chinese). Both have been fetched from Elsevier, Wiley, Springer Nature, OUP, Wolters Kluwer, Taylor & Francis, Sage, ACS, NEJM, ASCE, Dove and others; supplementary files from ASH, Thieme, PLOS, Copernicus, Annual Reviews, IOP, AMS, APS, Optica, IEEE, World Scientific, MDPI and Frontiers, as well as Figshare files linked to a paper, have also been fetched; remaining attachment routes are still being completed; sites not in the table are tried with the shared rules.
162
172
  - `paper-search carsi update` updates the extension after a PaperSearch upgrade; `paper-search carsi uninstall` removes it (keeping the browser and the school settings by default).
163
173
  - Windows: if PowerShell blocks `npm.ps1`, use `npm.cmd` or Command Prompt; downloads must run in a desktop session, as a browser window cannot open from SSH or a system service.
@@ -246,6 +256,18 @@ Run `npm root -g` to locate the global npm directory; the bundled Skill is under
246
256
  - **Auto-update after upgrades**: Skills installed through the built-in targets are updated on the first `paper-search` run after an upgrade (other than `skills` and `setup`): only where they were installed; replaced files are backed up under `~/.local/share/paper-search-cli/skill-backups/`; one line on stderr says what changed. With no Skill installed in those locations, it says once how to install it. To turn it off: `paper-search config set PAPER_SEARCH_SKILL_AUTO_UPDATE false`.
247
257
  - `paper-search doctor` shows Skill locations and version status for the built-in installation targets.
248
258
 
259
+ ### Update notices (since 0.4.8)
260
+
261
+ When npm has a newer stable version, ordinary invocations show the installed and latest versions and an upgrade command. Checks run alongside online tasks and cache successful results for 24 hours. Network failures do not affect paper tasks; unfinished checks are cancelled when the command ends. Notices go to stderr, preserving stdout JSON. Offline management commands use only cached results; CI, help and configuration commands do not show automatic notices.
262
+
263
+ ```bash
264
+ paper-search update check --format text
265
+ paper-search config set PAPER_SEARCH_UPDATE_NOTIFY false # Disable automatic checks and notices
266
+ paper-search config set PAPER_SEARCH_UPDATE_NOTIFY true # Enable them again
267
+ ```
268
+
269
+ Updates are never installed automatically. Installed Skills sync under the existing rules after a CLI upgrade; update the institutional extension separately with `paper-search carsi update`. This setting is independent of capsule/system notifications.
270
+
249
271
  ## Commands
250
272
 
251
273
  | Command | Use |
@@ -255,6 +277,7 @@ Run `npm root -g` to locate the global npm directory; the bundled Skill is under
255
277
  | `paper-search download` | Download the PDF of a verified paper |
256
278
  | `paper-search run <tool>` | Call one tool exactly, with `--arg` or `--json-args` |
257
279
  | `paper-search failures` | Why downloads failed, summarized |
280
+ | `paper-search update check` | Check the stable npm release (since 0.4.8) |
258
281
  | `paper-search carsi` | Install, check, update or remove the institutional download extension |
259
282
  | `paper-search setup` / `config` | Configure keys, the Skill and the extension |
260
283
  | `paper-search doctor` | Health check: configuration, available features, Skill and extension status |
@@ -280,7 +303,8 @@ Commands print JSON by default; `--pretty` formats it and `--format text` prints
280
303
 
281
304
  - Next: steadier batch downloads and smoother installs on new computers; beyond PDFs, a full-text package (the original XML/HTML, Markdown and the figures). See the [roadmap](docs/ROADMAP.zh.md) (Chinese).
282
305
  - How it works inside and where the code is: [architecture](docs/ARCHITECTURE.zh.md) (Chinese).
283
- - A download failed, or you want a publisher supported: open an issue with the output of `paper-search failures --format text` (remove anything you do not want to make public first).
306
+ - For failed downloads or publisher requests, use the download-failure issue template and provide the version, OS, website and DOI.
307
+ - New in 0.4.8: `paper-search failures --export ./failure-report.zip` exports institutional failures from the latest run, including saved main texts with incomplete supplements. Add `--run <run-id> --doi <DOI>` to select a paper. Review `summary.md`, HTML and images for personal information before attaching the ZIP manually. Export sanitizes copies without modifying originals, retrying downloads or uploading anything. Missing HTML in older records is explicitly reported. If your installed version lacks this command, report the version and symptoms without uploading raw diagnostics.
284
308
  - To add publisher rules yourself: see [carsi/CONTRIBUTING.md](carsi/CONTRIBUTING.md).
285
309
 
286
310
  ## Use responsibly
package/README.md CHANGED
@@ -1,8 +1,19 @@
1
- # PaperSearch
1
+ <p align="center">
2
+ <img src="assets/logo.svg" width="112" alt="PaperSearch 图标">
3
+ </p>
2
4
 
3
- 简体中文 | [English](README.en.md)
5
+ <h1 align="center">PaperSearch</h1>
4
6
 
5
- **让 AI 帮你查文献、核对引用、下载全文和补充材料。**
7
+ <p align="center"><b>让 AI 帮你查文献、核对引用、下载全文和补充材料。</b></p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/papersearch"><img src="https://img.shields.io/npm/v/papersearch" alt="npm"></a>
11
+ <img src="https://img.shields.io/node/v/papersearch" alt="Node.js">
12
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
13
+ <a href="https://linux.do"><img src="https://img.shields.io/badge/LinuxDo-community-1f6feb" alt="LinuxDo"></a>
14
+ </p>
15
+
16
+ <p align="center">简体中文 | <a href="README.en.md">English</a></p>
6
17
 
7
18
  PaperSearch 提供 `paper-search` 命令和一份随包 Skill。装好后,Claude Code、Codex、Cursor、Kimi Code、Qwen Code、CodeBuddy、TRAE 等支持本机命令调用的 AI 工具,就能替你检索 20 多个学术数据源、核对 DOI,把论文的 PDF 和补充材料下载下来并整理好。你也可以在终端或脚本里直接使用,输出默认是 JSON。
8
19
 
@@ -11,10 +22,7 @@ PaperSearch 提供 `paper-search` 命令和一份随包 Skill。装好后,Clau
11
22
  - **每一篇都核对过**:逐个核对 PDF 首页的 DOI 和题名,不是这篇文章的不算成功。
12
23
  - **结果直接能用**:按“期刊_年份_标题”建文件夹,正文和补充材料放在一起;没下到的篇目说明原因。
13
24
 
14
- [![npm](https://img.shields.io/npm/v/papersearch)](https://www.npmjs.com/package/papersearch)
15
- ![Node.js](https://img.shields.io/node/v/papersearch)
16
- ![License](https://img.shields.io/badge/license-MIT-blue.svg)
17
- [![LinuxDo](https://img.shields.io/badge/LinuxDo-community-1f6feb)](https://linux.do)
25
+ <p align="center"><img src="assets/overview.png" width="900" alt="PaperSearch 能做的事:检索论文、核验与引文、期刊指标、正文片段、下载全文和补充材料"></p>
18
26
 
19
27
  [效果](#效果) | [快速开始](#快速开始) | [常见任务](#常见任务) | [工作方式](#工作方式) | [机构下载扩展](#机构下载扩展) | [检索来源](#检索来源) | [配置](#配置) | [Agent Skill](#agent-skill) | [命令](#命令) | [排障](#排障)
20
28
 
@@ -38,7 +46,9 @@ downloads/
38
46
  └── diagnostics/ 运行记录、附件清单、截图
39
47
  ```
40
48
 
41
- <!-- 截图:机构下载的进度窗口。图片放在 docs/ 以外(例如 assets/progress-window.png),docs/ 不随公开仓库发布 -->
49
+ 机构下载时,屏幕角落会出现进度胶囊:显示进度;需要你登录或验证时变成琥珀色提醒;鼠标指上去展开更多操作。
50
+
51
+ <p align="center"><img src="assets/progress-capsule.png" width="820" alt="进度胶囊:下载中、需要登录学校、鼠标指上去展开、设置"></p>
42
52
 
43
53
  ## 快速开始
44
54
 
@@ -155,9 +165,9 @@ paper-search carsi status --format text
155
165
  - 下载时屏幕角落会出现进度胶囊:显示进度、正在下正文还是附录、哪家出版社;需要你登录或验证时变成琥珀色,背景与边缘轻柔呼吸,并在开启系统通知时发送通知;点击“请登录学校”等提醒可切到当前任务的下载浏览器。鼠标指上去展开,可以跳过本篇、标记本刊或出版社无权限、终止整个任务、报告问题,右上角齿轮调整等待时间和默认下载文件夹,“–”最小化;按住胶囊或展开卡片的非按钮区域可拖动。停在学校登录页默认最多等 3 分钟,停在其他页面(人机验证、出版社页面等)默认 1 分钟后结束这一篇。
156
166
  - 默认下载浏览器在后台继续运行,启动、点击和跳转时不主动抢前台,也不会自动最小化或隐藏窗口;需要登录或验证时由胶囊提示,点击提醒即可切到浏览器处理。完成检查但页面未列出附件会显示“已检查,页面未列出补充材料”,不计为失败;登录未完成、暂不支持发现附件或下载失败会分别说明。
157
167
  - 默认下载文件夹可在胶囊设置中选择或输入,也可运行 `paper-search config set DEFAULT_DOWNLOAD_PATH "/完整路径/论文"`。保存后用于新任务;`--save-path` 或 `savePath` 可为单次任务指定其他目录,正在运行的批次保持原目录。
158
- - 当前源码(待发布):胶囊齿轮新增“页面持续无进展”,默认 30 秒,可保存为 1–600 秒,并可恢复默认。学校账号登录立即提醒;其他页面持续无进展达到设定时间后,胶囊才变色呼吸、提示查看浏览器。自动通过保持安静,恢复进展后清除提醒;主页面仍在导航加载时,在原页面等待上限内暂不提醒;持续接收文件也不会被当作页面卡住。该设置只改变提醒时间,不延长页面等待上限。
159
- - 当前源码(待发布):机构登录中,你在专用登录页输入、选择或点击控件,或点击胶囊接管后,暂停登录等待倒计时;输入间的停顿不消耗剩余时间。离开人工登录步骤后继续计时;无人操作仍按原限时结束。
160
- - 当前源码(待发布):macOS 通知改用 PaperSearch 自己的名称和图标,点击通知与点击胶囊提醒共用当前任务的浏览器恢复入口。首次配置机构下载扩展时可选择是否开启系统通知,新配置默认关闭;胶囊齿轮里的“系统通知”开关点击即保存,已有选择在升级后保留。关闭通知仍保留琥珀色呼吸提醒。无需另外安装通知工具;开启后横幅显示仍遵循 macOS 通知权限与专注模式设置。
168
+ - 胶囊齿轮新增“页面持续无进展”,默认 30 秒,可保存为 1–600 秒,并可恢复默认。学校账号登录立即提醒;其他页面持续无进展达到设定时间后,胶囊才变色呼吸、提示查看浏览器。自动通过保持安静,恢复进展后清除提醒;主页面仍在导航加载时,在原页面等待上限内暂不提醒;持续接收文件也不会被当作页面卡住。该设置只改变提醒时间,不延长页面等待上限。
169
+ - 机构登录中,你在专用登录页输入、选择或点击控件,或点击胶囊接管后,暂停登录等待倒计时;输入间的停顿不消耗剩余时间。离开人工登录步骤后继续计时;无人操作仍按原限时结束。
170
+ - macOS 通知改用 PaperSearch 自己的名称和图标,点击通知与点击胶囊提醒共用当前任务的浏览器恢复入口。首次配置机构下载扩展时可选择是否开启系统通知,新配置默认关闭;胶囊齿轮里的“系统通知”开关点击即保存,已有选择在升级后保留。关闭通知仍保留琥珀色呼吸提醒。无需另外安装通知工具;开启后横幅显示仍遵循 macOS 通知权限与专注模式设置。
161
171
  - 能取哪些出版社的正文和补充材料,见 [出版社支持表](skills/paper-search/references/publisher-support.md)。正文和补充材料都实测取得的有 Elsevier、Wiley、Springer Nature、OUP、Wolters Kluwer、Taylor & Francis、Sage、ACS、NEJM、ASCE、Dove 等,另已实测取得 ASH、Thieme、PLOS、Copernicus、Annual Reviews、IOP、AMS、APS、Optica、IEEE、World Scientific、MDPI、Frontiers 的补充材料及论文关联的 Figshare 附件;尚未取得的附件入口仍在补全;表里没有的网站按通用规则尝试。
162
172
  - `paper-search carsi update` 在 PaperSearch 升级后更新扩展,`paper-search carsi uninstall` 卸载(默认保留浏览器和学校配置)。
163
173
  - Windows:PowerShell 拦住 `npm.ps1` 时改用 `npm.cmd` 或命令提示符;下载要在桌面会话里运行,经 SSH 或系统服务启动时浏览器窗口打不开。
@@ -246,6 +256,18 @@ paper-search skills update --targets claude
246
256
  - **升级后自动更新**:通过内置目标安装的 Skill,会在升级 PaperSearch 后第一次运行 `paper-search`(`skills`、`setup` 除外)时更新到新版本:只更新原来装过的位置;被替换的旧文件备份在 `~/.local/share/paper-search-cli/skill-backups/`;并在 stderr 写一行说明。一个都没装时只提示一次怎么装。不想自动更新:`paper-search config set PAPER_SEARCH_SKILL_AUTO_UPDATE false`。
247
257
  - `paper-search doctor` 显示内置安装目标中的 Skill 位置和版本状态。
248
258
 
259
+ ### 新版提醒(0.4.8 新增)
260
+
261
+ 发现 npm 上有新的稳定版本时,日常调用会在终端提示当前版本、最新版本和升级命令。在线任务期间异步检查,成功结果缓存 24 小时;检查失败不会影响文献任务,命令结束即取消未完成的检查。提醒写入 stderr,stdout 的 JSON 不变;离线管理命令只使用缓存,CI、帮助和配置命令不自动提醒。
262
+
263
+ ```bash
264
+ paper-search update check --format text
265
+ paper-search config set PAPER_SEARCH_UPDATE_NOTIFY false # 关闭自动检查和提醒
266
+ paper-search config set PAPER_SEARCH_UPDATE_NOTIFY true # 重新开启
267
+ ```
268
+
269
+ 不会自动安装更新。升级 CLI 后,已安装的 Skill 会按现有规则同步;机构下载扩展仍用 `paper-search carsi update` 更新。此开关与胶囊的系统通知开关独立。
270
+
249
271
  ## 命令
250
272
 
251
273
  | 命令 | 用途 |
@@ -255,6 +277,7 @@ paper-search skills update --targets claude
255
277
  | `paper-search download` | 下载已核验论文的 PDF |
256
278
  | `paper-search run <工具>` | 精确调用某个工具,参数用 `--arg` 或 `--json-args` |
257
279
  | `paper-search failures` | 汇总下载失败的原因 |
280
+ | `paper-search update check` | 检查 npm 稳定新版(0.4.8 新增) |
258
281
  | `paper-search carsi` | 机构下载扩展的安装、状态、更新、卸载 |
259
282
  | `paper-search setup` / `config` | 配置 key、Skill 和扩展 |
260
283
  | `paper-search doctor` | 健康检查:配置、可用功能、Skill 和扩展的状态 |
@@ -280,7 +303,8 @@ paper-search skills update --targets claude
280
303
 
281
304
  - 接下来的重点:批量下载更稳、新电脑安装更顺;在 PDF 之外交付全文包(原始 XML/HTML、Markdown 和正文图片)。详见 [路线图](docs/ROADMAP.zh.md)。
282
305
  - 想了解原理和代码结构:[架构说明](docs/ARCHITECTURE.zh.md)。
283
- - 下载失败或想要支持某家出版社:在 Issues 里附上 `paper-search failures --format text` 的输出(先删掉不想公开的信息)。
306
+ - 下载失败或想要支持某家出版社:使用“下载失败 / 想支持某家出版社”Issue 模板,说明版本、系统、网站和 DOI。
307
+ - 0.4.8 新增:`paper-search failures --export ./failure-report.zip` 导出最近一批机构下载失败记录;可加 `--run <运行ID> --doi <DOI>` 筛选,也包含正文成功但附件失败的条目。请先检查包内 `summary.md`、HTML 与截图中的个人信息,再手动附到 Issue。导出只处理副本,不改原记录、不重跑或上传;旧记录没有的 HTML 会标为缺失。已安装版本没有该命令时,先提供版本和现象,勿上传原始诊断。
284
308
  - 想自己加出版社规则:见 [carsi/CONTRIBUTING.md](carsi/CONTRIBUTING.md)。
285
309
 
286
310
  ## 使用边界
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <defs><linearGradient id="gc" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5B9BFF"/><stop offset="1" stop-color="#9A72FF"/></linearGradient></defs>
3
+ <rect x="32" y="32" width="448" height="448" rx="104" fill="url(#gc)"/>
4
+ <g transform="rotate(-8 220 240)">
5
+ <rect x="112" y="100" width="206" height="270" rx="30" fill="#fff" opacity=".96"/>
6
+ <rect x="148" y="148" width="116" height="18" rx="9" fill="#DCE3FF"/>
7
+ <rect x="148" y="192" width="134" height="18" rx="9" fill="#DCE3FF"/>
8
+ <rect x="148" y="236" width="80" height="18" rx="9" fill="#DCE3FF"/>
9
+ </g>
10
+ <circle cx="306" cy="300" r="92" fill="#8C8BFF" opacity=".55"/>
11
+ <circle cx="306" cy="300" r="92" fill="none" stroke="#fff" stroke-width="26"/>
12
+ <line x1="374" y1="368" x2="424" y2="418" stroke="#fff" stroke-width="32" stroke-linecap="round"/>
13
+ <path d="M306 248 Q306 300 358 300 Q306 300 306 352 Q306 300 254 300 Q306 300 306 248Z" fill="#fff"/>
14
+ <path d="M352 236 Q352 252 368 252 Q352 252 352 268 Q352 252 336 252 Q352 252 352 236Z" fill="#fff" opacity=".9"/>
15
+ </svg>
Binary file
Binary file
Binary file
Binary file
@@ -120,6 +120,14 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
120
120
  .prompt svg.i { width: 22px; height: 22px; }
121
121
  .prompt .t { font-weight: 600; font-size: 14px; }
122
122
  .prompt .s { font-size: 12px; }
123
+ .prompt.attention-target { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--warn-line); border-radius: 13px; background: var(--warn-bg); }
124
+ .attention-copy { flex: 1; min-width: 0; }
125
+ .prompt.attention-target .t { white-space: nowrap; font-size: 15px; }
126
+ .prompt.attention-target .s { white-space: nowrap; margin-top: 3px; font-size: 11px; }
127
+ .attention-arrow { flex: none; font-size: 19px; }
128
+ .attention-head { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--fg); }
129
+ .attention-head b { flex: 1; font-size: 12px; }
130
+ #root.card.warn { background: var(--bg); }
123
131
  </style>
124
132
  </head>
125
133
  <body>
@@ -258,10 +266,14 @@ function runningCard() {
258
266
 
259
267
  function attentionCard() {
260
268
  const a = V.attention;
261
- const sub = [a.remaining ? "剩 " + a.remaining : "", a.login ? "登录后自动继续" : "通过后自动继续",
262
- a.more ? "另有 " + a.more + " 项" : ""].filter(Boolean).join(" · ");
263
- let html = '<div class="card-body"><button type="button" class="prompt attention-target" data-act="show_browser" title="点击切到下载浏览器" aria-label="打开下载浏览器">' + icon(a.login ? "lock" : "shield")
264
- + '<div><div class="t">' + esc(a.message) + '</div><div class="s">' + esc(sub) + "</div></div></button>";
269
+ const title = a.short;
270
+ const detail = [a.message, a.remaining ? "剩 " + a.remaining : "",
271
+ a.more ? "另有 " + a.more + " 项" : ""].filter(Boolean).join(" · ");
272
+ let html = '<div class="card-body"><div class="attention-head capsule-drag-region"><b>PaperSearch</b>'
273
+ + '<button class="iconbtn" data-act="minimize" aria-label="最小化">' + icon("minimize") + '</button>'
274
+ + '<button class="iconbtn" data-act="close" aria-label="关闭">' + icon("close") + '</button></div>'
275
+ + '<button type="button" class="prompt attention-target" data-act="show_browser" title="' + esc(detail) + '" aria-label="打开下载浏览器">' + icon(a.login ? "lock" : "alert")
276
+ + '<div class="attention-copy"><div class="t">' + esc(title) + '</div><div class="s">点击打开浏览器,查看并继续</div></div><span class="attention-arrow" aria-hidden="true">›</span></button>';
265
277
  if (panel === "confirm") return html + actionsBlock() + "</div>";
266
278
  html += '<div class="actions"><button class="iconbtn" data-act="settings" aria-label="设置">' + icon("gear")
267
279
  + '</button><span class="grow"></span>';
@@ -367,13 +379,18 @@ async function tick() {
367
379
 
368
380
  function say(text) { flash = { text: text, until: Date.now() + 6000 }; render(true); }
369
381
 
382
+ let inputActivation = Promise.resolve();
370
383
  async function act(action, target) {
371
384
  const v = V;
372
385
  switch (action) {
373
386
  case "minimize": open = false; panel = ""; render(true); return api().minimize(); // back as a capsule when restored
374
387
  case "close": closing = true; ++fitGeneration; clearInterval(pollTimer); clearTimeout(hoverTimer); clearTimeout(leaveTimer); return api().request_close(); // no call left waiting on a closed page
375
388
  case "folder": return api().open_folder();
376
- case "show_browser": return say(await api().act("show_browser", v.current, v.run_id));
389
+ case "show_browser": {
390
+ try { await inputActivation; }
391
+ catch (error) { return say("未能激活进度窗口,请重试"); }
392
+ return say(await api().act("show_browser", v.current, v.run_id));
393
+ }
377
394
  case "menu": panel = panel === "menu" ? "" : "menu"; return render(true);
378
395
  case "report": if (!kinds.length) kinds = await api().issue_kinds(); panel = "report"; return render(true);
379
396
  case "issue": panel = ""; return say(await api().report(target.dataset.kind, v.current));
@@ -425,7 +442,7 @@ async function act(action, target) {
425
442
 
426
443
  const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"]');
427
444
  root.addEventListener("pointerdown", (event) => {
428
- if (event.button === 0 && api().activate_on_input) api().activate_on_input();
445
+ if (event.button === 0 && api().activate_on_input) inputActivation = api().activate_on_input();
429
446
  if (event.button !== 0 || interactive(event.target)) return;
430
447
  dragging = true;
431
448
  ++fitGeneration;
@@ -1,18 +1,15 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
2
- <!-- PaperSearch app icon: a paper sheet under a magnifier whose rim is a
3
- progress ring, flat like the progress capsule.
4
- Tile follows the macOS icon grid (824 px tile, 100 px margin). -->
5
- <rect x="100" y="100" width="824" height="824" rx="185" fill="#2563eb"/>
6
- <rect x="250" y="214" width="392" height="512" rx="48" fill="#ffffff"/>
7
- <g fill="#bfd3fb">
8
- <rect x="314" y="300" width="190" height="34" rx="17"/>
9
- <rect x="314" y="376" width="264" height="34" rx="17"/>
10
- <rect x="314" y="452" width="214" height="34" rx="17"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <defs><linearGradient id="gc" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5B9BFF"/><stop offset="1" stop-color="#9A72FF"/></linearGradient></defs>
3
+ <rect x="32" y="32" width="448" height="448" rx="104" fill="url(#gc)"/>
4
+ <g transform="rotate(-8 220 240)">
5
+ <rect x="112" y="100" width="206" height="270" rx="30" fill="#fff" opacity=".96"/>
6
+ <rect x="148" y="148" width="116" height="18" rx="9" fill="#DCE3FF"/>
7
+ <rect x="148" y="192" width="134" height="18" rx="9" fill="#DCE3FF"/>
8
+ <rect x="148" y="236" width="80" height="18" rx="9" fill="#DCE3FF"/>
11
9
  </g>
12
- <line x1="752" y1="722" x2="826" y2="796" stroke="#f59e0b" stroke-width="66" stroke-linecap="round"/>
13
- <circle cx="640" cy="610" r="132" fill="#eaf1ff"/>
14
- <circle cx="640" cy="610" r="132" fill="none" stroke="#fde7b0" stroke-width="46"/>
15
- <circle cx="640" cy="610" r="132" fill="none" stroke="#f59e0b" stroke-width="46" stroke-linecap="round"
16
- stroke-dasharray="600 830" transform="rotate(-90 640 610)"/>
17
- <rect x="562" y="590" width="156" height="42" rx="21" fill="#2563eb"/>
10
+ <circle cx="306" cy="300" r="92" fill="#8C8BFF" opacity=".55"/>
11
+ <circle cx="306" cy="300" r="92" fill="none" stroke="#fff" stroke-width="26"/>
12
+ <line x1="374" y1="368" x2="424" y2="418" stroke="#fff" stroke-width="32" stroke-linecap="round"/>
13
+ <path d="M306 248 Q306 300 358 300 Q306 300 306 352 Q306 300 254 300 Q306 300 306 248Z" fill="#fff"/>
14
+ <path d="M352 236 Q352 252 368 252 Q352 252 352 268 Q352 252 336 252 Q352 252 352 236Z" fill="#fff" opacity=".9"/>
18
15
  </svg>
@@ -86,10 +86,29 @@ var papersearchBackground = class extends ExtensionCommon.ExtensionAPI {
86
86
  ctypes.voidptr_t, ctypes.int);
87
87
  const setStyle = user.declare("SetWindowLongPtrW", ctypes.winapi_abi, ctypes.intptr_t,
88
88
  ctypes.voidptr_t, ctypes.int, ctypes.intptr_t);
89
+ const setPosition = user.declare("SetWindowPos", ctypes.winapi_abi, ctypes.int,
90
+ ctypes.voidptr_t, ctypes.voidptr_t, ctypes.int, ctypes.int, ctypes.int, ctypes.int, ctypes.uint32_t);
91
+ const setAlpha = user.declare("SetLayeredWindowAttributes", ctypes.winapi_abi, ctypes.int,
92
+ ctypes.voidptr_t, ctypes.uint32_t, ctypes.unsigned_char, ctypes.uint32_t);
93
+ const getAlpha = user.declare("GetLayeredWindowAttributes", ctypes.winapi_abi, ctypes.int,
94
+ ctypes.voidptr_t, ctypes.uint32_t.ptr, ctypes.unsigned_char.ptr, ctypes.uint32_t.ptr);
89
95
  const native = win.docShell.treeOwner.QueryInterface(Ci.nsIBaseWindow);
90
96
  const hwnd = ctypes.voidptr_t(ctypes.UInt64(native.nativeHandle));
91
97
  const style = Number(getStyle(hwnd, -20).toString());
92
- setStyle(hwnd, -20, style | 0x08000000); // WS_EX_NOACTIVATE, before the first ShowWindow.
98
+ const color = ctypes.uint32_t(), alpha = ctypes.unsigned_char(), alphaFlags = ctypes.uint32_t();
99
+ if ((style & 0x00080000) && !getAlpha(hwnd, color.address(), alpha.address(), alphaFlags.address())) {
100
+ user.close();
101
+ throw new Error("Cannot preserve browser window opacity");
102
+ }
103
+ // NOACTIVATE alone still lets Gecko's first ShowWindow cover another
104
+ // app. Keep only the initial, not-yet-painted window transparent until
105
+ // it can be placed behind existing windows, then restore normal styles.
106
+ setStyle(hwnd, -20, style | 0x08080000); // WS_EX_NOACTIVATE | WS_EX_LAYERED
107
+ if (!setAlpha(hwnd, 0, 0, 2)) {
108
+ setStyle(hwnd, -20, style);
109
+ user.close();
110
+ throw new Error("Cannot prepare the browser's background display");
111
+ }
93
112
  let observer, timer;
94
113
  try {
95
114
  await new Promise((resolve, reject) => {
@@ -103,9 +122,13 @@ var papersearchBackground = class extends ExtensionCommon.ExtensionAPI {
103
122
  } finally {
104
123
  if (observer) Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
105
124
  win.clearTimeout(timer);
125
+ const placed = setPosition(hwnd, ctypes.voidptr_t(1), 0, 0, 0, 0, 0x0013); // HWND_BOTTOM; NOSIZE|NOMOVE|NOACTIVATE
126
+ const opacityRestored = !(style & 0x00080000) || setAlpha(hwnd, color.value, alpha.value, alphaFlags.value);
106
127
  setStyle(hwnd, -20, style);
107
128
  user.close();
108
129
  win.focus = focus;
130
+ if (!placed) throw new Error("Cannot place the browser behind existing windows");
131
+ if (!opacityRestored) throw new Error("Cannot restore the browser window opacity");
109
132
  }
110
133
  }
111
134
  await IOUtils.writeJSON(PathUtils.join(PathUtils.profileDir, "papersearch-background.json"),
@@ -220,6 +220,29 @@ def _cmd_login(args: argparse.Namespace) -> int:
220
220
  # other commands
221
221
  # ---------------------------------------------------------------------------
222
222
 
223
+ def _cmd_report_export(args: argparse.Namespace) -> int:
224
+ from .config import load_config
225
+ from .failure_export import ExportError, MAX_REQUEST_BYTES, export_report
226
+
227
+ try:
228
+ raw = sys.stdin.buffer.read(MAX_REQUEST_BYTES + 1)
229
+ if len(raw) > MAX_REQUEST_BYTES:
230
+ raise ExportError("export_request_too_large")
231
+ request = json.loads(raw)
232
+ if not isinstance(request, dict):
233
+ raise ExportError("invalid_export_request")
234
+ result = export_report(request, Path(args.output), load_config())
235
+ except (OSError, ValueError) as exc:
236
+ # Never print original JSON, paths, secrets or exception payloads.
237
+ code = (str(exc) if isinstance(exc, ExportError) else
238
+ "export_target_exists" if isinstance(exc, FileExistsError) else
239
+ "export_permission_denied" if isinstance(exc, PermissionError) else "export_io_or_input_error")
240
+ print(json.dumps({"ok": False, "error": code}))
241
+ return 1
242
+ print(json.dumps(result, ensure_ascii=False))
243
+ return 0
244
+
245
+
223
246
  def _cmd_run(_args: argparse.Namespace) -> int:
224
247
  from .server import main as serve
225
248
 
@@ -436,6 +459,10 @@ def main(argv: list[str] | None = None) -> int:
436
459
 
437
460
  sub.add_parser("list-publishers", help="print publisher profiles and their platform labels").set_defaults(func=_cmd_list_publishers)
438
461
 
462
+ exp = sub.add_parser("report-export", help="export a sanitized local failure ZIP from a JSON request on stdin")
463
+ exp.add_argument("--output", required=True)
464
+ exp.set_defaults(func=_cmd_report_export)
465
+
439
466
  chk = sub.add_parser("publisher-check", help="run one institutional download and print a sanitized report")
440
467
  chk.add_argument("--doi", required=True)
441
468
  chk.add_argument("--output-dir")
@@ -187,6 +187,7 @@ class PublisherBatchDownloader(
187
187
  from . import supplements
188
188
  from .supplement_transfer import browser_request
189
189
 
190
+ self._run_dir = manifest_dir or getattr(self, "_run_dir", None)
190
191
  self._phase(result, "supplements")
191
192
  main_state = result.state
192
193
  progress_reporter.update(part="supplements", supplements_saved=0, supplements_total=None)
@@ -232,6 +233,7 @@ class PublisherBatchDownloader(
232
233
  links = self._settled_supplement_links(page, doi)
233
234
  if not (self._challenge_shell(page) or self._is_challenge_page(page)):
234
235
  break
236
+ self._snapshot(page, result, "supplements page")
235
237
  if links is None:
236
238
  self._event(result, "supplements_not_supported", self.profile.name)
237
239
  return [{"status": "skipped", "reason": "supplements_not_supported", "url": url, "label": ""}]
@@ -467,6 +469,7 @@ class PublisherBatchDownloader(
467
469
  preparation = self._prepare_article(page, result, run_dir)
468
470
  if preparation is not None:
469
471
  return preparation
472
+ self._snapshot(page, result, "article access checked")
470
473
  ip_block: str | None = None
471
474
  # Whether this capture comes after the school's login, and its first attempt.
472
475
  signed_in, attempts_from = self._school_login_done(), len(result.pdf_attempts)
@@ -782,7 +785,6 @@ class PublisherBatchDownloader(
782
785
  pdf_path = pdf_dir / f"{safe_name(record.doi)}.pdf"
783
786
  pdf_path.write_bytes(pdf_bytes)
784
787
  self._event(result, "pdf_saved")
785
- self._drop_snapshot_pictures(result)
786
788
  text = pdf_extractor.extract_from_bytes(pdf_bytes)
787
789
  result.status = "success"
788
790
  result.reason = ""
@@ -793,6 +795,8 @@ class PublisherBatchDownloader(
793
795
  result.text_length = len(text or "")
794
796
  result.verified_match = self._text_matches_record(
795
797
  text, record, fallback_title=self._identity_title() or result.title)
798
+ if result.verified_match and str(self.config.get("supplements") or "") != "with":
799
+ self._drop_snapshot_pictures(result)
796
800
  self._save_publisher_session(page, result)
797
801
  if not any(e["state"] == "pdf_saved_unconfirmed" for e in result.events):
798
802
  from ..browser.preview import discard_frames