evidence-mcp-dev 0.2.40 → 0.2.41

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 (2) hide show
  1. package/dist/index.js +15 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2450,8 +2450,10 @@ async function download(tier, p, candidates, ctx) {
2450
2450
  const c = ordered[i];
2451
2451
  ctx.tried.add(c.url);
2452
2452
  let link;
2453
+ let gone;
2453
2454
  const note = (x) => {
2454
2455
  if (!x.ok && x.pdfUrl) link ??= x.pdfUrl;
2456
+ if (!x.ok && !gone && /\bHTTP (404|410)\b/.test(x.reason)) gone = x.reason;
2455
2457
  return x;
2456
2458
  };
2457
2459
  let r = note(await tryOne(p, c, tier));
@@ -2498,7 +2500,7 @@ async function download(tier, p, candidates, ctx) {
2498
2500
  if (!r.ok && /^unlocker HTTP 4\d\d/.test(bare(r.reason))) ctx.onAlert?.(`brightdata: ${bare(r.reason)}`);
2499
2501
  }
2500
2502
  if (r.ok) return r;
2501
- reasons.push(`${r.reason}: ${hostOf2(c.url)}`);
2503
+ reasons.push(`${gone ?? r.reason}: ${hostOf2(c.url)}`);
2502
2504
  if (link && !ctx.tried.has(link) && !NCBI.test(link) && !ordered.slice(i + 1).some((o) => o.url === link)) {
2503
2505
  ctx.onTry?.(`${target.url} \u2192 pdf ${link}`);
2504
2506
  ordered.splice(i + 1, 0, { url: link, version: c.version, source: c.source, host: c.host, pdf: true });
@@ -3314,7 +3316,6 @@ function fragment(claim) {
3314
3316
  const first = /^(\S+)/.exec(body)?.[1] ?? "";
3315
3317
  const oddsRatio = first === "OR" && /^OR\s+(\d|=|\(|of\b|for\b)/.test(body);
3316
3318
  if (!oddsRatio && /^(and|or|but|nor|which|whereas|while)$/i.test(first.replace(/[,;:]$/, ""))) return `claim is a fragment: starts with "${first}" \u2014 send a complete statement with its subject`;
3317
- if (/^[a-z]/.test(body) && !/[A-Z0-9]/.test(first)) return `claim is a fragment: starts with "${first}" in lowercase \u2014 send a complete statement with its subject`;
3318
3319
  return null;
3319
3320
  }
3320
3321
  var SUPERSEDED = "The corrected text replaces figures that the paper first published wrongly. Does the statement give a figure for a quantity the corrected text also gives, but with a different value \u2014 the superseded, uncorrected figure? If the statement's figures match the corrected text, or it concerns something the corrected text does not cover, answer false.";
@@ -4106,6 +4107,12 @@ async function rung(url, via) {
4106
4107
  var climb = async (url, onTry, onAlert) => {
4107
4108
  let r = await rung(url, "fetch");
4108
4109
  const firstReason = r.ok ? void 0 : r.reason;
4110
+ let gone;
4111
+ const seen = (g) => {
4112
+ if (!g.ok) gone ??= goneReason(g.reason);
4113
+ return g;
4114
+ };
4115
+ seen(r);
4109
4116
  const target = !r.ok && r.url && r.url !== url ? r.url : url;
4110
4117
  if (target !== url) onTry?.(`\u2192 ${target}`);
4111
4118
  onTry?.(r.ok ? "ok fetch" : `failed fetch: ${r.reason}`);
@@ -4119,7 +4126,7 @@ var climb = async (url, onTry, onAlert) => {
4119
4126
  const w = walled(target, name);
4120
4127
  if (w) onTry?.(`skipped ${name}: ${wallNote(w)}`);
4121
4128
  else {
4122
- r = await rung(target, { proxy: f.proxy, label: f.label });
4129
+ r = seen(await rung(target, { proxy: f.proxy, label: f.label }));
4123
4130
  recordRung(target, name, r.ok, r.ok ? "" : r.reason);
4124
4131
  if (!r.ok && r.shell && !shell) shell = r.shell;
4125
4132
  onTry?.(r.ok ? `ok ${name}` : `failed ${name}: ${r.reason}`);
@@ -4133,7 +4140,7 @@ var climb = async (url, onTry, onAlert) => {
4133
4140
  onTry?.(`skipped ${name}: ${wallNote(w)}`);
4134
4141
  continue;
4135
4142
  }
4136
- r = await rung(target, { browser: b.endpoint, label: b.label });
4143
+ r = seen(await rung(target, { browser: b.endpoint, label: b.label }));
4137
4144
  recordRung(target, name, r.ok, r.ok ? "" : r.reason);
4138
4145
  if (!r.ok && r.shell && !shell) shell = r.shell;
4139
4146
  onTry?.(r.ok ? `ok ${name}` : `failed ${name}: ${r.reason}`);
@@ -4142,7 +4149,7 @@ var climb = async (url, onTry, onAlert) => {
4142
4149
  const uw = !r.ok && unlockerConfigured() ? walled(target, "brightdata") : null;
4143
4150
  if (uw) onTry?.(`skipped brightdata: ${wallNote(uw)}`);
4144
4151
  else if (!r.ok && unlockerConfigured() && (!plainVia(r) || met(r, /^(HTTP 403|wall page|script shell)/))) {
4145
- r = await rung(target, "brightdata");
4152
+ r = seen(await rung(target, "brightdata"));
4146
4153
  recordRung(target, "brightdata", r.ok, r.ok ? "" : r.reason);
4147
4154
  onTry?.(r.ok ? "ok brightdata" : `failed brightdata: ${r.reason}`);
4148
4155
  if (!r.ok && /^unlocker HTTP 4\d\d/.test(r.reason)) onAlert?.(`brightdata: ${r.reason}`);
@@ -4151,8 +4158,10 @@ var climb = async (url, onTry, onAlert) => {
4151
4158
  onTry?.("shell kept: no rung rendered the page, the script shell is served");
4152
4159
  return shell;
4153
4160
  }
4154
- return r.ok || r.via === "fetch" ? r : { ...r, first: firstReason };
4161
+ return r.ok || r.via === "fetch" ? r : { ...r, first: gone ?? firstReason };
4155
4162
  };
4163
+ var GONE = /\bHTTP (404|410)\b/;
4164
+ var goneReason = (reason) => reason.match(GONE)?.[0];
4156
4165
  var mediaType = (contentType) => contentType.split(";")[0].trim().toLowerCase();
4157
4166
  function isHtml(contentType, text4) {
4158
4167
  const ct = contentType.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evidence-mcp-dev",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
4
4
  "description": "Internal development build of evidence-mcp. Not for public use.",
5
5
  "type": "module",
6
6
  "bin": {