papersearch 0.4.12 → 0.5.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.
Files changed (138) hide show
  1. package/.env.example +8 -0
  2. package/README.en.md +94 -72
  3. package/README.md +95 -73
  4. package/assets/overview.en.png +0 -0
  5. package/assets/overview.png +0 -0
  6. package/carsi/paper_search_carsi/api_keys.py +138 -0
  7. package/carsi/paper_search_carsi/assets/api_keys.json +146 -0
  8. package/carsi/paper_search_carsi/assets/capsule.html +316 -29
  9. package/carsi/paper_search_carsi/assets/capsule_en.json +437 -0
  10. package/carsi/paper_search_carsi/cli.py +46 -4
  11. package/carsi/paper_search_carsi/cli_config.py +51 -0
  12. package/carsi/paper_search_carsi/config.py +2 -0
  13. package/carsi/paper_search_carsi/download_directory.py +5 -33
  14. package/carsi/paper_search_carsi/engine/batch_capture.py +19 -10
  15. package/carsi/paper_search_carsi/engine/bridge.py +2 -1
  16. package/carsi/paper_search_carsi/engine/pdf_guard.py +3 -6
  17. package/carsi/paper_search_carsi/extractors/pdf_extractor.py +4 -18
  18. package/carsi/paper_search_carsi/i18n.py +46 -0
  19. package/carsi/paper_search_carsi/orchestrator.py +14 -1
  20. package/carsi/paper_search_carsi/pdf_text.py +84 -0
  21. package/carsi/paper_search_carsi/pdf_utils.py +3 -12
  22. package/carsi/paper_search_carsi/progress_capsule.py +94 -10
  23. package/carsi/paper_search_carsi/progress_reporter.py +64 -4
  24. package/carsi/paper_search_carsi/server.py +9 -1
  25. package/carsi/paper_search_carsi/user_settings.py +17 -4
  26. package/carsi/pyproject.toml +6 -4
  27. package/dist/capabilities/citation-expansion/CitationService.d.ts +8 -0
  28. package/dist/capabilities/citation-expansion/CitationService.d.ts.map +1 -1
  29. package/dist/capabilities/citation-expansion/CitationService.js +14 -4
  30. package/dist/capabilities/citation-expansion/CitationService.js.map +1 -1
  31. package/dist/capabilities/citation-expansion/CrossrefReferences.d.ts +18 -0
  32. package/dist/capabilities/citation-expansion/CrossrefReferences.d.ts.map +1 -0
  33. package/dist/capabilities/citation-expansion/CrossrefReferences.js +83 -0
  34. package/dist/capabilities/citation-expansion/CrossrefReferences.js.map +1 -0
  35. package/dist/capabilities/citation-expansion/OpenAlexGraph.d.ts +36 -0
  36. package/dist/capabilities/citation-expansion/OpenAlexGraph.d.ts.map +1 -0
  37. package/dist/capabilities/citation-expansion/OpenAlexGraph.js +120 -0
  38. package/dist/capabilities/citation-expansion/OpenAlexGraph.js.map +1 -0
  39. package/dist/capabilities/citation-expansion/handler.d.ts +14 -5
  40. package/dist/capabilities/citation-expansion/handler.d.ts.map +1 -1
  41. package/dist/capabilities/citation-expansion/handler.js +64 -14
  42. package/dist/capabilities/citation-expansion/handler.js.map +1 -1
  43. package/dist/capabilities/citation-expansion/schemas.d.ts +1 -5
  44. package/dist/capabilities/citation-expansion/schemas.d.ts.map +1 -1
  45. package/dist/capabilities/citation-expansion/schemas.js +2 -2
  46. package/dist/capabilities/citation-expansion/schemas.js.map +1 -1
  47. package/dist/capabilities/citation-expansion/tools.d.ts +0 -18
  48. package/dist/capabilities/citation-expansion/tools.d.ts.map +1 -1
  49. package/dist/capabilities/citation-expansion/tools.js +4 -16
  50. package/dist/capabilities/citation-expansion/tools.js.map +1 -1
  51. package/dist/capabilities/citation-expansion/types.d.ts +4 -0
  52. package/dist/capabilities/citation-expansion/types.d.ts.map +1 -1
  53. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts +8 -0
  54. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts.map +1 -1
  55. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +36 -24
  56. package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +1 -1
  57. package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts +3 -1
  58. package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts.map +1 -1
  59. package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js +5 -1
  60. package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js.map +1 -1
  61. package/dist/capabilities/pdf-discovery/carsi/index.d.ts +1 -1
  62. package/dist/capabilities/pdf-discovery/carsi/index.d.ts.map +1 -1
  63. package/dist/capabilities/pdf-discovery/carsi/index.js +1 -1
  64. package/dist/capabilities/pdf-discovery/carsi/index.js.map +1 -1
  65. package/dist/capabilities/pdf-discovery/carsi/types.d.ts +5 -0
  66. package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +1 -1
  67. package/dist/capabilities/pdf-discovery/outputLayout.d.ts.map +1 -1
  68. package/dist/capabilities/pdf-discovery/outputLayout.js +2 -1
  69. package/dist/capabilities/pdf-discovery/outputLayout.js.map +1 -1
  70. package/dist/capabilities/pdf-discovery/tiers/entitledAccess.d.ts.map +1 -1
  71. package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js +1 -0
  72. package/dist/capabilities/pdf-discovery/tiers/entitledAccess.js.map +1 -1
  73. package/dist/cli.js +84 -11
  74. package/dist/cli.js.map +1 -1
  75. package/dist/config/ConfigService.d.ts +1 -1
  76. package/dist/config/ConfigService.d.ts.map +1 -1
  77. package/dist/config/ConfigService.js +3 -0
  78. package/dist/config/ConfigService.js.map +1 -1
  79. package/dist/config/apiKeySignup.d.ts +11 -1
  80. package/dist/config/apiKeySignup.d.ts.map +1 -1
  81. package/dist/config/apiKeySignup.js +18 -6
  82. package/dist/config/apiKeySignup.js.map +1 -1
  83. package/dist/config/apiKeyTest.d.ts +18 -0
  84. package/dist/config/apiKeyTest.d.ts.map +1 -0
  85. package/dist/config/apiKeyTest.js +109 -0
  86. package/dist/config/apiKeyTest.js.map +1 -0
  87. package/dist/config/selfCommand.d.ts +8 -0
  88. package/dist/config/selfCommand.d.ts.map +1 -0
  89. package/dist/config/selfCommand.js +10 -0
  90. package/dist/config/selfCommand.js.map +1 -0
  91. package/dist/management/capability-profile/index.js +4 -4
  92. package/dist/management/capability-profile/index.js.map +1 -1
  93. package/dist/management/carsi/autoUpdate.d.ts +21 -0
  94. package/dist/management/carsi/autoUpdate.d.ts.map +1 -0
  95. package/dist/management/carsi/autoUpdate.js +88 -0
  96. package/dist/management/carsi/autoUpdate.js.map +1 -0
  97. package/dist/management/carsi/installer.d.ts +1 -1
  98. package/dist/management/carsi/installer.d.ts.map +1 -1
  99. package/dist/management/carsi/installer.js +38 -7
  100. package/dist/management/carsi/installer.js.map +1 -1
  101. package/dist/management/carsi/runtime.d.ts +9 -0
  102. package/dist/management/carsi/runtime.d.ts.map +1 -1
  103. package/dist/management/carsi/runtime.js +11 -0
  104. package/dist/management/carsi/runtime.js.map +1 -1
  105. package/dist/management/carsi/settingsWindow.d.ts +30 -0
  106. package/dist/management/carsi/settingsWindow.d.ts.map +1 -0
  107. package/dist/management/carsi/settingsWindow.js +51 -0
  108. package/dist/management/carsi/settingsWindow.js.map +1 -0
  109. package/dist/management/diagnostics/index.d.ts.map +1 -1
  110. package/dist/management/diagnostics/index.js +16 -0
  111. package/dist/management/diagnostics/index.js.map +1 -1
  112. package/dist/management/skills/nextSteps.d.ts +2 -0
  113. package/dist/management/skills/nextSteps.d.ts.map +1 -0
  114. package/dist/management/skills/nextSteps.js +16 -0
  115. package/dist/management/skills/nextSteps.js.map +1 -0
  116. package/dist/platforms/ACMSearcher.d.ts.map +1 -1
  117. package/dist/platforms/ACMSearcher.js +3 -2
  118. package/dist/platforms/ACMSearcher.js.map +1 -1
  119. package/dist/platforms/CrossrefSearcher.d.ts.map +1 -1
  120. package/dist/platforms/CrossrefSearcher.js +4 -3
  121. package/dist/platforms/CrossrefSearcher.js.map +1 -1
  122. package/dist/platforms/OpenAlexSearcher.d.ts.map +1 -1
  123. package/dist/platforms/OpenAlexSearcher.js +4 -1
  124. package/dist/platforms/OpenAlexSearcher.js.map +1 -1
  125. package/dist/registry/platformMetadata.d.ts.map +1 -1
  126. package/dist/registry/platformMetadata.js +1 -0
  127. package/dist/registry/platformMetadata.js.map +1 -1
  128. package/dist/utils/plainText.d.ts +7 -0
  129. package/dist/utils/plainText.d.ts.map +1 -0
  130. package/dist/utils/plainText.js +19 -0
  131. package/dist/utils/plainText.js.map +1 -0
  132. package/package.json +3 -1
  133. package/skills/paper-search/SKILL.md +16 -5
  134. package/skills/paper-search/references/capability-routing.md +5 -3
  135. package/skills/paper-search/references/carsi-setup.md +6 -3
  136. package/skills/paper-search/references/cli-contract.md +9 -4
  137. package/skills/paper-search/references/management-layer.md +4 -4
  138. package/skills/paper-search/references/troubleshooting.md +1 -1
