ai4scholar 0.1.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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/assets/styles.css +588 -0
  4. package/assets/template_fulltext.html +342 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +65 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/src/commands.d.ts +5 -0
  10. package/dist/src/commands.d.ts.map +1 -0
  11. package/dist/src/commands.js +89 -0
  12. package/dist/src/commands.js.map +1 -0
  13. package/dist/src/hooks/scholar-mode.d.ts +16 -0
  14. package/dist/src/hooks/scholar-mode.d.ts.map +1 -0
  15. package/dist/src/hooks/scholar-mode.js +10 -0
  16. package/dist/src/hooks/scholar-mode.js.map +1 -0
  17. package/dist/src/tools/api-client.d.ts +19 -0
  18. package/dist/src/tools/api-client.d.ts.map +1 -0
  19. package/dist/src/tools/api-client.js +119 -0
  20. package/dist/src/tools/api-client.js.map +1 -0
  21. package/dist/src/tools/arxiv.d.ts +20 -0
  22. package/dist/src/tools/arxiv.d.ts.map +1 -0
  23. package/dist/src/tools/arxiv.js +83 -0
  24. package/dist/src/tools/arxiv.js.map +1 -0
  25. package/dist/src/tools/biorxiv.d.ts +37 -0
  26. package/dist/src/tools/biorxiv.d.ts.map +1 -0
  27. package/dist/src/tools/biorxiv.js +76 -0
  28. package/dist/src/tools/biorxiv.js.map +1 -0
  29. package/dist/src/tools/google-scholar.d.ts +20 -0
  30. package/dist/src/tools/google-scholar.d.ts.map +1 -0
  31. package/dist/src/tools/google-scholar.js +57 -0
  32. package/dist/src/tools/google-scholar.js.map +1 -0
  33. package/dist/src/tools/params.d.ts +8 -0
  34. package/dist/src/tools/params.d.ts.map +1 -0
  35. package/dist/src/tools/params.js +35 -0
  36. package/dist/src/tools/params.js.map +1 -0
  37. package/dist/src/tools/pubmed.d.ts +71 -0
  38. package/dist/src/tools/pubmed.d.ts.map +1 -0
  39. package/dist/src/tools/pubmed.js +118 -0
  40. package/dist/src/tools/pubmed.js.map +1 -0
  41. package/dist/src/tools/result.d.ts +19 -0
  42. package/dist/src/tools/result.d.ts.map +1 -0
  43. package/dist/src/tools/result.js +21 -0
  44. package/dist/src/tools/result.js.map +1 -0
  45. package/dist/src/tools/semantic-scholar.d.ts +159 -0
  46. package/dist/src/tools/semantic-scholar.d.ts.map +1 -0
  47. package/dist/src/tools/semantic-scholar.js +254 -0
  48. package/dist/src/tools/semantic-scholar.js.map +1 -0
  49. package/openclaw.plugin.json +34 -0
  50. package/package.json +60 -0
  51. package/scripts/__pycache__/fulltext_search.cpython-313.pyc +0 -0
  52. package/scripts/__pycache__/generate_html.cpython-313.pyc +0 -0
  53. package/scripts/__pycache__/translate_titles.cpython-313.pyc +0 -0
  54. package/scripts/fulltext_search.py +386 -0
  55. package/scripts/generate_html.py +632 -0
  56. package/scripts/translate_titles.py +156 -0
  57. package/skills/literature-survey/SKILL.md +206 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ai4scholar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # AI4Scholar
