evidence-mcp-dev 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +71 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3233,6 +3233,9 @@ var VARIABLES = [
|
|
|
3233
3233
|
"FH_VERIFY_OPENAI_MODEL",
|
|
3234
3234
|
"FH_VERIFY_OPENAI_URL",
|
|
3235
3235
|
"FH_VERIFY_OPENAI_API_KEY",
|
|
3236
|
+
"FH_VERIFY_LIQUID_MODEL",
|
|
3237
|
+
"FH_VERIFY_LIQUID_URL",
|
|
3238
|
+
"FH_VERIFY_LIQUID_API_KEY",
|
|
3236
3239
|
"FH_VERIFY_MODEL",
|
|
3237
3240
|
"FH_VERIFY_URL",
|
|
3238
3241
|
"FH_VERIFY_API_KEY",
|
|
@@ -3311,6 +3314,37 @@ function googleInput(state) {
|
|
|
3311
3314
|
return Object.entries(state).map(([k, v]) => ({ type: "text", text: JSON.stringify({ [k]: v }) + "\n" }));
|
|
3312
3315
|
}
|
|
3313
3316
|
|
|
3317
|
+
// src/verify/liquid.ts
|
|
3318
|
+
var hosted = (baseUrl) => {
|
|
3319
|
+
try {
|
|
3320
|
+
return new URL(baseUrl).hostname === "api.liquid.ai";
|
|
3321
|
+
} catch {
|
|
3322
|
+
return false;
|
|
3323
|
+
}
|
|
3324
|
+
};
|
|
3325
|
+
var liquid = {
|
|
3326
|
+
name: "liquid",
|
|
3327
|
+
// d1-ultra (2026-11-16, claims.json, 3 rounds): 22/22, true claims ≥ 0.95, false ≤ 0.05, 1.7 s median;
|
|
3328
|
+
// d1.1 22/22 too but with less margin (≥ 0.89, ≤ 0.12), 0.5 s
|
|
3329
|
+
defaultModel: "d1-ultra",
|
|
3330
|
+
hostedUrl: "https://api.liquid.ai",
|
|
3331
|
+
keyPrefixes: ["liquid_"],
|
|
3332
|
+
modelPrefix: "d1",
|
|
3333
|
+
matches: (host3) => host3 === "api.liquid.ai",
|
|
3334
|
+
// Characters per window for the model's tokens, with room for the statement and
|
|
3335
|
+
// the question. A paper's Markdown can run under 2.75 characters a token
|
|
3336
|
+
// (2026-11-16: a 90,000-character window of pmid:18843650 went over d1-ultra's
|
|
3337
|
+
// 32,768), so 75,000 for 32k (d1-ultra; local, for -b/-ub 32768) and 150,000
|
|
3338
|
+
// for d1.1's 65k — both under the 250 KB text limit.
|
|
3339
|
+
windowChars: (baseUrl, model) => !hosted(baseUrl) || /^d1-ultra/.test(model) ? 75e3 : 15e4,
|
|
3340
|
+
request: ({ base_url, api_key, model, state, questions }) => ({
|
|
3341
|
+
url: `${base_url}${hosted(base_url) ? "/decisions" : ""}/v1/systemone`,
|
|
3342
|
+
// the Liquid API under /decisions, llama.cpp at the root
|
|
3343
|
+
headers: { "content-type": "application/json", ...api_key ? { authorization: `Bearer ${api_key}` } : {} },
|
|
3344
|
+
body: JSON.stringify({ model, state, questions })
|
|
3345
|
+
})
|
|
3346
|
+
};
|
|
3347
|
+
|
|
3314
3348
|
// src/verify/openai.ts
|
|
3315
3349
|
var openai = {
|
|
3316
3350
|
name: "openai",
|
|
@@ -3367,7 +3401,7 @@ var perplexity = {
|
|
|
3367
3401
|
};
|
|
3368
3402
|
|
|
3369
3403
|
// src/verify/providers.ts
|
|
3370
|
-
var PROVIDERS = [google, openai, perplexity];
|
|
3404
|
+
var PROVIDERS = [google, openai, liquid, perplexity];
|
|
3371
3405
|
var PROVIDER_NAMES = PROVIDERS.map((p) => p.name);
|
|
3372
3406
|
var providerByName = (name) => PROVIDERS.find((p) => p.name === name) ?? null;
|
|
3373
3407
|
var providerForKey = (key2) => PROVIDERS.find((p) => p.keyPrefixes.some((k) => key2.startsWith(k))) ?? null;
|
|
@@ -4051,7 +4085,7 @@ function decider(cfg, fetchFn = fetch) {
|
|
|
4051
4085
|
await new Promise((res) => setTimeout(res, RETRY_MS));
|
|
4052
4086
|
continue;
|
|
4053
4087
|
}
|
|
4054
|
-
throw new Error(msg ? `${cfg.model}: ${msg}` : `${cfg.model}: HTTP ${r.status} without an answer`);
|
|
4088
|
+
throw new Error(msg ? msg.startsWith(`${cfg.model}: `) ? msg : `${cfg.model}: ${msg}` : `${cfg.model}: HTTP ${r.status} without an answer`);
|
|
4055
4089
|
}
|
|
4056
4090
|
};
|
|
4057
4091
|
}
|
|
@@ -4788,17 +4822,48 @@ function paperYearOnly(md) {
|
|
|
4788
4822
|
});
|
|
4789
4823
|
}
|
|
4790
4824
|
function windows(md, max) {
|
|
4825
|
+
const secs = cleanMarkdown(md).split(/\n(?=#)/);
|
|
4826
|
+
const whole = secs.join("\n");
|
|
4827
|
+
if (whole.length <= max) return [whole];
|
|
4828
|
+
const title = secs[0]?.startsWith("# ") ? secs[0] : "";
|
|
4829
|
+
const abstract = secs.find((x) => /^#+\s*(abstract|summary)\b/i.test(x)) ?? "";
|
|
4830
|
+
const head = [title, abstract].filter((x, i, all) => x && all.indexOf(x) === i).join("\n").slice(0, Math.floor(max / 4));
|
|
4831
|
+
const room = max - (head ? head.length + 1 : 0);
|
|
4832
|
+
const pieces = secs.flatMap((x) => x.length <= room ? [x] : splitSection(x, room));
|
|
4791
4833
|
const out = [];
|
|
4792
4834
|
let cur = "";
|
|
4793
|
-
for (const
|
|
4794
|
-
if (cur && cur.length +
|
|
4835
|
+
for (const x of pieces) {
|
|
4836
|
+
if (cur && cur.length + x.length + 1 > room) {
|
|
4795
4837
|
out.push(cur);
|
|
4796
4838
|
cur = "";
|
|
4797
4839
|
}
|
|
4798
|
-
cur += (cur ? "\n" : "") +
|
|
4840
|
+
cur += (cur ? "\n" : "") + x;
|
|
4799
4841
|
}
|
|
4800
4842
|
if (cur) out.push(cur);
|
|
4801
|
-
return out.
|
|
4843
|
+
return out.map((w, i) => i > 0 && head ? `${head}
|
|
4844
|
+
${w}` : w);
|
|
4845
|
+
}
|
|
4846
|
+
function splitSection(section2, room) {
|
|
4847
|
+
const paras = section2.split(/\n{2,}/).flatMap((p) => {
|
|
4848
|
+
if (p.length <= room) return [p];
|
|
4849
|
+
const slices = [];
|
|
4850
|
+
const step = room - Math.min(500, Math.floor(room / 4));
|
|
4851
|
+
for (let i = 0; i < p.length; i += step) slices.push(p.slice(i, i + room));
|
|
4852
|
+
return slices;
|
|
4853
|
+
});
|
|
4854
|
+
const out = [];
|
|
4855
|
+
let cur = [];
|
|
4856
|
+
const len = (ps) => ps.reduce((n, p) => n + p.length + 2, 0);
|
|
4857
|
+
for (const p of paras) {
|
|
4858
|
+
if (cur.length && len(cur) + p.length > room) {
|
|
4859
|
+
out.push(cur.join("\n\n"));
|
|
4860
|
+
const last = cur[cur.length - 1];
|
|
4861
|
+
cur = last.length <= room / 4 && last.length + p.length + 2 <= room ? [last] : [];
|
|
4862
|
+
}
|
|
4863
|
+
cur.push(p);
|
|
4864
|
+
}
|
|
4865
|
+
if (cur.length) out.push(cur.join("\n\n"));
|
|
4866
|
+
return out;
|
|
4802
4867
|
}
|
|
4803
4868
|
var MONTH = /^(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|June?|July?|Aug(ust)?|Sep(t(ember)?)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\.?$/;
|
|
4804
4869
|
var namesAuthor = (group) => (group.match(/\b[A-Z][\p{L}'’-]+/gu) ?? []).some((w) => !MONTH.test(w));
|