@@ -0,0 +1,437 @@
1
+ {
2
+ "exact": {
3
+ "暂无下载任务": "No downloads",
4
+ "成功": "Saved",
5
+ "失败": "Failed",
6
+ "剩余": "Left",
7
+ "用时": "Time",
8
+ "按原因": "by reason",
9
+ "正文已保存": "main text saved",
10
+ "没权限": "No access",
11
+ "外部原因": "External",
12
+ "暂不支持": "Unsupported",
13
+ "原因不明": "Unclear",
14
+ "其他": "Other",
15
+ "文件夹": "Folder",
16
+ "打开文件夹": "Open folder",
17
+ "跳过": "Skip",
18
+ "终止": "Stop",
19
+ "跳过本篇": "Skip this",
20
+ "本刊无权限": "No access: journal",
21
+ "出版社无权限": "No access: publisher",
22
+ "报告问题": "Report issue",
23
+ "取消": "Cancel",
24
+ "关闭": "Close",
25
+ "最小化": "Minimize",
26
+ "最小化到程序坞": "Minimize to Dock",
27
+ "设置": "Settings",
28
+ "返回": "Back",
29
+ "更多": "More",
30
+ "点击打开浏览器,查看并继续": "Click to open the browser",
31
+ "在浏览器打开这篇文章": "Open in your browser",
32
+ "点击切到下载浏览器": "Show download browser",
33
+ "打开下载浏览器": "Open download browser",
34
+ "切到下载浏览器": "Show download browser",
35
+ "未能激活进度窗口,请重试": "Window didn't respond; retry",
36
+ "终止整个下载任务?这一篇立即结束。": "Stop the whole task? This paper ends now.",
37
+ "下载": "Downloads",
38
+ "等待和提醒": "Waits & alerts",
39
+ "语言": "Language",
40
+ "系统通知开": "Notifications on",
41
+ "系统通知关": "Notifications off",
42
+ "已保存,之后的下载按新设置": "Saved; applies to later downloads",
43
+ "默认下载文件夹": "Default download folder",
44
+ "输入完整路径": "Full path",
45
+ "选择…": "Choose…",
46
+ "用于后续下载;命令中指定路径时优先使用指定路径。": "For later downloads; a path in a command wins.",
47
+ "恢复默认": "Defaults",
48
+ "保存": "Save",
49
+ "需要处理时发系统通知": "Notify me when needed",
50
+ "系统通知": "Notifications",
51
+ "通知设置保存失败": "Couldn't save",
52
+ "填写": "Add",
53
+ "未填": "Not set",
54
+ "去申请": "Get key",
55
+ "教程": "Guide",
56
+ "测试": "Test",
57
+ "清除": "Clear",
58
+ "确认清除": "Confirm",
59
+ "粘贴 key": "Paste key",
60
+ "显示 key": "Show key",
61
+ "正在测试…": "Testing…",
62
+ "读取配置失败": "Couldn't read settings",
63
+ "返回进度 ›": "Back to progress ›",
64
+ "去处理 ›": "Handle ›",
65
+ "正文": "Main",
66
+ "附录": "Supp.",
67
+ "正文+附录": "Main+Supp.",
68
+ "准备中": "Preparing",
69
+ "正在打开文章": "Opening article",
70
+ "正在检查访问权限": "Checking access",
71
+ "等待机构登录": "Waiting for login",
72
+ "等待人机验证": "Waiting for check",
73
+ "正在获取 PDF": "Getting PDF",
74
+ "已读到 PDF,正在核对": "Checking PDF",
75
+ "已保存": "Saved",
76
+ "这条路没走通,正在换路": "Trying another route",
77
+ "附录检查完成": "Supp. checked",
78
+ "打开文章": "Open",
79
+ "权限": "Access",
80
+ "取 PDF": "PDF",
81
+ "核对": "Check",
82
+ "检查权限": "Access",
83
+ "等待登录": "Login",
84
+ "等待验证": "Verify",
85
+ "换一条路": "Reroute",
86
+ "核对 PDF": "Check PDF",
87
+ "查找附录": "Finding supp.",
88
+ "正在查找附录文件": "Finding supp. files",
89
+ "处理中": "Working",
90
+ "正在切到下载浏览器": "Showing download browser",
91
+ "已终止任务:这一篇结束,剩下的不再下载": "Stopped: this one ends, the rest won't run",
92
+ "已跳过本篇,进入下一篇": "Skipped; moving on",
93
+ "已记住:本刊无权限,以后自动跳过(可用 entitlements 撤销)": "Noted: no access; journal skipped from now",
94
+ "已记住:该出版社无权限,以后自动跳过": "Noted: no access; publisher skipped from now",
95
+ "请查看浏览器,可能需要手动操作": "Check the browser; you may need to act",
96
+ "页面暂时无进展": "Page stuck",
97
+ "请选择学校": "Choose school",
98
+ "请登录学校": "Sign in to school",
99
+ "请完成验证": "Complete the check",
100
+ "需要你处理": "Needs you",
101
+ "需要你操作": "Action needed",
102
+ "下载中": "Downloading",
103
+ "已终止任务": "Stopped",
104
+ "下载中断": "Interrupted",
105
+ "下载未成功": "Download failed",
106
+ "下载结束,部分失败": "Done, some failed",
107
+ "下载完成": "Done",
108
+ "其他原因": "Other reasons",
109
+ "未知论文": "Unknown paper",
110
+ "下载浏览器已关闭": "Download browser closed",
111
+ "出版社内容服务错误,当前路径已停止": "Publisher server error; route stopped",
112
+ "出版社尚未发布这篇论文的全文,当前路径已停止": "Full text not out yet; route stopped",
113
+ "安全验证": "Security check",
114
+ "安全验证等待已结束,正在检查页面": "Check wait over; checking page",
115
+ "已从打开的 PDF 读取,正在核对并保存": "Read from the open PDF; checking and saving",
116
+ "已切到下载浏览器": "Download browser shown",
117
+ "未能切到下载浏览器,请从程序坞或任务栏打开": "Couldn't switch; open it from the Dock or taskbar",
118
+ "未能切到下载浏览器,请从程序坞打开": "Couldn't switch; open it from the Dock",
119
+ "机构登录": "School login",
120
+ "浏览器下载": "Browser download",
121
+ "点击时这一篇已经保存好了,没有跳过": "Already saved; not skipped",
122
+ "自动验证尚未完成,请在浏览器中检查并完成验证": "Auto check not done; finish it in the browser",
123
+ "请在浏览器窗口完成机构登录": "Sign in to school in the browser",
124
+ "请在浏览器窗口选择学校并完成机构登录": "Choose your school and sign in, in the browser",
125
+ "跳过已尝试": "Skipping tried",
126
+ "进入机构访问": "School access",
127
+ "PDF 已保存,待内容核验": "PDF saved; checking",
128
+ "下载未完成": "Not finished",
129
+ "下载进程已结束,结果未确认": "Download ended; unconfirmed",
130
+ "已检查,页面未列出补充材料": "Checked; no supp. listed",
131
+ "批量下载已停止,结果未确认": "Batch stopped; result unconfirmed",
132
+ "机构 PDF 下载": "School PDF download",
133
+ "机构 PDF 批量下载": "School PDF batch",
134
+ "等待下载进程响应(暂无新进度)": "Waiting for the download (no news)",
135
+ "DOI 没指向能登录的网站": "DOI leads to no login site",
136
+ "PDF 身份未确认": "PDF identity unconfirmed",
137
+ "下载已取消": "Download cancelled",
138
+ "下载时程序出错": "Program error",
139
+ "下载环境不可用": "Download setup down",
140
+ "下载环境被占用": "Download setup busy",
141
+ "下载等待超时": "Download timed out",
142
+ "人机验证没通过": "Failed bot check",
143
+ "任务已终止": "Task stopped",
144
+ "你标记过无权限": "You marked no access",
145
+ "你跳过了这一篇": "You skipped it",
146
+ "全文尚未发布": "Full text not out yet",
147
+ "全文未确认有效": "Full text unconfirmed",
148
+ "出版社网站没响应": "Publisher site silent",
149
+ "出版社页面出错": "Publisher page error",
150
+ "到了每小时下载上限": "Hourly limit reached",
151
+ "只在其他平台提供": "Only on another platform",
152
+ "后端结果无法使用": "Backend result unusable",
153
+ "学校密码已过期": "School password expired",
154
+ "学校没有订阅": "No school subscription",
155
+ "学校登录系统出错": "School login error",
156
+ "学校登录被拒绝": "School login refused",
157
+ "学校账号被锁定": "School account locked",
158
+ "找不到学校的登录路线": "No login route for school",
159
+ "找不到机构登录入口": "No institution login",
160
+ "拿到的 PDF 无效": "Invalid PDF",
161
+ "拿到的是别篇 PDF": "Another paper's PDF",
162
+ "拿到网页不是文件": "Got a page, not a file",
163
+ "没取到 PDF": "No PDF",
164
+ "没找到可用 PDF": "No usable PDF",
165
+ "没进入学校登录页": "School login not reached",
166
+ "浏览器没有响应": "Browser not responding",
167
+ "登录后没回到出版社": "No return to publisher",
168
+ "登录重试已用尽": "Login retries used up",
169
+ "登录页被关闭": "Login page closed",
170
+ "等学校登录超时": "School login timed out",
171
+ "网站人机验证拦截": "Blocked by bot check",
172
+ "网站拦截了当前网络": "Site blocked network",
173
+ "网站暂不支持附录": "Supp. not supported here",
174
+ "认证入口未注册": "Login entry unregistered",
175
+ "需要学校登录": "School login needed",
176
+ "页面处理超时": "Page timed out",
177
+ "页面提示全文受限": "Full text restricted",
178
+ "没有有效 DOI": "No valid DOI",
179
+ "没有进行机构下载": "No school download",
180
+ "附录没下载成功": "Supp. not downloaded",
181
+ "机构订阅": "Subscription",
182
+ "预印本": "Preprint",
183
+ "出版社 API": "Publisher API",
184
+ "开放获取": "Open access",
185
+ "学校登录页最多等": "Wait for school login",
186
+ "其他页面最多等": "Wait for other pages",
187
+ "验证提醒前最多等": "Wait before check alert",
188
+ "每家出版社每小时最多": "Per publisher per hour",
189
+ "秒": "s",
190
+ "篇": "papers",
191
+ "查期刊、搜正文": "Journals & snippets",
192
+ "出版社接口": "Publisher APIs",
193
+ "增加检索来源": "More sources",
194
+ "提高限额": "Higher limits",
195
+ "查影响因子和分区": "Impact factor & rank",
196
+ "搜正文片段": "Full-text snippets",
197
+ "下载全文,检索 ScienceDirect、Scopus": "Full text; search ScienceDirect, Scopus",
198
+ "下载全文,检索 Springer": "Full text; search Springer",
199
+ "检索 Web of Science": "Search Web of Science",
200
+ "检索 IEEE Xplore": "Search IEEE Xplore",
201
+ "检索 PubMed 更快(每秒 3 次提到 10 次)": "Faster PubMed (3 → 10 per second)",
202
+ "检索 CORE 开放全文,更稳定": "Steadier CORE open full text",
203
+ "检索 OpenAIRE,限额更高": "Higher OpenAIRE limits",
204
+ "查引文的限额更高,被引过万也能列全": "Higher citation limits; lists 10k+",
205
+ "申请教程": "Guide",
206
+ "可以用": "Works",
207
+ "没有填": "Empty",
208
+ "key 里不能有空格、换行或中文字符": "No spaces, line breaks or Chinese",
209
+ "太长了,请确认粘贴的是 key": "Too long; is this the key?",
210
+ "没有这一项": "Unknown item",
211
+ "测试超时,没法判断;检查网络或代理后再试": "Timed out; check network or proxy",
212
+ "请先粘贴 key;要删除请点“清除”": "Paste a key first; Clear removes it",
213
+ "此路径是文件,请选择文件夹": "That's a file; choose a folder",
214
+ "请输入完整的绝对路径": "Enter a full path",
215
+ "请选择下载文件夹或输入完整路径": "Choose a folder or enter a full path",
216
+ "PDF 已打开,但没保存": "PDF opened, not saved",
217
+ "一直加载或验证过不去": "Stuck loading or checking",
218
+ "其他问题": "Other problem",
219
+ "没出现机构登录或选学校": "No school login shown",
220
+ "跳到了个人账号登录": "Went to personal login",
221
+ "跳到了无关页面": "Went to unrelated page",
222
+ "选错了学校": "Wrong school",
223
+ "已在浏览器打开这篇文章": "Opened in your browser",
224
+ "当前没有正在下载的浏览器": "No download browser now",
225
+ "打开失败:不是有效的 DOI": "Couldn't open: not a DOI",
226
+ "打开失败:没有找到默认浏览器": "Couldn't open: no default browser",
227
+ "打开失败:没有这一项": "Couldn't open: unknown",
228
+ "这一篇在查开放来源,没有打开浏览器": "Checking open sources; no browser",
229
+ "通知开关必须为开启或关闭": "Must be on or off",
230
+ "语言只能是中文或英文": "Chinese or English only",
231
+ "需要你在浏览器里处理": "Needed in the browser",
232
+ "完成": "Done",
233
+ "已终止": "Stopped",
234
+ "已中断": "Interrupted",
235
+ "被拒绝:key 不对,或已失效": "Rejected: wrong or expired key",
236
+ "服务器限流,稍后再试;key 本身可能没问题": "Rate-limited; try later",
237
+ "没连上服务器,没法判断;检查网络或代理后再试": "Couldn't reach the server"
238
+ },
239
+ "patterns": [
240
+ [
241
+ "^完成 (\\d+)/(\\d+)$",
242
+ "Done $1/$2"
243
+ ],
244
+ [
245
+ "^已终止 (\\d+)/(\\d+)$",
246
+ "Stopped $1/$2"
247
+ ],
248
+ [
249
+ "^已中断 (\\d+)/(\\d+)$",
250
+ "Interrupted $1/$2"
251
+ ],
252
+ [
253
+ "^(\\d+) 篇失败$",
254
+ "$1 failed"
255
+ ],
256
+ [
257
+ "^已用 (.+)$",
258
+ "$1 elapsed"
259
+ ],
260
+ [
261
+ "^共 (\\d+) 篇$",
262
+ "$1 papers"
263
+ ],
264
+ [
265
+ "^未完成 (\\d+) 篇$",
266
+ "Not saved: $1"
267
+ ],
268
+ [
269
+ "^正文未下到 (\\d+) 篇$",
270
+ "No main text: $1"
271
+ ],
272
+ [
273
+ "^附录未下全 (\\d+) 篇$",
274
+ "Supp. missing: $1"
275
+ ],
276
+ [
277
+ "^已完成 (\\d+) 篇$",
278
+ "Saved: $1"
279
+ ],
280
+ [
281
+ "^另有 (\\d+) 篇未列出$",
282
+ "+$1 more"
283
+ ],
284
+ [
285
+ "^另有 (\\d+) 项$",
286
+ "+$1 more"
287
+ ],
288
+ [
289
+ "^剩 (.+)$",
290
+ "$1 left"
291
+ ],
292
+ [
293
+ "^终止整个下载任务?这一篇立即结束,剩下的 (\\d+) 篇不再下载。$",
294
+ "Stop the whole task? This one ends now; $1 more won't run."
295
+ ],
296
+ [
297
+ "^正在下载 (.+)$",
298
+ "Downloading $1"
299
+ ],
300
+ [
301
+ "^每家每小时 (\\d+) 篇$",
302
+ "$1/hour per publisher"
303
+ ],
304
+ [
305
+ "^登录页 (\\d+) 秒$",
306
+ "Login $1 s"
307
+ ],
308
+ [
309
+ "^已填 (\\d+)/(\\d+)$",
310
+ "$1/$2 set"
311
+ ],
312
+ [
313
+ "^附录 (\\d+)/(\\d+)$",
314
+ "Supp. $1/$2"
315
+ ],
316
+ [
317
+ "^已保存 (\\d+)/(\\d+)$",
318
+ "Saved $1/$2"
319
+ ],
320
+ [
321
+ "^正文 (\\d+) 篇$",
322
+ "Main $1"
323
+ ],
324
+ [
325
+ "^附录 (\\d+) 个$",
326
+ "Supp. $1"
327
+ ],
328
+ [
329
+ "^(\\d+) 篇未列出附录$",
330
+ "$1 list no supp."
331
+ ],
332
+ [
333
+ "^(.+) 等$",
334
+ "$1 etc."
335
+ ],
336
+ [
337
+ "^机构订阅 (\\d+)$",
338
+ "Subscription $1"
339
+ ],
340
+ [
341
+ "^预印本 (\\d+)$",
342
+ "Preprint $1"
343
+ ],
344
+ [
345
+ "^出版社 API (\\d+)$",
346
+ "Publisher API $1"
347
+ ],
348
+ [
349
+ "^开放获取 (\\d+)$",
350
+ "Open access $1"
351
+ ],
352
+ [
353
+ "^附录 (\\d+) 个已保存$",
354
+ "$1 supp. saved"
355
+ ],
356
+ [
357
+ "^补充材料已保存 (\\d+) 个$",
358
+ "$1 supp. files saved"
359
+ ],
360
+ [
361
+ "^已完成 (\\d+)/(\\d+) 篇,等待下一篇$",
362
+ "Done $1/$2; next soon"
363
+ ],
364
+ [
365
+ "^批量下载结束:成功 (\\d+),失败 (\\d+)$",
366
+ "Batch done: $1 saved, $2 failed"
367
+ ],
368
+ [
369
+ "^第 (\\d+)/(\\d+) 篇已检查,等待下一篇$",
370
+ "Paper $1/$2 checked; next soon"
371
+ ],
372
+ [
373
+ "^第 (\\d+)/(\\d+) 篇已保存,等待下一篇$",
374
+ "Paper $1/$2 saved; next soon"
375
+ ],
376
+ [
377
+ "^第 (\\d+)/(\\d+) 篇未完成,等待下一篇$",
378
+ "Paper $1/$2 not saved; next soon"
379
+ ],
380
+ [
381
+ "^第 (\\d+)/(\\d+) 篇:进入机构访问$",
382
+ "Paper $1/$2: school access"
383
+ ],
384
+ [
385
+ "^这篇文章只在 (.+) 平台提供,暂不支持,当前路径已停止$",
386
+ "Only on $1, not supported yet; route stopped"
387
+ ],
388
+ [
389
+ "^被拒绝:key 不对,或已失效((.+))$",
390
+ "Rejected: wrong or expired key ($1)"
391
+ ],
392
+ [
393
+ "^服务器限流,稍后再试;key 本身可能没问题((.+))$",
394
+ "Rate-limited; try later ($1)"
395
+ ],
396
+ [
397
+ "^没连上服务器,没法判断;检查网络或代理后再试((.+))$",
398
+ "Couldn't reach the server ($1)"
399
+ ],
400
+ [
401
+ "^请输入 (\\d+) 到 (\\d+) 之间的整数$",
402
+ "Enter a whole number $1–$2"
403
+ ],
404
+ [
405
+ "^保存失败:(.+)$",
406
+ "Save failed: $1"
407
+ ],
408
+ [
409
+ "^清除失败:(.+)$",
410
+ "Clear failed: $1"
411
+ ],
412
+ [
413
+ "^记录失败:(.+)$",
414
+ "Report failed: $1"
415
+ ],
416
+ [
417
+ "^读取配置失败:(.+)$",
418
+ "Couldn't read settings: $1"
419
+ ],
420
+ [
421
+ "^打开失败:(.+)$",
422
+ "Couldn't open: $1"
423
+ ],
424
+ [
425
+ "^测试没有完成:(.+)$",
426
+ "Test didn't finish: $1"
427
+ ],
428
+ [
429
+ "^已收到:.+,正在处理$",
430
+ "Got it; working on it"
431
+ ],
432
+ [
433
+ "^找不到 paper-search 命令,没法测试;也可以在终端运行 (.+)$",
434
+ "paper-search not found; run $1 in a terminal"
435
+ ]
436
+ ]
437
+ }
@@ -9,6 +9,7 @@ Commands:
9
9
  publisher-check --doi DOI run one institutional download and print a sanitized report
