papersearch 0.7.2 → 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/LICENSE-paper-search-mcp-nodejs +24 -0
- package/NOTICE +8 -37
- package/README.en.md +7 -3
- package/README.fr.md +268 -0
- package/README.ja.md +268 -0
- package/README.ko.md +268 -0
- package/README.md +7 -3
- package/README.zh-Hant.md +268 -0
- package/dist/capabilities/download/batch/batch.d.ts +16 -1
- package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batch.js +669 -53
- package/dist/capabilities/download/batch/batch.js.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.js +4 -3
- package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
- package/dist/capabilities/download/batch/batchSummary.js +1 -1
- package/dist/capabilities/download/batch/batchSummary.js.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.d.ts +12 -3
- package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.js +25 -4
- package/dist/capabilities/download/batch/networkLoss.js.map +1 -1
- package/dist/capabilities/download/batch/resume.d.ts +7 -0
- package/dist/capabilities/download/batch/resume.d.ts.map +1 -1
- package/dist/capabilities/download/batch/resume.js +50 -9
- package/dist/capabilities/download/batch/resume.js.map +1 -1
- package/dist/capabilities/download/content/markdown/pro.d.ts +6 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/pro.js.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.d.ts +8 -5
- package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.js +27 -15
- package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
- package/dist/capabilities/download/content/markdown/step.d.ts +9 -0
- package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/step.js +42 -2
- package/dist/capabilities/download/content/markdown/step.js.map +1 -1
- package/dist/capabilities/download/content/markdown/types.d.ts +10 -1
- package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -1
- package/dist/capabilities/download/handler.d.ts.map +1 -1
- package/dist/capabilities/download/handler.js +13 -5
- package/dist/capabilities/download/handler.js.map +1 -1
- package/dist/capabilities/download/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/download/outputLayout.js +3 -1
- package/dist/capabilities/download/outputLayout.js.map +1 -1
- package/dist/capabilities/download/tools.js +2 -2
- package/dist/capabilities/download/tools.js.map +1 -1
- package/dist/capabilities/download/types.d.ts +9 -1
- package/dist/capabilities/download/types.d.ts.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.d.ts +7 -0
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +13 -0
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +17 -9
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +89 -56
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.d.ts +11 -0
- package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.js +107 -59
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.d.ts +7 -2
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.js +30 -7
- package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.d.ts +2 -0
- package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.js +2 -0
- package/dist/infrastructure/school/SchoolProgress.js.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.d.ts +2 -0
- package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.js +2 -0
- package/dist/infrastructure/school/SchoolReadiness.js.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.js +4 -0
- package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -1
- package/dist/infrastructure/school/index.d.ts +2 -2
- package/dist/infrastructure/school/index.d.ts.map +1 -1
- package/dist/infrastructure/school/index.js +1 -1
- package/dist/infrastructure/school/index.js.map +1 -1
- package/dist/infrastructure/school/types.d.ts +52 -3
- package/dist/infrastructure/school/types.d.ts.map +1 -1
- package/dist/infrastructure/school/types.js.map +1 -1
- package/dist/management/failures/index.d.ts +28 -2
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +83 -21
- package/dist/management/failures/index.js.map +1 -1
- package/package.json +7 -2
- package/school/NOTICE +3 -2
- package/school/paper_search_school/adapters/__init__.py +2 -0
- package/school/paper_search_school/adapters/aps/__init__.py +3 -6
- package/school/paper_search_school/adapters/base.py +18 -0
- package/school/paper_search_school/adapters/copernicus/__init__.py +2 -7
- package/school/paper_search_school/adapters/elsevier/__init__.py +50 -1
- package/school/paper_search_school/adapters/frontiers/__init__.py +41 -2
- package/school/paper_search_school/adapters/ieee/__init__.py +6 -4
- package/school/paper_search_school/adapters/iop/__init__.py +8 -0
- package/school/paper_search_school/adapters/jama/__init__.py +8 -0
- package/school/paper_search_school/adapters/lww/__init__.py +14 -6
- package/school/paper_search_school/adapters/mdpi/__init__.py +12 -7
- package/school/paper_search_school/adapters/neurology/__init__.py +5 -2
- package/school/paper_search_school/adapters/optica/__init__.py +2 -9
- package/school/paper_search_school/adapters/oup/__init__.py +27 -4
- package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +8 -0
- package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
- package/school/paper_search_school/adapters/sage/__init__.py +4 -1
- package/school/paper_search_school/adapters/thieme/__init__.py +6 -11
- package/school/paper_search_school/api_keys.py +63 -13
- package/school/paper_search_school/assets/api_keys.json +14 -0
- package/school/paper_search_school/assets/capsule.html +274 -158
- package/school/paper_search_school/assets/capsule_en.json +99 -98
- package/school/paper_search_school/assets/capsule_fr.json +100 -99
- package/school/paper_search_school/assets/capsule_ja.json +99 -98
- package/school/paper_search_school/assets/capsule_ko.json +99 -98
- package/school/paper_search_school/assets/capsule_zh-Hant.json +94 -97
- package/school/paper_search_school/browser/batch_session.py +1 -1
- package/school/paper_search_school/browser/challenge/__init__.py +12 -9
- package/school/paper_search_school/browser/challenge/continuation.py +65 -0
- package/school/paper_search_school/browser/challenge/handlers/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/handlers/aws_waf.py +260 -0
- package/school/paper_search_school/browser/challenge/handlers/recaptcha_hcaptcha.py +167 -0
- package/school/paper_search_school/browser/challenge/handlers/text_captcha.py +100 -0
- package/school/paper_search_school/browser/challenge/handlers/turnstile.py +174 -0
- package/school/paper_search_school/browser/challenge/kinds.py +203 -0
- package/school/paper_search_school/browser/challenge/local/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/{interaction.py → local/interaction.py} +94 -13
- package/school/paper_search_school/browser/challenge/{pointer.py → local/pointer.py} +2 -2
- package/school/paper_search_school/browser/challenge/local/prompt.py +283 -0
- package/school/paper_search_school/browser/challenge/local/submission.py +33 -0
- package/school/paper_search_school/browser/challenge/services/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/services/solver.py +272 -0
- package/school/paper_search_school/cli_config.py +10 -5
- package/school/paper_search_school/cold_start.py +22 -11
- package/school/paper_search_school/config.py +11 -10
- package/school/paper_search_school/download_diagnostics.py +7 -2
- package/school/paper_search_school/engine/access_rules.py +15 -5
- package/school/paper_search_school/engine/batch.py +55 -15
- package/school/paper_search_school/engine/batch_access.py +59 -21
- package/school/paper_search_school/engine/batch_capture.py +215 -18
- package/school/paper_search_school/engine/batch_common.py +3 -0
- package/school/paper_search_school/engine/batch_diagnostics.py +25 -5
- package/school/paper_search_school/engine/batch_institution.py +168 -32
- package/school/paper_search_school/engine/batch_login.py +223 -16
- package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
- package/school/paper_search_school/engine/batch_waits.py +179 -12
- package/school/paper_search_school/engine/bridge.py +44 -7
- package/school/paper_search_school/engine/fulltext_page.py +45 -7
- package/school/paper_search_school/engine/router.py +18 -2
- package/school/paper_search_school/entitlements.py +1 -1
- package/school/paper_search_school/orchestrator.py +44 -18
- package/school/paper_search_school/pdf_utils.py +25 -16
- package/school/paper_search_school/progress_capsule.py +36 -6
- package/school/paper_search_school/progress_reporter.py +71 -13
- package/school/paper_search_school/progress_view.py +64 -44
- package/school/paper_search_school/publishers/builtin/iop.json +2 -1
- package/school/paper_search_school/publishers/builtin/neurology.json +4 -2
- package/school/paper_search_school/publishers/builtin/sage.json +4 -2
- package/school/paper_search_school/publishers/builtin/thieme.json +3 -1
- package/school/paper_search_school/publishers/site.py +12 -4
- package/school/paper_search_school/school_switch.py +34 -52
- package/school/paper_search_school/school_test.py +1 -1
- package/school/paper_search_school/server.py +24 -11
- package/school/paper_search_school/user_settings.py +13 -0
- package/school/pyproject.toml +1 -0
- package/skills/paper-search/SKILL.md +107 -107
- package/skills/paper-search/references/browser-download.md +102 -101
- package/skills/paper-search/references/capability-routing.md +89 -89
- package/skills/paper-search/references/cli-contract.md +78 -78
- package/skills/paper-search/references/federation-support.md +172 -172
- package/skills/paper-search/references/management-layer.md +78 -78
- package/skills/paper-search/references/publisher-support.md +38 -38
- package/skills/paper-search/references/school-setup.md +56 -55
- package/skills/paper-search/references/setup.md +20 -20
- package/skills/paper-search/references/troubleshooting.md +12 -12
- package/school/paper_search_school/browser/challenge/prompt.py +0 -154
|
@@ -1,100 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# School download: install the extension, set the school, choose the browser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
School subscription downloads (signing in through the school's academic identity federation or OpenAthens) let PaperSearch use the user's school access to download subscription papers in a browser. On a computer with a graphical interface it is installed only after the user agrees: ask once when the user says "start setup" or first wants a subscription article; when the user said no (`PAPER_SEARCH_SCHOOL_DECLINED=true`), or on a server without a graphical interface, do not install it and do not ask. Search and open download do not need it.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Check and install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
paper-search school status --format text
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Shows whether it is installed, the install directory, the browser used (Google Chrome's path and version, the driver version), the school, and whether PaperSearch has it enabled. When Chrome is older than the tested version, it says to update Chrome first.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
After the user agrees, run (when the agent installs it for the user, add `--yes --skip-school`):
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
paper-search school install
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- `paper-search
|
|
19
|
+
- Needs a graphical interface: the school login must happen in a visible browser. On Linux without a graphical interface (a server, with no `DISPLAY` or `WAYLAND_DISPLAY`) installation stops at the first step, and `paper-search setup` no longer asks whether to install it; on such machines use `paper-search setup <KEY>` for keys; search and open-access download work as usual.
|
|
20
|
+
- Needs Google Chrome on this computer; without it, installation stops. Then tell the user that Chrome must be installed first; after the user agrees, install it for them: on macOS with Homebrew run `brew install --cask google-chrome`, on Windows run `winget install -e --id Google.Chrome`; then run the same `school install` again. Without Homebrew or winget, or when the installation fails, ask the user to download and install it from https://www.google.com/chrome/. `--browser ego` uses the user's own ego lite instead (macOS only).
|
|
21
|
+
- Before installing, it lists the install location and the download size (about 0.5 GB; no browser is downloaded), and starts only after the user confirms. `--yes` skips the confirmation; use it only after the user has agreed.
|
|
22
|
+
- The user does not need to install Python first; when it fails midway, fix the reported problem and run the same command again: it continues from the step that failed.
|
|
23
|
+
- When done, it opens the settings window on the API key page; the user closes it with the × at the top right after filling it in, or when nothing is needed.
|
|
24
|
+
- In development builds with YesCaptcha, the user enters ClientKey in Settings → API key → YesCaptcha, presses "测试" (Test) to check the balance, then "保存" (Save). Supported challenges send only puzzle images and the question; the local browser applies the answer. School sign-in pages are excluded. The test checks the key, not whether a website will accept an answer.
|
|
25
|
+
- It enables itself when done (`PAPER_SEARCH_SCHOOL_ENABLED=true`, `PAPER_SEARCH_SCHOOL_EXECUTABLE` pointing at the new backend). When another backend was configured, it first asks the user whether to replace it.
|
|
26
|
+
- Installation asks for the school; `--skip-school` skips that, to configure it later.
|
|
27
|
+
- The first time the extension is configured, it asks whether to turn on system notifications. New configurations default to off, and Enter keeps the current choice; `--yes` does not mean consent to turning notifications on. When the agent configures it for the user, first ask the user whether to turn them on or off, then save the answer with the same backend's `config set progress_notify true` or `false`; when there is already a clear choice, do not ask again. Later the user can change it at once with the "系统通知" (Notifications) switch under the capsule's gear → "等待和提醒" (Waits & alerts); turning it off does not affect the amber breathing or clicking to bring back the browser.
|
|
28
|
+
- The progress window's settings (download folder, waits and alerts, API keys): click the capsule's gear, or run `paper-search settings [about|download|wait|keys|<KEY>]` (about: version and updates). When no download is running, it opens a window of its own, which goes away when the settings window is closed.
|
|
29
|
+
- `paper-search setup` also asks at the end whether to install the extension; `--skip-school` does not ask, `--install-school` installs it directly.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
A backend the user maintains (such as the development build in the repository) is set with `paper-search config set PAPER_SEARCH_SCHOOL_EXECUTABLE <path>`; do not change a path the user configured on your own.
|
|
31
32
|
|
|
32
|
-
##
|
|
33
|
+
## Sign in to the school first (optional)
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
|
-
paper-search school login --doi
|
|
36
|
+
paper-search school login --doi <DOI of an article the school subscribes to>
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
39
|
+
- Use it when the user wants to sign in before a batch download, or to try whether sign-in works; normally it is not needed: a download that meets a login stops and waits for the user.
|
|
40
|
+
- It opens the download browser, passes the site checks automatically, chooses the school, and stops at the school login page for the user to sign in (waiting at most `browser_login_timeout` seconds; `--max-wait <seconds>` changes it for this run only); after sign-in it checks that the full text of this article is visible, does not download the PDF, and keeps the sign-in for later downloads.
|
|
41
|
+
- Only `success: true` (`state: signed_in`) means sign-in succeeded. `access_without_login`: this article needs no sign-in (open access or campus network); try again with another article that needs a subscription; for `login_timeout`, `browser_closed`, `institution_pdf_entitlement_missing` and others, tell the user what the reply's `message` says.
|
|
42
|
+
- The program manages the download browser and its profile directory; sign in with this command or simply by downloading; do not dig through the source code for another way to sign in. When school subscription downloads are not installed or no school is configured, follow the hint in the reply.
|
|
42
43
|
|
|
43
|
-
##
|
|
44
|
+
## Update and uninstall
|
|
44
45
|
|
|
45
|
-
- PaperSearch
|
|
46
|
-
-
|
|
46
|
+
- After PaperSearch is upgraded, the first use of school subscription downloads makes the same update automatically (one line on stderr); when the user turned off automatic updates (`PAPER_SEARCH_SCHOOL_AUTO_UPDATE=false`) or the automatic update failed, `status` says the extension is behind; run `paper-search school update`: it reinstalls the backend and dependencies and checks Chrome; the school settings, sign-in sessions, Chrome and ego lite are left alone. An installation that used Camoufox switches to Chrome and states the directory of the old Camoufox browser; the user decides whether to delete it by hand. When it is already up to date it does nothing; `--force` forces a reinstall.
|
|
47
|
+
- Uninstall: `paper-search school uninstall`. It first lists what will be deleted and what kept, and deletes the install directory after the user confirms; when the PaperSearch config points at this installation's backend, it turns off the school download and clears the backend path; when it points elsewhere, it is left unchanged. School settings and sign-in sessions are kept by default, and it asks about them; with `--yes` they are kept unless `--remove-data` is also given. Google Chrome and ego lite are not affected.
|
|
47
48
|
|
|
48
|
-
##
|
|
49
|
+
## School
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
The user's school is stored in the backend configuration, as the user gives it; never preset or replace it. The user only needs to name the school; the backend works out its federation; do not ask the user which federation it is:
|
|
51
52
|
|
|
52
53
|
```bash
|
|
53
|
-
paper-search-school setup --institution "
|
|
54
|
+
paper-search-school setup --institution "School name the user gave" [--also-name "The school's official English name"]
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
- `--carsi --institution`
|
|
61
|
-
- `setup --check`
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
57
|
+
- Supported now: the academic identity federations of China mainland and Macao (CARSI), Hong Kong (HKAF), Singapore (SGAF), Japan (GakuNin), South Korea (KAFE), Malaysia (SIFULAN), India (INFED), Turkey (YETKİM), Sri Lanka (LIAF), Bangladesh (TIGERfed), Pakistan (PKIFED), Oman (OMREN), research institutes in China mainland (CSTCloud), Saudi Arabia (Maeen), Cyprus (CyNet), Israel (IUCC), Iran (IRFED), Azerbaijan (AzScienceNet), the United Kingdom (UK federation), Ireland (Edugate), France (RENATER), the Netherlands (SURFconext), Belgium (Belnet), Luxembourg (eduID Luxembourg), the countries of Northern, Central, Southern and Eastern Europe, and countries in the Americas, Oceania and Africa (each federation in `federation-support.md`), plus schools that sign in only through OpenAthens. `--institution` can be a school name (in any language), the school's domain or an entityID; the backend searches each federation's school list, saves only once it knows which school it is, and saves the federation it belongs to.
|
|
58
|
+
- Federation lists give school names in the local language and in English (China mainland and Macao have Chinese, Japan Japanese, Turkey Turkish, most European and Latin American countries local-language names; Hong Kong, South Korea, Singapore, Malaysia, South Asia, North America, Oceania and Africa mostly English only). When the school name the user gave is not English, add `--also-name` with the school's official English name (publishers mostly list schools by their English names); when you are unsure of the English name, leave it out.
|
|
59
|
+
- Some schools sign in through a login entry shared by several schools (universities in Israel, Norway and Croatia, research institutes in China mainland, some schools in Pakistan and Latvia), and the federation list has only their domains: when the school name finds nothing, search again with `--institution <school name> --also-name <school website domain>`; the program finds the entry by the domain and searches publishers by the given school name.
|
|
60
|
+
- On `school_ambiguous`, list the `candidates` (school name, federation, domain) for the user to choose, then rerun with the chosen school's `entity_id` as `--institution`; ask even when there is only one candidate: it is a school whose name does not quite match. On `school_not_found`, ask the user for the school's official name, English name or domain; when it is still not found, explain truthfully as the reply's `reasons` say: this school may not be connected to an academic identity federation or OpenAthens, and school subscription downloads cannot sign in for it; `federation_not_supported` means the school was found but its federation is not supported yet: tell the user so truthfully; `school_list_unavailable` means the list could not be fetched: retry later. When the user should send feedback, see "When school login fails" in `federation-support.md`.
|
|
61
|
+
- `--carsi --institution` searches only the CARSI list (error codes `carsi_school_*`); to look up the CARSI list: `paper-search-school setup --list-carsi-schools <keyword>`.
|
|
62
|
+
- When the `school` item of `setup --check` is `missing`, only the school name was saved; rerun the command above as the hint says.
|
|
63
|
+
- Once configured, the program chooses the federation and the school and presses continue; the user only enters the account and password on the school login page and completes human verification.
|
|
64
|
+
- With no school configured (`setup --carsi`), CARSI is still on, and the user chooses on the school-selection page.
|
|
65
|
+
- When the user's school is not in the publisher's list, report that it was not found; do not choose another school instead.
|
|
66
|
+
- Backend commands must use the same data directory as the downloads (PaperSearch's default is `${XDG_DATA_HOME:-~/.local/share}/paper-search-cli/school`); when needed, put `SCHOOL_DATA_DIR=<that directory>` before the command. The sign-in state is kept in the download browser in this directory.
|
|
66
67
|
|
|
67
|
-
###
|
|
68
|
+
### Several schools
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
Several schools can be saved; one of them is the current school, which downloads use by default. **Switch or name a school only when the user clearly asks; never switch on your own, and do not suggest which one to switch to.**
|
|
70
71
|
|
|
71
72
|
```bash
|
|
72
|
-
paper-search-school schools #
|
|
73
|
-
paper-search-school use "
|
|
74
|
-
paper-search-school forget "
|
|
73
|
+
paper-search-school schools # list saved schools; current is the current school
|
|
74
|
+
paper-search-school use "School name" # switch the current school; when not saved yet, look it up and save it as setup --institution does
|
|
75
|
+
paper-search-school forget "School name" # remove it from the list (the current school cannot be removed)
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
78
|
+
- When `setup --institution` changes the school, the old school stays in the list too. `use` accepts a school name, English name, domain or entityID; on `school_ambiguous`, list the `candidates` for the user to choose. For a school not saved yet, `use` looks it up and reports errors as above (`--also-name` too).
|
|
79
|
+
- To use another saved school only for this batch (the user says "download these with school X"): add `school` (the school name, etc.) to `download_batch`; the current school does not change, and this batch's "go on" (接着下) uses it too. When the extension is too old to know it, it reports "需要更新" (update needed, `school_update_needed`); run `paper-search school update`.
|
|
80
|
+
- Every school's sign-in is in the same download browser; switching does not sign out of the others; the user still enters the account and password on the school login page.
|
|
80
81
|
|
|
81
|
-
##
|
|
82
|
+
## Browser
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
The backend setting `browser_backend` takes one of two values:
|
|
84
85
|
|
|
85
|
-
- `chrome
|
|
86
|
-
- `ego
|
|
86
|
+
- `chrome` (default): the user's own Google Chrome, started by the backend with a separate browser profile, not touching the profile and tabs of the user's everyday Chrome. At the first download the user signs in to the school once in its window, and the sign-in is kept afterwards. Use it for everyday and batch downloads. When Chrome is installed elsewhere: `paper-search-school config set chrome_executable <Chrome program path>`. The old value `camoufox` is treated as `chrome`.
|
|
87
|
+
- `ego`: choose it to reuse sign-ins already in the user's ego lite (Chromium-based; the user and the agent look at the same browser; macOS only). The user must open `chrome://inspect/#remote-debugging` in ego and tick "Allow remote debugging for this browser instance" once. On each connection (for example after ego restarts) ego shows an "允许连接" (allow connection) prompt once, for the user to confirm; when the ego window is in the background the connection is often refused outright, and the download reports an error at once with the reason: ask the user to bring ego to the front, press "允许" (Allow), and retry.
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
Check or switch:
|
|
89
90
|
|
|
90
91
|
```bash
|
|
91
92
|
paper-search-school config get browser_backend
|
|
92
93
|
paper-search-school config set browser_backend chrome
|
|
93
94
|
```
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
The two browser profiles do not affect each other; switching does not delete the other one. Do not switch unless the user asks; `paper-search school install --browser ego` also switches the installation.
|
|
96
97
|
|
|
97
|
-
##
|
|
98
|
+
## Boundaries
|
|
98
99
|
|
|
99
|
-
-
|
|
100
|
-
- `
|
|
100
|
+
- The account, password and verification codes are entered only by the user in the browser; they never appear in the chat, command arguments, configuration or logs.
|
|
101
|
+
- `entitled_access` as `available` in `doctor` only means the backend can be reached; it does not mean signed in, or access to any paper.
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Setup: "start setup" (请开始配置)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
When the user says "start setup" (or "请开始配置", "配置 PaperSearch", "set up PaperSearch"), follow the fixed flow below. Ask one question at a time and wait for the answer before going on; do not list all the settings for the user to fill in at once.
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
2.
|
|
5
|
+
1. Run `paper-search doctor --format text` to see what is already set up; this step needs no question to the user. When there is no `paper-search` command, first install it with the user's consent as "When only the Skill is installed" in `management-layer.md` says, then run it.
|
|
6
|
+
2. Ask only one question: whether to use school subscription downloads (school setup). When asking, explain that it downloads the full texts and supplementary files of non-OA articles with the school account, and needs Google Chrome (installed too if missing). Do not ask in these cases: already installed (`entitled_access` in `doctor` is `available`): go straight to A; this computer has no graphical interface, or the user said no before (`PAPER_SEARCH_SCHOOL_DECLINED` is `true`): go straight to B. When the user says no, run `paper-search config set PAPER_SEARCH_SCHOOL_DECLINED true` to record it, then go to B.
|
|
7
7
|
|
|
8
|
-
A.
|
|
8
|
+
A. School setup (the user agrees to use school subscription downloads)
|
|
9
9
|
|
|
10
|
-
1.
|
|
11
|
-
2.
|
|
12
|
-
3.
|
|
13
|
-
4.
|
|
10
|
+
1. When it is not installed, install it (see `school-setup.md`): `paper-search school install --yes --skip-school`; when there is no Chrome, install Chrome first.
|
|
11
|
+
2. Ask the user for their school right away and set it: run `paper-search-school setup --institution "School name"` (see "School" in `school-setup.md`). Skip this only when the user says to skip it; then they choose on the school-selection page at the first download.
|
|
12
|
+
3. Everything else is set in the settings window: it opens by itself after installation; when it did not open, or it was installed long ago, run `paper-search settings` directly to open the settings window. Tell the user to enter the API keys they want and change the download folder and wait times in the window; each key has a "测试" (Test) button; when done, close it with the × at the top right. Recommend EasyScholar (impact factors and quartiles) and Semantic Scholar (body snippets) first; the other keys are optional. Do not ask for keys or the download folder one by one in the chat.
|
|
13
|
+
4. When the user says they are done, run `paper-search doctor --format text` and tell the user what they can use now.
|
|
14
14
|
|
|
15
|
-
B.
|
|
15
|
+
B. No school setup
|
|
16
16
|
|
|
17
|
-
1.
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
20
|
-
4.
|
|
21
|
-
5.
|
|
17
|
+
1. Recommend only two keys: `EASYSCHOLAR_KEY` (impact factors and quartiles) and `SEMANTIC_SCHOLAR_API_KEY` (body snippets), with where to apply (the To enable line in `doctor`); all other keys are optional; mention them only when the user asks. When the user needs neither, skip to step 4.
|
|
18
|
+
2. Ask the user to run `paper-search setup --skip-school` in their own terminal to enter the keys (the input is hidden), and to tell you when done.
|
|
19
|
+
3. When the user says they are done, run `paper-search config test <KEY>` for each key they entered to confirm it works.
|
|
20
|
+
4. Set the default download folder (see "Default download folder" below).
|
|
21
|
+
5. Run `paper-search doctor --format text` and tell the user what they can use now.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Outside "start setup": when the user first wants a subscription article, school subscription downloads are not installed, the user has not said no, and this computer has a graphical interface, also ask once whether to install it (explained as in step 2); when they agree, do steps 1–3 of A. When the user only asks what a capability lacks, mention only the key it needs and where to apply; for entering it, use step 3 of A (the settings window) or step 2 of B (the terminal).
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Default download folder
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
During setup, or at the first download when it has not been set, first check whether it is set:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
paper-search config get DEFAULT_DOWNLOAD_PATH
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
When it is not set (`configured` is `false`), ask the user: "Which folder should downloaded papers go to by default?" When the user gives a place, save it as a full path (`~` means the home folder):
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
paper-search config set DEFAULT_DOWNLOAD_PATH "~/Documents/Papers"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
After that, do not pass `savePath` / `--save-path` when downloading: files go into a new `<YYYYMMDD-HHmmss>_PaperSearchDownload` folder created in this folder each time; pass it only when the user names another place for this download. When it is not set, files go to `./downloads` under the command's current directory, a place that changes and that users find hard to locate. Users can also change this folder in the settings of the progress capsule.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# When search commands fail
|
|
2
2
|
|
|
3
|
-
|
|
|
3
|
+
| Situation | What to do |
|
|
4
4
|
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
5
|
-
|
|
|
6
|
-
| Windows
|
|
7
|
-
| Windows
|
|
8
|
-
| API key
|
|
9
|
-
| Google Scholar
|
|
10
|
-
| Google Scholar
|
|
11
|
-
| 429
|
|
12
|
-
| 0
|
|
13
|
-
|
|
|
5
|
+
| Command not found | Install it with the user's consent, as "When only the Skill is installed" in `management-layer.md` says |
|
|
6
|
+
| Windows PowerShell blocks `paper-search` or `npm` (script execution policy) | Use `paper-search.cmd` and `npm.cmd` instead; do not change the execution policy |
|
|
7
|
+
| On Windows, `--json-args` reports `is not valid JSON` | PowerShell removed the double quotes in the argument: write the JSON to a file and pass `--json-args '@<file path>'` |
|
|
8
|
+
| API key or email missing | Tell the user three things: which key this capability needs; where to apply (the address in the error or in `paper-search doctor --format text`); after applying, run `paper-search setup <KEY>` in their own terminal to enter it, then `paper-search config test <KEY>` to confirm it works. When school subscription downloads are installed and the user is at this computer, you can also run `paper-search settings <KEY>` to open the settings window for the user to fill in (when it is not installed or there is no graphical interface, it returns an error with the terminal command). Once the key is entered, rerun the original command. |
|
|
9
|
+
| Google Scholar returns CAPTCHA/429 or an unusual-traffic page | Scholar is a best-effort source: `0.5 RPS` by default, successful results cached, stops at once on a verification page. Wait a while, then retry with `--platform googlescholar --max-results 1`; if needed, configure an authorized `GOOGLE_SCHOLAR_PROXY_URL`. It is not in the default `--sources all` list |
|
|
10
|
+
| Google Scholar still unavailable, and no key wanted | Use `paper-search search "<search terms>" --sources no-key --max-results 5 --pretty` (Crossref, PubMed, Europe PMC, arXiv, OpenReview) |
|
|
11
|
+
| 429 rate limit | Lower `--max-results`, switch platform, or suggest configuring an optional key |
|
|
12
|
+
| 0 results | Broaden the keywords, use English synonyms, switch platform, or widen with `--sources` |
|
|
13
|
+
| Download failed | Use the unified `download_with_fallback` and report each attempt; failures involving the school's access are handled by the failure classes in `browser-download.md` |
|
|
14
14
|
|
|
15
|
-
Scholar
|
|
15
|
+
Scholar settings: `SCHOLAR_RATE_LIMIT_RPS` (default `0.5`), `SCHOLAR_MAX_RETRIES` (default `2`), `SCHOLAR_TIMEOUT_MS` (default `15000`). Only adjust them in the more conservative direction. Scholar is for finding individual papers and topping up small searches; for batch searches use PubMed, Crossref and OpenAlex. Stop at a verification page and try again after a while.
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"""One bounded press on another provider's own confirmation control.
|
|
2
|
-
|
|
3
|
-
Turnstile's checkbox has its own module (``challenge_interaction``). The same
|
|
4
|
-
kind of control on the other providers' interstitials — reCAPTCHA v2's "I'm not
|
|
5
|
-
a robot", hCaptcha's checkbox, AWS WAF's "Verify you are human" button — is a
|
|
6
|
-
press the program can make as well: it starts the provider's own check and
|
|
7
|
-
answers no puzzle. A puzzle that follows is the user's, and
|
|
8
|
-
``needs_manual_verification`` hands the page over as before.
|
|
9
|
-
|
|
10
|
-
Off unless ``PAPER_SEARCH_AUTO_CONFIRM`` is ``0`` (user, 2026-11-18: the
|
|
11
|
-
control is pressed as well; only the puzzle behind it stays the user's). On a
|
|
12
|
-
page the user is watching, a press can still turn a short wait into an image
|
|
13
|
-
challenge, so the switch exists to turn it off per run. Turnstile is unaffected:
|
|
14
|
-
the program clicks its box either way.
|
|
15
|
-
|
|
16
|
-
Nothing here solves a puzzle, reads a response token, navigates, or decides
|
|
17
|
-
that verification passed.
|
|
18
|
-
"""
|
|
19
|
-
from __future__ import annotations
|
|
20
|
-
|
|
21
|
-
import os
|
|
22
|
-
import re
|
|
23
|
-
import time
|
|
24
|
-
from typing import Any, Literal
|
|
25
|
-
from urllib.parse import urlsplit
|
|
26
|
-
|
|
27
|
-
from . import pointer
|
|
28
|
-
|
|
29
|
-
#: Provider frames and the one control each shows before any puzzle.
|
|
30
|
-
_FRAMES: tuple[tuple[str, re.Pattern[str], str], ...] = (
|
|
31
|
-
("reCAPTCHA", re.compile(r"^https://(?:www\.)?(?:google\.com|recaptcha\.net)/recaptcha/"
|
|
32
|
-
r"(?:api2|enterprise)/anchor"), "#recaptcha-anchor, .recaptcha-checkbox"),
|
|
33
|
-
("hCaptcha", re.compile(r"^https://(?:[a-z0-9-]+\.)*hcaptcha\.com/captcha/"), "#checkbox"),
|
|
34
|
-
)
|
|
35
|
-
#: AWS WAF's own button: the only control on its interstitial, and its puzzle
|
|
36
|
-
#: follows a press on it.
|
|
37
|
-
_AWS_WAF = re.compile(r"^https://[^/]*\.captcha\.awswaf\.com/")
|
|
38
|
-
_AWS_BUTTONS = ("button:has-text('Verify you are human')",
|
|
39
|
-
"button:has-text('Verify you are a human')",
|
|
40
|
-
"button:has-text('verify you are human')")
|
|
41
|
-
#: The longest one press may take, including its approach.
|
|
42
|
-
PRESS_LIMIT_SEC = 3.0
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def enabled() -> bool:
|
|
46
|
-
"""Whether pressing another provider's own confirmation control is allowed.
|
|
47
|
-
|
|
48
|
-
On unless ``PAPER_SEARCH_AUTO_CONFIRM`` is 0 (user, 2026-11-18: these
|
|
49
|
-
controls are pressed as well). Only the confirmation control is pressed —
|
|
50
|
-
the puzzle behind it stays the user's, and ``needs_manual_verification``
|
|
51
|
-
hands that over as before.
|
|
52
|
-
"""
|
|
53
|
-
value = os.environ.get("PAPER_SEARCH_AUTO_CONFIRM", "").strip().lower()
|
|
54
|
-
return value not in {"0", "false", "no", "off"}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def _unchecked(control: Any) -> bool:
|
|
58
|
-
"""Not already pressed: ``aria-checked`` false, or no such attribute."""
|
|
59
|
-
try:
|
|
60
|
-
state = (control.get_attribute("aria-checked") or "").strip().lower()
|
|
61
|
-
except Exception: # noqa: BLE001 - a read that fails leaves the control alone
|
|
62
|
-
state = "true"
|
|
63
|
-
return state in {"false", ""}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def _press(page: Any, control: Any, *, box: dict[str, Any] | None,
|
|
67
|
-
remaining_ms: int) -> bool:
|
|
68
|
-
"""Approach the control, then let its own actionable click press it."""
|
|
69
|
-
if box:
|
|
70
|
-
pointer.approach(page, box, limit_sec=pointer.budget_for(remaining_ms))
|
|
71
|
-
control.click(timeout=remaining_ms, no_wait_after=True)
|
|
72
|
-
return True
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def click_confirm_control(page: Any, *, timeout_ms: int, checkpoint: Any = None,
|
|
76
|
-
observation: Any = None) -> Literal["absent", "clicked", "unavailable"]:
|
|
77
|
-
"""One press on the first visible confirmation control of a known provider."""
|
|
78
|
-
from ..driver import Error, TimeoutError
|
|
79
|
-
|
|
80
|
-
def note(reason: str) -> None:
|
|
81
|
-
if observation is not None:
|
|
82
|
-
observation(reason)
|
|
83
|
-
|
|
84
|
-
until = time.monotonic() + max(0.0, timeout_ms) / 1000
|
|
85
|
-
unavailable = False
|
|
86
|
-
frames = getattr(page, "frames", ())
|
|
87
|
-
frames = frames if isinstance(frames, (list, tuple)) else ()
|
|
88
|
-
for frame in frames:
|
|
89
|
-
if checkpoint is not None:
|
|
90
|
-
checkpoint()
|
|
91
|
-
if time.monotonic() >= until:
|
|
92
|
-
return "unavailable" if unavailable else "absent"
|
|
93
|
-
url = str(getattr(frame, "url", "") or "")
|
|
94
|
-
for name, pattern, selector in _FRAMES:
|
|
95
|
-
if not pattern.search(url):
|
|
96
|
-
continue
|
|
97
|
-
try:
|
|
98
|
-
controls = frame.locator(selector)
|
|
99
|
-
count = controls.count()
|
|
100
|
-
if not count:
|
|
101
|
-
continue
|
|
102
|
-
control = controls.first
|
|
103
|
-
if not control.is_visible() or not control.is_enabled() or not _unchecked(control):
|
|
104
|
-
note(f"{name}: not actionable")
|
|
105
|
-
unavailable = True
|
|
106
|
-
continue
|
|
107
|
-
remaining_ms = int((until - time.monotonic()) * 1000)
|
|
108
|
-
if remaining_ms <= 0:
|
|
109
|
-
return "unavailable"
|
|
110
|
-
_press(page, control, box=control.bounding_box(), remaining_ms=remaining_ms)
|
|
111
|
-
note(f"{name}: control pressed")
|
|
112
|
-
return "clicked"
|
|
113
|
-
except TimeoutError:
|
|
114
|
-
note(f"{name}: actionability timeout")
|
|
115
|
-
unavailable = True
|
|
116
|
-
except Error as exc:
|
|
117
|
-
if any(text in str(exc).lower() for text in (
|
|
118
|
-
"frame was detached", "frame has been detached", "element is not attached",
|
|
119
|
-
"execution context was destroyed")):
|
|
120
|
-
unavailable = True
|
|
121
|
-
continue
|
|
122
|
-
raise
|
|
123
|
-
|
|
124
|
-
# AWS WAF puts its button on the outer page, not in a provider frame.
|
|
125
|
-
try:
|
|
126
|
-
on_aws = any(_AWS_WAF.match(str(script.get_attribute("src") or ""))
|
|
127
|
-
for script in page.locator("script[src]").all())
|
|
128
|
-
except (Error, AttributeError, TypeError):
|
|
129
|
-
on_aws = False
|
|
130
|
-
if not on_aws:
|
|
131
|
-
return "unavailable" if unavailable else "absent"
|
|
132
|
-
for selector in _AWS_BUTTONS:
|
|
133
|
-
if time.monotonic() >= until:
|
|
134
|
-
return "unavailable"
|
|
135
|
-
try:
|
|
136
|
-
buttons = page.locator(selector)
|
|
137
|
-
if not buttons.count():
|
|
138
|
-
continue
|
|
139
|
-
button = buttons.first
|
|
140
|
-
if not button.is_visible() or not button.is_enabled():
|
|
141
|
-
continue
|
|
142
|
-
remaining_ms = int((until - time.monotonic()) * 1000)
|
|
143
|
-
if remaining_ms <= 0:
|
|
144
|
-
return "unavailable"
|
|
145
|
-
_press(page, button, box=button.bounding_box(), remaining_ms=remaining_ms)
|
|
146
|
-
note("AWS WAF: control pressed")
|
|
147
|
-
return "clicked"
|
|
148
|
-
except TimeoutError:
|
|
149
|
-
unavailable = True
|
|
150
|
-
except Error as exc:
|
|
151
|
-
if not any(text in str(exc).lower() for text in ("element is not attached",)):
|
|
152
|
-
raise
|
|
153
|
-
unavailable = True
|
|
154
|
-
return "unavailable" if unavailable else "absent"
|