@cyanheads/biorxiv-mcp-server 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/AGENTS.md +5 -4
  2. package/CLAUDE.md +5 -4
  3. package/Dockerfile +3 -3
  4. package/README.md +10 -7
  5. package/changelog/0.4.x/0.4.2.md +34 -0
  6. package/changelog/0.4.x/0.4.3.md +27 -0
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts +2 -2
  10. package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts.map +1 -1
  11. package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js +9 -6
  12. package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js.map +1 -1
  13. package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts +4 -1
  14. package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts.map +1 -1
  15. package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js +9 -5
  16. package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js.map +1 -1
  17. package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts +19 -8
  18. package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts.map +1 -1
  19. package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js +51 -18
  20. package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js.map +1 -1
  21. package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.d.ts +13 -0
  22. package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.d.ts.map +1 -1
  23. package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.js +70 -12
  24. package/dist/mcp-server/tools/definitions/biorxiv-list-published-versions.tool.js.map +1 -1
  25. package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts +5 -2
  26. package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js +22 -17
  28. package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js.map +1 -1
  29. package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts +10 -5
  30. package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts.map +1 -1
  31. package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js +23 -17
  32. package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js.map +1 -1
  33. package/dist/mcp-server/tools/definitions/index.d.ts +27 -12
  34. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  35. package/dist/services/biorxiv/biorxiv-service.d.ts +31 -21
  36. package/dist/services/biorxiv/biorxiv-service.d.ts.map +1 -1
  37. package/dist/services/biorxiv/biorxiv-service.js +90 -39
  38. package/dist/services/biorxiv/biorxiv-service.js.map +1 -1
  39. package/dist/services/biorxiv/types.d.ts +29 -3
  40. package/dist/services/biorxiv/types.d.ts.map +1 -1
  41. package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts +5 -3
  42. package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts.map +1 -1
  43. package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js +311 -14
  44. package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js.map +1 -1
  45. package/dist/services/europe-pmc/europe-pmc-service.d.ts +21 -5
  46. package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
  47. package/dist/services/europe-pmc/europe-pmc-service.js +111 -25
  48. package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
  49. package/dist/services/shared.d.ts +52 -16
  50. package/dist/services/shared.d.ts.map +1 -1
  51. package/dist/services/shared.js +121 -22
  52. package/dist/services/shared.js.map +1 -1
  53. package/dist/services/upstream-text-tables.d.ts +11 -1
  54. package/dist/services/upstream-text-tables.d.ts.map +1 -1
  55. package/dist/services/upstream-text-tables.js +42 -1
  56. package/dist/services/upstream-text-tables.js.map +1 -1
  57. package/package.json +9 -9
  58. package/server.json +3 -3
@@ -3,8 +3,10 @@
3
3
  * HTML page from the bioRxiv/medRxiv website (`www.{server}.org/content/{doi}v{N}.full`)
4
4
  * and extracts readable Markdown via the framework HTML extractor. The page is
5
5
  * reshaped first (`prepareArticlePage`) so the extractor keeps inline citation
6
- * labels and reference text, and the tables the page carries no cells for are
7
- * returned by name with the URL that serves them.
6
+ * labels, reference text, and every article block, renders each figure and
7
+ * reference number once, sets each display formula in a block of its own, and
8
+ * the tables the page carries no cells for are returned by name with the URL
9
+ * that serves them.
8
10
  *
9
11
  * This is a DISTINCT fetch path from BiorxivApiService: it EXPECTS an HTML
10
12
  * document (the rendered article page), so it never routes through the JSON
@@ -14,7 +16,7 @@
14
16
  * the extractor.
15
17
  *
16
18
  * Extracted articles are cached in `ctx.state` under
17
- * `fulltext/v3/{server}/{doi}/{version}` for {@link FULLTEXT_CACHE_TTL_SECONDS}
19
+ * `fulltext/v5/{server}/{doi}/{version}` for {@link FULLTEXT_CACHE_TTL_SECONDS}
18
20
  * seconds, so paging a long article with offset/limit costs one origin fetch and
