paper-search-cli 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.
- package/.env.example +165 -0
- package/LICENSE +21 -0
- package/README-sc.md +642 -0
- package/README.md +642 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +637 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/ConfigService.d.ts +26 -0
- package/dist/config/ConfigService.d.ts.map +1 -0
- package/dist/config/ConfigService.js +145 -0
- package/dist/config/ConfigService.js.map +1 -0
- package/dist/config/constants.d.ts +140 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +93 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/core/diagnostics.d.ts +43 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +544 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/handleToolCall.d.ts +8 -0
- package/dist/core/handleToolCall.d.ts.map +1 -0
- package/dist/core/handleToolCall.js +440 -0
- package/dist/core/handleToolCall.js.map +1 -0
- package/dist/core/schemas.d.ts +454 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/schemas.js +322 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/searchers.d.ts +45 -0
- package/dist/core/searchers.d.ts.map +1 -0
- package/dist/core/searchers.js +73 -0
- package/dist/core/searchers.js.map +1 -0
- package/dist/core/tools.d.ts +7 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +640 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/models/Paper.d.ts +64 -0
- package/dist/models/Paper.d.ts.map +1 -0
- package/dist/models/Paper.js +70 -0
- package/dist/models/Paper.js.map +1 -0
- package/dist/platforms/ArxivSearcher.d.ts +64 -0
- package/dist/platforms/ArxivSearcher.d.ts.map +1 -0
- package/dist/platforms/ArxivSearcher.js +531 -0
- package/dist/platforms/ArxivSearcher.js.map +1 -0
- package/dist/platforms/BioRxivSearcher.d.ts +47 -0
- package/dist/platforms/BioRxivSearcher.d.ts.map +1 -0
- package/dist/platforms/BioRxivSearcher.js +196 -0
- package/dist/platforms/BioRxivSearcher.js.map +1 -0
- package/dist/platforms/CORESearcher.d.ts +16 -0
- package/dist/platforms/CORESearcher.d.ts.map +1 -0
- package/dist/platforms/CORESearcher.js +148 -0
- package/dist/platforms/CORESearcher.js.map +1 -0
- package/dist/platforms/CrossrefSearcher.d.ts +34 -0
- package/dist/platforms/CrossrefSearcher.d.ts.map +1 -0
- package/dist/platforms/CrossrefSearcher.js +339 -0
- package/dist/platforms/CrossrefSearcher.js.map +1 -0
- package/dist/platforms/EuropePMCSearcher.d.ts +20 -0
- package/dist/platforms/EuropePMCSearcher.d.ts.map +1 -0
- package/dist/platforms/EuropePMCSearcher.js +173 -0
- package/dist/platforms/EuropePMCSearcher.js.map +1 -0
- package/dist/platforms/GoogleScholarSearcher.d.ts +77 -0
- package/dist/platforms/GoogleScholarSearcher.d.ts.map +1 -0
- package/dist/platforms/GoogleScholarSearcher.js +262 -0
- package/dist/platforms/GoogleScholarSearcher.js.map +1 -0
- package/dist/platforms/IACRSearcher.d.ts +51 -0
- package/dist/platforms/IACRSearcher.d.ts.map +1 -0
- package/dist/platforms/IACRSearcher.js +339 -0
- package/dist/platforms/IACRSearcher.js.map +1 -0
- package/dist/platforms/OpenAIRESearcher.d.ts +22 -0
- package/dist/platforms/OpenAIRESearcher.d.ts.map +1 -0
- package/dist/platforms/OpenAIRESearcher.js +223 -0
- package/dist/platforms/OpenAIRESearcher.js.map +1 -0
- package/dist/platforms/OpenAlexSearcher.d.ts +14 -0
- package/dist/platforms/OpenAlexSearcher.d.ts.map +1 -0
- package/dist/platforms/OpenAlexSearcher.js +114 -0
- package/dist/platforms/OpenAlexSearcher.js.map +1 -0
- package/dist/platforms/PMCSearcher.d.ts +20 -0
- package/dist/platforms/PMCSearcher.d.ts.map +1 -0
- package/dist/platforms/PMCSearcher.js +177 -0
- package/dist/platforms/PMCSearcher.js.map +1 -0
- package/dist/platforms/PaperSource.d.ts +143 -0
- package/dist/platforms/PaperSource.d.ts.map +1 -0
- package/dist/platforms/PaperSource.js +125 -0
- package/dist/platforms/PaperSource.js.map +1 -0
- package/dist/platforms/PubMedSearcher.d.ts +104 -0
- package/dist/platforms/PubMedSearcher.d.ts.map +1 -0
- package/dist/platforms/PubMedSearcher.js +422 -0
- package/dist/platforms/PubMedSearcher.js.map +1 -0
- package/dist/platforms/SciHubSearcher.d.ts +66 -0
- package/dist/platforms/SciHubSearcher.d.ts.map +1 -0
- package/dist/platforms/SciHubSearcher.js +398 -0
- package/dist/platforms/SciHubSearcher.js.map +1 -0
- package/dist/platforms/ScienceDirectSearcher.d.ts +42 -0
- package/dist/platforms/ScienceDirectSearcher.d.ts.map +1 -0
- package/dist/platforms/ScienceDirectSearcher.js +326 -0
- package/dist/platforms/ScienceDirectSearcher.js.map +1 -0
- package/dist/platforms/ScopusSearcher.d.ts +43 -0
- package/dist/platforms/ScopusSearcher.d.ts.map +1 -0
- package/dist/platforms/ScopusSearcher.js +364 -0
- package/dist/platforms/ScopusSearcher.js.map +1 -0
- package/dist/platforms/SemanticScholarSearcher.d.ts +96 -0
- package/dist/platforms/SemanticScholarSearcher.d.ts.map +1 -0
- package/dist/platforms/SemanticScholarSearcher.js +419 -0
- package/dist/platforms/SemanticScholarSearcher.js.map +1 -0
- package/dist/platforms/SpringerSearcher.d.ts +54 -0
- package/dist/platforms/SpringerSearcher.d.ts.map +1 -0
- package/dist/platforms/SpringerSearcher.js +407 -0
- package/dist/platforms/SpringerSearcher.js.map +1 -0
- package/dist/platforms/UnpaywallSearcher.d.ts +18 -0
- package/dist/platforms/UnpaywallSearcher.d.ts.map +1 -0
- package/dist/platforms/UnpaywallSearcher.js +115 -0
- package/dist/platforms/UnpaywallSearcher.js.map +1 -0
- package/dist/platforms/WebOfScienceSearcher.d.ts +111 -0
- package/dist/platforms/WebOfScienceSearcher.d.ts.map +1 -0
- package/dist/platforms/WebOfScienceSearcher.js +500 -0
- package/dist/platforms/WebOfScienceSearcher.js.map +1 -0
- package/dist/platforms/WileySearcher.d.ts +44 -0
- package/dist/platforms/WileySearcher.d.ts.map +1 -0
- package/dist/platforms/WileySearcher.js +148 -0
- package/dist/platforms/WileySearcher.js.map +1 -0
- package/dist/services/CitationService.d.ts +66 -0
- package/dist/services/CitationService.d.ts.map +1 -0
- package/dist/services/CitationService.js +237 -0
- package/dist/services/CitationService.js.map +1 -0
- package/dist/services/MultiSourceSearchService.d.ts +19 -0
- package/dist/services/MultiSourceSearchService.d.ts.map +1 -0
- package/dist/services/MultiSourceSearchService.js +96 -0
- package/dist/services/MultiSourceSearchService.js.map +1 -0
- package/dist/services/OpenAccessFallbackService.d.ts +20 -0
- package/dist/services/OpenAccessFallbackService.d.ts.map +1 -0
- package/dist/services/OpenAccessFallbackService.js +124 -0
- package/dist/services/OpenAccessFallbackService.js.map +1 -0
- package/dist/utils/ErrorHandler.d.ts +99 -0
- package/dist/utils/ErrorHandler.d.ts.map +1 -0
- package/dist/utils/ErrorHandler.js +266 -0
- package/dist/utils/ErrorHandler.js.map +1 -0
- package/dist/utils/Logger.d.ts +6 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +26 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/PDFExtractor.d.ts +34 -0
- package/dist/utils/PDFExtractor.d.ts.map +1 -0
- package/dist/utils/PDFExtractor.js +130 -0
- package/dist/utils/PDFExtractor.js.map +1 -0
- package/dist/utils/PdfDownload.d.ts +7 -0
- package/dist/utils/PdfDownload.d.ts.map +1 -0
- package/dist/utils/PdfDownload.js +52 -0
- package/dist/utils/PdfDownload.js.map +1 -0
- package/dist/utils/QuotaManager.d.ts +32 -0
- package/dist/utils/QuotaManager.d.ts.map +1 -0
- package/dist/utils/QuotaManager.js +95 -0
- package/dist/utils/QuotaManager.js.map +1 -0
- package/dist/utils/RateLimiter.d.ts +50 -0
- package/dist/utils/RateLimiter.d.ts.map +1 -0
- package/dist/utils/RateLimiter.js +121 -0
- package/dist/utils/RateLimiter.js.map +1 -0
- package/dist/utils/RequestCache.d.ts +26 -0
- package/dist/utils/RequestCache.d.ts.map +1 -0
- package/dist/utils/RequestCache.js +66 -0
- package/dist/utils/RequestCache.js.map +1 -0
- package/dist/utils/SecurityUtils.d.ts +80 -0
- package/dist/utils/SecurityUtils.d.ts.map +1 -0
- package/dist/utils/SecurityUtils.js +357 -0
- package/dist/utils/SecurityUtils.js.map +1 -0
- package/package.json +111 -0
- package/skills/paper-search/SKILL.md +192 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const CONFIG_KEYS: readonly ["SEMANTIC_SCHOLAR_API_KEY", "PAPER_SEARCH_UNPAYWALL_EMAIL", "UNPAYWALL_EMAIL", "PAPER_SEARCH_CORE_API_KEY", "CORE_API_KEY", "WOS_API_KEY", "WOS_API_VERSION", "PUBMED_API_KEY", "NCBI_EMAIL", "NCBI_TOOL", "ELSEVIER_API_KEY", "SPRINGER_API_KEY", "SPRINGER_OPENACCESS_API_KEY", "WILEY_TDM_TOKEN", "CROSSREF_MAILTO", "PAPER_SEARCH_OPENAIRE_API_KEY", "OPENAIRE_API_KEY", "LOG_LEVEL", "DEFAULT_DOWNLOAD_PATH", "MAX_FILE_SIZE_MB", "RATE_LIMIT_REQUESTS_PER_MINUTE", "RATE_LIMIT_BURST"];
|
|
2
|
+
export type ConfigKey = (typeof CONFIG_KEYS)[number];
|
|
3
|
+
export interface ConfigEntry {
|
|
4
|
+
key: string;
|
|
5
|
+
configured: boolean;
|
|
6
|
+
source: 'environment' | 'user_config' | 'missing';
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getConfigPath(): string;
|
|
10
|
+
export declare function readUserConfig(): Record<string, string>;
|
|
11
|
+
export declare function writeUserConfig(config: Record<string, string>): string;
|
|
12
|
+
export declare function initUserConfig(force?: boolean): {
|
|
13
|
+
path: string;
|
|
14
|
+
created: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function setUserConfigValue(key: string, value: string): Record<string, string>;
|
|
17
|
+
export declare function unsetUserConfigValue(key: string): Record<string, string>;
|
|
18
|
+
export declare function importEnvFile(filePath: string): {
|
|
19
|
+
path: string;
|
|
20
|
+
imported: string[];
|
|
21
|
+
};
|
|
22
|
+
export declare function loadUserConfigIntoEnv(): string[];
|
|
23
|
+
export declare function listConfigEntries(includeMissing?: boolean): ConfigEntry[];
|
|
24
|
+
export declare function maskValue(key: string, value: string): string;
|
|
25
|
+
export declare function assertConfigKey(key: string): asserts key is ConfigKey;
|
|
26
|
+
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../src/config/ConfigService.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,weAuBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IAClD,KAAK,EAAE,MAAM,CAAC;CACf;AAKD,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBvD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAMtE;AAED,wBAAgB,cAAc,CAAC,KAAK,UAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAQhF;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMrF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAcpF;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAYhD;AAED,wBAAgB,iBAAiB,CAAC,cAAc,UAAQ,GAAG,WAAW,EAAE,CAiBvE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,SAAS,CAIrE"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as dotenv from 'dotenv';
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { homedir } from 'os';
|
|
5
|
+
export const CONFIG_KEYS = [
|
|
6
|
+
'SEMANTIC_SCHOLAR_API_KEY',
|
|
7
|
+
'PAPER_SEARCH_UNPAYWALL_EMAIL',
|
|
8
|
+
'UNPAYWALL_EMAIL',
|
|
9
|
+
'PAPER_SEARCH_CORE_API_KEY',
|
|
10
|
+
'CORE_API_KEY',
|
|
11
|
+
'WOS_API_KEY',
|
|
12
|
+
'WOS_API_VERSION',
|
|
13
|
+
'PUBMED_API_KEY',
|
|
14
|
+
'NCBI_EMAIL',
|
|
15
|
+
'NCBI_TOOL',
|
|
16
|
+
'ELSEVIER_API_KEY',
|
|
17
|
+
'SPRINGER_API_KEY',
|
|
18
|
+
'SPRINGER_OPENACCESS_API_KEY',
|
|
19
|
+
'WILEY_TDM_TOKEN',
|
|
20
|
+
'CROSSREF_MAILTO',
|
|
21
|
+
'PAPER_SEARCH_OPENAIRE_API_KEY',
|
|
22
|
+
'OPENAIRE_API_KEY',
|
|
23
|
+
'LOG_LEVEL',
|
|
24
|
+
'DEFAULT_DOWNLOAD_PATH',
|
|
25
|
+
'MAX_FILE_SIZE_MB',
|
|
26
|
+
'RATE_LIMIT_REQUESTS_PER_MINUTE',
|
|
27
|
+
'RATE_LIMIT_BURST'
|
|
28
|
+
];
|
|
29
|
+
const CONFIG_KEY_SET = new Set(CONFIG_KEYS);
|
|
30
|
+
const APPLIED_FROM_USER_CONFIG = new Set();
|
|
31
|
+
export function getConfigPath() {
|
|
32
|
+
if (process.env.PAPER_SEARCH_CONFIG_FILE)
|
|
33
|
+
return process.env.PAPER_SEARCH_CONFIG_FILE;
|
|
34
|
+
const configDir = process.env.PAPER_SEARCH_CONFIG_DIR || join(homedir(), '.config', 'paper-search-cli');
|
|
35
|
+
return join(configDir, 'config.json');
|
|
36
|
+
}
|
|
37
|
+
export function readUserConfig() {
|
|
38
|
+
const filePath = getConfigPath();
|
|
39
|
+
if (!existsSync(filePath))
|
|
40
|
+
return {};
|
|
41
|
+
const parsed = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
42
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
43
|
+
throw new Error(`Invalid config file: ${filePath}`);
|
|
44
|
+
}
|
|
45
|
+
const config = {};
|
|
46
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
47
|
+
if (CONFIG_KEY_SET.has(key) && value !== undefined && value !== null) {
|
|
48
|
+
config[key] = String(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return config;
|
|
52
|
+
}
|
|
53
|
+
export function writeUserConfig(config) {
|
|
54
|
+
const filePath = getConfigPath();
|
|
55
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
56
|
+
writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
|
|
57
|
+
chmodSync(filePath, 0o600);
|
|
58
|
+
return filePath;
|
|
59
|
+
}
|
|
60
|
+
export function initUserConfig(force = false) {
|
|
61
|
+
const filePath = getConfigPath();
|
|
62
|
+
if (existsSync(filePath) && !force) {
|
|
63
|
+
chmodSync(filePath, 0o600);
|
|
64
|
+
return { path: filePath, created: false };
|
|
65
|
+
}
|
|
66
|
+
writeUserConfig({});
|
|
67
|
+
return { path: filePath, created: true };
|
|
68
|
+
}
|
|
69
|
+
export function setUserConfigValue(key, value) {
|
|
70
|
+
assertConfigKey(key);
|
|
71
|
+
const config = readUserConfig();
|
|
72
|
+
config[key] = value;
|
|
73
|
+
writeUserConfig(config);
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
export function unsetUserConfigValue(key) {
|
|
77
|
+
assertConfigKey(key);
|
|
78
|
+
const config = readUserConfig();
|
|
79
|
+
delete config[key];
|
|
80
|
+
writeUserConfig(config);
|
|
81
|
+
return config;
|
|
82
|
+
}
|
|
83
|
+
export function importEnvFile(filePath) {
|
|
84
|
+
if (!existsSync(filePath))
|
|
85
|
+
throw new Error(`Env file not found: ${filePath}`);
|
|
86
|
+
const parsed = dotenv.parse(readFileSync(filePath));
|
|
87
|
+
const config = readUserConfig();
|
|
88
|
+
const imported = [];
|
|
89
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
90
|
+
if (!CONFIG_KEY_SET.has(key))
|
|
91
|
+
continue;
|
|
92
|
+
config[key] = value;
|
|
93
|
+
imported.push(key);
|
|
94
|
+
}
|
|
95
|
+
writeUserConfig(config);
|
|
96
|
+
return { path: getConfigPath(), imported };
|
|
97
|
+
}
|
|
98
|
+
export function loadUserConfigIntoEnv() {
|
|
99
|
+
const config = readUserConfig();
|
|
100
|
+
const applied = [];
|
|
101
|
+
for (const [key, value] of Object.entries(config)) {
|
|
102
|
+
if (process.env[key])
|
|
103
|
+
continue;
|
|
104
|
+
process.env[key] = value;
|
|
105
|
+
APPLIED_FROM_USER_CONFIG.add(key);
|
|
106
|
+
applied.push(key);
|
|
107
|
+
}
|
|
108
|
+
return applied;
|
|
109
|
+
}
|
|
110
|
+
export function listConfigEntries(includeMissing = false) {
|
|
111
|
+
const config = readUserConfig();
|
|
112
|
+
return CONFIG_KEYS.map(key => {
|
|
113
|
+
const value = process.env[key] || config[key] || '';
|
|
114
|
+
const source = value
|
|
115
|
+
? APPLIED_FROM_USER_CONFIG.has(key) || (!process.env[key] && Boolean(config[key]))
|
|
116
|
+
? 'user_config'
|
|
117
|
+
: 'environment'
|
|
118
|
+
: 'missing';
|
|
119
|
+
return {
|
|
120
|
+
key,
|
|
121
|
+
configured: Boolean(value),
|
|
122
|
+
source,
|
|
123
|
+
value: value ? maskValue(key, value) : ''
|
|
124
|
+
};
|
|
125
|
+
}).filter(entry => includeMissing || entry.configured);
|
|
126
|
+
}
|
|
127
|
+
export function maskValue(key, value) {
|
|
128
|
+
if (!value)
|
|
129
|
+
return '';
|
|
130
|
+
if (key.toLowerCase().includes('email') || value.includes('@')) {
|
|
131
|
+
const [name, domain] = value.split('@');
|
|
132
|
+
if (!domain)
|
|
133
|
+
return '***';
|
|
134
|
+
return `${name.slice(0, 2)}***@${domain}`;
|
|
135
|
+
}
|
|
136
|
+
if (value.length <= 8)
|
|
137
|
+
return '***';
|
|
138
|
+
return `${value.slice(0, 4)}...${value.slice(-4)}`;
|
|
139
|
+
}
|
|
140
|
+
export function assertConfigKey(key) {
|
|
141
|
+
if (!CONFIG_KEY_SET.has(key)) {
|
|
142
|
+
throw new Error(`Unsupported config key: ${key}. Run "paper-search config keys" to list supported keys.`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=ConfigService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.js","sourceRoot":"","sources":["../../src/config/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAA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AE;SAC1C,CAAC;IACJ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAC1B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,MAAM,EAAE,CAAC;IAC5C,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,0DAA0D,CAAC,CAAC;IAC5G,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application constants and configuration
|
|
3
|
+
* Centralized configuration for timeouts, limits, and other settings
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* API Timeout Configuration (in milliseconds)
|
|
7
|
+
*/
|
|
8
|
+
export declare const TIMEOUTS: {
|
|
9
|
+
/** Default timeout for API requests */
|
|
10
|
+
readonly DEFAULT: 30000;
|
|
11
|
+
/** Extended timeout for slow APIs */
|
|
12
|
+
readonly EXTENDED: 60000;
|
|
13
|
+
/** Short timeout for health checks */
|
|
14
|
+
readonly HEALTH_CHECK: 10000;
|
|
15
|
+
/** Timeout for PDF downloads */
|
|
16
|
+
readonly DOWNLOAD: 120000;
|
|
17
|
+
/** Timeout for batch operations */
|
|
18
|
+
readonly BATCH: 90000;
|
|
19
|
+
/** Per-source timeout for fan-out operations */
|
|
20
|
+
readonly SOURCE_TASK: 15000;
|
|
21
|
+
/** Timeout buffer for withTimeout wrapper */
|
|
22
|
+
readonly BUFFER: 5000;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Rate Limiting Configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare const RATE_LIMITS: {
|
|
28
|
+
/** Default requests per second */
|
|
29
|
+
readonly DEFAULT_RPS: 1;
|
|
30
|
+
/** Conservative requests per second */
|
|
31
|
+
readonly CONSERVATIVE_RPS: 0.5;
|
|
32
|
+
/** Aggressive requests per second (for high-limit APIs) */
|
|
33
|
+
readonly AGGRESSIVE_RPS: 5;
|
|
34
|
+
/** Default burst capacity */
|
|
35
|
+
readonly DEFAULT_BURST: 5;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Search Limits
|
|
39
|
+
*/
|
|
40
|
+
export declare const SEARCH_LIMITS: {
|
|
41
|
+
/** Default number of results */
|
|
42
|
+
readonly DEFAULT_RESULTS: 10;
|
|
43
|
+
/** Maximum results per request */
|
|
44
|
+
readonly MAX_RESULTS: 100;
|
|
45
|
+
/** Maximum query length */
|
|
46
|
+
readonly MAX_QUERY_LENGTH: 1000;
|
|
47
|
+
/** Maximum boolean operators in query */
|
|
48
|
+
readonly MAX_BOOLEAN_OPERATORS: 10;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* API Endpoints
|
|
52
|
+
*/
|
|
53
|
+
export declare const API_ENDPOINTS: {
|
|
54
|
+
readonly CROSSREF: "https://api.crossref.org/works";
|
|
55
|
+
readonly OPENCITATIONS: "https://opencitations.net/index/coci/api/v1";
|
|
56
|
+
readonly WOS_STARTER: "https://api.clarivate.com/apis/wos-starter";
|
|
57
|
+
readonly SPRINGER_META: "https://api.springernature.com/meta/v2";
|
|
58
|
+
readonly SPRINGER_OA: "https://api.springernature.com/openaccess";
|
|
59
|
+
readonly ELSEVIER: "https://api.elsevier.com";
|
|
60
|
+
readonly SEMANTIC_SCHOLAR: "https://api.semanticscholar.org/graph/v1";
|
|
61
|
+
readonly ARXIV: "http://export.arxiv.org/api";
|
|
62
|
+
readonly PUBMED: "https://eutils.ncbi.nlm.nih.gov/entrez/eutils";
|
|
63
|
+
readonly BIORXIV: "https://api.biorxiv.org";
|
|
64
|
+
readonly MEDRXIV: "https://api.medrxiv.org";
|
|
65
|
+
readonly WILEY_TDM: "https://api.wiley.com/onlinelibrary/tdm/v1";
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Default User Agent
|
|
69
|
+
*/
|
|
70
|
+
export declare const USER_AGENT = "Paper-Search-CLI/1.0 (Academic Research Tool)";
|
|
71
|
+
/**
|
|
72
|
+
* Default mailto for Crossref polite pool
|
|
73
|
+
*/
|
|
74
|
+
export declare const DEFAULT_MAILTO: string;
|
|
75
|
+
/**
|
|
76
|
+
* DOI validation pattern
|
|
77
|
+
*/
|
|
78
|
+
export declare const DOI_PATTERN: RegExp;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum DOI length
|
|
81
|
+
*/
|
|
82
|
+
export declare const MAX_DOI_LENGTH = 256;
|
|
83
|
+
declare const _default: {
|
|
84
|
+
TIMEOUTS: {
|
|
85
|
+
/** Default timeout for API requests */
|
|
86
|
+
readonly DEFAULT: 30000;
|
|
87
|
+
/** Extended timeout for slow APIs */
|
|
88
|
+
readonly EXTENDED: 60000;
|
|
89
|
+
/** Short timeout for health checks */
|
|
90
|
+
readonly HEALTH_CHECK: 10000;
|
|
91
|
+
/** Timeout for PDF downloads */
|
|
92
|
+
readonly DOWNLOAD: 120000;
|
|
93
|
+
/** Timeout for batch operations */
|
|
94
|
+
readonly BATCH: 90000;
|
|
95
|
+
/** Per-source timeout for fan-out operations */
|
|
96
|
+
readonly SOURCE_TASK: 15000;
|
|
97
|
+
/** Timeout buffer for withTimeout wrapper */
|
|
98
|
+
readonly BUFFER: 5000;
|
|
99
|
+
};
|
|
100
|
+
RATE_LIMITS: {
|
|
101
|
+
/** Default requests per second */
|
|
102
|
+
readonly DEFAULT_RPS: 1;
|
|
103
|
+
/** Conservative requests per second */
|
|
104
|
+
readonly CONSERVATIVE_RPS: 0.5;
|
|
105
|
+
/** Aggressive requests per second (for high-limit APIs) */
|
|
106
|
+
readonly AGGRESSIVE_RPS: 5;
|
|
107
|
+
/** Default burst capacity */
|
|
108
|
+
readonly DEFAULT_BURST: 5;
|
|
109
|
+
};
|
|
110
|
+
SEARCH_LIMITS: {
|
|
111
|
+
/** Default number of results */
|
|
112
|
+
readonly DEFAULT_RESULTS: 10;
|
|
113
|
+
/** Maximum results per request */
|
|
114
|
+
readonly MAX_RESULTS: 100;
|
|
115
|
+
/** Maximum query length */
|
|
116
|
+
readonly MAX_QUERY_LENGTH: 1000;
|
|
117
|
+
/** Maximum boolean operators in query */
|
|
118
|
+
readonly MAX_BOOLEAN_OPERATORS: 10;
|
|
119
|
+
};
|
|
120
|
+
API_ENDPOINTS: {
|
|
121
|
+
readonly CROSSREF: "https://api.crossref.org/works";
|
|
122
|
+
readonly OPENCITATIONS: "https://opencitations.net/index/coci/api/v1";
|
|
123
|
+
readonly WOS_STARTER: "https://api.clarivate.com/apis/wos-starter";
|
|
124
|
+
readonly SPRINGER_META: "https://api.springernature.com/meta/v2";
|
|
125
|
+
readonly SPRINGER_OA: "https://api.springernature.com/openaccess";
|
|
126
|
+
readonly ELSEVIER: "https://api.elsevier.com";
|
|
127
|
+
readonly SEMANTIC_SCHOLAR: "https://api.semanticscholar.org/graph/v1";
|
|
128
|
+
readonly ARXIV: "http://export.arxiv.org/api";
|
|
129
|
+
readonly PUBMED: "https://eutils.ncbi.nlm.nih.gov/entrez/eutils";
|
|
130
|
+
readonly BIORXIV: "https://api.biorxiv.org";
|
|
131
|
+
readonly MEDRXIV: "https://api.medrxiv.org";
|
|
132
|
+
readonly WILEY_TDM: "https://api.wiley.com/onlinelibrary/tdm/v1";
|
|
133
|
+
};
|
|
134
|
+
USER_AGENT: string;
|
|
135
|
+
DEFAULT_MAILTO: string;
|
|
136
|
+
DOI_PATTERN: RegExp;
|
|
137
|
+
MAX_DOI_LENGTH: number;
|
|
138
|
+
};
|
|
139
|
+
export default _default;
|
|
140
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB,uCAAuC;;IAEvC,qCAAqC;;IAErC,sCAAsC;;IAEtC,gCAAgC;;IAEhC,mCAAmC;;IAEnC,gDAAgD;;IAEhD,6CAA6C;;CAErC,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB,kCAAkC;;IAElC,uCAAuC;;IAEvC,2DAA2D;;IAE3D,6BAA6B;;CAErB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB,gCAAgC;;IAEhC,kCAAkC;;IAElC,2BAA2B;;IAE3B,yCAAyC;;CAEjC,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAahB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU,kDAAkD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,cAAc,QAAgE,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,WAAW,QAA8B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,cAAc,MAAM,CAAC;;;QAhFhC,uCAAuC;;QAEvC,qCAAqC;;QAErC,sCAAsC;;QAEtC,gCAAgC;;QAEhC,mCAAmC;;QAEnC,gDAAgD;;QAEhD,6CAA6C;;;;QAQ7C,kCAAkC;;QAElC,uCAAuC;;QAEvC,2DAA2D;;QAE3D,6BAA6B;;;;QAQ7B,gCAAgC;;QAEhC,kCAAkC;;QAElC,2BAA2B;;QAE3B,yCAAyC;;;;;;;;;;;;;;;;;;;;;;AA0C3C,wBASE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application constants and configuration
|
|
3
|
+
* Centralized configuration for timeouts, limits, and other settings
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* API Timeout Configuration (in milliseconds)
|
|
7
|
+
*/
|
|
8
|
+
export const TIMEOUTS = {
|
|
9
|
+
/** Default timeout for API requests */
|
|
10
|
+
DEFAULT: 30000,
|
|
11
|
+
/** Extended timeout for slow APIs */
|
|
12
|
+
EXTENDED: 60000,
|
|
13
|
+
/** Short timeout for health checks */
|
|
14
|
+
HEALTH_CHECK: 10000,
|
|
15
|
+
/** Timeout for PDF downloads */
|
|
16
|
+
DOWNLOAD: 120000,
|
|
17
|
+
/** Timeout for batch operations */
|
|
18
|
+
BATCH: 90000,
|
|
19
|
+
/** Per-source timeout for fan-out operations */
|
|
20
|
+
SOURCE_TASK: 15000,
|
|
21
|
+
/** Timeout buffer for withTimeout wrapper */
|
|
22
|
+
BUFFER: 5000
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Rate Limiting Configuration
|
|
26
|
+
*/
|
|
27
|
+
export const RATE_LIMITS = {
|
|
28
|
+
/** Default requests per second */
|
|
29
|
+
DEFAULT_RPS: 1,
|
|
30
|
+
/** Conservative requests per second */
|
|
31
|
+
CONSERVATIVE_RPS: 0.5,
|
|
32
|
+
/** Aggressive requests per second (for high-limit APIs) */
|
|
33
|
+
AGGRESSIVE_RPS: 5,
|
|
34
|
+
/** Default burst capacity */
|
|
35
|
+
DEFAULT_BURST: 5
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Search Limits
|
|
39
|
+
*/
|
|
40
|
+
export const SEARCH_LIMITS = {
|
|
41
|
+
/** Default number of results */
|
|
42
|
+
DEFAULT_RESULTS: 10,
|
|
43
|
+
/** Maximum results per request */
|
|
44
|
+
MAX_RESULTS: 100,
|
|
45
|
+
/** Maximum query length */
|
|
46
|
+
MAX_QUERY_LENGTH: 1000,
|
|
47
|
+
/** Maximum boolean operators in query */
|
|
48
|
+
MAX_BOOLEAN_OPERATORS: 10
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* API Endpoints
|
|
52
|
+
*/
|
|
53
|
+
export const API_ENDPOINTS = {
|
|
54
|
+
CROSSREF: 'https://api.crossref.org/works',
|
|
55
|
+
OPENCITATIONS: 'https://opencitations.net/index/coci/api/v1',
|
|
56
|
+
WOS_STARTER: 'https://api.clarivate.com/apis/wos-starter',
|
|
57
|
+
SPRINGER_META: 'https://api.springernature.com/meta/v2',
|
|
58
|
+
SPRINGER_OA: 'https://api.springernature.com/openaccess',
|
|
59
|
+
ELSEVIER: 'https://api.elsevier.com',
|
|
60
|
+
SEMANTIC_SCHOLAR: 'https://api.semanticscholar.org/graph/v1',
|
|
61
|
+
ARXIV: 'http://export.arxiv.org/api',
|
|
62
|
+
PUBMED: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils',
|
|
63
|
+
BIORXIV: 'https://api.biorxiv.org',
|
|
64
|
+
MEDRXIV: 'https://api.medrxiv.org',
|
|
65
|
+
WILEY_TDM: 'https://api.wiley.com/onlinelibrary/tdm/v1'
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Default User Agent
|
|
69
|
+
*/
|
|
70
|
+
export const USER_AGENT = 'Paper-Search-CLI/1.0 (Academic Research Tool)';
|
|
71
|
+
/**
|
|
72
|
+
* Default mailto for Crossref polite pool
|
|
73
|
+
*/
|
|
74
|
+
export const DEFAULT_MAILTO = process.env.CROSSREF_MAILTO || 'paper-search-cli@example.com';
|
|
75
|
+
/**
|
|
76
|
+
* DOI validation pattern
|
|
77
|
+
*/
|
|
78
|
+
export const DOI_PATTERN = /^10\.\d{4,}(\.\d+)*\/\S+$/;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum DOI length
|
|
81
|
+
*/
|
|
82
|
+
export const MAX_DOI_LENGTH = 256;
|
|
83
|
+
export default {
|
|
84
|
+
TIMEOUTS,
|
|
85
|
+
RATE_LIMITS,
|
|
86
|
+
SEARCH_LIMITS,
|
|
87
|
+
API_ENDPOINTS,
|
|
88
|
+
USER_AGENT,
|
|
89
|
+
DEFAULT_MAILTO,
|
|
90
|
+
DOI_PATTERN,
|
|
91
|
+
MAX_DOI_LENGTH
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,uCAAuC;IACvC,OAAO,EAAE,KAAK;IACd,qCAAqC;IACrC,QAAQ,EAAE,KAAK;IACf,sCAAsC;IACtC,YAAY,EAAE,KAAK;IACnB,gCAAgC;IAChC,QAAQ,EAAE,MAAM;IAChB,mCAAmC;IACnC,KAAK,EAAE,KAAK;IACZ,gDAAgD;IAChD,WAAW,EAAE,KAAK;IAClB,6CAA6C;IAC7C,MAAM,EAAE,IAAI;CACJ,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,kCAAkC;IAClC,WAAW,EAAE,CAAC;IACd,uCAAuC;IACvC,gBAAgB,EAAE,GAAG;IACrB,2DAA2D;IAC3D,cAAc,EAAE,CAAC;IACjB,6BAA6B;IAC7B,aAAa,EAAE,CAAC;CACR,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,gCAAgC;IAChC,eAAe,EAAE,EAAE;IACnB,kCAAkC;IAClC,WAAW,EAAE,GAAG;IAChB,2BAA2B;IAC3B,gBAAgB,EAAE,IAAI;IACtB,yCAAyC;IACzC,qBAAqB,EAAE,EAAE;CACjB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ,EAAE,gCAAgC;IAC1C,aAAa,EAAE,6CAA6C;IAC5D,WAAW,EAAE,4CAA4C;IACzD,aAAa,EAAE,wCAAwC;IACvD,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,0BAA0B;IACpC,gBAAgB,EAAE,0CAA0C;IAC5D,KAAK,EAAE,6BAA6B;IACpC,MAAM,EAAE,+CAA+C;IACvD,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,yBAAyB;IAClC,SAAS,EAAE,4CAA4C;CAC/C,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,+CAA+C,CAAC;AAE1E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,8BAA8B,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,eAAe;IACb,QAAQ;IACR,WAAW;IACX,aAAa;IACb,aAAa;IACb,UAAU;IACV,cAAc;IACd,WAAW;IACX,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ApiRequirement {
|
|
2
|
+
id: string;
|
|
3
|
+
platform: string;
|
|
4
|
+
capability: string;
|
|
5
|
+
tools: string[];
|
|
6
|
+
keyGroups: string[][];
|
|
7
|
+
optionalKeyGroups?: string[][];
|
|
8
|
+
productAccess?: string;
|
|
9
|
+
commonFailures: string[];
|
|
10
|
+
actions: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface RequirementStatus extends ApiRequirement {
|
|
13
|
+
configured: boolean;
|
|
14
|
+
configuredGroups: string[][];
|
|
15
|
+
missingGroups: string[][];
|
|
16
|
+
}
|
|
17
|
+
export interface Diagnostic {
|
|
18
|
+
severity: 'info' | 'warning' | 'error';
|
|
19
|
+
category: 'missing_config' | 'invalid_key' | 'permission' | 'query_or_filter' | 'rate_limit' | 'timeout' | 'zero_results' | 'partial_failure' | 'unsupported';
|
|
20
|
+
platform?: string;
|
|
21
|
+
tool?: string;
|
|
22
|
+
summary: string;
|
|
23
|
+
likelyCauses: string[];
|
|
24
|
+
actions: string[];
|
|
25
|
+
relatedConfigKeys: string[];
|
|
26
|
+
}
|
|
27
|
+
interface DiagnosticContext {
|
|
28
|
+
tool?: string;
|
|
29
|
+
platform?: string;
|
|
30
|
+
sources?: string;
|
|
31
|
+
}
|
|
32
|
+
interface ToolResultContext extends DiagnosticContext {
|
|
33
|
+
args?: Record<string, unknown>;
|
|
34
|
+
data?: unknown;
|
|
35
|
+
message?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const API_REQUIREMENTS: ApiRequirement[];
|
|
38
|
+
export declare function getRequirementStatus(): RequirementStatus[];
|
|
39
|
+
export declare function diagnoseToolResult(context: ToolResultContext): Diagnostic | undefined;
|
|
40
|
+
export declare function diagnoseError(error: any, context?: DiagnosticContext): Diagnostic | undefined;
|
|
41
|
+
export declare function diagnosticContextFromCli(command: string, positionals: string[], flags: Record<string, unknown>): DiagnosticContext;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/core/diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,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