2
+
3
+ **Multi-source academic literature search, management, and analysis plugin for [OpenClaw](https://github.com/openclaw/openclaw).**
4
+
5
+ Powered by [ai4scholar.net](https://ai4scholar.net).
6
+
7
+ ## What It Does
8
+
9
+ AI4Scholar gives OpenClaw direct access to 6 academic platforms through 17 built-in tools, plus a literature survey skill that generates rich HTML reports.
10
+
11
+ ### Platforms & Tools
12
+
13
+ | Platform | Tools | Via |
14
+ |----------|-------|-----|
15
+ | **Semantic Scholar** | `search_semantic`, `get_semantic_paper_detail`, `get_semantic_citations`, `get_semantic_references`, `search_semantic_authors`, `get_semantic_author_papers`, `get_semantic_recommendations`, `get_semantic_recommendations_for_paper`, `search_semantic_snippets` | ai4scholar.net |
16
+ | **PubMed** | `search_pubmed`, `get_pubmed_paper_detail`, `get_pubmed_citations`, `get_pubmed_related` | ai4scholar.net |
17
+ | **Google Scholar** | `search_google_scholar` | ai4scholar.net |
18
+ | **arXiv** | `search_arxiv` | Direct API |
19
+ | **bioRxiv** | `search_biorxiv` | Direct API |
20
+ | **medRxiv** | `search_medrxiv` | Direct API |
21
+
22
+ ### Skills
23
+
24
+ | Skill | Description |
25
+ |-------|-------------|
26
+ | **literature-survey** | Structured literature survey with fulltext search, HTML report + CSV generation, or multi-source review |
27
+
28
+ ### Slash Commands
29
+
30
+ | Command | Description |
31
+ |---------|-------------|
32
+ | `/library` | List downloaded papers in the active project |
33
+ | `/projects` | List all literature projects |
34
+ | `/reading-list` | Show the reading list |
35
+
36
+ ### Report Generation
37
+
38
+ The plugin includes Python scripts for generating rich HTML reports from fulltext search results:
39
+
40
+ - **6 color themes** (Light, Sepia, Dark, Green, Pink, Perplexity)
41
+ - Interactive snippet cards with modal detail views
42
+ - Filtering by source type, year, venue, and keyword
43
+ - Automatic title translation (Chinese ↔ English)
44
+ - CSV data export
45
+
46
+ ## Prerequisites
47
+
48
+ - [OpenClaw](https://github.com/openclaw/openclaw) installed and running
49
+ - An [ai4scholar.net](https://ai4scholar.net) API key (for Semantic Scholar, PubMed, and Google Scholar tools)
50
+ - Python 3.8+ with `requests` (for HTML report generation)
51
+
52
+ ## Install
53
+
54
+ ### From npm (recommended)
55
+
56
+ ```bash
57
+ openclaw plugins install ai4scholar
58
+ ```
59
+
60
+ The plugin installs to `~/.openclaw/extensions/ai4scholar/` and is automatically enabled.
61
+
62
+ ### From source (development)
63
+
64
+ ```bash
65
+ git clone https://github.com/literaf/ai4scholar.git
66
+ cd ai4scholar && pnpm install && pnpm build
67
+
68
+ # Link as dev plugin
69
+ pnpm dev:link
70
+ # or equivalently:
71
+ openclaw plugins install -l .
72
+ ```
73
+
74
+ ### Verify installation
75
+
76
+ ```bash
77
+ openclaw plugins list
78
+ # Should show: ai4scholar (enabled)
79
+ ```
80
+
81
+ After installation, **restart the gateway** to load the plugin:
82
+
83
+ ```bash
84
+ # Stop the running gateway (Ctrl+C), then:
85
+ openclaw gateway
86
+ ```
87
+
88
+ ### Configuration
89
+
90
+ After installation, set your API key in OpenClaw's plugin settings (WebUI):
91
+
92
+ - **AI4Scholar API Key** — get one at [ai4scholar.net/dashboard](https://ai4scholar.net/dashboard?view=api-keys)
93
+
94
+ ### Optional: External MCP Server
95
+
96
+ For additional capabilities, you can also configure the [ai4scholar-mcp](https://github.com/literaf/ai4s-mcp) server in `~/.openclaw/openclaw.json`:
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "ai4scholar": {
102
+ "url": "https://mcp.ai4scholar.net/sse",
103
+ "headers": {
104
+ "Authorization": "Bearer <your-api-key>"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ## Usage
112
+
113
+ Just talk to your OpenClaw assistant:
114
+
115
+ ```
116
+ Search for recent papers on transformer-based time series forecasting
117
+ ```
118
+
119
+ ```
120
+ Give me a literature survey on protein folding prediction methods since 2020
121
+ ```
122
+
123
+ ```
124
+ Search the full text of papers for "dropout rate 0.1 Transformer implementation"
125
+ ```
126
+
127
+ ## Project Structure
128
+
129
+ ```
130
+ ai4scholar/
131
+ ├── src/ # TypeScript source
132
+ │ ├── tools/ # 17 tool implementations
133
+ │ │ ├── api-client.ts # HTTP client for ai4scholar.net
134
+ │ │ ├── semantic-scholar.ts # 9 Semantic Scholar tools
135
+ │ │ ├── pubmed.ts # 4 PubMed tools
136
+ │ │ ├── google-scholar.ts # Google Scholar search
137
+ │ │ ├── arxiv.ts # arXiv search
138
+ │ │ ├── biorxiv.ts # bioRxiv + medRxiv search
139
+ │ │ ├── result.ts # Tool result helpers
140
+ │ │ └── params.ts # Parameter parsing
141
+ │ ├── hooks/ # Agent hooks
142
+ │ └── commands.ts # Slash commands
143
+ ├── scripts/ # Python helper scripts
144
+ │ ├── fulltext_search.py # Fulltext search + data processing
145
+ │ ├── generate_html.py # HTML report generator
146
+ │ └── translate_titles.py # Title translation helper
147
+ ├── assets/ # Report templates
148
+ │ ├── template_fulltext.html
149
+ │ └── styles.css
150
+ ├── skills/ # Agent skills
151
+ │ └── literature-survey/
152
+ │ └── SKILL.md
153
+ ├── openclaw.plugin.json # Plugin manifest
154
+ └── index.ts # Plugin entry point
155
+ ```
156
+
157
+ ## License
158
+
159
+ MIT