19
21
  * one extraction instead of one per chunk. `ctx.state` is tenant-scoped, which is
20
22
  * the intended blast radius — no cross-tenant or process-wide sharing. Only
@@ -61,15 +63,135 @@ const EXPECTED_STATUSES = [...DETERMINISTIC_UNAVAILABLE_STATUSES, 429];
61
63
  */
62
64
  const FULLTEXT_CACHE_TTL_SECONDS = 3_600;
63
65
  /**
64
- * Cache key: `fulltext/v3/{server}/{doi}/{version}`. Slash-delimited because the
66
+ * Cache key: `fulltext/v5/{server}/{doi}/{version}`. Slash-delimited because the
65
67
  * storage layer validates keys against `[a-zA-Z0-9_.\-/]` — a colon separator is
66
68
  * rejected outright, and a DOI's own `/` and `.` are already inside the allowed
67
- * set. The `v3` segment is the cached-value schema generation — bump it when
68
- * {@link CachedArticle} changes so entries written by an older build are never
69
- * read back under the new shape. (`v2` dropped the extractor's `wordCount`; `v3`
70
- * added `omittedTables` and keeps citation labels and reference text.)
69
+ * set. The `v5` segment is the cached-value generation — bump it when
70
+ * {@link CachedArticle} or the Markdown it holds changes shape, so entries
71
+ * written by an older build are never read back. (`v2` dropped the extractor's
72
+ * `wordCount`; `v3` added `omittedTables` and keeps citation labels and
73
+ * reference text; `v4` renders each figure once, numbers each reference once,
74
+ * and sets each display formula in a block of its own; `v5` keeps a short
75
+ * section whose heading holds a navigation word, sets a list nested in a
76
+ * reference entry inline, and drops a duplicate one whose names the entry
77
+ * already gives.)
71
78
  */
