@tool-bridge/server 0.21.1 → 0.23.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/dist/admin.js +170 -0
- package/dist/airtable-VMQVXLHK.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FTWY4RU4.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-OK5VBHYC.js} +221 -220
- package/dist/anthropic-S67AZFZ3.js +203 -0
- package/dist/apify-ZE6MYQI3.js +248 -0
- package/dist/brave_search-TG2M2KOD.js +302 -0
- package/dist/chunk-2JNAI4OC.js +161 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-4XJPN3DY.js} +19392 -26136
- package/dist/chunk-5ICRY3VU.js +8432 -0
- package/dist/chunk-7CTWGTDU.js +302 -0
- package/dist/chunk-BADVCN6K.js +378 -0
- package/dist/{chunk-XYBU3WZH.js → chunk-TDAWLMDE.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-VWRUGUSU.js} +3 -3
- package/dist/{chunk-ATK45BXV.js → chunk-WJHG6OK7.js} +4 -2
- package/dist/circleci-3L3WJVSK.js +389 -0
- package/dist/clerk-EZPF2V7T.js +1019 -0
- package/dist/cohere-U27DPO64.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-G2KL6ERH.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-L4CLJ2M3.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-YPYXG7YY.js} +71 -71
- package/dist/deepseek-6HT6WF3M.js +210 -0
- package/dist/docker_hub-LPE3PCVB.js +933 -0
- package/dist/dropbox-V56ABHTA.js +1305 -0
- package/dist/dub-6OKQ7MHT.js +680 -0
- package/dist/e2b-JS2U2QFU.js +278 -0
- package/dist/exa-DPWVYXSP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-DK6Y27ZF.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-K7EGSRF3.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-2JUGFYNG.js} +57 -53
- package/dist/figma-FT5I7ITD.js +777 -0
- package/dist/firehydrant-EIKLKHX2.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-U5QXIAKD.js} +34 -33
- package/dist/fly-T3JYFZ2M.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-D72MGVOR.js} +104 -104
- package/dist/geocodio-BOTD5TI5.js +213 -0
- package/dist/ghost-KYP7SZGB.js +338 -0
- package/dist/github-AGMZT3VY.js +5421 -0
- package/dist/gmail-BLJNJOBG.js +1887 -0
- package/dist/googlecalendar-GTHWNCF6.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-6EEDMEBQ.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-GMW6EKSQ.js} +221 -220
- package/dist/graphhopper-6OLGBDGB.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-4QN42E6T.js} +28 -27
- package/dist/ipgeolocation_io-SK4XKDA2.js +315 -0
- package/dist/ipqualityscore-6ANBPXKT.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-IHPSVRM5.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-46KKM4LC.js} +118 -117
- package/dist/langsmith-JZA345I5.js +593 -0
- package/dist/lemlist-43IV7DK6.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-5LFH7XNL.js} +327 -326
- package/dist/logsnag-5RMYAHIL.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-XFL6SHGG.js} +59 -58
- package/dist/mem0-NYO4DTP6.js +544 -0
- package/dist/memos-37MPQOLV.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-KYBKZFMG.js} +90 -89
- package/dist/mistral_ai-6PL3K4PM.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-2NH7W5M5.js} +94 -93
- package/dist/ngrok-UO6CDYCA.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-I3P32WP4.js} +11 -9
- package/dist/notion-BEAJFUOE.js +940 -0
- package/dist/open_exchange_rates-CMF62JB4.js +215 -0
- package/dist/openai-IHOMKVND.js +800 -0
- package/dist/opengraph_io-ZQ2FGLHX.js +362 -0
- package/dist/openrouter-HXLW3NR5.js +441 -0
- package/dist/outline-ELCP4NEU.js +599 -0
- package/dist/paddle-O77LALVN.js +454 -0
- package/dist/perplexity-JCU654QV.js +220 -0
- package/dist/pinecone-W5W4LRKL.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-ITMJLLPZ.js} +99 -98
- package/dist/polar-R33XU4L3.js +395 -0
- package/dist/posthog-JVNTOLTV.js +3464 -0
- package/dist/postmark-6SBG7HWV.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-GPNKTNFC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-UP6ZEEIH.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KWEWXHTY.js} +118 -117
- package/dist/readwise-BLATSMC3.js +470 -0
- package/dist/render-QYRVIXII.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-JYTWH4NF.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-L5N75SZM.js} +20 -16
- package/dist/rootly-MHCPEQ26.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-PTPGYSJM.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-JN6UH5PY.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-4QRVSV55.js} +16 -16
- package/dist/semantic_scholar-LRSWA2GE.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-2G6PF5W6.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-WKKPP5C6.js} +62 -61
- package/dist/shopify-64YDK5T2.js +610 -0
- package/dist/stripe-QAIGGOTF.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-WHTGR6ND.js} +245 -244
- package/dist/tavily-QIXCDDWO.js +326 -0
- package/dist/telegram-E6G7CWI6.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-ZDVVS7PK.js} +57 -56
- package/dist/todoist-DMYF3G7J.js +664 -0
- package/dist/trello-HY2RYIRP.js +1080 -0
- package/dist/turso-HAQWMGRP.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-MLXYPHJE.js} +70 -69
- package/dist/umami-DZHBLPVG.js +389 -0
- package/dist/unsplash-GS2OPXKE.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-XMXWTNAJ.js} +51 -50
- package/dist/uptimerobot-TF5WRZ4G.js +483 -0
- package/dist/v2ex-2BVXAPDF.js +667 -0
- package/dist/vercel-YMJGQYJE.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-I56SXWFZ.js} +36 -35
- package/dist/wordpress-R7TDFZ2P.js +812 -0
- package/dist/workos-HDNHWVMS.js +664 -0
- package/dist/zhihu-LX6AGGDS.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAuthedClient
|
|
3
|
-
} from "./chunk-XYBU3WZH.js";
|
|
4
|
-
import "./chunk-E6JCVKW6.js";
|
|
5
|
-
import {
|
|
6
|
-
asJsonObject
|
|
7
|
-
} from "./chunk-JXHMDBAY.js";
|
|
8
|
-
import {
|
|
9
|
-
createProviderPlugin,
|
|
10
|
-
upstreamError
|
|
11
|
-
} from "./chunk-ATK45BXV.js";
|
|
12
|
-
import "./chunk-U7B6DS2O.js";
|
|
13
|
-
import {
|
|
14
|
-
TBError,
|
|
15
|
-
external_exports
|
|
16
|
-
} from "./chunk-UZM2RXZH.js";
|
|
17
|
-
import "./chunk-U67V476Y.js";
|
|
18
|
-
|
|
19
|
-
// ../plugins/src/semantic_scholar/api.ts
|
|
20
|
-
var SERVICE = "semantic_scholar";
|
|
21
|
-
var GRAPH_BASE = "https://api.semanticscholar.org/graph/v1";
|
|
22
|
-
var RECOMMENDATIONS_BASE = "https://api.semanticscholar.org/recommendations/v1";
|
|
23
|
-
var REQUEST_TIMEOUT_MS = 3e4;
|
|
24
|
-
function trimmed(value) {
|
|
25
|
-
if (typeof value !== "string") return void 0;
|
|
26
|
-
const result = value.trim();
|
|
27
|
-
return result === "" ? void 0 : result;
|
|
28
|
-
}
|
|
29
|
-
function id(value, field) {
|
|
30
|
-
const result = trimmed(value);
|
|
31
|
-
if (result === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
function array(value) {
|
|
35
|
-
return Array.isArray(value) ? value : [];
|
|
36
|
-
}
|
|
37
|
-
function rawObject(value) {
|
|
38
|
-
return asJsonObject(value) ?? {};
|
|
39
|
-
}
|
|
40
|
-
function nullableInt(value) {
|
|
41
|
-
return Number.isInteger(value) ? value : null;
|
|
42
|
-
}
|
|
43
|
-
function nullableString(value) {
|
|
44
|
-
return typeof value === "string" ? value : null;
|
|
45
|
-
}
|
|
46
|
-
function params(input, keys) {
|
|
47
|
-
const result = {};
|
|
48
|
-
for (const key of keys) {
|
|
49
|
-
const value = input[key];
|
|
50
|
-
if (value === void 0 || value === null) continue;
|
|
51
|
-
if (key === "openAccessPdf") {
|
|
52
|
-
if (value === true) result[key] = "";
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
result[key] = String(value);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
var PAPER_SEARCH_FILTER_KEYS = [
|
|
60
|
-
"query",
|
|
61
|
-
"fields",
|
|
62
|
-
"limit",
|
|
63
|
-
"year",
|
|
64
|
-
"venue",
|
|
65
|
-
"fieldsOfStudy",
|
|
66
|
-
"publicationTypes",
|
|
67
|
-
"publicationDateOrYear",
|
|
68
|
-
"minCitationCount",
|
|
69
|
-
"openAccessPdf"
|
|
70
|
-
];
|
|
71
|
-
function paperSearchParams(input, pagingKey) {
|
|
72
|
-
return { ...params(input, PAPER_SEARCH_FILTER_KEYS), ...params(input, [pagingKey]) };
|
|
73
|
-
}
|
|
74
|
-
function errorMessage(payload, status) {
|
|
75
|
-
const direct = trimmed(payload);
|
|
76
|
-
if (direct !== void 0) return direct;
|
|
77
|
-
const body = asJsonObject(payload);
|
|
78
|
-
return trimmed(body?.message) ?? trimmed(body?.error) ?? trimmed(body?.detail) ?? `Semantic Scholar \u8FD4\u56DE HTTP ${status}`;
|
|
79
|
-
}
|
|
80
|
-
function s2Client(baseUrl) {
|
|
81
|
-
return createAuthedClient({
|
|
82
|
-
baseUrl,
|
|
83
|
-
service: SERVICE,
|
|
84
|
-
auth: { kind: "header", name: "x-api-key" },
|
|
85
|
-
headers: { accept: "application/json" },
|
|
86
|
-
// invalid-json 与常规错误体走不同分支,标准键序提取表达不了,整段覆写。
|
|
87
|
-
mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true }) : upstreamError(status, errorMessage(data, status)),
|
|
88
|
-
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Semantic Scholar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Semantic Scholar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
var graphHttp = s2Client(`${GRAPH_BASE}/`);
|
|
92
|
-
var recommendationsHttp = s2Client(`${RECOMMENDATIONS_BASE}/`);
|
|
93
|
-
async function request(ctx, input) {
|
|
94
|
-
const http = input.family === "graph" ? graphHttp : recommendationsHttp;
|
|
95
|
-
const response = await http.request(ctx, {
|
|
96
|
-
method: input.method,
|
|
97
|
-
path: input.path,
|
|
98
|
-
query: Object.entries(input.params ?? {}),
|
|
99
|
-
// 上游对 POST 一律发 body(没给就发 `{}`),保留:batch 端点不接受空请求。
|
|
100
|
-
...input.method === "POST" ? { json: input.body ?? {} } : {},
|
|
101
|
-
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
102
|
-
invalidJsonMessage: "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
103
|
-
});
|
|
104
|
-
return response.bodyKind === "empty" ? null : response.data;
|
|
105
|
-
}
|
|
106
|
-
function normalizePaperList(payload) {
|
|
107
|
-
const body = asJsonObject(payload);
|
|
108
|
-
return {
|
|
109
|
-
total: nullableInt(body?.total),
|
|
110
|
-
offset: nullableInt(body?.offset),
|
|
111
|
-
next: nullableInt(body?.next),
|
|
112
|
-
token: nullableString(body?.token),
|
|
113
|
-
papers: array(body?.data ?? body?.recommendedPapers),
|
|
114
|
-
raw: rawObject(payload)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function normalizeAuthorList(payload) {
|
|
118
|
-
const body = asJsonObject(payload);
|
|
119
|
-
return {
|
|
120
|
-
total: nullableInt(body?.total),
|
|
121
|
-
offset: nullableInt(body?.offset),
|
|
122
|
-
next: nullableInt(body?.next),
|
|
123
|
-
authors: array(body?.data),
|
|
124
|
-
raw: rawObject(payload)
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function normalizeEdgeList(payload) {
|
|
128
|
-
const body = asJsonObject(payload);
|
|
129
|
-
return {
|
|
130
|
-
total: nullableInt(body?.total),
|
|
131
|
-
offset: nullableInt(body?.offset),
|
|
132
|
-
next: nullableInt(body?.next),
|
|
133
|
-
data: array(body?.data),
|
|
134
|
-
raw: rawObject(payload)
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
async function getPaper(input, ctx) {
|
|
138
|
-
const paper = await request(ctx, {
|
|
139
|
-
family: "graph",
|
|
140
|
-
method: "GET",
|
|
141
|
-
path: `/paper/${encodeURIComponent(id(input.paperId, "paperId"))}`,
|
|
142
|
-
params: params(input, ["fields"])
|
|
143
|
-
});
|
|
144
|
-
return { paper };
|
|
145
|
-
}
|
|
146
|
-
async function getPapers(input, ctx) {
|
|
147
|
-
const papers = await request(ctx, {
|
|
148
|
-
family: "graph",
|
|
149
|
-
method: "POST",
|
|
150
|
-
path: "/paper/batch",
|
|
151
|
-
// fields 在 query 上,ids 在 body 里 —— batch 端点就是这么分的。
|
|
152
|
-
params: params(input, ["fields"]),
|
|
153
|
-
body: { ids: input.paperIds.map((item) => id(item, "paperId")) }
|
|
154
|
-
});
|
|
155
|
-
return { papers: array(papers) };
|
|
156
|
-
}
|
|
157
|
-
async function searchPapers(input, ctx) {
|
|
158
|
-
return normalizePaperList(await request(ctx, {
|
|
159
|
-
family: "graph",
|
|
160
|
-
method: "GET",
|
|
161
|
-
path: "/paper/search",
|
|
162
|
-
params: paperSearchParams(input, "offset")
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
async function bulkSearchPapers(input, ctx) {
|
|
166
|
-
return normalizePaperList(await request(ctx, {
|
|
167
|
-
family: "graph",
|
|
168
|
-
method: "GET",
|
|
169
|
-
path: "/paper/search/bulk",
|
|
170
|
-
params: paperSearchParams(input, "token")
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
async function matchPaperTitle(input, ctx) {
|
|
174
|
-
const payload = await request(ctx, {
|
|
175
|
-
family: "graph",
|
|
176
|
-
method: "GET",
|
|
177
|
-
path: "/paper/search/match",
|
|
178
|
-
params: params(input, ["query", "fields"])
|
|
179
|
-
});
|
|
180
|
-
return { paper: asJsonObject(payload), raw: rawObject(payload) };
|
|
181
|
-
}
|
|
182
|
-
async function autocompletePapers(input, ctx) {
|
|
183
|
-
const payload = await request(ctx, {
|
|
184
|
-
family: "graph",
|
|
185
|
-
method: "GET",
|
|
186
|
-
path: "/paper/autocomplete",
|
|
187
|
-
params: params(input, ["query", "limit"])
|
|
188
|
-
});
|
|
189
|
-
const body = asJsonObject(payload);
|
|
190
|
-
return { completions: array(body?.matches ?? body?.data), raw: rawObject(payload) };
|
|
191
|
-
}
|
|
192
|
-
async function getPaperAuthors(input, ctx) {
|
|
193
|
-
return normalizeAuthorList(await request(ctx, {
|
|
194
|
-
family: "graph",
|
|
195
|
-
method: "GET",
|
|
196
|
-
path: `/paper/${encodeURIComponent(id(input.paperId, "paperId"))}/authors`,
|
|
197
|
-
params: params(input, ["fields", "limit", "offset"])
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
async function getPaperCitations(input, ctx) {
|
|
201
|
-
return normalizeEdgeList(await request(ctx, {
|
|
202
|
-
family: "graph",
|
|
203
|
-
method: "GET",
|
|
204
|
-
path: `/paper/${encodeURIComponent(id(input.paperId, "paperId"))}/citations`,
|
|
205
|
-
params: params(input, ["fields", "limit", "offset"])
|
|
206
|
-
}));
|
|
207
|
-
}
|
|
208
|
-
async function getPaperReferences(input, ctx) {
|
|
209
|
-
return normalizeEdgeList(await request(ctx, {
|
|
210
|
-
family: "graph",
|
|
211
|
-
method: "GET",
|
|
212
|
-
path: `/paper/${encodeURIComponent(id(input.paperId, "paperId"))}/references`,
|
|
213
|
-
params: params(input, ["fields", "limit", "offset"])
|
|
214
|
-
}));
|
|
215
|
-
}
|
|
216
|
-
async function searchAuthors(input, ctx) {
|
|
217
|
-
return normalizeAuthorList(await request(ctx, {
|
|
218
|
-
family: "graph",
|
|
219
|
-
method: "GET",
|
|
220
|
-
path: "/author/search",
|
|
221
|
-
params: params(input, ["query", "fields", "limit", "offset"])
|
|
222
|
-
}));
|
|
223
|
-
}
|
|
224
|
-
async function getAuthor(input, ctx) {
|
|
225
|
-
const author = await request(ctx, {
|
|
226
|
-
family: "graph",
|
|
227
|
-
method: "GET",
|
|
228
|
-
path: `/author/${encodeURIComponent(id(input.authorId, "authorId"))}`,
|
|
229
|
-
params: params(input, ["fields"])
|
|
230
|
-
});
|
|
231
|
-
return { author };
|
|
232
|
-
}
|
|
233
|
-
async function getAuthors(input, ctx) {
|
|
234
|
-
const authors = await request(ctx, {
|
|
235
|
-
family: "graph",
|
|
236
|
-
method: "POST",
|
|
237
|
-
path: "/author/batch",
|
|
238
|
-
params: params(input, ["fields"]),
|
|
239
|
-
body: { ids: input.authorIds.map((item) => id(item, "authorId")) }
|
|
240
|
-
});
|
|
241
|
-
return { authors: array(authors) };
|
|
242
|
-
}
|
|
243
|
-
async function getAuthorPapers(input, ctx) {
|
|
244
|
-
return normalizePaperList(await request(ctx, {
|
|
245
|
-
family: "graph",
|
|
246
|
-
method: "GET",
|
|
247
|
-
path: `/author/${encodeURIComponent(id(input.authorId, "authorId"))}/papers`,
|
|
248
|
-
params: params(input, ["fields", "limit", "offset"])
|
|
249
|
-
}));
|
|
250
|
-
}
|
|
251
|
-
async function searchSnippets(input, ctx) {
|
|
252
|
-
const payload = await request(ctx, {
|
|
253
|
-
family: "graph",
|
|
254
|
-
method: "GET",
|
|
255
|
-
path: "/snippet/search",
|
|
256
|
-
params: params(input, ["query", "limit"])
|
|
257
|
-
});
|
|
258
|
-
const body = asJsonObject(payload);
|
|
259
|
-
return {
|
|
260
|
-
total: nullableInt(body?.total),
|
|
261
|
-
offset: nullableInt(body?.offset),
|
|
262
|
-
next: nullableInt(body?.next),
|
|
263
|
-
snippets: array(body?.data),
|
|
264
|
-
raw: rawObject(payload)
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
async function recommendForPaper(input, ctx) {
|
|
268
|
-
return normalizePaperList(await request(ctx, {
|
|
269
|
-
family: "recommendations",
|
|
270
|
-
method: "GET",
|
|
271
|
-
path: `/papers/forpaper/${encodeURIComponent(id(input.paperId, "paperId"))}`,
|
|
272
|
-
params: params(input, ["fields", "limit"])
|
|
273
|
-
}));
|
|
274
|
-
}
|
|
275
|
-
async function recommendPapers(input, ctx) {
|
|
276
|
-
const negativePaperIds = input.negativePaperIds?.map((item) => id(item, "paperId"));
|
|
277
|
-
return normalizePaperList(await request(ctx, {
|
|
278
|
-
family: "recommendations",
|
|
279
|
-
method: "POST",
|
|
280
|
-
// 末尾这个斜杠是上游端点要求的,去掉会 404。
|
|
281
|
-
path: "/papers/",
|
|
282
|
-
params: params(input, ["fields", "limit"]),
|
|
283
|
-
body: {
|
|
284
|
-
positivePaperIds: input.positivePaperIds.map((item) => id(item, "paperId")),
|
|
285
|
-
// 没给就整个键不发(上游 `compactObject`),发 `null` 会被当成非法入参。
|
|
286
|
-
...negativePaperIds === void 0 ? {} : { negativePaperIds }
|
|
287
|
-
}
|
|
288
|
-
}));
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// ../plugins/src/semantic_scholar/schema.ts
|
|
292
|
-
var getPaperInput = external_exports.strictObject({
|
|
293
|
-
paperId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>."),
|
|
294
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional()
|
|
295
|
-
}).describe("The input payload for retrieving a Semantic Scholar paper.");
|
|
296
|
-
var getPaperOutput = external_exports.strictObject({
|
|
297
|
-
paper: external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.").optional()
|
|
298
|
-
}).describe("The response returned when retrieving a Semantic Scholar paper.");
|
|
299
|
-
var getPapersInput = external_exports.strictObject({
|
|
300
|
-
paperIds: external_exports.array(external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>.")).min(1).max(500).describe("The paper IDs to request."),
|
|
301
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional()
|
|
302
|
-
}).describe("The input payload for retrieving multiple Semantic Scholar papers.");
|
|
303
|
-
var getPapersOutput = external_exports.strictObject({
|
|
304
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.").nullable()).describe("The papers returned in the same order as the requested IDs.").optional()
|
|
305
|
-
}).describe("The response returned when retrieving multiple Semantic Scholar papers.");
|
|
306
|
-
var searchPapersInput = external_exports.strictObject({
|
|
307
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
308
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
309
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
310
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional(),
|
|
311
|
-
year: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The publication year or inclusive year range, such as 2019, 2016-2020, 2010-, or -2015.").optional(),
|
|
312
|
-
venue: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of publication venues to filter by, using full names or abbreviations.").optional(),
|
|
313
|
-
fieldsOfStudy: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of fields of study to filter by.").optional(),
|
|
314
|
-
publicationTypes: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of publication types to filter by, such as Review, JournalArticle, or Conference.").optional(),
|
|
315
|
-
publicationDateOrYear: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The publication date or year filter, such as 2019, 2020-06, 2016-03-05:2020-06-06, 1981-08-25:, or :2015-01.").optional(),
|
|
316
|
-
minCitationCount: external_exports.int().min(0).describe("The minimum number of citations a paper must have.").optional(),
|
|
317
|
-
openAccessPdf: external_exports.boolean().describe("Whether to restrict results to papers with a public PDF available.").optional()
|
|
318
|
-
}).describe("The input payload for searching Semantic Scholar papers by relevance.");
|
|
319
|
-
var searchPapersOutput = external_exports.strictObject({
|
|
320
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
321
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
322
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
323
|
-
token: external_exports.string().describe("The continuation token when Semantic Scholar returns it.").nullable().optional(),
|
|
324
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.")).describe("The papers returned by Semantic Scholar.").optional(),
|
|
325
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
326
|
-
}).describe("A Semantic Scholar paper list response.");
|
|
327
|
-
var bulkSearchPapersInput = external_exports.strictObject({
|
|
328
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
329
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
330
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
331
|
-
token: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The continuation token returned by Semantic Scholar.").optional(),
|
|
332
|
-
year: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The publication year or inclusive year range, such as 2019, 2016-2020, 2010-, or -2015.").optional(),
|
|
333
|
-
venue: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of publication venues to filter by, using full names or abbreviations.").optional(),
|
|
334
|
-
fieldsOfStudy: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of fields of study to filter by.").optional(),
|
|
335
|
-
publicationTypes: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of publication types to filter by, such as Review, JournalArticle, or Conference.").optional(),
|
|
336
|
-
publicationDateOrYear: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The publication date or year filter, such as 2019, 2020-06, 2016-03-05:2020-06-06, 1981-08-25:, or :2015-01.").optional(),
|
|
337
|
-
minCitationCount: external_exports.int().min(0).describe("The minimum number of citations a paper must have.").optional(),
|
|
338
|
-
openAccessPdf: external_exports.boolean().describe("Whether to restrict results to papers with a public PDF available.").optional()
|
|
339
|
-
}).describe("The input payload for bulk-searching Semantic Scholar papers.");
|
|
340
|
-
var bulkSearchPapersOutput = external_exports.strictObject({
|
|
341
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
342
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
343
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
344
|
-
token: external_exports.string().describe("The continuation token when Semantic Scholar returns it.").nullable().optional(),
|
|
345
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.")).describe("The papers returned by Semantic Scholar.").optional(),
|
|
346
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
347
|
-
}).describe("A Semantic Scholar paper list response.");
|
|
348
|
-
var matchPaperTitleInput = external_exports.strictObject({
|
|
349
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
350
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional()
|
|
351
|
-
}).describe("The input payload for matching a Semantic Scholar paper title.");
|
|
352
|
-
var matchPaperTitleOutput = external_exports.strictObject({
|
|
353
|
-
paper: external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.").nullable().optional(),
|
|
354
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
355
|
-
}).describe("The response returned when matching a Semantic Scholar paper title.");
|
|
356
|
-
var autocompletePapersInput = external_exports.strictObject({
|
|
357
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
358
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional()
|
|
359
|
-
}).describe("The input payload for Semantic Scholar paper autocomplete.");
|
|
360
|
-
var autocompletePapersOutput = external_exports.strictObject({
|
|
361
|
-
completions: external_exports.array(external_exports.looseObject({}).describe("One autocomplete suggestion returned by Semantic Scholar.")).describe("The autocomplete suggestions returned by Semantic Scholar.").optional(),
|
|
362
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
363
|
-
}).describe("The response returned by Semantic Scholar paper autocomplete.");
|
|
364
|
-
var getPaperAuthorsInput = external_exports.strictObject({
|
|
365
|
-
paperId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>."),
|
|
366
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
367
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
368
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional()
|
|
369
|
-
}).describe("The input payload for listing Semantic Scholar paper authors.");
|
|
370
|
-
var getPaperAuthorsOutput = external_exports.strictObject({
|
|
371
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
372
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
373
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
374
|
-
authors: external_exports.array(external_exports.looseObject({}).describe("The author object returned by Semantic Scholar.")).describe("The authors returned by Semantic Scholar.").optional(),
|
|
375
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
376
|
-
}).describe("A Semantic Scholar author list response.");
|
|
377
|
-
var getPaperCitationsInput = external_exports.strictObject({
|
|
378
|
-
paperId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>."),
|
|
379
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
380
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
381
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional()
|
|
382
|
-
}).describe("The input payload for listing Semantic Scholar paper citations.");
|
|
383
|
-
var getPaperCitationsOutput = external_exports.strictObject({
|
|
384
|
-
total: external_exports.int().describe("The total edge count when Semantic Scholar returns it.").nullable().optional(),
|
|
385
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
386
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
387
|
-
data: external_exports.array(external_exports.looseObject({}).describe("One paper edge returned by Semantic Scholar.")).describe("The citation or reference edges returned by Semantic Scholar.").optional(),
|
|
388
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
389
|
-
}).describe("A Semantic Scholar paper edge list response.");
|
|
390
|
-
var getPaperReferencesInput = external_exports.strictObject({
|
|
391
|
-
paperId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>."),
|
|
392
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
393
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
394
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional()
|
|
395
|
-
}).describe("The input payload for listing Semantic Scholar paper references.");
|
|
396
|
-
var getPaperReferencesOutput = external_exports.strictObject({
|
|
397
|
-
total: external_exports.int().describe("The total edge count when Semantic Scholar returns it.").nullable().optional(),
|
|
398
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
399
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
400
|
-
data: external_exports.array(external_exports.looseObject({}).describe("One paper edge returned by Semantic Scholar.")).describe("The citation or reference edges returned by Semantic Scholar.").optional(),
|
|
401
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
402
|
-
}).describe("A Semantic Scholar paper edge list response.");
|
|
403
|
-
var searchAuthorsInput = external_exports.strictObject({
|
|
404
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
405
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
406
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
407
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional()
|
|
408
|
-
}).describe("The input payload for searching Semantic Scholar authors.");
|
|
409
|
-
var searchAuthorsOutput = external_exports.strictObject({
|
|
410
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
411
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
412
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
413
|
-
authors: external_exports.array(external_exports.looseObject({}).describe("The author object returned by Semantic Scholar.")).describe("The authors returned by Semantic Scholar.").optional(),
|
|
414
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
415
|
-
}).describe("A Semantic Scholar author list response.");
|
|
416
|
-
var getAuthorInput = external_exports.strictObject({
|
|
417
|
-
authorId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar author ID."),
|
|
418
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional()
|
|
419
|
-
}).describe("The input payload for retrieving a Semantic Scholar author.");
|
|
420
|
-
var getAuthorOutput = external_exports.strictObject({
|
|
421
|
-
author: external_exports.looseObject({}).describe("The author object returned by Semantic Scholar.").optional()
|
|
422
|
-
}).describe("The response returned when retrieving a Semantic Scholar author.");
|
|
423
|
-
var getAuthorsInput = external_exports.strictObject({
|
|
424
|
-
authorIds: external_exports.array(external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar author ID.")).min(1).max(1e3).describe("The author IDs to request."),
|
|
425
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional()
|
|
426
|
-
}).describe("The input payload for retrieving multiple Semantic Scholar authors.");
|
|
427
|
-
var getAuthorsOutput = external_exports.strictObject({
|
|
428
|
-
authors: external_exports.array(external_exports.looseObject({}).describe("The author object returned by Semantic Scholar.").nullable()).describe("The authors returned in the same order as the requested IDs.").optional()
|
|
429
|
-
}).describe("The response returned when retrieving multiple Semantic Scholar authors.");
|
|
430
|
-
var getAuthorPapersInput = external_exports.strictObject({
|
|
431
|
-
authorId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar author ID."),
|
|
432
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
433
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
|
|
434
|
-
offset: external_exports.int().min(0).describe("The zero-based pagination offset.").optional()
|
|
435
|
-
}).describe("The input payload for listing Semantic Scholar author papers.");
|
|
436
|
-
var getAuthorPapersOutput = external_exports.strictObject({
|
|
437
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
438
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
439
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
440
|
-
token: external_exports.string().describe("The continuation token when Semantic Scholar returns it.").nullable().optional(),
|
|
441
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.")).describe("The papers returned by Semantic Scholar.").optional(),
|
|
442
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
443
|
-
}).describe("A Semantic Scholar paper list response.");
|
|
444
|
-
var searchSnippetsInput = external_exports.strictObject({
|
|
445
|
-
query: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The plain-text search query. Semantic Scholar does not support special query syntax."),
|
|
446
|
-
limit: external_exports.int().min(1).max(100).describe("The maximum number of results to return.").optional()
|
|
447
|
-
}).describe("The input payload for searching Semantic Scholar text snippets.");
|
|
448
|
-
var searchSnippetsOutput = external_exports.strictObject({
|
|
449
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
450
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
451
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
452
|
-
snippets: external_exports.array(external_exports.looseObject({}).describe("The text snippet object returned by Semantic Scholar.")).describe("The snippets returned by Semantic Scholar.").optional(),
|
|
453
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
454
|
-
}).describe("The response returned by Semantic Scholar text snippet search.");
|
|
455
|
-
var recommendForPaperInput = external_exports.strictObject({
|
|
456
|
-
paperId: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>."),
|
|
457
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
458
|
-
limit: external_exports.int().min(1).max(500).describe("The maximum number of recommendations to return.").optional()
|
|
459
|
-
}).describe("The input payload for recommending papers from one Semantic Scholar paper.");
|
|
460
|
-
var recommendForPaperOutput = external_exports.strictObject({
|
|
461
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
462
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
463
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
464
|
-
token: external_exports.string().describe("The continuation token when Semantic Scholar returns it.").nullable().optional(),
|
|
465
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.")).describe("The papers returned by Semantic Scholar.").optional(),
|
|
466
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
467
|
-
}).describe("A Semantic Scholar paper list response.");
|
|
468
|
-
var recommendPapersInput = external_exports.strictObject({
|
|
469
|
-
positivePaperIds: external_exports.array(external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>.")).min(1).max(500).describe("The paper IDs that represent positive examples."),
|
|
470
|
-
negativePaperIds: external_exports.array(external_exports.string().min(1).regex(new RegExp("\\S")).describe("The Semantic Scholar paper ID, CorpusId, DOI:<doi>, ARXIV:<id>, MAG:<id>, ACL:<id>, PMID:<id>, or PMCID:<id>.")).min(1).max(500).describe("The paper IDs that represent negative examples.").optional(),
|
|
471
|
-
fields: external_exports.string().min(1).regex(new RegExp("\\S")).describe("A comma-separated list of Semantic Scholar fields to return, using dot notation for nested fields when needed.").optional(),
|
|
472
|
-
limit: external_exports.int().min(1).max(500).describe("The maximum number of recommendations to return.").optional()
|
|
473
|
-
}).describe("The input payload for recommending Semantic Scholar papers from example paper IDs.");
|
|
474
|
-
var recommendPapersOutput = external_exports.strictObject({
|
|
475
|
-
total: external_exports.int().describe("The total result count when Semantic Scholar returns it.").nullable().optional(),
|
|
476
|
-
offset: external_exports.int().describe("The returned result offset when Semantic Scholar returns it.").nullable().optional(),
|
|
477
|
-
next: external_exports.int().describe("The next offset when Semantic Scholar returns it.").nullable().optional(),
|
|
478
|
-
token: external_exports.string().describe("The continuation token when Semantic Scholar returns it.").nullable().optional(),
|
|
479
|
-
papers: external_exports.array(external_exports.looseObject({}).describe("The paper object returned by Semantic Scholar.")).describe("The papers returned by Semantic Scholar.").optional(),
|
|
480
|
-
raw: external_exports.looseObject({}).describe("The raw Semantic Scholar response payload.").optional()
|
|
481
|
-
}).describe("A Semantic Scholar paper list response.");
|
|
482
|
-
var semanticScholarActions = {
|
|
483
|
-
get_paper: {
|
|
484
|
-
description: "Get details for a Semantic Scholar paper by paper ID or external identifier.",
|
|
485
|
-
effect: "read",
|
|
486
|
-
inputSchema: getPaperInput,
|
|
487
|
-
outputSchema: external_exports.toJSONSchema(getPaperOutput, { io: "output", unrepresentable: "any" })
|
|
488
|
-
},
|
|
489
|
-
get_papers: {
|
|
490
|
-
description: "Get details for multiple Semantic Scholar papers at once.",
|
|
491
|
-
effect: "read",
|
|
492
|
-
inputSchema: getPapersInput,
|
|
493
|
-
outputSchema: external_exports.toJSONSchema(getPapersOutput, { io: "output", unrepresentable: "any" })
|
|
494
|
-
},
|
|
495
|
-
search_papers: {
|
|
496
|
-
description: "Search Semantic Scholar papers by relevance with optional publication filters.",
|
|
497
|
-
effect: "read",
|
|
498
|
-
inputSchema: searchPapersInput,
|
|
499
|
-
outputSchema: external_exports.toJSONSchema(searchPapersOutput, { io: "output", unrepresentable: "any" })
|
|
500
|
-
},
|
|
501
|
-
bulk_search_papers: {
|
|
502
|
-
description: "Bulk-search Semantic Scholar papers and page through large result sets with tokens.",
|
|
503
|
-
effect: "write",
|
|
504
|
-
inputSchema: bulkSearchPapersInput,
|
|
505
|
-
outputSchema: external_exports.toJSONSchema(bulkSearchPapersOutput, { io: "output", unrepresentable: "any" })
|
|
506
|
-
},
|
|
507
|
-
match_paper_title: {
|
|
508
|
-
description: "Find the best Semantic Scholar paper match for a paper title.",
|
|
509
|
-
effect: "write",
|
|
510
|
-
inputSchema: matchPaperTitleInput,
|
|
511
|
-
outputSchema: external_exports.toJSONSchema(matchPaperTitleOutput, { io: "output", unrepresentable: "any" })
|
|
512
|
-
},
|
|
513
|
-
autocomplete_papers: {
|
|
514
|
-
description: "Suggest Semantic Scholar paper query completions.",
|
|
515
|
-
effect: "write",
|
|
516
|
-
inputSchema: autocompletePapersInput,
|
|
517
|
-
outputSchema: external_exports.toJSONSchema(autocompletePapersOutput, { io: "output", unrepresentable: "any" })
|
|
518
|
-
},
|
|
519
|
-
get_paper_authors: {
|
|
520
|
-
description: "List authors for a Semantic Scholar paper.",
|
|
521
|
-
effect: "read",
|
|
522
|
-
inputSchema: getPaperAuthorsInput,
|
|
523
|
-
outputSchema: external_exports.toJSONSchema(getPaperAuthorsOutput, { io: "output", unrepresentable: "any" })
|
|
524
|
-
},
|
|
525
|
-
get_paper_citations: {
|
|
526
|
-
description: "List papers that cite a Semantic Scholar paper.",
|
|
527
|
-
effect: "read",
|
|
528
|
-
inputSchema: getPaperCitationsInput,
|
|
529
|
-
outputSchema: external_exports.toJSONSchema(getPaperCitationsOutput, { io: "output", unrepresentable: "any" })
|
|
530
|
-
},
|
|
531
|
-
get_paper_references: {
|
|
532
|
-
description: "List papers referenced by a Semantic Scholar paper.",
|
|
533
|
-
effect: "read",
|
|
534
|
-
inputSchema: getPaperReferencesInput,
|
|
535
|
-
outputSchema: external_exports.toJSONSchema(getPaperReferencesOutput, { io: "output", unrepresentable: "any" })
|
|
536
|
-
},
|
|
537
|
-
search_authors: {
|
|
538
|
-
description: "Search Semantic Scholar authors by name.",
|
|
539
|
-
effect: "read",
|
|
540
|
-
inputSchema: searchAuthorsInput,
|
|
541
|
-
outputSchema: external_exports.toJSONSchema(searchAuthorsOutput, { io: "output", unrepresentable: "any" })
|
|
542
|
-
},
|
|
543
|
-
get_author: {
|
|
544
|
-
description: "Get details for a Semantic Scholar author.",
|
|
545
|
-
effect: "read",
|
|
546
|
-
inputSchema: getAuthorInput,
|
|
547
|
-
outputSchema: external_exports.toJSONSchema(getAuthorOutput, { io: "output", unrepresentable: "any" })
|
|
548
|
-
},
|
|
549
|
-
get_authors: {
|
|
550
|
-
description: "Get details for multiple Semantic Scholar authors at once.",
|
|
551
|
-
effect: "read",
|
|
552
|
-
inputSchema: getAuthorsInput,
|
|
553
|
-
outputSchema: external_exports.toJSONSchema(getAuthorsOutput, { io: "output", unrepresentable: "any" })
|
|
554
|
-
},
|
|
555
|
-
get_author_papers: {
|
|
556
|
-
description: "List papers written by a Semantic Scholar author.",
|
|
557
|
-
effect: "read",
|
|
558
|
-
inputSchema: getAuthorPapersInput,
|
|
559
|
-
outputSchema: external_exports.toJSONSchema(getAuthorPapersOutput, { io: "output", unrepresentable: "any" })
|
|
560
|
-
},
|
|
561
|
-
search_snippets: {
|
|
562
|
-
description: "Search text snippets in Semantic Scholar papers.",
|
|
563
|
-
effect: "read",
|
|
564
|
-
inputSchema: searchSnippetsInput,
|
|
565
|
-
outputSchema: external_exports.toJSONSchema(searchSnippetsOutput, { io: "output", unrepresentable: "any" })
|
|
566
|
-
},
|
|
567
|
-
recommend_for_paper: {
|
|
568
|
-
description: "Get recommended Semantic Scholar papers for one positive example paper.",
|
|
569
|
-
effect: "write",
|
|
570
|
-
inputSchema: recommendForPaperInput,
|
|
571
|
-
outputSchema: external_exports.toJSONSchema(recommendForPaperOutput, { io: "output", unrepresentable: "any" })
|
|
572
|
-
},
|
|
573
|
-
recommend_papers: {
|
|
574
|
-
description: "Get recommended Semantic Scholar papers from positive and optional negative examples.",
|
|
575
|
-
effect: "write",
|
|
576
|
-
inputSchema: recommendPapersInput,
|
|
577
|
-
outputSchema: external_exports.toJSONSchema(recommendPapersOutput, { io: "output", unrepresentable: "any" })
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// ../plugins/src/semantic_scholar/index.ts
|
|
582
|
-
function createSemanticScholarPlugin() {
|
|
583
|
-
return createProviderPlugin({
|
|
584
|
-
description: "Semantic Scholar",
|
|
585
|
-
actions: semanticScholarActions,
|
|
586
|
-
handlers: {
|
|
587
|
-
get_paper: getPaper,
|
|
588
|
-
get_papers: getPapers,
|
|
589
|
-
search_papers: searchPapers,
|
|
590
|
-
bulk_search_papers: bulkSearchPapers,
|
|
591
|
-
match_paper_title: matchPaperTitle,
|
|
592
|
-
autocomplete_papers: autocompletePapers,
|
|
593
|
-
get_paper_authors: getPaperAuthors,
|
|
594
|
-
get_paper_citations: getPaperCitations,
|
|
595
|
-
get_paper_references: getPaperReferences,
|
|
596
|
-
search_authors: searchAuthors,
|
|
597
|
-
get_author: getAuthor,
|
|
598
|
-
get_authors: getAuthors,
|
|
599
|
-
get_author_papers: getAuthorPapers,
|
|
600
|
-
search_snippets: searchSnippets,
|
|
601
|
-
recommend_for_paper: recommendForPaper,
|
|
602
|
-
recommend_papers: recommendPapers
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
var semantic_scholar_default = createSemanticScholarPlugin();
|
|
607
|
-
export {
|
|
608
|
-
createSemanticScholarPlugin,
|
|
609
|
-
semantic_scholar_default as default
|
|
610
|
-
};
|