@cyanheads/pubmed-mcp-server 2.10.17 → 2.10.19
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/AGENTS.md +12 -14
- package/CLAUDE.md +12 -14
- package/Dockerfile +77 -36
- package/README.md +86 -109
- package/changelog/2.10.x/2.10.17.md +1 -1
- package/changelog/2.10.x/2.10.18.md +14 -0
- package/changelog/2.10.x/2.10.19.md +42 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +7 -3
- package/dist/config/server-config.js.map +1 -1
- package/dist/mcp-server/resources/definitions/database-info.resource.d.ts +43 -1
- package/dist/mcp-server/resources/definitions/database-info.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/database-info.resource.js +2 -0
- package/dist/mcp-server/resources/definitions/database-info.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/_visible-text.d.ts +19 -0
- package/dist/mcp-server/tools/definitions/_visible-text.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/_visible-text.js +22 -0
- package/dist/mcp-server/tools/definitions/_visible-text.js.map +1 -0
- package/dist/mcp-server/tools/definitions/convert-ids.tool.d.ts +11 -4
- package/dist/mcp-server/tools/definitions/convert-ids.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/convert-ids.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/convert-ids.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-articles.tool.d.ts +20 -7
- package/dist/mcp-server/tools/definitions/fetch-articles.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-articles.tool.js +40 -5
- package/dist/mcp-server/tools/definitions/fetch-articles.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.d.ts +11 -4
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.js +18 -1
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/find-related.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-related.tool.js +39 -10
- package/dist/mcp-server/tools/definitions/find-related.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/format-citations.tool.d.ts +11 -4
- package/dist/mcp-server/tools/definitions/format-citations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-citation.tool.d.ts +16 -15
- package/dist/mcp-server/tools/definitions/lookup-citation.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-citation.tool.js +40 -22
- package/dist/mcp-server/tools/definitions/lookup-citation.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-mesh.tool.d.ts +13 -6
- package/dist/mcp-server/tools/definitions/lookup-mesh.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-mesh.tool.js +8 -8
- package/dist/mcp-server/tools/definitions/lookup-mesh.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-fetch.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-fetch.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-fetch.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-fetch.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-search.tool.d.ts +19 -5
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-search.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-search.tool.js +37 -7
- package/dist/mcp-server/tools/definitions/pubmed-europepmc-search.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts +40 -18
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-articles.tool.js +193 -43
- package/dist/mcp-server/tools/definitions/search-articles.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spell-check.tool.d.ts +13 -6
- package/dist/mcp-server/tools/definitions/spell-check.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spell-check.tool.js +8 -8
- package/dist/mcp-server/tools/definitions/spell-check.tool.js.map +1 -1
- package/dist/services/error-contracts.d.ts +42 -71
- package/dist/services/error-contracts.d.ts.map +1 -1
- package/dist/services/error-contracts.js +43 -75
- package/dist/services/error-contracts.js.map +1 -1
- package/dist/services/europe-pmc/api-client.d.ts +8 -2
- package/dist/services/europe-pmc/api-client.d.ts.map +1 -1
- package/dist/services/europe-pmc/api-client.js +13 -8
- package/dist/services/europe-pmc/api-client.js.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.d.ts +43 -14
- package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.js +165 -85
- package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
- package/dist/services/europe-pmc/request-queue.d.ts +11 -27
- package/dist/services/europe-pmc/request-queue.d.ts.map +1 -1
- package/dist/services/europe-pmc/request-queue.js +17 -104
- package/dist/services/europe-pmc/request-queue.js.map +1 -1
- package/dist/services/europe-pmc/types.d.ts +6 -1
- package/dist/services/europe-pmc/types.d.ts.map +1 -1
- package/dist/services/ncbi/api-client.d.ts.map +1 -1
- package/dist/services/ncbi/api-client.js +2 -3
- package/dist/services/ncbi/api-client.js.map +1 -1
- package/dist/services/ncbi/ncbi-service.d.ts +2 -1
- package/dist/services/ncbi/ncbi-service.d.ts.map +1 -1
- package/dist/services/ncbi/ncbi-service.js +67 -20
- package/dist/services/ncbi/ncbi-service.js.map +1 -1
- package/dist/services/ncbi/parsing/article-parser.d.ts +15 -1
- package/dist/services/ncbi/parsing/article-parser.d.ts.map +1 -1
- package/dist/services/ncbi/parsing/article-parser.js +29 -0
- package/dist/services/ncbi/parsing/article-parser.js.map +1 -1
- package/dist/services/ncbi/response-handler.d.ts.map +1 -1
- package/dist/services/ncbi/response-handler.js +22 -19
- package/dist/services/ncbi/response-handler.js.map +1 -1
- package/dist/services/ncbi/types.d.ts +33 -0
- package/dist/services/ncbi/types.d.ts.map +1 -1
- package/dist/services/openalex/api-client.d.ts.map +1 -1
- package/dist/services/openalex/api-client.js +6 -7
- package/dist/services/openalex/api-client.js.map +1 -1
- package/dist/services/openalex/openalex-service.d.ts +11 -1
- package/dist/services/openalex/openalex-service.d.ts.map +1 -1
- package/dist/services/openalex/openalex-service.js +18 -11
- package/dist/services/openalex/openalex-service.js.map +1 -1
- package/dist/services/unpaywall/unpaywall-service.d.ts.map +1 -1
- package/dist/services/unpaywall/unpaywall-service.js +1 -3
- package/dist/services/unpaywall/unpaywall-service.js.map +1 -1
- package/package.json +6 -5
- package/server.json +3 -3
|
@@ -7,9 +7,17 @@
|
|
|
7
7
|
* from the same `ORDERED_XML_PARSER_OPTIONS` NCBI's ordered parser uses, so
|
|
8
8
|
* `parsePmcArticle` consumes the result without modification.
|
|
9
9
|
*
|
|
10
|
+
* Every call runs as a retry loop around the shared request queue: each attempt
|
|
11
|
+
* re-enters the queue and waits out its start gap, and a backoff sleep holds no
|
|
12
|
+
* concurrency slot, so callers backing off never stall the calls behind them.
|
|
13
|
+
*
|
|
10
14
|
* A search's retry boundary covers fetch and response classification, so
|
|
11
15
|
* Europe PMC's intermittent empty `{ version }` envelope is retried like an
|
|
12
16
|
* HTTP outage; only a sort or cursor that explains it is reported as bad input.
|
|
17
|
+
* Europe PMC answers an unreadable cursor with the HTTP 503 it uses for an
|
|
18
|
+
* outage, so a 503 on a caller-supplied cursor is checked against the first
|
|
19
|
+
* page of the same query, and the cursor is blamed only when a retry draws
|
|
20
|
+
* the 503 again while that first page was served.
|
|
13
21
|
* A search reports the effective query Europe PMC echoes back, or — with no
|
|
14
22
|
* echo — the source-filtered query it sent.
|
|
15
23
|
*
|
|
@@ -19,9 +27,9 @@
|
|
|
19
27
|
*
|
|
20
28
|
* @module src/services/europe-pmc/europe-pmc-service
|
|
21
29
|
*/
|
|
30
|
+
import { type Pacer } from '@cyanheads/mcp-ts-core/utils';
|
|
22
31
|
import type { JatsNode } from '../ncbi/parsing/pmc-xml-helpers.js';
|
|
23
32
|
import { EuropePmcApiClient } from './api-client.js';
|
|
24
|
-
import { EuropePmcRequestQueue } from './request-queue.js';
|
|
25
33
|
import type { EuropePmcFullTextResult, EuropePmcRecordRef, EuropePmcRelatedResult, EuropePmcSearchHit, EuropePmcSearchParams, EuropePmcSearchResult, EuropePmcSource } from './types.js';
|
|
26
34
|
/**
|
|
27
35
|
* Facade over the Europe PMC REST API:
|
|
@@ -31,14 +39,15 @@ import type { EuropePmcFullTextResult, EuropePmcRecordRef, EuropePmcRelatedResul
|
|
|
31
39
|
* - `citations()` / `references()` — EPMC's link graph for a PubMed article.
|
|
32
40
|
*
|
|
33
41
|
* All honor `ctx.signal` for cancellation and retry transient failures with
|
|
34
|
-
* capped exponential backoff plus jitter
|
|
42
|
+
* capped exponential backoff plus jitter, each attempt paced through the shared
|
|
43
|
+
* request queue.
|
|
35
44
|
*/
|
|
36
45
|
export declare class EuropePmcService {
|
|
37
46
|
private readonly client;
|
|
38
47
|
private readonly queue;
|
|
39
48
|
private readonly maxRetries;
|
|
40
49
|
private readonly orderedXmlParser;
|
|
41
|
-
constructor(client: EuropePmcApiClient, queue:
|
|
50
|
+
constructor(client: EuropePmcApiClient, queue: Pacer, maxRetries: number);
|
|
42
51
|
/**
|
|
43
52
|
* Search Europe PMC. Cursor-based pagination — pass `cursorMark: '*'` (or
|
|
44
53
|
* omit) for the first page; pass the returned `nextCursorMark` for the next.
|
|
@@ -46,12 +55,26 @@ export declare class EuropePmcService {
|
|
|
46
55
|
* The retry boundary covers the fetch and the response classification
|
|
47
56
|
* together, so an empty envelope retries like any other transient failure
|
|
48
57
|
* rather than surfacing after the loop has already returned. (#159)
|
|
58
|
+
*
|
|
59
|
+
* The first HTTP 503 on a caller-supplied cursor draws one probe of the same
|
|
60
|
+
* query's first page, and the cursor is retried either way: one 503 is not
|
|
61
|
+
* enough to tell a bad cursor from a transient outage. A later 503 fails the
|
|
62
|
+
* search at once as non-retryable input only when that probe was served;
|
|
63
|
+
* otherwise it goes on through the ordinary retry path. A 503 with no retry
|
|
64
|
+
* left is never probed, since nothing could use the answer. (#180)
|
|
49
65
|
*/
|
|
50
66
|
search(params: EuropePmcSearchParams): Promise<EuropePmcSearchResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Whether Europe PMC serves the first page of the search in `params`: one
|
|
69
|
+
* request (`cursorMark: '*'`, `pageSize: 1`), paced like any other, with no
|
|
70
|
+
* retries of its own. Any failure reads as not served — except the caller's
|
|
71
|
+
* cancellation, which propagates.
|
|
72
|
+
*/
|
|
73
|
+
private firstPageServed;
|
|
51
74
|
/**
|
|
52
75
|
* One search attempt: fetch, parse, and classify the body. `isLastAttempt`
|
|
53
|
-
* lets an empty envelope
|
|
54
|
-
*
|
|
76
|
+
* lets an empty envelope on the last attempt the retry budget allows be
|
|
77
|
+
* attributed to a caller-supplied cursor.
|
|
55
78
|
*/
|
|
56
79
|
private searchOnce;
|
|
57
80
|
/**
|
|
@@ -117,16 +140,22 @@ export declare class EuropePmcService {
|
|
|
117
140
|
*/
|
|
118
141
|
parseFullTextXml(xml: string): JatsNode | undefined;
|
|
119
142
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* the
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
143
|
+
* Runs one Europe PMC call: a retry loop around the shared request queue, so
|
|
144
|
+
* every attempt re-queues and is re-paced, and a backoff sleep holds no queue
|
|
145
|
+
* slot. No service-level deadline — Europe PMC requests are cheap individually
|
|
146
|
+
* and the caller's signal (typically `ctx.signal`) bounds the total chain; that
|
|
147
|
+
* signal reaches the queue wait and the backoff sleep. `execute` receives the
|
|
148
|
+
* one-based attempt number.
|
|
149
|
+
*
|
|
150
|
+
* `reclassify`, when given, sees each failed attempt after its queue slot is
|
|
151
|
+
* released and before the retry decision, with the attempt's signal and its
|
|
152
|
+
* one-based number. The error it returns is the one the loop judges, so it
|
|
153
|
+
* can end the retries by returning a non-transient error.
|
|
154
|
+
*
|
|
155
|
+
* A caller abort rethrows the caller's own reason; an exhausted failure is
|
|
156
|
+
* reshaped by {@link toServiceError}, after the loop.
|
|
128
157
|
*/
|
|
129
|
-
private
|
|
158
|
+
private runPaced;
|
|
130
159
|
}
|
|
131
160
|
/**
|
|
132
161
|
* Initialize the Europe PMC service when enabled. Safe to call regardless of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"europe-pmc-service.d.ts","sourceRoot":"","sources":["../../../src/services/europe-pmc/europe-pmc-service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"europe-pmc-service.d.ts","sourceRoot":"","sources":["../../../src/services/europe-pmc/europe-pmc-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,OAAO,EAGL,KAAK,KAAK,EAGX,MAAM,8BAA8B,CAAC;AAMtC,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,4CAA4C,CAAC;AAEzF,OAAO,EAAoB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,KAAK,EACV,uBAAuB,EAEvB,kBAAkB,EAElB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EAErB,qBAAqB,EACrB,eAAe,EAChB,MAAM,YAAY,CAAC;AAsGpB;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB;IAIzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAL7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAY;IAE7C,YACmB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,MAAM,EAQpC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA+BpE;IAED;;;;;OAKG;YACW,eAAe;IAgB7B;;;;OAIG;YACW,UAAU;IAyHxB;;;;;;;;;;OAUG;IACG,YAAY,CAChB,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAQ/B;IAED;;;;;;;OAOG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,uBAAuB,CAAC,CASlC;IAED;;;;;;;;;;OAUG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAQjC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAQjC;IAED;;;;;OAKG;YACW,iBAAiB;IAkE/B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA4BlD;IAED;;;;;;;;;;;;;;;OAeG;YACW,QAAQ;CA8CvB;AAMD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAyB3C;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,IAAI,gBAAgB,GAAG,SAAS,CAElE"}
|
|
@@ -7,9 +7,17 @@
|
|
|
7
7
|
* from the same `ORDERED_XML_PARSER_OPTIONS` NCBI's ordered parser uses, so
|
|
8
8
|
* `parsePmcArticle` consumes the result without modification.
|
|
9
9
|
*
|
|
10
|
+
* Every call runs as a retry loop around the shared request queue: each attempt
|
|
11
|
+
* re-enters the queue and waits out its start gap, and a backoff sleep holds no
|
|
12
|
+
* concurrency slot, so callers backing off never stall the calls behind them.
|
|
13
|
+
*
|
|
10
14
|
* A search's retry boundary covers fetch and response classification, so
|
|
11
15
|
* Europe PMC's intermittent empty `{ version }` envelope is retried like an
|
|
12
16
|
* HTTP outage; only a sort or cursor that explains it is reported as bad input.
|
|
17
|
+
* Europe PMC answers an unreadable cursor with the HTTP 503 it uses for an
|
|
18
|
+
* outage, so a 503 on a caller-supplied cursor is checked against the first
|
|
19
|
+
* page of the same query, and the cursor is blamed only when a retry draws
|
|
20
|
+
* the 503 again while that first page was served.
|
|
13
21
|
* A search reports the effective query Europe PMC echoes back, or — with no
|
|
14
22
|
* echo — the source-filtered query it sent.
|
|
15
23
|
*
|
|
@@ -19,33 +27,45 @@
|
|
|
19
27
|
*
|
|
20
28
|
* @module src/services/europe-pmc/europe-pmc-service
|
|
21
29
|
*/
|
|
22
|
-
import {
|
|
23
|
-
import { defaultIsTransient, logger, requestContextService } from '@cyanheads/mcp-ts-core/utils';
|
|
30
|
+
import { JsonRpcErrorCode, McpError, serializationError, serviceUnavailable, validationError, } from '@cyanheads/mcp-ts-core/errors';
|
|
31
|
+
import { defaultIsTransient, logger, requestContextService, withRetry, } from '@cyanheads/mcp-ts-core/utils';
|
|
24
32
|
// biome-ignore lint/suspicious/noDeprecatedImports: staying on in-tree XMLValidator — see ncbi/response-handler.ts
|
|
25
33
|
import { XMLParser, XMLValidator } from 'fast-xml-parser';
|
|
26
34
|
import { getServerConfig } from '../../config/server-config.js';
|
|
27
|
-
import { recoveryFor } from '../error-contracts.js';
|
|
28
35
|
import { ORDERED_XML_PARSER_OPTIONS } from '../ncbi/parsing/ordered-xml-parser-options.js';
|
|
29
36
|
import { ensureArray } from '../ncbi/parsing/xml-helpers.js';
|
|
30
37
|
import { buildSearchQuery, EuropePmcApiClient } from './api-client.js';
|
|
31
|
-
import {
|
|
38
|
+
import { createEuropePmcRequestQueue } from './request-queue.js';
|
|
39
|
+
/** Ceiling on one backoff sleep, so a high retry count cannot grow it without bound. */
|
|
32
40
|
const MAX_BACKOFF_MS = 30_000;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Retry gate: the framework's transient set, narrowed to `McpError`s. The client
|
|
43
|
+
* classifies every upstream failure, so a plain `Error` reaching the loop is a defect
|
|
44
|
+
* or a response that cannot parse — retrying it only repeats it.
|
|
45
|
+
*/
|
|
46
|
+
const isTransient = (error) => error instanceof McpError && defaultIsTransient(error);
|
|
47
|
+
/**
|
|
48
|
+
* Reshapes an error whose retries ran out: the last attempt's code and message with
|
|
49
|
+
* the attempt count appended, `label`, `attempts`, and the upstream `retryAfter`, so a
|
|
50
|
+
* 429 still tells the caller how long to wait. Only a `ServiceUnavailable` gains
|
|
51
|
+
* `europepmc_unreachable`; a `Timeout` or `RateLimited` keeps its code with no
|
|
52
|
+
* reason, as the OpenAlex service reports them. Anything never retried — a
|
|
53
|
+
* non-transient failure, or a `Retry-After` longer than the backoff cap — passes
|
|
54
|
+
* through unchanged.
|
|
55
|
+
*/
|
|
56
|
+
function toServiceError(error, label) {
|
|
57
|
+
if (!(error instanceof McpError) || typeof error.data?.retryAttempts !== 'number')
|
|
58
|
+
return error;
|
|
59
|
+
const last = error.cause instanceof McpError ? error.cause : error;
|
|
60
|
+
const attempts = error.data.retryAttempts;
|
|
61
|
+
return new McpError(error.code, `${last.message} (failed after ${attempts} attempt${attempts === 1 ? '' : 's'})`, {
|
|
62
|
+
...(error.code === JsonRpcErrorCode.ServiceUnavailable && {
|
|
63
|
+
reason: 'europepmc_unreachable',
|
|
64
|
+
}),
|
|
65
|
+
label,
|
|
66
|
+
attempts,
|
|
67
|
+
...(last.data?.retryAfter !== undefined && { retryAfter: last.data.retryAfter }),
|
|
68
|
+
}, { cause: last });
|
|
49
69
|
}
|
|
50
70
|
/**
|
|
51
71
|
* Europe PMC lookup clause for one record addressed by `source` + EPMC id.
|
|
@@ -69,6 +89,15 @@ function recordLookupQuery({ epmcId, source }) {
|
|
|
69
89
|
const extIdClause = `(EXT_ID:${epmcId} AND SRC:${source})`;
|
|
70
90
|
return source === 'PMC' ? `${extIdClause} OR (PMCID:${epmcId})` : extIdClause;
|
|
71
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The caller's cursor when it asks for a page past the first. `*` and an
|
|
94
|
+
* exactly-empty cursor both read as the first page upstream.
|
|
95
|
+
*/
|
|
96
|
+
function callerCursor({ cursorMark }) {
|
|
97
|
+
return cursorMark && cursorMark !== '*' ? cursorMark : undefined;
|
|
98
|
+
}
|
|
99
|
+
/** Next step for a cursor Europe PMC cannot read, whichever way it signals that. */
|
|
100
|
+
const CURSOR_RECOVERY_HINT = "Pass the previous response's `nextCursorMark` verbatim as `cursorMark`, or `*` to restart from the first page.";
|
|
72
101
|
/** The sort fields Europe PMC documents. */
|
|
73
102
|
const DOCUMENTED_SORT_FIELDS = new Set(['P_PDATE_D', 'CITED', 'AUTH_FIRST', 'PUB_YEAR']);
|
|
74
103
|
/**
|
|
@@ -99,7 +128,8 @@ function sortExplainsEnvelope(sort) {
|
|
|
99
128
|
* - `citations()` / `references()` — EPMC's link graph for a PubMed article.
|
|
100
129
|
*
|
|
101
130
|
* All honor `ctx.signal` for cancellation and retry transient failures with
|
|
102
|
-
* capped exponential backoff plus jitter
|
|
131
|
+
* capped exponential backoff plus jitter, each attempt paced through the shared
|
|
132
|
+
* request queue.
|
|
103
133
|
*/
|
|
104
134
|
export class EuropePmcService {
|
|
105
135
|
client;
|
|
@@ -124,14 +154,60 @@ export class EuropePmcService {
|
|
|
124
154
|
* The retry boundary covers the fetch and the response classification
|
|
125
155
|
* together, so an empty envelope retries like any other transient failure
|
|
126
156
|
* rather than surfacing after the loop has already returned. (#159)
|
|
157
|
+
*
|
|
158
|
+
* The first HTTP 503 on a caller-supplied cursor draws one probe of the same
|
|
159
|
+
* query's first page, and the cursor is retried either way: one 503 is not
|
|
160
|
+
* enough to tell a bad cursor from a transient outage. A later 503 fails the
|
|
161
|
+
* search at once as non-retryable input only when that probe was served;
|
|
162
|
+
* otherwise it goes on through the ordinary retry path. A 503 with no retry
|
|
163
|
+
* left is never probed, since nothing could use the answer. (#180)
|
|
127
164
|
*/
|
|
128
165
|
search(params) {
|
|
129
|
-
|
|
166
|
+
const cursorMark = callerCursor(params);
|
|
167
|
+
let firstPage = 'unknown';
|
|
168
|
+
return this.runPaced('search', params.signal, (attempt) => this.searchOnce(params, attempt === this.maxRetries + 1), cursorMark === undefined
|
|
169
|
+
? undefined
|
|
170
|
+
: async (error, signal, attempt) => {
|
|
171
|
+
if (!(error instanceof McpError) || error.data?.status !== 503)
|
|
172
|
+
return error;
|
|
173
|
+
if (firstPage === 'unknown') {
|
|
174
|
+
if (attempt <= this.maxRetries) {
|
|
175
|
+
firstPage = (await this.firstPageServed(params, signal)) ? 'served' : 'failed';
|
|
176
|
+
}
|
|
177
|
+
return error;
|
|
178
|
+
}
|
|
179
|
+
if (firstPage === 'failed')
|
|
180
|
+
return error;
|
|
181
|
+
return validationError(`Europe PMC answered cursorMark "${cursorMark}" with HTTP 503 twice but served the first page of the same query — the cursor is most likely invalid or expired.`, {
|
|
182
|
+
reason: 'europepmc_invalid_input',
|
|
183
|
+
cursorMark,
|
|
184
|
+
status: 503,
|
|
185
|
+
retryable: false,
|
|
186
|
+
recovery: { hint: CURSOR_RECOVERY_HINT },
|
|
187
|
+
}, { cause: error });
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Whether Europe PMC serves the first page of the search in `params`: one
|
|
192
|
+
* request (`cursorMark: '*'`, `pageSize: 1`), paced like any other, with no
|
|
193
|
+
* retries of its own. Any failure reads as not served — except the caller's
|
|
194
|
+
* cancellation, which propagates.
|
|
195
|
+
*/
|
|
196
|
+
async firstPageServed(params, signal) {
|
|
197
|
+
try {
|
|
198
|
+
await this.queue.run(() => this.searchOnce({ ...params, cursorMark: '*', pageSize: 1, signal }, false), { signal });
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (signal.aborted)
|
|
203
|
+
throw error;
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
130
206
|
}
|
|
131
207
|
/**
|
|
132
208
|
* One search attempt: fetch, parse, and classify the body. `isLastAttempt`
|
|
133
|
-
* lets an empty envelope
|
|
134
|
-
*
|
|
209
|
+
* lets an empty envelope on the last attempt the retry budget allows be
|
|
210
|
+
* attributed to a caller-supplied cursor.
|
|
135
211
|
*/
|
|
136
212
|
async searchOnce(params, isLastAttempt) {
|
|
137
213
|
const text = await this.client.search(params);
|
|
@@ -143,7 +219,6 @@ export class EuropePmcService {
|
|
|
143
219
|
throw serializationError('Failed to parse Europe PMC search JSON response.', {
|
|
144
220
|
reason: 'europepmc_invalid_response',
|
|
145
221
|
responseSnippet: text.substring(0, 200),
|
|
146
|
-
...recoveryFor('europepmc_invalid_response'),
|
|
147
222
|
}, { cause: error });
|
|
148
223
|
}
|
|
149
224
|
/**
|
|
@@ -155,6 +230,7 @@ export class EuropePmcService {
|
|
|
155
230
|
if (errMsg) {
|
|
156
231
|
throw validationError(`Europe PMC rejected the request: ${errMsg}`, {
|
|
157
232
|
reason: 'europepmc_invalid_input',
|
|
233
|
+
retryable: false,
|
|
158
234
|
epmcErrCode: parsed.errCode,
|
|
159
235
|
epmcErrMsg: errMsg,
|
|
160
236
|
recovery: { hint: `Europe PMC reported: "${errMsg}". Fix the input and retry.` },
|
|
@@ -168,25 +244,28 @@ export class EuropePmcService {
|
|
|
168
244
|
*
|
|
169
245
|
* - A sort that EPMC rejects every time (see `sortExplainsEnvelope`) fails
|
|
170
246
|
* fast as non-retryable input — retrying only adds backoff.
|
|
171
|
-
* - A non-default cursor that draws it on
|
|
172
|
-
* invalid or expired; EPMC rejects a malformed
|
|
247
|
+
* - A non-default cursor that draws it on the last attempt the retry budget
|
|
248
|
+
* allows is most likely invalid or expired; EPMC rejects a malformed
|
|
249
|
+
* cursor every time. Earlier attempts may have failed another way.
|
|
173
250
|
* - Otherwise it is intermittent upstream noise — valid requests, with or
|
|
174
251
|
* without a documented sort, draw it on a fraction of calls and succeed
|
|
175
252
|
* when repeated — so it is thrown as a transient `europepmc_unreachable`
|
|
176
253
|
* for the retry loop, and never names the caller's input. (#159)
|
|
177
254
|
*
|
|
178
255
|
* Each throw keeps the diagnosis (message) apart from the next step
|
|
179
|
-
* (recovery hint): the framework
|
|
180
|
-
* `content[]
|
|
181
|
-
*
|
|
256
|
+
* (recovery hint): the framework renders `data.recovery.hint` in
|
|
257
|
+
* `content[]` as a `Recovery:` line only when the message does not already
|
|
258
|
+
* contain it, so one string passed as both would leave the caller the
|
|
259
|
+
* diagnosis and no separate next step. (#75)
|
|
182
260
|
*/
|
|
183
261
|
if (parsed.hitCount === undefined &&
|
|
184
262
|
parsed.request === undefined &&
|
|
185
263
|
parsed.resultList === undefined) {
|
|
186
|
-
const cursorMark = params
|
|
264
|
+
const cursorMark = callerCursor(params);
|
|
187
265
|
if (params.sort && sortExplainsEnvelope(params.sort)) {
|
|
188
266
|
throw validationError(`Europe PMC silently rejected the request — most likely the sort "${params.sort}", which needs a documented field and an asc/desc direction.`, {
|
|
189
267
|
reason: 'europepmc_invalid_input',
|
|
268
|
+
retryable: false,
|
|
190
269
|
sort: params.sort,
|
|
191
270
|
...(cursorMark && { cursorMark }),
|
|
192
271
|
responseSnippet: text.substring(0, 200),
|
|
@@ -196,16 +275,15 @@ export class EuropePmcService {
|
|
|
196
275
|
});
|
|
197
276
|
}
|
|
198
277
|
if (cursorMark && isLastAttempt) {
|
|
199
|
-
throw validationError(`Europe PMC answered
|
|
278
|
+
throw validationError(`Europe PMC answered the last attempt for cursorMark "${cursorMark}" with an empty response — the cursor is most likely invalid or expired.`, {
|
|
200
279
|
reason: 'europepmc_invalid_input',
|
|
280
|
+
retryable: false,
|
|
201
281
|
cursorMark,
|
|
202
282
|
responseSnippet: text.substring(0, 200),
|
|
203
|
-
recovery: {
|
|
204
|
-
hint: 'Restart from the first page with `cursorMark: "*"`, or pass the exact `nextCursorMark` from the previous response.',
|
|
205
|
-
},
|
|
283
|
+
recovery: { hint: CURSOR_RECOVERY_HINT },
|
|
206
284
|
});
|
|
207
285
|
}
|
|
208
|
-
throw serviceUnavailable('Europe PMC returned an empty response with no hit count or result list.', { reason: 'europepmc_unreachable'
|
|
286
|
+
throw serviceUnavailable('Europe PMC returned an empty response with no hit count or result list.', { reason: 'europepmc_unreachable' });
|
|
209
287
|
}
|
|
210
288
|
const hits = ensureArray(parsed.resultList?.result);
|
|
211
289
|
// Without an echo, report the query actually sent — source filter included —
|
|
@@ -256,7 +334,7 @@ export class EuropePmcService {
|
|
|
256
334
|
* publishes no fullTextXML (404 or empty body).
|
|
257
335
|
*/
|
|
258
336
|
async fullTextXml(epmcId, source, signal) {
|
|
259
|
-
const outcome = await this.
|
|
337
|
+
const outcome = await this.runPaced(`fullTextXml(${epmcId})`, signal, () => this.client.fullTextXml(epmcId, signal));
|
|
260
338
|
if (outcome.kind === 'not-available') {
|
|
261
339
|
return { kind: 'not-available', reason: outcome.reason };
|
|
262
340
|
}
|
|
@@ -297,7 +375,7 @@ export class EuropePmcService {
|
|
|
297
375
|
* upstream row count and the PubMed-addressable set they actually get back.
|
|
298
376
|
*/
|
|
299
377
|
async fetchRelatedLinks(fetch, kind, pmid, extractRecords, signal) {
|
|
300
|
-
const text = await this.
|
|
378
|
+
const text = await this.runPaced(`${kind}(${pmid})`, signal, fetch);
|
|
301
379
|
let parsed;
|
|
302
380
|
try {
|
|
303
381
|
parsed = JSON.parse(text);
|
|
@@ -306,7 +384,6 @@ export class EuropePmcService {
|
|
|
306
384
|
throw serializationError(`Failed to parse Europe PMC ${kind} JSON response.`, {
|
|
307
385
|
reason: 'europepmc_invalid_response',
|
|
308
386
|
responseSnippet: text.substring(0, 200),
|
|
309
|
-
...recoveryFor('europepmc_invalid_response'),
|
|
310
387
|
}, { cause: error });
|
|
311
388
|
}
|
|
312
389
|
/**
|
|
@@ -319,6 +396,7 @@ export class EuropePmcService {
|
|
|
319
396
|
if (errMsg) {
|
|
320
397
|
throw validationError(`Europe PMC rejected the ${kind} request: ${errMsg}`, {
|
|
321
398
|
reason: 'europepmc_invalid_input',
|
|
399
|
+
retryable: false,
|
|
322
400
|
epmcErrCode: parsed.errCode,
|
|
323
401
|
epmcErrMsg: errMsg,
|
|
324
402
|
recovery: { hint: `Europe PMC reported: "${errMsg}". Fix the input and retry.` },
|
|
@@ -363,7 +441,6 @@ export class EuropePmcService {
|
|
|
363
441
|
throw serializationError('Received invalid XML from Europe PMC.', {
|
|
364
442
|
reason: 'europepmc_invalid_response',
|
|
365
443
|
responseSnippet: xml.substring(0, 200),
|
|
366
|
-
...recoveryFor('europepmc_invalid_response'),
|
|
367
444
|
});
|
|
368
445
|
}
|
|
369
446
|
let parsed;
|
|
@@ -376,7 +453,6 @@ export class EuropePmcService {
|
|
|
376
453
|
reason: 'europepmc_invalid_response',
|
|
377
454
|
parserError,
|
|
378
455
|
responseSnippet: xml.substring(0, 200),
|
|
379
|
-
...recoveryFor('europepmc_invalid_response'),
|
|
380
456
|
}, { cause: error });
|
|
381
457
|
}
|
|
382
458
|
if (!Array.isArray(parsed))
|
|
@@ -385,53 +461,57 @@ export class EuropePmcService {
|
|
|
385
461
|
return nodes.find((n) => 'article' in n);
|
|
386
462
|
}
|
|
387
463
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* the
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
464
|
+
* Runs one Europe PMC call: a retry loop around the shared request queue, so
|
|
465
|
+
* every attempt re-queues and is re-paced, and a backoff sleep holds no queue
|
|
466
|
+
* slot. No service-level deadline — Europe PMC requests are cheap individually
|
|
467
|
+
* and the caller's signal (typically `ctx.signal`) bounds the total chain; that
|
|
468
|
+
* signal reaches the queue wait and the backoff sleep. `execute` receives the
|
|
469
|
+
* one-based attempt number.
|
|
470
|
+
*
|
|
471
|
+
* `reclassify`, when given, sees each failed attempt after its queue slot is
|
|
472
|
+
* released and before the retry decision, with the attempt's signal and its
|
|
473
|
+
* one-based number. The error it returns is the one the loop judges, so it
|
|
474
|
+
* can end the retries by returning a non-transient error.
|
|
475
|
+
*
|
|
476
|
+
* A caller abort rethrows the caller's own reason; an exhausted failure is
|
|
477
|
+
* reshaped by {@link toServiceError}, after the loop.
|
|
396
478
|
*/
|
|
397
|
-
async
|
|
398
|
-
|
|
479
|
+
async runPaced(label, signal, execute, reclassify) {
|
|
480
|
+
let attempt = 0;
|
|
481
|
+
try {
|
|
482
|
+
return await withRetry(({ signal: attemptSignal }) => {
|
|
483
|
+
const current = ++attempt;
|
|
484
|
+
return this.queue
|
|
485
|
+
.run(() => execute(current), { signal: attemptSignal })
|
|
486
|
+
.catch(async (failure) => {
|
|
487
|
+
const error = reclassify
|
|
488
|
+
? await reclassify(failure, attemptSignal, current)
|
|
489
|
+
: failure;
|
|
490
|
+
if (current <= this.maxRetries && isTransient(error)) {
|
|
491
|
+
logger.warning(`Europe PMC ${label} failed on attempt ${current} of ${this.maxRetries + 1}.`, requestContextService.createRequestContext({
|
|
492
|
+
operation: 'EuropePmcRetry',
|
|
493
|
+
additionalContext: {
|
|
494
|
+
label,
|
|
495
|
+
attempt: current,
|
|
496
|
+
error: error instanceof Error ? error.message : String(error),
|
|
497
|
+
},
|
|
498
|
+
}));
|
|
499
|
+
}
|
|
500
|
+
throw error;
|
|
501
|
+
});
|
|
502
|
+
}, {
|
|
503
|
+
maxRetries: this.maxRetries,
|
|
504
|
+
maxDelayMs: MAX_BACKOFF_MS,
|
|
505
|
+
isTransient,
|
|
506
|
+
operation: `Europe PMC ${label}`,
|
|
507
|
+
...(signal && { signal }),
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
399
511
|
if (signal?.aborted)
|
|
400
512
|
throw signal.reason;
|
|
401
|
-
|
|
402
|
-
return await execute(attempt);
|
|
403
|
-
}
|
|
404
|
-
catch (error) {
|
|
405
|
-
if (signal?.aborted)
|
|
406
|
-
throw signal.reason;
|
|
407
|
-
if (!(error instanceof McpError))
|
|
408
|
-
throw error;
|
|
409
|
-
if (!defaultIsTransient(error))
|
|
410
|
-
throw error;
|
|
411
|
-
if (attempt < this.maxRetries) {
|
|
412
|
-
const baseDelay = Math.min(1000 * 2 ** attempt, MAX_BACKOFF_MS);
|
|
413
|
-
const jitter = baseDelay * (0.75 + 0.5 * Math.random());
|
|
414
|
-
const retryDelay = Math.round(jitter);
|
|
415
|
-
logger.warning(`Europe PMC ${label} failed. Retrying (${attempt + 1}/${this.maxRetries}) in ${retryDelay}ms.`, requestContextService.createRequestContext({
|
|
416
|
-
operation: 'EuropePmcRetry',
|
|
417
|
-
additionalContext: { label, attempt: attempt + 1, retryDelay },
|
|
418
|
-
}));
|
|
419
|
-
await abortableSleep(retryDelay, signal);
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
const attempts = this.maxRetries + 1;
|
|
423
|
-
throw new McpError(error.code, `${error.message} (failed after ${attempts} attempts)`, {
|
|
424
|
-
...(error.code === JsonRpcErrorCode.ServiceUnavailable && {
|
|
425
|
-
reason: 'europepmc_unreachable',
|
|
426
|
-
...recoveryFor('europepmc_unreachable'),
|
|
427
|
-
}),
|
|
428
|
-
label,
|
|
429
|
-
attempts,
|
|
430
|
-
...(error.data?.retryAfter !== undefined && { retryAfter: error.data.retryAfter }),
|
|
431
|
-
}, { cause: error });
|
|
432
|
-
}
|
|
513
|
+
throw toServiceError(error, label);
|
|
433
514
|
}
|
|
434
|
-
throw internalError('Europe PMC request failed after all retries.', { label });
|
|
435
515
|
}
|
|
436
516
|
}
|
|
437
517
|
// ─── Init / Accessor ────────────────────────────────────────────────────────
|
|
@@ -451,7 +531,7 @@ export function initEuropePmcService() {
|
|
|
451
531
|
timeoutMs: config.europepmcTimeoutMs,
|
|
452
532
|
...(config.europepmcEmail && { email: config.europepmcEmail }),
|
|
453
533
|
});
|
|
454
|
-
const queue =
|
|
534
|
+
const queue = createEuropePmcRequestQueue(config.europepmcRequestDelayMs);
|
|
455
535
|
_service = new EuropePmcService(client, queue, config.europepmcMaxRetries);
|
|
456
536
|
logger.info('Europe PMC service initialized.', requestContextService.createRequestContext({
|
|
457
537
|
operation: 'EuropePmcInit',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"europe-pmc-service.js","sourceRoot":"","sources":["../../../src/services/europe-pmc/europe-pmc-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACjG,mHAAmH;AACnH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAc3D,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,SAAS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AAC,kBAAkB;QACpC,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC;KAC/D,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACxE,QAAQ,GAAG,IAAI,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3E,MAAM,CAAC,IAAI,CACT,iCAAiC,EACjC,qBAAqB,CAAC,oBAAoB,CAAC;QACzC,SAAS,EAAE,eAAe;QAC1B,iBAAiB,EAAE;YACjB,cAAc,EAAE,MAAM,CAAC,uBAAuB;YAC9C,UAAU,EAAE,MAAM,CAAC,mBAAmB;YACtC,SAAS,EAAE,MAAM,CAAC,kBAAkB;YACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc;SAClC;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB;IACjC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"europe-pmc-service.js","sourceRoot":"","sources":["../../../src/services/europe-pmc/europe-pmc-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,MAAM,EAEN,qBAAqB,EACrB,SAAS,GACV,MAAM,8BAA8B,CAAC;AACtC,mHAAmH;AACnH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAA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AAC,kBAAkB;QACpC,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC;KAC/D,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,2BAA2B,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAC1E,QAAQ,GAAG,IAAI,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3E,MAAM,CAAC,IAAI,CACT,iCAAiC,EACjC,qBAAqB,CAAC,oBAAoB,CAAC;QACzC,SAAS,EAAE,eAAe;QAC1B,iBAAiB,EAAE;YACjB,cAAc,EAAE,MAAM,CAAC,uBAAuB;YAC9C,UAAU,EAAE,MAAM,CAAC,mBAAmB;YACtC,SAAS,EAAE,MAAM,CAAC,kBAAkB;YACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc;SAClC;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB;IACjC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,33 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview
|
|
3
|
-
* concurrent in-flight requests and
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* @fileoverview Request queue for Europe PMC calls, built on the framework pacer.
|
|
3
|
+
* Caps concurrent in-flight requests and spaces request starts to stay polite with
|
|
4
|
+
* EBI's infrastructure, and releases a waiting caller the moment its signal aborts.
|
|
5
|
+
* Each retry attempt re-enters the queue, so a backoff sleep holds no slot and every
|
|
6
|
+
* attempt waits out the start gap. Independent rate domain from NCBI's queue —
|
|
7
|
+
* Europe PMC runs on a different host with its own limits.
|
|
7
8
|
* @module src/services/europe-pmc/request-queue
|
|
8
9
|
*/
|
|
10
|
+
import { type Pacer } from '@cyanheads/mcp-ts-core/utils';
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* dispatch times. Defaults to 200ms to be polite with EBI.
|
|
14
|
-
* - **Concurrency** (`maxConcurrent`): maximum simultaneous in-flight
|
|
15
|
-
* requests. Decouples concurrency from rate so slow upstream responses
|
|
16
|
-
* don't block new dispatches.
|
|
17
|
-
*
|
|
18
|
-
* Enqueue accepts an optional `AbortSignal` so callers can bound their total
|
|
19
|
-
* time inside the scheduler — when the signal fires, a still-waiting task
|
|
20
|
-
* rejects immediately instead of sitting behind a saturated worker.
|
|
12
|
+
* Creates the pacer every Europe PMC call runs through. No queue-depth cap and no
|
|
13
|
+
* wait budget: a caller waits for its turn rather than being shed, so the pacer never
|
|
14
|
+
* rejects on its own — only the caller's signal ends a wait early.
|
|
21
15
|
*/
|
|
22
|
-
export declare
|
|
23
|
-
private readonly waiters;
|
|
24
|
-
private readonly minStartGapMs;
|
|
25
|
-
private readonly maxConcurrent;
|
|
26
|
-
private inFlight;
|
|
27
|
-
private lastStartTime;
|
|
28
|
-
private nextDispatchTimer;
|
|
29
|
-
constructor(minStartGapMs: number, maxConcurrent?: number);
|
|
30
|
-
enqueue<T>(task: () => Promise<T>, label: string, signal?: AbortSignal): Promise<T>;
|
|
31
|
-
private tryDispatch;
|
|
32
|
-
}
|
|
16
|
+
export declare function createEuropePmcRequestQueue(minStartGapMs: number): Pacer;
|
|
33
17
|
//# sourceMappingURL=request-queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-queue.d.ts","sourceRoot":"","sources":["../../../src/services/europe-pmc/request-queue.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"request-queue.d.ts","sourceRoot":"","sources":["../../../src/services/europe-pmc/request-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAQvE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,KAAK,CAExE"}
|