72
- const cacheKeyFor = (server, doi, version) => `fulltext/v3/${server}/${doi}/${version}`;
79
+ const cacheKeyFor = (server, doi, version) => `fulltext/v5/${server}/${doi}/${version}`;
80
+ /**
81
+ * The block elements Defuddle's low-score removal scores (`BLOCK_ELEMENTS` in
82
+ * its constants, which the package does not export).
83
+ */
84
+ const SCORED_BLOCK_SELECTOR = 'div, section, article, main, aside, header, footer, nav, content';
85
+ /**
86
+ * A reference label that is one integer: `12.`, `(12).`, or `[12].`. Anchored at
87
+ * both ends, so a label carrying anything else (`12a.`, `1–2.`) is not a number.
88
+ */
89
+ const NUMERIC_REF_LABEL = /^[([]?(\d+)[)\]]?\.?$/;
90
+ /**
91
+ * The elements under `root` matching `selector` that no other match contains.
92
+ * Every pass of {@link prepareArticlePage} that queries a match's own subtree
93
+ * runs over these: a match nested inside another is reached through that one's
94
+ * subtree and handled as part of it. Outermost matches have disjoint subtrees,
95
+ * so each pass stays linear in the page's size.
96
+ */
97
+ function outermost(root, selector) {
98
+ const nested = new Set();
99
+ return [...root.querySelectorAll(selector)].filter((el) => {
100
+ if (nested.has(el))
101
+ return false;
102
+ for (const inner of el.querySelectorAll(selector))
103
+ nested.add(inner);
104
+ return true;
105
+ });
106
+ }
107
+ /**
108
+ * The URL an image shows. The page lazy-loads: `src` holds a `data:`
109
+ * placeholder and `data-src` the image, so `data-src` wins, and a `src` that is
110
+ * a `data:` URL counts as no source.
111
+ */
112
+ function imageSource(image) {
113
+ const src = image?.getAttribute('data-src') ?? image?.getAttribute('src');
114
+ return src && !src.startsWith('data:') ? src : undefined;
115
+ }
116
+ /** `text` with each run of whitespace collapsed to one space, trimmed. */
117
+ const collapseSpace = (text) => (text ?? '').replace(/\s+/g, ' ').trim();
118
+ /**
119
+ * `name` without the separators that run on to the next name of a list:
120
+ * `A. Rich, and` → `A. Rich`. Expects collapsed whitespace.
121
+ */
122
+ function withoutTrailingSeparators(name) {
123
+ let end = name.length;
124
+ while (end > 0) {
125
+ if (' ,;&'.includes(name.charAt(end - 1)))
126
+ end--;
127
+ else if (name.endsWith(' and', end))
128
+ end -= 4;
129
+ else
130
+ break;
131
+ }
132
+ return name.slice(0, end);
133
+ }
134
+ /**
135
+ * The text of `root` with the subtrees of `excluded` (elements under it) left
136
+ * out, whitespace collapsed. Each excluded element stands aside for an empty
137
+ * comment while the text is read, then returns to its place.
138
+ */
139
+ function textOutside(root, excluded) {
140
+ const swaps = excluded.map((el) => {
141
+ const holder = root.ownerDocument.createComment('');
142
+ el.replaceWith(holder);
143
+ return [el, holder];
144
+ });
145
+ const text = collapseSpace(root.textContent);
146
+ for (const [el, holder] of swaps)
147
+ holder.replaceWith(el);
148
+ return text;
149
+ }
150
+ /** A letter or digit: a name that has one beside it is part of a longer word. */
151
+ const WORD_CHAR = /[\p{L}\p{N}]/u;
152
+ /**
153
+ * The first place at or after `from` where `text` holds `name` as whole words:
154
+ * a match that a letter or digit runs on from, before or after, is part of a
155
+ * longer name (`N. David` in `N. Davidson`) and is skipped. -1 when there is none.
156
+ */
157
+ function indexOfWhole(text, name, from) {
158
+ const startsWord = WORD_CHAR.test(name.charAt(0));
159
+ const endsWord = WORD_CHAR.test(name.charAt(name.length - 1));
160
+ let at = text.indexOf(name, from);
161
+ while (at >= 0 &&
162
+ ((startsWord && WORD_CHAR.test(text.charAt(at - 1))) ||
163
+ (endsWord && WORD_CHAR.test(text.charAt(at + name.length))))) {
164
+ at = text.indexOf(name, at + 1);
165
+ }
166
+ return at;
167
+ }
168
+ /**
169
+ * Whether `text` names every item of `list`, in list order, and the list holds
170
+ * nothing but its items. An item's name is its text with whitespace collapsed
171
+ * and trailing separators trimmed, found as whole words. Each search starts
172
+ * where the last match ended, so the check stays linear in the size of `text`
173
+ * however many items the list holds.
174
+ */
175
+ function namesEveryItem(list, text) {
176
+ let from = 0;
177
+ for (const node of list.childNodes) {
178
+ if (node.nodeType === node.TEXT_NODE) {
179
+ if (collapseSpace(node.textContent))
180
+ return false;
181
+ continue;
182
+ }
183
+ if (node.nodeType !== node.ELEMENT_NODE)
184
+ continue;
185
+ if (node.localName !== 'li')
186
+ return false;
187
+ const name = withoutTrailingSeparators(collapseSpace(node.textContent));
188
+ const at = indexOfWhole(text, name, from);
189
+ if (at < 0)
190
+ return false;
191
+ from = at + name.length;
192
+ }
193
+ return true;
194
+ }
73
195
  /**
74
196
  * Rewrites the article container so the extractor keeps what its cleanup rules
75
197
  * strip from Highwire pages, and lists the tables the page carries no cells for.
@@ -82,6 +204,52 @@ const cacheKeyFor = (server, doi, version) => `fulltext/v3/${server}/${doi}/${ve
82
204
  * reshaped here instead:
83
205
  *
84
206
  * - each cross-reference anchor becomes its own label text;
207
+ * - each inline formula (`span.inline-formula`) becomes a bare `<img>` with an
208
+ * empty alt where the span stood, inside its sentence (the image source is
209
+ * read as for figures, and a formula with none is left as the page has it).
210
+ * The page gives the formula image the alt `Embedded Image`, which Defuddle
211
+ * reads as a caption: it lifts the image out of the sentence into a captioned
212
+ * figure, so the alt becomes a paragraph of its own and the sentence's tail
213
+ * starts a new one;
214
+ * - each display formula (`span.disp-formula`) becomes a bare `<img>` with an
215
+ * empty alt in a paragraph of its own, and a paragraph that held formulas is
216
+ * split around them, dropping the runs that hold only whitespace (the image
217
+ * source is read as for figures, and a formula with none is left as the page
218
+ * has it). The page sets the formula image inside the paragraph with the alt
219
+ * `Embedded Image`, which Defuddle reads as a caption: it makes the image a
220
+ * captioned figure, whose start tag closes the open paragraph, so the text
221
+ * after the formula loses its block and the next formula in the paragraph is
222
+ * glued onto it. The page prints no formula label for an alt, and Defuddle
223
+ * collapses adjacent images that share a non-empty alt, so consecutive
224
+ * equations keep an empty one;
225
+ * - each figure (`div.fig`) loses its "Download figure" / "Open in new tab"
226
+ * links, and each of its images becomes a bare `<img>` in its own paragraph,
227
+ * alt-texted with the figure's printed label (`Figure 2`, `Fig. S16 (1 of 2)`
228
+ * when the figure holds several). The source is the lazy-loaded `data-src`, or
229
+ * a `src` that is not a `data:` placeholder; an image with neither is left to
230
+ * the extractor as the page has it. The page's image link carries the caption
231
+ * in its `title`, and the image the caption again in its `alt`: Defuddle
232
+ * emits the alt as the image text, then again as a paragraph, and its
233
+ * empty-link cleanup leaves the title's text after its first `)` spliced onto
234
+ * the preceding block, or glues the image onto that block when the title has
235
+ * none. The `div.fig-caption` below stays the figure's one caption. Distinct
236
+ * alts keep Defuddle from collapsing a figure's images into one, and the
237
+ * paragraph keeps the image off the `Figure N.` line;
238
+ * - each list nested in a reference entry (an edited volume's editors as an
239
+ * `<ol>`), and every list within it, gives way to its items' content, inline
240
+ * where the list stood and in page order, with a space before each list and
241
+ * after each item. Defuddle renders a nested list as numbered items inside
242
+ * the entry, or, within 500 characters of either end of the article text,
243
+ * deletes it as a blog metadata list. A nested list marked `duplicate`
244
+ * (Highwire's copy of editors the citation already names) is dropped instead
245
+ * when it holds nothing but list items and the rest of the entry, read
246
+ * without its nested lists, names every item as whole words, in list
247
+ * order — the item's text with whitespace collapsed and its trailing
248
+ * separators (`, and`) trimmed;
249
+ * - in a reference list (`ol.cit-list`) whose printed labels are consecutive
250
+ * integers, the labels give way to the list's own numbering, starting at the
251
+ * first label (a Methods list can start at 53); any other list keeps its
252
+ * labels and is rendered unordered, so no entry carries two numbers;
85
253
  * - in the reference list, the `↵` backlinks go, every `.cit-extra` link-out but
86
254
  * the DOI one goes (the OpenURL ones are an unexpanded `{openurl}` template,
87
255
  * the PubMed ones often a truncated `access_num`), the DOI one becomes a
@@ -92,8 +260,24 @@ const cacheKeyFor = (server, doi, version) => `fulltext/v3/${server}/${doi}/${ve
92
260
  * origin's expansion page, where the cells live: the caption stays in place,
93
261
  * and the table is returned with that page's URL, under its printed label, or
94
262
  * its `id` when it prints none. The cells are never fetched: each would cost
95
- * a request to an origin that rate-limits after a handful.
263
+ * a request to an origin that rate-limits after a handful;
264
+ * - every block element left in the container that Defuddle's low-score removal
265
+ * scores ({@link SCORED_BLOCK_SELECTOR}, outside a table or a `pre`) gets
266
+ * `role="article"`, which that removal reads as content before any other
267
+ * test. Without it, a block under 200 words with a heading holding one of its
268
+ * navigation words (`related`, `responses`, `share`, `terms`, … as a
269
+ * substring) stops counting as content, and goes when its whole-word
270
+ * indicators outweigh its commas: a section headed `Effect of suppressing the
271
+ * vaccination-related input` was dropped whole. Defuddle also reads the role
272
+ * when choosing the content root, which never runs here (the content selector
273
+ * matches this container), and when flattening wrappers, which keeps a
274
+ * marked block as a block. Blocks inside a table or a `pre` stay unmarked:
275
+ * the scorer skips table cells and `pre`, and a marked block anywhere in a
276
+ * table, its caption included, would reach a table the extractor writes as
277
+ * HTML as a `<div>` instead of a `<p>`. The role never reaches the Markdown.
96
278
  *
279
+ * Each pass that queries a match's subtree runs over the outermost matches only
280
+ * ({@link outermost}), so the reshaping runs in linear time.
97
281
  * A page without the container is returned unchanged. An `href` that does not
98
282
  * parse as a URL counts as no link: the page is upstream markup, and one bad
99
283
  * link must not cost the caller the whole article.
@@ -103,13 +287,117 @@ function prepareArticlePage(html, sourceUrl) {
103
287
  const view = document.querySelector(FULLTEXT_CONTENT_SELECTOR);
104
288
  if (!view)
105
289
  return { html, omittedTables: [] };
106
- for (const anchor of view.querySelectorAll('a[class^="xref-"]')) {
290
+ for (const anchor of outermost(view, 'a[class^="xref-"]')) {
107
291
  anchor.replaceWith(document.createTextNode(anchor.textContent ?? ''));
108
292
  }
109
- for (const refList of view.querySelectorAll('div.ref-list')) {
293
+ for (const formula of outermost(view, 'span.inline-formula')) {
294
+ const src = imageSource(formula.querySelector('img'));
295
+ if (!src)
296
+ continue;
297
+ const image = document.createElement('img');
298
+ image.setAttribute('src', src);
299
+ image.setAttribute('alt', '');
300
+ formula.replaceWith(image);
301
+ }
302
+ const formulaBlocks = new Set();
303
+ const heldFormulas = new Set();
304
+ for (const formula of outermost(view, 'span.disp-formula')) {
305
+ const src = imageSource(formula.querySelector('img'));
306
+ if (!src)
307
+ continue;
308
+ const image = document.createElement('img');
309
+ image.setAttribute('src', src);
310
+ image.setAttribute('alt', '');
311
+ const block = document.createElement('p');
312
+ block.append(image);
313
+ formulaBlocks.add(block);
314
+ const parent = formula.parentElement;
315
+ if (parent?.localName === 'p')
316
+ heldFormulas.add(parent);
317
+ formula.replaceWith(block);
318
+ }
319
+ // One pass over each paragraph's children, so a paragraph of many formulas
320
+ // is split in time linear in its length.
321
+ for (const paragraph of heldFormulas) {
322
+ const parts = [];
323
+ let run = document.createElement('p');
324
+ // A run holding only the whitespace around a formula is dropped, not left an empty paragraph.
325
+ const endRun = () => {
326
+ if (run.children.length > 0 || run.textContent?.trim())
327
+ parts.push(run);
328
+ run = document.createElement('p');
329
+ };
330
+ for (const node of [...paragraph.childNodes]) {
331
+ if (formulaBlocks.has(node)) {
332
+ endRun();
333
+ parts.push(node);
334
+ }
335
+ else {
336
+ run.append(node);
337
+ }
338
+ }
339
+ endRun();
340
+ paragraph.replaceWith(...parts);
341
+ }
342
+ for (const figure of outermost(view, 'div.fig')) {
343
+ for (const links of figure.querySelectorAll('ul.highwire-figure-links'))
344
+ links.remove();
345
+ const label = figure.querySelector('.fig-label')?.textContent?.trim().replace(/[.:]$/, '') ?? '';
346
+ const holders = outermost(figure, '.fig-inline-img');
347
+ for (const [index, holder] of holders.entries()) {
348
+ const src = imageSource(holder.querySelector('img'));
349
+ if (!src)
350
+ continue;
351
+ const image = document.createElement('img');
352
+ image.setAttribute('src', src);
353
+ image.setAttribute('alt', holders.length > 1 ? `${label} (${index + 1} of ${holders.length})`.trim() : label);
354
+ const block = document.createElement('p');
355
+ block.append(image);
356
+ holder.replaceChildren(block);
357
+ }
358
+ }
359
+ for (const refList of outermost(view, 'div.ref-list')) {
360
+ for (const list of outermost(refList, 'ol.cit-list')) {
361
+ for (const entry of list.children) {
362
+ const nestedLists = outermost(entry, 'ol, ul');
363
+ const isDuplicate = (nested) => nested.classList.contains('duplicate');
364
+ // Read without any nested list, so a name only another nested list
365
+ // repeats does not count: dropping the list must lose no text.
366
+ const rest = nestedLists.some(isDuplicate) ? textOutside(entry, nestedLists) : '';
367
+ for (const nested of nestedLists) {
368
+ if (isDuplicate(nested) && namesEveryItem(nested, rest)) {
369
+ nested.remove();
370
+ continue;
371
+ }
372
+ // Document order: each element is unwrapped once, moving only its own children.
373
+ for (const el of [nested, ...nested.querySelectorAll('ol, ul, li')]) {
374
+ if (el.localName === 'li')
375
+ el.append(' ');
376
+ else
377
+ el.before(' ');
378
+ el.replaceWith(...el.childNodes);
379
+ }
380
+ }
381
+ }
382
+ }
383
+ for (const list of refList.querySelectorAll('ol.cit-list')) {
384
+ const labels = [...list.children].map((item) => [...item.children].find((child) => child.matches('span.ref-label')));
385
+ const numbers = labels.map((label) => Number(NUMERIC_REF_LABEL.exec(label?.textContent?.trim() ?? '')?.[1] ?? Number.NaN));
386
+ const first = numbers[0];
387
+ if (first !== undefined && numbers.every((n, i) => n === first + i)) {
388
+ list.setAttribute('start', String(first));
389
+ for (const label of labels)
390
+ label?.remove();
391
+ }
392
+ else {
393
+ const unordered = document.createElement('ul');
394
+ unordered.append(...list.childNodes);
395
+ list.replaceWith(unordered);
396
+ }
397
+ }
110
398
  for (const backlink of refList.querySelectorAll('a.rev-xref-ref'))
111
399
  backlink.remove();
112
- for (const extra of refList.querySelectorAll('.cit-extra')) {
400
+ for (const extra of outermost(refList, '.cit-extra')) {
113
401
  for (const link of extra.querySelectorAll('a')) {
114
402
  const doi = link.classList.contains('cit-ref-sprinkles-doi')
115
403
  ? URL.parse(link.getAttribute('href') ?? '', sourceUrl)?.searchParams.get('access_num')
@@ -128,7 +416,7 @@ function prepareArticlePage(html, sourceUrl) {
128
416
  }
129
417
  }
130
418
  const omittedTables = [];
131
- for (const table of view.querySelectorAll('div.table')) {
419
+ for (const table of outermost(view, 'div.table')) {
132
420
  const href = table.querySelector('a.table-expand-popup')?.getAttribute('href');
133
421
  for (const callout of table.querySelectorAll('.table-callout-links'))
134
422
  callout.remove();
@@ -140,6 +428,15 @@ function prepareArticlePage(html, sourceUrl) {
140
428
  'Unlabelled table';
141
429
  omittedTables.push({ label, url: url.href });
142
430
  }
431
+ const unmarked = new Set();
432
+ for (const holder of outermost(view, 'table, pre')) {
433
+ for (const block of holder.querySelectorAll(SCORED_BLOCK_SELECTOR))
434
+ unmarked.add(block);
435
+ }
436
+ for (const block of view.querySelectorAll(SCORED_BLOCK_SELECTOR)) {
437
+ if (!unmarked.has(block))
438
+ block.setAttribute('role', 'article');
439
+ }
143
440
  return { html: document.toString(), omittedTables };
144
441
  }
145
442
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"biorxiv-fulltext-service.js","sourceRoot":"","sources":["../../../src/services/biorxiv-fulltext/biorxiv-fulltext-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAEL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAEnD;;;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,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO;gBACL,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE,OAAO;gBACf,MAAM,EACJ,yIAAyI;gBAC3I,SAAS;aACV,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAkB;YAC7B,QAAQ;YACR,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;YAClD,SAAS;YACT,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;SAC5E,CAAC;QACF,0EAA0E;QAC1E,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC;IACzC,CAAC;CACF;AAED,gFAAgF;AAEhF,IAAI,QAA4C,CAAC;AAEjD,MAAM,UAAU,0BAA0B,CAAC,MAAiB,EAAE,OAAuB;IACnF,QAAQ,GAAG,IAAI,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,IAAI,CAAC,QAAQ;QACX,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;IACJ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -10,7 +10,9 @@
10
10
  * Detects HTML error pages, retries an HTTP 200 body that carries no result
11
11
  * list, and classifies an origin rate limit (HTTP 429) as its own retryable
12
12
  * `rate_limited` condition carrying the parsed `Retry-After` wait — never the
13
- * upstream response body.
13
+ * upstream response body. A cursor page that fails every attempt the way a
14
+ * malformed `cursorMark` does is told apart from an outage by one request for
15
+ * the same query's first page.
14
16
  * @module services/europe-pmc/europe-pmc-service
15
17
  */