10
10
  progress open the floating progress window
11
11
  progress --json [--watch] read-only snapshot of the current task progress file
12
+ settings [PAGE|KEY] show the progress window's settings: download, wait, keys, or one API key (e.g. EASYSCHOLAR_KEY)
12
13
  preview [--run-id ID --doi DOI] latest screenshots of the download browser (JSON)
13
14
  entitlements [list|set|clear] remembered "has access / no access" decisions per journal or publisher
14
15
  issues [list|show ID|resolve ID --note TEXT] problem reports filed from the progress window (agent review)
@@ -315,11 +316,10 @@ def _cmd_publisher_check(args: argparse.Namespace) -> int:
315
316
  report["file"] = path.name
316
317
  report["size_kb"] = result.get("size_kb")
317
318
  try:
318
- import pymupdf
319
+ from . import pdf_text
319
320
 
320
- with pymupdf.open(path) as doc:
321
- report["pages"] = doc.page_count
322
- first = doc[0].get_text() if doc.page_count else ""
321
+ report["pages"] = pdf_text.page_count(path)
322
+ first = pdf_text.text(path, 1) if report["pages"] else ""
323
323
  report["first_page_has_doi"] = (result.get("doi") or "").lower() in first.lower()
324
324
  except Exception:
325
325
  report["pages"] = None
