@cyanheads/cern-inspire-mcp-server 0.1.1 → 0.1.2
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 +11 -8
- package/CLAUDE.md +11 -8
- package/README.md +60 -33
- package/changelog/0.1.x/0.1.2.md +29 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/index.d.ts +13 -5
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/inspire-literature.resource.d.ts +13 -5
- package/dist/mcp-server/resources/definitions/inspire-literature.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/inspire-literature.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/inspire-literature.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/export-citations.tool.d.ts +10 -1
- package/dist/mcp-server/tools/definitions/export-citations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/export-citations.tool.js +83 -19
- package/dist/mcp-server/tools/definitions/export-citations.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-citation-summary.tool.d.ts +6 -2
- package/dist/mcp-server/tools/definitions/get-citation-summary.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-citation-summary.tool.js +71 -19
- package/dist/mcp-server/tools/definitions/get-citation-summary.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-paper.tool.d.ts +26 -10
- package/dist/mcp-server/tools/definitions/get-paper.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-paper.tool.js +107 -40
- package/dist/mcp-server/tools/definitions/get-paper.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +30 -9
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-reference.tool.js +27 -8
- package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-authors.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-authors.tool.js +9 -9
- package/dist/mcp-server/tools/definitions/search-authors.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-experiments.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-experiments.tool.js +6 -3
- package/dist/mcp-server/tools/definitions/search-experiments.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-hepdata.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/search-hepdata.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-hepdata.tool.js +14 -12
- package/dist/mcp-server/tools/definitions/search-hepdata.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-literature.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/search-literature.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-literature.tool.js +22 -11
- package/dist/mcp-server/tools/definitions/search-literature.tool.js.map +1 -1
- package/dist/mcp-server/tools/inputs.d.ts +17 -5
- package/dist/mcp-server/tools/inputs.d.ts.map +1 -1
- package/dist/mcp-server/tools/inputs.js +29 -10
- package/dist/mcp-server/tools/inputs.js.map +1 -1
- package/dist/services/inspire/identifiers.d.ts +17 -6
- package/dist/services/inspire/identifiers.d.ts.map +1 -1
- package/dist/services/inspire/identifiers.js +28 -7
- package/dist/services/inspire/identifiers.js.map +1 -1
- package/dist/services/inspire/inspire-service.d.ts +78 -18
- package/dist/services/inspire/inspire-service.d.ts.map +1 -1
- package/dist/services/inspire/inspire-service.js +293 -52
- package/dist/services/inspire/inspire-service.js.map +1 -1
- package/dist/services/inspire/markup-to-text.d.ts +32 -0
- package/dist/services/inspire/markup-to-text.d.ts.map +1 -0
- package/dist/services/inspire/markup-to-text.js +783 -0
- package/dist/services/inspire/markup-to-text.js.map +1 -0
- package/dist/services/inspire/normalize.d.ts +23 -6
- package/dist/services/inspire/normalize.d.ts.map +1 -1
- package/dist/services/inspire/normalize.js +94 -21
- package/dist/services/inspire/normalize.js.map +1 -1
- package/dist/services/inspire/types.d.ts +73 -5
- package/dist/services/inspire/types.d.ts.map +1 -1
- package/dist/utils/render.d.ts +34 -5
- package/dist/utils/render.d.ts.map +1 -1
- package/dist/utils/render.js +69 -16
- package/dist/utils/render.js.map +1 -1
- package/package.json +1 -1
- package/server.json +9 -3
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Input schemas and helpers shared across the INSPIRE tools: the
|
|
3
|
-
* blank-as-unset wrapper for form clients, the `paper` identifier input
|
|
4
|
-
*
|
|
5
|
-
* author-identifier inputs, and the
|
|
3
|
+
* blank-as-unset wrapper for form clients, the `paper` identifier input and the
|
|
4
|
+
* route from a HEPData record to its paper, the facet enum arrays (comma-joined
|
|
5
|
+
* or array, case-folded), the year bounds, the author-identifier inputs, and the
|
|
6
|
+
* applied-filters echo string.
|
|
6
7
|
* @module mcp-server/tools/inputs
|
|
7
8
|
*/
|
|
8
9
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
-
import { normalizeAuthorId, normalizePaperId, PAPER_ID_PATTERN, } from '../../services/inspire/identifiers.js';
|
|
10
|
+
import { hepdataRecordNumber, normalizeAuthorId, normalizePaperId, PAPER_ID_PATTERN, } from '../../services/inspire/identifiers.js';
|
|
10
11
|
import { DOCUMENT_TYPES, SUBJECTS } from '../../services/inspire/vocabulary.js';
|
|
11
12
|
/**
|
|
12
13
|
* Treats `''` as unset before `schema` runs, so a form client's blank optional
|
|
13
14
|
* field (enums with a default included) takes the default instead of failing.
|
|
14
15
|
*/
|
|
15
16
|
export const blankAsUnset = (schema) => z.preprocess((value) => (value === '' ? undefined : value), schema);
|
|
17
|
+
/**
|
|
18
|
+
* The call that leads from HEPData record `n` to its paper: the HEPData search
|
|
19
|
+
* matches the record DOI and returns the record's paper recids.
|
|
20
|
+
*/
|
|
21
|
+
export const hepdataRecordRoute = (n) => `call cern_inspire_search_hepdata with query dois.value:"10.17182/hepdata.${n}" and pass one of the record's paperRecids to cern_inspire_get_paper`;
|
|
22
|
+
/** The pattern refinement's message: the HEPData route for a numbered record link, else the accepted forms. */
|
|
23
|
+
const paperIdError = (value) => {
|
|
24
|
+
const record = typeof value === 'string' ? hepdataRecordNumber(value) : undefined;
|
|
25
|
+
return record
|
|
26
|
+
? `A hepdata.net/record/${record} link names HEPData record ${record}, not a paper: ${hepdataRecordRoute(record)}.`
|
|
27
|
+
: 'Expected an INSPIRE recid (451647), an arXiv ID (1207.7214 or hep-th/9711200), or a DOI (10.1016/…).';
|
|
28
|
+
};
|
|
16
29
|
/**
|
|
17
30
|
* One paper identifier, normalized before the length and pattern checks (see
|
|
18
31
|
* `normalizePaperId`): recid, new or old arXiv ID, or DOI, at most 256 characters.
|
|
32
|
+
* The pattern runs as a refinement, so the advertised JSON Schema carries no
|
|
33
|
+
* `pattern` that would reject the prefixed and URL spellings the preprocess maps.
|
|
19
34
|
*/
|
|
20
35
|
export const paperInput = z
|
|
21
36
|
.preprocess((value) => (typeof value === 'string' ? normalizePaperId(value) : value), z
|
|
22
37
|
.string()
|
|
23
38
|
.max(256)
|
|
24
|
-
.
|
|
25
|
-
.describe("INSPIRE recid (e.g. 451647), arXiv ID (1207.7214 or hep-th/9711200, with or without 'arXiv:', a version suffix, or an arxiv.org
|
|
39
|
+
.refine((id) => PAPER_ID_PATTERN.test(id), { error: (issue) => paperIdError(issue.input) }))
|
|
40
|
+
.describe("INSPIRE recid (e.g. 451647), arXiv ID (1207.7214 or hep-th/9711200, with or without 'arXiv:', a version suffix, or an https://arxiv.org/abs/ or https://arxiv.org/pdf/ prefix), DOI (10.1016/…, with or without 'doi:' or an https://doi.org/ prefix; no * or ? wildcards), an https://inspirehep.net/literature/<recid> URL, or HEPData's ins<recid> form, alone or in an https://www.hepdata.net/record/ins<recid> URL. Up to 256 characters.");
|
|
26
41
|
/**
|
|
27
42
|
* An optional array of enum values that also accepts a comma-joined string.
|
|
28
43
|
* `''` and `[]` are unset; each entry is trimmed, case-folded to the canonical
|
|
@@ -48,10 +63,14 @@ function enumArray(values, max, itemDescription) {
|
|
|
48
63
|
return folded.length === 0 ? undefined : [...new Set(folded)].slice(0, max + 1);
|
|
49
64
|
}, z.array(z.enum(values).describe(itemDescription)).max(max).optional());
|
|
50
65
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Up to 4 INSPIRE document types; multiple values AND together upstream. The
|
|
68
|
+
* description documents the advertised enum array only; the comma-joined string
|
|
69
|
+
* and case folding stay undocumented leniency.
|
|
70
|
+
*/
|
|
71
|
+
export const documentTypesInput = enumArray(DOCUMENT_TYPES, 4, 'An INSPIRE document type.').describe(`Restrict to INSPIRE document types (up to 4). Multiple values must ALL hold (published + review = published reviews), not either. Values: ${DOCUMENT_TYPES.join(', ')}.`);
|
|
72
|
+
/** Up to 4 INSPIRE subject categories; multiple values AND together upstream. Documented as `documentTypesInput` is. */
|
|
73
|
+
export const subjectsInput = enumArray(SUBJECTS, 4, 'An INSPIRE subject category.').describe(`Restrict to INSPIRE subject categories (up to 4). Multiple values must ALL hold, not either. Values: ${SUBJECTS.join(', ')}.`);
|
|
55
74
|
const year = () => blankAsUnset(z.number().int().min(1900).max(2100).optional());
|
|
56
75
|
/** Earliest publication year to include (inclusive); maps to INSPIRE `earliest_date`. */
|
|
57
76
|
export const yearFromInput = year().describe('Earliest year to include (1900–2100, inclusive), matched on the earliest date INSPIRE records for the paper. Omit for no lower bound.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/inputs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,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,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/F,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/E,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;QACpC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,SAAS;KACzE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,OAAqB;IACnD,OAAO,OAAO,CACZ,OAAO,CAAC,aAAa,EAAE,MAAM;QAC3B,OAAO,CAAC,QAAQ,EAAE,MAAM;QACxB,OAAO,CAAC,QAAQ,KAAK,SAAS;QAC9B,OAAO,CAAC,MAAM,KAAK,SAAS,CAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Paper and author identifier handling for INSPIRE: the one-to-one
|
|
3
|
-
* normalizations the tool schemas run in their preprocess, the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* normalizations the tool schemas run in their preprocess, the paper pattern
|
|
4
|
+
* their refinement checks (kept out of the advertised JSON Schema), the HEPData
|
|
5
|
+
* record numbers a paper input can name instead of a paper, and the
|
|
6
|
+
* classification that routes an identifier to the INSPIRE query form that
|
|
7
|
+
* matches it.
|
|
6
8
|
* @module services/inspire/identifiers
|
|
7
9
|
*/
|
|
8
10
|
/** How a paper identifier was resolved to an INSPIRE recid. */
|
|
9
11
|
export type PaperIdKind = 'recid' | 'arxiv' | 'doi';
|
|
10
12
|
/** A normalized paper identifier: recid, new or old arXiv ID, or DOI without `*` or `?`. */
|
|
11
13
|
export declare const PAPER_ID_PATTERN: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* The HEPData record number a numbered hepdata.net record URL or a HEPData DOI
|
|
16
|
+
* names, without leading zeros; `undefined` for anything else. A DOI is read past
|
|
17
|
+
* trailing prose punctuation, as the paper resolve reads it. Such an identifier
|
|
18
|
+
* names the data, not a paper, so the paper input routes it to the HEPData search
|
|
19
|
+
* rather than reading the number as a recid.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hepdataRecordNumber(id: string): string | undefined;
|
|
12
22
|
/**
|
|
13
23
|
* Reduces the accepted spellings of a paper identifier to its bare form: trims,
|
|
14
|
-
* maps arxiv.org, doi.org, inspirehep.net literature, and hepdata.net
|
|
15
|
-
* to the identifier they carry
|
|
24
|
+
* maps arxiv.org, doi.org, inspirehep.net literature, and hepdata.net
|
|
25
|
+
* `record/ins<recid>` URLs to the identifier they carry (a numbered
|
|
26
|
+
* `record/<n>` URL names a HEPData record, not a paper, and is not mapped), strips `arXiv:` / `doi:` prefixes (and any space after them) and HEPData's
|
|
16
27
|
* `ins` prefix, lower-cases an old-style arXiv archive (`HEP-TH/9711200` →
|
|
17
28
|
* `hep-th/9711200`, the subject class of `math.AG/0601001` kept as written), and
|
|
18
29
|
* drops an arXiv version suffix (INSPIRE matches `1207.7214`, not `1207.7214v2`).
|
|
19
30
|
* Every mapping is one-to-one; anything else passes through for the pattern
|
|
20
|
-
*
|
|
31
|
+
* refinement to reject.
|
|
21
32
|
*/
|
|
22
33
|
export declare function normalizePaperId(raw: string): string;
|
|
23
34
|
/** Classifies a normalized paper identifier; `undefined` when it matches no form. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../../../src/services/inspire/identifiers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../../../src/services/inspire/identifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAQpD,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,QACuD,CAAC;AASrF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqBpD;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAKnE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAKlF;AAED,wFAAwF;AACxF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAM5E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,WAAW,CAAC;IACvB,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAM3D;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Paper and author identifier handling for INSPIRE: the one-to-one
|
|
3
|
-
* normalizations the tool schemas run in their preprocess, the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* normalizations the tool schemas run in their preprocess, the paper pattern
|
|
4
|
+
* their refinement checks (kept out of the advertised JSON Schema), the HEPData
|
|
5
|
+
* record numbers a paper input can name instead of a paper, and the
|
|
6
|
+
* classification that routes an identifier to the INSPIRE query form that
|
|
7
|
+
* matches it.
|
|
6
8
|
* @module services/inspire/identifiers
|
|
7
9
|
*/
|
|
8
10
|
const RECID = /^\d{1,9}$/;
|
|
@@ -12,15 +14,34 @@ const OLD_ARXIV = /^[a-z-]+(?:\.[A-Z]{2})?\/\d{7}$/;
|
|
|
12
14
|
const DOI = /^10\.\d{4,9}\/[^\s*?]+$/;
|
|
13
15
|
/** A normalized paper identifier: recid, new or old arXiv ID, or DOI without `*` or `?`. */
|
|
14
16
|
export const PAPER_ID_PATTERN = /^(?:\d{1,9}|\d{4}\.\d{4,5}|[a-z-]+(?:\.[A-Z]{2})?\/\d{7}|10\.\d{4,9}\/[^\s*?]+)$/;
|
|
17
|
+
/** A numbered hepdata.net record page, scheme optional; the `ins<recid>` form is a paper and is mapped instead. */
|
|
18
|
+
const HEPDATA_RECORD_URL = /^(?:https?:\/\/)?(?:www\.)?hepdata\.net\/record\/(\d+)\/?(?:[?#].*)?$/i;
|
|
19
|
+
/** A HEPData record DOI, or one of its version (`.vK`) or table (`.vK/tJ`) DOIs. */
|
|
20
|
+
const HEPDATA_DOI = /^10\.17182\/hepdata\.(\d+)(?:\.v\d+(?:\/t\d+)?)?$/i;
|
|
21
|
+
/** Prose punctuation after a DOI (`.`, `,`, `;`, `:`, `)`, `]`), which INSPIRE's `doi:` match passes over. */
|
|
22
|
+
const TRAILING_PROSE_PUNCTUATION = /[.,;:)\]]+$/;
|
|
23
|
+
/**
|
|
24
|
+
* The HEPData record number a numbered hepdata.net record URL or a HEPData DOI
|
|
25
|
+
* names, without leading zeros; `undefined` for anything else. A DOI is read past
|
|
26
|
+
* trailing prose punctuation, as the paper resolve reads it. Such an identifier
|
|
27
|
+
* names the data, not a paper, so the paper input routes it to the HEPData search
|
|
28
|
+
* rather than reading the number as a recid.
|
|
29
|
+
*/
|
|
30
|
+
export function hepdataRecordNumber(id) {
|
|
31
|
+
const number = (HEPDATA_RECORD_URL.exec(id) ??
|
|
32
|
+
HEPDATA_DOI.exec(id.replace(TRAILING_PROSE_PUNCTUATION, '')))?.[1];
|
|
33
|
+
return number?.replace(/^0+(?=\d)/, '');
|
|
34
|
+
}
|
|
15
35
|
/**
|
|
16
36
|
* Reduces the accepted spellings of a paper identifier to its bare form: trims,
|
|
17
|
-
* maps arxiv.org, doi.org, inspirehep.net literature, and hepdata.net
|
|
18
|
-
* to the identifier they carry
|
|
37
|
+
* maps arxiv.org, doi.org, inspirehep.net literature, and hepdata.net
|
|
38
|
+
* `record/ins<recid>` URLs to the identifier they carry (a numbered
|
|
39
|
+
* `record/<n>` URL names a HEPData record, not a paper, and is not mapped), strips `arXiv:` / `doi:` prefixes (and any space after them) and HEPData's
|
|
19
40
|
* `ins` prefix, lower-cases an old-style arXiv archive (`HEP-TH/9711200` →
|
|
20
41
|
* `hep-th/9711200`, the subject class of `math.AG/0601001` kept as written), and
|
|
21
42
|
* drops an arXiv version suffix (INSPIRE matches `1207.7214`, not `1207.7214v2`).
|
|
22
43
|
* Every mapping is one-to-one; anything else passes through for the pattern
|
|
23
|
-
*
|
|
44
|
+
* refinement to reject.
|
|
24
45
|
*/
|
|
25
46
|
export function normalizePaperId(raw) {
|
|
26
47
|
let id = raw.trim();
|
|
@@ -57,7 +78,7 @@ export function paperIdKey(kind, id) {
|
|
|
57
78
|
const lower = id.toLowerCase();
|
|
58
79
|
return kind === 'arxiv'
|
|
59
80
|
? lower.replace(/^([a-z-]+)\.[a-z]{2}(?=\/)/, '$1')
|
|
60
|
-
: lower.replace(
|
|
81
|
+
: lower.replace(TRAILING_PROSE_PUNCTUATION, '');
|
|
61
82
|
}
|
|
62
83
|
const ORCID = /^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/;
|
|
63
84
|
const INSPIRE_ID = /^INSPIRE-\d{8}$/;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../../../src/services/inspire/identifiers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../../../src/services/inspire/identifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,KAAK,GAAG,WAAW,CAAC;AAC1B,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,gGAAgG;AAChG,MAAM,GAAG,GAAG,yBAAyB,CAAC;AAEtC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAC3B,kFAAkF,CAAC;AAErF,mHAAmH;AACnH,MAAM,kBAAkB,GAAG,wEAAwE,CAAC;AACpG,oFAAoF;AACpF,MAAM,WAAW,GAAG,oDAAoD,CAAC;AACzE,8GAA8G;AAC9G,MAAM,0BAA0B,GAAG,aAAa,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,MAAM,MAAM,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrE,OAAO,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,EAAE,GAAG,EAAE,CAAC,OAAO,CACb,8EAA8E,EAC9E,IAAI,CACL,CAAC;IACF,EAAE,GAAG,EAAE,CAAC,OAAO,CA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C,EAAE,kBAAkB,KAAK,EAAE,EAAE,CAAC;IACnF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;AACzC,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,kDAAkD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -10,14 +10,29 @@ import type { Context } from '@cyanheads/mcp-ts-core';
|
|
|
10
10
|
import type { AppConfig } from '@cyanheads/mcp-ts-core/config';
|
|
11
11
|
import { type Pacer } from '@cyanheads/mcp-ts-core/utils';
|
|
12
12
|
import { type AuthorRoute } from './identifiers.js';
|
|
13
|
-
import type { AuthorSearchPage, CitationExport, CitationExportParams,
|
|
13
|
+
import type { AuthorSearchPage, CitationExport, CitationExportParams, CitationSummaryLookup, CitationSummaryParams, ExperimentSearchPage, HepdataLookup, HepdataSearchPage, HepdataSearchParams, LiteratureSearchPage, LiteratureSearchParams, PaperLookup, ResolvedAuthor, ResolvedPaper } from './types.js';
|
|
14
14
|
/** One budget per tool call, inside a 60 s client timeout. */
|
|
15
15
|
export declare const CALL_BUDGET_MS = 55000;
|
|
16
|
+
/**
|
|
17
|
+
* The citations-by-year series' own budget: one attempt's timeout. Its time grows
|
|
18
|
+
* with the matched set (0.5 s for an author, 4 s at 10,000 records, 10.5 s at
|
|
19
|
+
* 122,000; 278,875 took 25 s and 644,000 drew a 500 after 30 s) while the summary
|
|
20
|
+
* beside it stays near 0.5 s, so a broad query's series is cut here, not retried.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CITATIONS_BY_YEAR_BUDGET_MS = 15000;
|
|
23
|
+
/**
|
|
24
|
+
* Past this many matched records INSPIRE takes longer than the series' budget to
|
|
25
|
+
* answer it cold (2026-10-01: 121,921 records in 10.5 s, 149,688 in 16.8 s), so
|
|
26
|
+
* the series is cut early instead of waited on.
|
|
27
|
+
*/
|
|
28
|
+
export declare const BROAD_SERIES_RECORDS = 150000;
|
|
16
29
|
/** One tool call's view of INSPIRE: its context and the deadline every request in it shares. */
|
|
17
30
|
export interface InspireCall {
|
|
18
31
|
readonly ctx: Context;
|
|
19
32
|
/** Epoch ms after which no request in this call may run. */
|
|
20
33
|
readonly deadline: number;
|
|
34
|
+
/** Abandons a request the call no longer needs; `ctx.signal` still cancels it too. */
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
21
36
|
}
|
|
22
37
|
/** Constructor options; `fetch` and `pacer` are the test seams. */
|
|
23
38
|
export interface InspireServiceOptions {
|
|
@@ -30,11 +45,17 @@ export interface InspireServiceOptions {
|
|
|
30
45
|
export declare class InspireService {
|
|
31
46
|
private readonly fetchImpl;
|
|
32
47
|
private readonly pacer;
|
|
48
|
+
/**
|
|
49
|
+
* Admits citations-by-year series to the INSPIRE pacer at most
|
|
50
|
+
* `SERIES_MAX_CONCURRENT` at a time. It sets no rate of its own: each series
|
|
51
|
+
* still starts through `pacer`, which keeps the start rate and the 429 cooldown.
|
|
52
|
+
*/
|
|
53
|
+
private readonly seriesGate;
|
|
33
54
|
private readonly userAgent;
|
|
34
55
|
constructor(options: InspireServiceOptions);
|
|
35
56
|
/** Opens one tool call's budget; pass the result to every method the call makes. */
|
|
36
57
|
beginCall(ctx: Context, budgetMs?: number): InspireCall;
|
|
37
|
-
/** Releases
|
|
58
|
+
/** Releases both pacers' timers and rejects their queued waiters. */
|
|
38
59
|
dispose(): void;
|
|
39
60
|
/** One page of literature search results. */
|
|
40
61
|
searchLiterature(params: LiteratureSearchParams, call: InspireCall): Promise<LiteratureSearchPage>;
|
|
@@ -47,22 +68,46 @@ export declare class InspireService {
|
|
|
47
68
|
resolvePaper(paper: string, call: InspireCall): Promise<ResolvedPaper | undefined>;
|
|
48
69
|
/**
|
|
49
70
|
* The `get_paper` dossier: resolves the identifier, then reads the record and
|
|
50
|
-
* its HEPData availability in parallel. `
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
71
|
+
* its HEPData availability in parallel. When the `recid:N` search returns no
|
|
72
|
+
* hit, INSPIRE may have merged the record into another and kept N as a
|
|
73
|
+
* redirect, which its search does not follow: the record URL is asked where N
|
|
74
|
+
* went, and the record and availability are read again for the recid it names
|
|
75
|
+
* (`mergedFrom` then holds N), up to `MAX_MERGE_REDIRECTS` times. `undefined`
|
|
76
|
+
* when the identifier matches no record. A failed availability lookup degrades
|
|
77
|
+
* to `hepdata.status: 'lookup_failed'` — except a cancelled call or an
|
|
78
|
+
* input-class rejection, which rethrow — unless `requireHepdata` is set, when it
|
|
79
|
+
* throws its own error once the record is known to exist. Any failure of the
|
|
80
|
+
* resolve, a record read, or a redirect lookup throws.
|
|
55
81
|
*/
|
|
56
82
|
getPaper(paper: string, maxAuthors: number, call: InspireCall, options?: {
|
|
57
83
|
requireHepdata?: boolean;
|
|
58
84
|
}): Promise<PaperLookup | undefined>;
|
|
59
|
-
/**
|
|
60
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Where INSPIRE sends a recid its search does not return: `GET
|
|
87
|
+
* /literature/<recid>` with redirects not followed. A merged record answers with
|
|
88
|
+
* a redirect to the record it was merged into, whose recid is returned. A recid
|
|
89
|
+
* INSPIRE does not hold (404) or has deleted (410) gives `undefined`, and so does
|
|
90
|
+
* one it serves (200) although its search returns nothing, which is logged.
|
|
91
|
+
*/
|
|
92
|
+
private mergedInto;
|
|
93
|
+
/**
|
|
94
|
+
* HEPData availability for one paper recid, from INSPIRE's `data` collection:
|
|
95
|
+
* up to `HEPDATA_RECORDS_PER_PAPER` of its data records in one request, and
|
|
96
|
+
* INSPIRE's total.
|
|
97
|
+
*/
|
|
98
|
+
getHepdataAvailability(recid: string, call: InspireCall): Promise<HepdataLookup>;
|
|
61
99
|
private degradeAvailability;
|
|
62
100
|
/**
|
|
63
|
-
* INSPIRE's citation entries for a literature query.
|
|
64
|
-
*
|
|
65
|
-
*
|
|
101
|
+
* INSPIRE's citation entries for one page of a literature query. Page 1 is one
|
|
102
|
+
* request for `size + 1` entries, truncated when the extra one came back. A
|
|
103
|
+
* later page cannot carry that probe, since INSPIRE's pages sit `size` apart: it
|
|
104
|
+
* sends `page` and `size` as given, with one `fields=control_number&size=1`
|
|
105
|
+
* search on the same query in parallel for the match total. The total sets
|
|
106
|
+
* `truncated`, and a page at or past it returns no entries, because INSPIRE
|
|
107
|
+
* answers a past-the-end page of an OR query with a leftover entry. A failed
|
|
108
|
+
* total request never fails the page: the page returns as INSPIRE sent it, with
|
|
109
|
+
* no `total`, unless the call was cancelled. Zero matches is an empty body and
|
|
110
|
+
* an empty `entries`.
|
|
66
111
|
*/
|
|
67
112
|
exportCitations(params: CitationExportParams, call: InspireCall): Promise<CitationExport>;
|
|
68
113
|
/**
|
|
@@ -77,8 +122,20 @@ export declare class InspireService {
|
|
|
77
122
|
* route) to the profile's recid and name. `undefined` when no profile matches.
|
|
78
123
|
*/
|
|
79
124
|
resolveAuthor(route: AuthorRoute, call: InspireCall): Promise<ResolvedAuthor | undefined>;
|
|
80
|
-
/**
|
|
81
|
-
|
|
125
|
+
/**
|
|
126
|
+
* INSPIRE's citation summary for a literature query under the given facet
|
|
127
|
+
* filters, and its citations-by-year series. The series facet honors `doc_type`
|
|
128
|
+
* and `subject` but ignores `earliest_date` and `exclude-self-citations`, so with
|
|
129
|
+
* a year bound or the self-citation exclusion set it is not requested (`skipped`,
|
|
130
|
+
* naming those filters). Otherwise both facets are requested in parallel, since
|
|
131
|
+
* one request keeps only its first `facet_name`; the series runs under its own
|
|
132
|
+
* 15 s budget inside the call's. A failure of the summary fails the call and
|
|
133
|
+
* abandons the series. When the summary counts more than `BROAD_SERIES_RECORDS`
|
|
134
|
+
* matches, the series is abandoned `BROAD_SERIES_CUT_MS` after the requests
|
|
135
|
+
* started unless it has landed (`too_broad`). Any other failure of the series
|
|
136
|
+
* returns the summary with the series `failed`; only a cancelled call rethrows.
|
|
137
|
+
*/
|
|
138
|
+
getCitationSummary(params: CitationSummaryParams, call: InspireCall): Promise<CitationSummaryLookup>;
|
|
82
139
|
/**
|
|
83
140
|
* Experiments, collaborations, and facilities by free text; a query of digits
|
|
84
141
|
* only is a recid (`control_number:<n>` — digits as free text match nothing).
|
|
@@ -86,12 +143,15 @@ export declare class InspireService {
|
|
|
86
143
|
searchExperiments(query: string, limit: number, call: InspireCall): Promise<ExperimentSearchPage>;
|
|
87
144
|
/** One page of HEPData records from INSPIRE's `data` collection. */
|
|
88
145
|
searchHepdata(params: HepdataSearchParams, call: InspireCall): Promise<HepdataSearchPage>;
|
|
146
|
+
/** One INSPIRE request whose body `parse` reads; see {@link InspireService.request}. */
|
|
147
|
+
private send;
|
|
89
148
|
/**
|
|
90
149
|
* One INSPIRE request inside the call's budget: retry (outside) around the
|
|
91
|
-
* pacer (inside) around fetch + status mapping, with `
|
|
92
|
-
* so an unreadable
|
|
150
|
+
* pacer (inside) around fetch + status mapping, with `read` inside the retry
|
|
151
|
+
* so an unreadable response is retried like a failed fetch. `exchange` sets the
|
|
152
|
+
* statuses returned to `read` and whether redirects are followed.
|
|
93
153
|
*/
|
|
94
|
-
private
|
|
154
|
+
private request;
|
|
95
155
|
/** One HTTP exchange; maps INSPIRE's 400 and 429 onto the shared contract reasons. */
|
|
96
156
|
private exchange;
|
|
97
157
|
}
|
|
@@ -99,6 +159,6 @@ export declare class InspireService {
|
|
|
99
159
|
export declare function initInspireService(config: AppConfig): void;
|
|
100
160
|
/** The initialized service. Throws when `initInspireService()` has not run. */
|
|
101
161
|
export declare function getInspireService(): InspireService;
|
|
102
|
-
/** Disposes the service's
|
|
162
|
+
/** Disposes the service's pacers; called from `createApp`'s `teardown()`. */
|
|
103
163
|
export declare function disposeInspireService(): void;
|
|
104
164
|
//# sourceMappingURL=inspire-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspire-service.d.ts","sourceRoot":"","sources":["../../../src/services/inspire/inspire-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,K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