16
18
  import type { Context } from '@cyanheads/mcp-ts-core';
@@ -45,12 +47,26 @@ export declare class EuropePmcService {
45
47
  * firstPublicationDate), which carries no abstract — see `getAbstracts`.
46
48
  * Throws a retryable `rate_limited` error when the origin returns HTTP 429.
47
49
  * A body with no result list is retried; if every attempt returns one, throws
48
- * `ValidationError` (`invalid_cursor_mark`) when a cursor page other than `*`
49
- * was requested, and `ServiceUnavailable` (`empty_response_body`) otherwise.
50
- * A deadline that runs out first is a `Timeout` expiry either way: fewer
51
- * attempts than the full ladder do not establish that the cursor is at fault.
50
+ * `ServiceUnavailable` (`empty_response_body`).
51
+ *
52
+ * On a cursor page other than `*`, a ladder that every attempt failed with
53
+ * HTTP 503 or the empty body sends one more request, unretried: the same
54
+ * query's first page. When that answers, throws `ValidationError`
55
+ * (`invalid_cursor_mark`) — four requests plus one; otherwise the ladder's
56
+ * own failure. A deadline that runs out first is a `Timeout` expiry either
57
+ * way: fewer attempts than the full ladder do not establish that the cursor
58
+ * is at fault.
52
59
  */
53
60
  search(options: SearchOptions, deadline: CallDeadline, ctx: Context): Promise<EuropePmcSearchResult>;
61
+ /**
62
+ * Whether EuropePMC answers a first-page search right now: one request, never
63
+ * retried, timed out at 20 s or what is left of the call's budget, and not
64
+ * sent at all once that budget is spent. A miss of any kind — a status, the
65
+ * empty body, a page that is not JSON, a network error, the timeout — is
66
+ * `false`; retrying would only add requests against an origin that may be in
67
+ * outage. A caller cancellation is re-thrown, never read as a miss.
68
+ */
69
+ private firstPageAnswers;
54
70
  /**
55
71
  * Fetch the abstracts of preprints by DOI in one `resultType=core` query — the
56
72
  * only EuropePMC result type that carries `abstractText`. The query is keyed
@@ -1 +1 @@
1
- {"version":3,"file":"europe-pmc-service.d.ts","sourceRoot":"","sources":["../../../src/services/europe-pmc/europe-pmc-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,E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