@@ -422,6 +422,44 @@ def _cmd_issues(args: argparse.Namespace) -> int:
422
422
  return 0
423
423
 
424
424
 
425
+ SETTINGS_PAGES = ("home", "download", "wait", "keys")
426
+
427
+
428
+ def _cmd_settings(args: argparse.Namespace) -> int:
429
+ """Open the settings in the progress window, at a page or at one service's key."""
430
+ from . import api_keys, progress_reporter
431
+
432
+ target = (args.target or "home").strip()
433
+ page = target if target in SETTINGS_PAGES else "keys"
434
+ found = None if target in SETTINGS_PAGES else api_keys.find(target)
435
+ if page == "keys" and target != "keys" and found is None:
436
+ print(json.dumps({"ok": False, "error": f"没有这一项设置:{target}"}, ensure_ascii=False))
437
+ return 2
438
+ service = found["id"] if found else ""
439
+ # Servers and other machines without a screen keep the terminal: `paper-search setup`.
440
+ terminal = "paper-search setup " + (found["keys"][0]["key"] if found else "<KEY>")
441
+ if sys.platform.startswith("linux") and not (os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY")):
442
+ print(json.dumps({"ok": False, "error": f"这台电脑没有图形界面,打不开设置窗口;请在终端运行 {terminal}"},
443
+ ensure_ascii=False))
444
+ return 1
445
+ try:
446
+ import webview # noqa: F401 (the settings need the capsule's web view, not the classic window)
447
+ except Exception:
448
+ print(json.dumps({"ok": False, "error": f"设置窗口需要 pywebview,当前环境里没有;请运行 paper-search carsi update,或在终端运行 {terminal}"},
449
+ ensure_ascii=False))
450
+ return 1
451
+ try:
452
+ window = progress_reporter.open_settings(page, service)
453
+ except (OSError, RuntimeError) as exc:
454
+ print(json.dumps({"ok": False, "error": f"设置窗口没能打开:{exc};也可以在终端运行 {terminal}"}, ensure_ascii=False))
455
+ return 1
456
+ reply = {"ok": True, "window": window, "page": page, **({"service": service} if service else {})}
457
+ if os.environ.get("SSH_CONNECTION"):
458
+ reply["note"] = f"窗口开在这台电脑自己的屏幕上;远程连接、看不到这块屏幕时,请在终端运行 {terminal}"
459
+ print(json.dumps(reply, ensure_ascii=False))
460
+ return 0
461
+
462
+
425
463
  def main(argv: list[str] | None = None) -> int:
426
464
  # Fingerprint generation needs no parallel linear algebra. On Windows its
427
465
  # default OpenBLAS worker pool reserves hundreds of MiB in each backend.
@@ -515,6 +553,10 @@ def main(argv: list[str] | None = None) -> int:
515
553
 
516
554
  sub.add_parser("progress", help="open the progress window; `progress --json` for a read-only snapshot", add_help=False)
517
555
 
556
+ stg = sub.add_parser("settings", help="show the progress window's settings")
557
+ stg.add_argument("target", nargs="?", help="download, wait, keys, or an API key name such as EASYSCHOLAR_KEY")
558
+ stg.set_defaults(func=_cmd_settings)
559
+
518
560
  args = parser.parse_args(argv)
519
561
  if args.command == "config" and args.action != "list" and not args.key:
520
562
  parser.error("config get/set needs KEY")
@@ -0,0 +1,51 @@
1
+ """PaperSearch's CLI config file (``config.json``), shared with ``paper-search setup``.
2
+
3
+ The progress window writes the download directory and API keys here, so the
4
+ CLI and the window always show the same values."""
5
+ from __future__ import annotations
6
+
7
+ import json
8
+ import os
9
+ import tempfile
10
+ from pathlib import Path
11
+
12
+
13
+ def config_path() -> Path:
14
+ override = os.environ.get("PAPER_SEARCH_CONFIG_FILE")
15
+ if override:
16
+ return Path(override).expanduser()
17
+ return Path(os.environ.get("PAPER_SEARCH_CONFIG_DIR", str(Path.home() / ".config" / "paper-search-cli"))) / "config.json"
18
+
19
+
20
+ def read() -> dict:
21
+ path = config_path()
22
+ if not path.exists():
23
+ return {}
24
+ data = json.loads(path.read_text(encoding="utf-8-sig"))
25
+ if not isinstance(data, dict):
26
+ raise ValueError("PaperSearch 配置必须是 JSON 对象")
27
+ return data
28
+
29
+
30
+ def update(changes: dict[str, str | None]) -> None:
31
+ """Set (or, for None, remove) these keys and keep every other setting.
32
+
33
+ The file is replaced atomically, never left half written; like the CLI's
34
+ own writes it is readable by the user only."""
35
+ data = read()
36
+ for key, value in changes.items():
37
+ if value is None:
38
+ data.pop(key, None)
39
+ else:
40
+ data[key] = value
41
+ target = config_path()
42
+ target.parent.mkdir(parents=True, exist_ok=True)
43
+ with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", dir=target.parent, delete=False) as fh:
44
+ temporary = Path(fh.name)
45
+ json.dump(data, fh, ensure_ascii=False, indent=2)
46
+ fh.write("\n")
47
+ try:
48
+ os.chmod(temporary, 0o600)
49
+ temporary.replace(target)
50
+ finally:
51
+ temporary.unlink(missing_ok=True)
@@ -104,6 +104,8 @@ DEFAULT_CONFIG: dict[str, Any] = {
104
104
  "progress_bar_auto": True,
105
105
  # 需要登录学校或完成验证时,除了进度胶囊变色,再发一条系统通知;进度窗口的设置里可以关。
106
106
  "progress_notify": False,
107
+ # The progress window's language: "zh" or "en" (user_settings.language).
108
+ "progress_language": "zh",
107
109
  # 每篇文章在学校登录页等待用户输入的总时长上限,秒;从第一次等待算起。
108
110
  "browser_login_timeout": 180,
109
111
  # 不在学校登录页时(出版社页面、选机构页、人机验证、取 PDF 时等待处理)最多等多久,秒;
@@ -1,33 +1,17 @@
1
1
  """Shared default download directory, stored in PaperSearch's CLI config."""
2
2
  from __future__ import annotations
3
3
 
4
- import json
5
4
  import os
6
- import tempfile
7
5
  from pathlib import Path
8
6
 
9
- KEY = "DEFAULT_DOWNLOAD_PATH"
10
-
11
-
12
- def config_path() -> Path:
13
- override = os.environ.get("PAPER_SEARCH_CONFIG_FILE")
14
- if override:
15
- return Path(override).expanduser()
16
- return Path(os.environ.get("PAPER_SEARCH_CONFIG_DIR", str(Path.home() / ".config" / "paper-search-cli"))) / "config.json"
7
+ from . import cli_config
8
+ from .cli_config import config_path # noqa: F401 (kept for callers of this module)
17
9
 
18
-
19
- def _read() -> dict:
20
- path = config_path()
21
- if not path.exists():
22
- return {}
23
- data = json.loads(path.read_text(encoding="utf-8"))
24
- if not isinstance(data, dict):
25
- raise ValueError("PaperSearch 配置必须是 JSON 对象")
26
- return data
10
+ KEY = "DEFAULT_DOWNLOAD_PATH"
27
11
 
28
12
 
29
13
  def configured() -> str:
30
- value = os.environ.get(KEY) or _read().get(KEY) or ""
14
+ value = os.environ.get(KEY) or cli_config.read().get(KEY) or ""
31
15
  return str(Path(str(value)).expanduser()) if value else ""
32
16
 
33
17
 
@@ -52,17 +36,5 @@ def validate(value: str) -> str:
52
36
  def save(value: str) -> str:
53
37
  value = validate(value)
54
38
  Path(value).mkdir(parents=True, exist_ok=True)
55
- data = _read()
56
- data[KEY] = value
57
- target = config_path()
58
- target.parent.mkdir(parents=True, exist_ok=True)
59
- # Preserve unrelated CLI settings; replace atomically, never write a partial config.
60
- with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", dir=target.parent, delete=False) as fh:
61
- temporary = Path(fh.name)
62
- json.dump(data, fh, ensure_ascii=False, indent=2)
63
- fh.write("\n")
64
- try:
65
- temporary.replace(target)
66
- finally:
67
- temporary.unlink(missing_ok=True)
39
+ cli_config.update({KEY: value})
68
40
  return value
@@ -215,10 +215,19 @@ class CaptureMixin:
215
215
  from ..browser.preview import pause as pause_preview
216
216
 
217
217
  with pause_preview(getattr(page, "context", None)):
218
- body, url, block = self._capture_pdf_channels(page, doi, result)
219
- if (body is None and not block and len(result.pdf_attempts) == tried_before
220
- and not result.reason and self._wait_for_pdf_candidates(page, doi, result)):
218
+ try:
221
219
  body, url, block = self._capture_pdf_channels(page, doi, result)
220
+ if (body is None and not block and len(result.pdf_attempts) == tried_before
221
+ and not result.reason and self._wait_for_pdf_candidates(page, doi, result)):
222
+ body, url, block = self._capture_pdf_channels(page, doi, result)
223
+ except watchdog.BrowserBudgetExhausted as exc:
224
+ # The step's time ran out between browser calls, so the browser is fine. A PDF
225
+ # the article's own link already gave is saved unconfirmed for PaperSearch to
226
+ # check, not lost with the time (Science, 2026-11-09).
227
+ if self._fallback_pdf is None:
228
+ raise
229
+ self._event(result, "pdf_budget_exhausted", str(exc))
230
+ body, url, block = None, "", None
222
231
  if body is None and not block and self._fallback_pdf is not None:
223
232
  body, url = self._fallback_pdf
224
233
  self._event(result, "pdf_saved_unconfirmed", f"{url} | no DOI or title on the first pages")
@@ -1756,15 +1765,15 @@ class CaptureMixin:
1756
1765
  if self._is_supplementary_url(url):
1757
1766
  return False
1758
1767
  if self.adapter.requires_complete_pdf:
1759
- # Never label a truncated or repaired transfer as saved.
1760
- if b"%%EOF" not in body[-2048:]:
1768
+ # Never label a truncated or damaged transfer as saved.
1769
+ from .. import pdf_text
1770
+
1771
+ if not pdf_text.complete(body):
1761
1772
  return False
1762
1773
  try:
1763
- import pymupdf
1764
- with pymupdf.open(stream=body, filetype="pdf") as document:
1765
- if not len(document) or document.is_repaired:
1766
- return False
1767
- except Exception:
1774
+ if not pdf_text.page_count(body):
1775
+ return False
1776
+ except pdf_text.PdfError:
1768
1777
  return False
1769
1778
  from .pdf_guard import classify_with_evidence
1770
1779