@ncukondo/reference-manager 0.30.0 → 0.30.1
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/chunks/{SearchableMultiSelect-CpCrb-G1.js → SearchableMultiSelect-SOvTpKAU.js} +2 -2
- package/dist/chunks/{SearchableMultiSelect-CpCrb-G1.js.map → SearchableMultiSelect-SOvTpKAU.js.map} +1 -1
- package/dist/chunks/{action-menu-DwHspdjM.js → action-menu-DCZcb0HB.js} +3 -3
- package/dist/chunks/{action-menu-DwHspdjM.js.map → action-menu-DCZcb0HB.js.map} +1 -1
- package/dist/chunks/{checker-DhHnmgq0.js → checker-CxSG7cdw.js} +4 -4
- package/dist/chunks/{checker-DhHnmgq0.js.map → checker-CxSG7cdw.js.map} +1 -1
- package/dist/chunks/{crossref-client-DG4AA_Ax.js → crossref-client-CN2pRi3R.js} +2 -2
- package/dist/chunks/{crossref-client-DG4AA_Ax.js.map → crossref-client-CN2pRi3R.js.map} +1 -1
- package/dist/chunks/{fix-interaction-CIstlQZN.js → fix-interaction-C3OrF3yU.js} +5 -5
- package/dist/chunks/{fix-interaction-CIstlQZN.js.map → fix-interaction-C3OrF3yU.js.map} +1 -1
- package/dist/chunks/{index-C7BVI2qL.js → index-4w0pu_0o.js} +354 -232
- package/dist/chunks/index-4w0pu_0o.js.map +1 -0
- package/dist/chunks/{index-4KRTx7Fg.js → index-BZMfDG4M.js} +3 -3
- package/dist/chunks/index-BZMfDG4M.js.map +1 -0
- package/dist/chunks/{index-AvQ2XqcY.js → index-CA9y5wSm.js} +4 -4
- package/dist/chunks/{index-AvQ2XqcY.js.map → index-CA9y5wSm.js.map} +1 -1
- package/dist/chunks/{index-DoOmAYKd.js → index-C_mW5LMY.js} +459 -363
- package/dist/chunks/{index-DoOmAYKd.js.map → index-C_mW5LMY.js.map} +1 -1
- package/dist/chunks/{loader-6TuXzBbw.js → loader-BG2eomDC.js} +52 -3
- package/dist/chunks/loader-BG2eomDC.js.map +1 -0
- package/dist/chunks/{pubmed-client-CyaNS4Y1.js → pubmed-client-MF5gA6Os.js} +2 -2
- package/dist/chunks/{pubmed-client-CyaNS4Y1.js.map → pubmed-client-MF5gA6Os.js.map} +1 -1
- package/dist/chunks/{reference-select-CES2SpzK.js → reference-select-Bm-05R0u.js} +3 -3
- package/dist/chunks/{reference-select-CES2SpzK.js.map → reference-select-Bm-05R0u.js.map} +1 -1
- package/dist/chunks/{style-select-DrECo2bW.js → style-select-kfWjEg1X.js} +3 -3
- package/dist/chunks/{style-select-DrECo2bW.js.map → style-select-kfWjEg1X.js.map} +1 -1
- package/dist/cli/help/convert-help.d.ts +6 -0
- package/dist/cli/help/convert-help.d.ts.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/key-parser.d.ts +2 -0
- package/dist/config/key-parser.d.ts.map +1 -1
- package/dist/config/schema.d.ts +10 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/features/import/fetcher.d.ts +2 -1
- package/dist/features/import/fetcher.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/server.js +3 -3
- package/package.json +1 -1
- package/dist/chunks/index-4KRTx7Fg.js.map +0 -1
- package/dist/chunks/index-C7BVI2qL.js.map +0 -1
- package/dist/chunks/loader-6TuXzBbw.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Command, Option } from "commander";
|
|
2
|
+
import { n as normalizePathForOutput, d as deleteDirectoryIfEmpty, p as parseFilename, i as isReservedRole, e as ensureDirectory, a as addAttachment, R as RESERVED_ROLES, b as generateFilename, c as findFulltextFiles, h as findFulltextFile, j as extensionToFormat, k as fulltextAttach, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as fulltextGet, r as getExtension, s as getDefaultExportFromCjs, B as BUILTIN_STYLES, t as packageJson, u as getFulltextAttachmentTypes, v as startServerWithFileWatcher, w as BUILTIN_CONVERTER_NAMES, x as BUILTIN_CONVERTER_INFO } from "./index-C_mW5LMY.js";
|
|
2
3
|
import { i as isEqual, M as MANAGED_CUSTOM_FIELDS, w as writeFileAtomic, L as Library, h as CslItemSchema, p as pickDefined, a as sortOrderSchema, z as paginationOptionsSchema, F as FileWatcher, b as sortFieldSchema, y as searchSortFieldSchema } from "./file-watcher-CWHg1yol.js";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import { promises, readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
5
6
|
import * as os from "node:os";
|
|
6
7
|
import * as path from "node:path";
|
|
7
8
|
import path__default, { join, basename, dirname } from "node:path";
|
|
8
|
-
import { n as normalizePathForOutput, d as deleteDirectoryIfEmpty, p as parseFilename, i as isReservedRole, e as ensureDirectory, a as addAttachment, R as RESERVED_ROLES, b as generateFilename, c as findFulltextFiles, h as findFulltextFile, j as extensionToFormat, k as fulltextAttach, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as fulltextGet, r as getExtension, s as getDefaultExportFromCjs, B as BUILTIN_STYLES, t as getFulltextAttachmentTypes, u as startServerWithFileWatcher } from "./index-DoOmAYKd.js";
|
|
9
9
|
import { readFile, unlink, stat, readdir, rename } from "node:fs/promises";
|
|
10
|
-
import { o as openWithSystemApp, l as loadConfig, e as getDefaultCurrentDirConfigFilename, h as getDefaultUserConfigPath } from "./loader-
|
|
10
|
+
import { o as openWithSystemApp, l as loadConfig, e as getDefaultCurrentDirConfigFilename, h as getDefaultUserConfigPath } from "./loader-BG2eomDC.js";
|
|
11
11
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
12
|
import process$1, { stdin, stdout } from "node:process";
|
|
13
13
|
import * as readline from "node:readline";
|
|
@@ -18,14 +18,6 @@ import "@citation-js/core";
|
|
|
18
18
|
import "@citation-js/plugin-csl";
|
|
19
19
|
import { ZodOptional as ZodOptional$2, z } from "zod";
|
|
20
20
|
import { serve } from "@hono/node-server";
|
|
21
|
-
const name = "@ncukondo/reference-manager";
|
|
22
|
-
const version$1 = "0.30.0";
|
|
23
|
-
const description$1 = "A local reference management tool using CSL-JSON as the single source of truth";
|
|
24
|
-
const packageJson = {
|
|
25
|
-
name,
|
|
26
|
-
version: version$1,
|
|
27
|
-
description: description$1
|
|
28
|
-
};
|
|
29
21
|
const ISO_DATE_REGEX$1 = /^\d{4}(-\d{2})?(-\d{2})?$/;
|
|
30
22
|
function datePartsToIso(dateParts) {
|
|
31
23
|
if (!dateParts || dateParts.length === 0 || !dateParts[0]) {
|
|
@@ -901,15 +893,15 @@ class OperationsLibrary {
|
|
|
901
893
|
}
|
|
902
894
|
// High-level operations
|
|
903
895
|
async search(options) {
|
|
904
|
-
const { searchReferences } = await import("./index-
|
|
896
|
+
const { searchReferences } = await import("./index-C_mW5LMY.js").then((n) => n.H);
|
|
905
897
|
return searchReferences(this.library, options);
|
|
906
898
|
}
|
|
907
899
|
async list(options) {
|
|
908
|
-
const { listReferences } = await import("./index-
|
|
900
|
+
const { listReferences } = await import("./index-C_mW5LMY.js").then((n) => n.G);
|
|
909
901
|
return listReferences(this.library, options ?? {});
|
|
910
902
|
}
|
|
911
903
|
async cite(options) {
|
|
912
|
-
const { citeReferences } = await import("./index-
|
|
904
|
+
const { citeReferences } = await import("./index-C_mW5LMY.js").then((n) => n.F);
|
|
913
905
|
const defaultStyle = options.defaultStyle ?? this.citationConfig?.defaultStyle;
|
|
914
906
|
const cslDirectory = options.cslDirectory ?? this.citationConfig?.cslDirectory;
|
|
915
907
|
const mergedOptions = {
|
|
@@ -920,36 +912,36 @@ class OperationsLibrary {
|
|
|
920
912
|
return citeReferences(this.library, mergedOptions);
|
|
921
913
|
}
|
|
922
914
|
async import(inputs, options) {
|
|
923
|
-
const { addReferences } = await import("./index-
|
|
915
|
+
const { addReferences } = await import("./index-C_mW5LMY.js").then((n) => n.D);
|
|
924
916
|
return addReferences(inputs, this.library, options ?? {});
|
|
925
917
|
}
|
|
926
918
|
async check(options) {
|
|
927
|
-
const { checkReferences } = await import("./index-
|
|
919
|
+
const { checkReferences } = await import("./index-C_mW5LMY.js").then((n) => n.E);
|
|
928
920
|
return checkReferences(this.library, options);
|
|
929
921
|
}
|
|
930
922
|
// Attachment operations
|
|
931
923
|
async attachAdd(options) {
|
|
932
|
-
const { addAttachment: addAttachment2 } = await import("./index-
|
|
924
|
+
const { addAttachment: addAttachment2 } = await import("./index-BZMfDG4M.js");
|
|
933
925
|
return addAttachment2(this.library, options);
|
|
934
926
|
}
|
|
935
927
|
async attachList(options) {
|
|
936
|
-
const { listAttachments: listAttachments2 } = await import("./index-
|
|
928
|
+
const { listAttachments: listAttachments2 } = await import("./index-BZMfDG4M.js");
|
|
937
929
|
return listAttachments2(this.library, options);
|
|
938
930
|
}
|
|
939
931
|
async attachGet(options) {
|
|
940
|
-
const { getAttachment: getAttachment2 } = await import("./index-
|
|
932
|
+
const { getAttachment: getAttachment2 } = await import("./index-BZMfDG4M.js");
|
|
941
933
|
return getAttachment2(this.library, options);
|
|
942
934
|
}
|
|
943
935
|
async attachDetach(options) {
|
|
944
|
-
const { detachAttachment: detachAttachment2 } = await import("./index-
|
|
936
|
+
const { detachAttachment: detachAttachment2 } = await import("./index-BZMfDG4M.js");
|
|
945
937
|
return detachAttachment2(this.library, options);
|
|
946
938
|
}
|
|
947
939
|
async attachSync(options) {
|
|
948
|
-
const { syncAttachments: syncAttachments2 } = await import("./index-
|
|
940
|
+
const { syncAttachments: syncAttachments2 } = await import("./index-BZMfDG4M.js");
|
|
949
941
|
return syncAttachments2(this.library, options);
|
|
950
942
|
}
|
|
951
943
|
async attachOpen(options) {
|
|
952
|
-
const { openAttachment: openAttachment2 } = await import("./index-
|
|
944
|
+
const { openAttachment: openAttachment2 } = await import("./index-BZMfDG4M.js");
|
|
953
945
|
return openAttachment2(this.library, options);
|
|
954
946
|
}
|
|
955
947
|
}
|
|
@@ -1814,7 +1806,7 @@ function getAttachExitCode(result) {
|
|
|
1814
1806
|
}
|
|
1815
1807
|
async function executeInteractiveSelect$2(context, config2) {
|
|
1816
1808
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
1817
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
1809
|
+
const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
1818
1810
|
const allReferences = await context.library.getAll();
|
|
1819
1811
|
const identifiers = await withAlternateScreen2(
|
|
1820
1812
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -2479,7 +2471,7 @@ async function handleCheckAction(identifiers, options, globalOpts) {
|
|
|
2479
2471
|
const jsonOptions = buildJsonOptionsFromRefs(options, outputFormat, result, allRefs);
|
|
2480
2472
|
outputCheckResult(result, outputFormat, jsonOptions);
|
|
2481
2473
|
if (options.fix && result.summary.warnings > 0 && allRefs) {
|
|
2482
|
-
const { runFixInteraction } = await import("./fix-interaction-
|
|
2474
|
+
const { runFixInteraction } = await import("./fix-interaction-C3OrF3yU.js");
|
|
2483
2475
|
const findItem = (id2) => allRefs.find((item) => item.id === id2);
|
|
2484
2476
|
const fixResult = await runFixInteraction(result.results, context.library, findItem);
|
|
2485
2477
|
const removedSuffix = fixResult.removed.length > 0 ? `, ${fixResult.removed.length} removed` : "";
|
|
@@ -2547,7 +2539,7 @@ function outputCheckError(error, format2) {
|
|
|
2547
2539
|
}
|
|
2548
2540
|
async function selectReferencesInteractively(context, config2) {
|
|
2549
2541
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
2550
|
-
const { selectReferenceItemsOrExit } = await import("./reference-select-
|
|
2542
|
+
const { selectReferenceItemsOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
2551
2543
|
const allReferences = await context.library.getAll();
|
|
2552
2544
|
if (allReferences.length === 0) {
|
|
2553
2545
|
process.stderr.write("No references in library.\n");
|
|
@@ -2615,8 +2607,8 @@ function getCiteExitCode(result) {
|
|
|
2615
2607
|
}
|
|
2616
2608
|
async function executeInteractiveCite(options, context, config2) {
|
|
2617
2609
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
2618
|
-
const { runCiteFlow } = await import("./index-
|
|
2619
|
-
const { buildStyleChoices, listCustomStyles } = await import("./style-select-
|
|
2610
|
+
const { runCiteFlow } = await import("./index-CA9y5wSm.js");
|
|
2611
|
+
const { buildStyleChoices, listCustomStyles } = await import("./style-select-kfWjEg1X.js");
|
|
2620
2612
|
const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
|
|
2621
2613
|
const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
|
|
2622
2614
|
const { checkTTY } = await import("./tty-BMyaEOhX.js");
|
|
@@ -2790,6 +2782,21 @@ const CONFIG_KEY_REGISTRY = [
|
|
|
2790
2782
|
type: "boolean",
|
|
2791
2783
|
description: "Auto-fetch fulltext when adding references"
|
|
2792
2784
|
},
|
|
2785
|
+
{
|
|
2786
|
+
key: "fulltext.pdf_converter",
|
|
2787
|
+
type: "string",
|
|
2788
|
+
description: "PDF converter: auto, marker, docling, mineru, pymupdf, or custom name"
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
key: "fulltext.pdf_converter_priority",
|
|
2792
|
+
type: "string[]",
|
|
2793
|
+
description: "PDF converter auto-detection priority order"
|
|
2794
|
+
},
|
|
2795
|
+
{
|
|
2796
|
+
key: "fulltext.pdf_converter_timeout",
|
|
2797
|
+
type: "integer",
|
|
2798
|
+
description: "PDF converter timeout in seconds"
|
|
2799
|
+
},
|
|
2793
2800
|
{
|
|
2794
2801
|
key: "fulltext.sources.unpaywall_email",
|
|
2795
2802
|
type: "string",
|
|
@@ -2860,19 +2867,86 @@ const CONFIG_KEY_REGISTRY = [
|
|
|
2860
2867
|
// mcp section
|
|
2861
2868
|
{ key: "mcp.default_limit", type: "integer", description: "Default result limit for MCP" }
|
|
2862
2869
|
];
|
|
2870
|
+
const DYNAMIC_KEY_PATTERNS = [
|
|
2871
|
+
{
|
|
2872
|
+
key: "fulltext.converters.*.command",
|
|
2873
|
+
type: "string",
|
|
2874
|
+
description: "Shell command template for the converter"
|
|
2875
|
+
},
|
|
2876
|
+
{
|
|
2877
|
+
key: "fulltext.converters.*.output_mode",
|
|
2878
|
+
type: "enum",
|
|
2879
|
+
description: "Output mode",
|
|
2880
|
+
enumValues: ["file", "stdout"],
|
|
2881
|
+
optional: true
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
key: "fulltext.converters.*.check_command",
|
|
2885
|
+
type: "string",
|
|
2886
|
+
description: "Command to check converter availability",
|
|
2887
|
+
optional: true
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
key: "fulltext.converters.*.timeout",
|
|
2891
|
+
type: "integer",
|
|
2892
|
+
description: "Converter timeout in seconds",
|
|
2893
|
+
optional: true
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
key: "fulltext.converters.*.progress",
|
|
2897
|
+
type: "enum",
|
|
2898
|
+
description: "Progress display mode",
|
|
2899
|
+
enumValues: ["inherit", "quiet"],
|
|
2900
|
+
optional: true
|
|
2901
|
+
},
|
|
2902
|
+
{
|
|
2903
|
+
key: "fulltext.converters.*.command_windows",
|
|
2904
|
+
type: "string",
|
|
2905
|
+
description: "Windows-specific command template",
|
|
2906
|
+
optional: true
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
key: "fulltext.converters.*.check_command_windows",
|
|
2910
|
+
type: "string",
|
|
2911
|
+
description: "Windows-specific availability check command",
|
|
2912
|
+
optional: true
|
|
2913
|
+
}
|
|
2914
|
+
];
|
|
2915
|
+
const DYNAMIC_PATTERN_MAP = new Map(
|
|
2916
|
+
DYNAMIC_KEY_PATTERNS.map((info) => [info.key, info])
|
|
2917
|
+
);
|
|
2863
2918
|
const KEY_MAP = new Map(CONFIG_KEY_REGISTRY.map((info) => [info.key, info]));
|
|
2864
2919
|
let allKeysCache = null;
|
|
2865
2920
|
function parseConfigKey(key) {
|
|
2866
2921
|
return key.split(".");
|
|
2867
2922
|
}
|
|
2923
|
+
function toDynamicPattern(key) {
|
|
2924
|
+
const segments = key.split(".");
|
|
2925
|
+
if (segments.length >= 4 && segments[0] === "fulltext" && segments[1] === "converters") {
|
|
2926
|
+
return `${segments[0]}.${segments[1]}.*.${segments.slice(3).join(".")}`;
|
|
2927
|
+
}
|
|
2928
|
+
return null;
|
|
2929
|
+
}
|
|
2868
2930
|
function isValidConfigKey(key) {
|
|
2869
2931
|
if (!key) {
|
|
2870
2932
|
return false;
|
|
2871
2933
|
}
|
|
2872
|
-
|
|
2934
|
+
if (KEY_MAP.has(key)) {
|
|
2935
|
+
return true;
|
|
2936
|
+
}
|
|
2937
|
+
const pattern2 = toDynamicPattern(key);
|
|
2938
|
+
return pattern2 !== null && DYNAMIC_PATTERN_MAP.has(pattern2);
|
|
2873
2939
|
}
|
|
2874
2940
|
function getConfigKeyInfo(key) {
|
|
2875
|
-
|
|
2941
|
+
const info = KEY_MAP.get(key);
|
|
2942
|
+
if (info) {
|
|
2943
|
+
return info;
|
|
2944
|
+
}
|
|
2945
|
+
const pattern2 = toDynamicPattern(key);
|
|
2946
|
+
if (pattern2) {
|
|
2947
|
+
return DYNAMIC_PATTERN_MAP.get(pattern2) ?? null;
|
|
2948
|
+
}
|
|
2949
|
+
return null;
|
|
2876
2950
|
}
|
|
2877
2951
|
function getAllConfigKeys(section) {
|
|
2878
2952
|
if (!allKeysCache) {
|
|
@@ -3896,8 +3970,8 @@ function requireReactJsxRuntime_development() {
|
|
|
3896
3970
|
if ("object" === typeof type2 && null !== type2 && type2.$$typeof === REACT_LAZY_TYPE)
|
|
3897
3971
|
return "<...>";
|
|
3898
3972
|
try {
|
|
3899
|
-
var
|
|
3900
|
-
return
|
|
3973
|
+
var name = getComponentNameFromType(type2);
|
|
3974
|
+
return name ? "<" + name + ">" : "<...>";
|
|
3901
3975
|
} catch (x) {
|
|
3902
3976
|
return "<...>";
|
|
3903
3977
|
}
|
|
@@ -4391,9 +4465,9 @@ function compileStyleAliases(map2) {
|
|
|
4391
4465
|
}
|
|
4392
4466
|
function Type$1(tag, options) {
|
|
4393
4467
|
options = options || {};
|
|
4394
|
-
Object.keys(options).forEach(function(
|
|
4395
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(
|
|
4396
|
-
throw new exception('Unknown option "' +
|
|
4468
|
+
Object.keys(options).forEach(function(name) {
|
|
4469
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
4470
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
4397
4471
|
}
|
|
4398
4472
|
});
|
|
4399
4473
|
this.options = options;
|
|
@@ -4417,9 +4491,9 @@ function Type$1(tag, options) {
|
|
|
4417
4491
|
}
|
|
4418
4492
|
}
|
|
4419
4493
|
var type$2 = Type$1;
|
|
4420
|
-
function compileList(schema2,
|
|
4494
|
+
function compileList(schema2, name) {
|
|
4421
4495
|
var result = [];
|
|
4422
|
-
schema2[
|
|
4496
|
+
schema2[name].forEach(function(currentType) {
|
|
4423
4497
|
var newIndex = result.length;
|
|
4424
4498
|
result.forEach(function(previousType, previousIndex) {
|
|
4425
4499
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -5133,7 +5207,7 @@ function throwWarning(state, message) {
|
|
|
5133
5207
|
}
|
|
5134
5208
|
}
|
|
5135
5209
|
var directiveHandlers = {
|
|
5136
|
-
YAML: function handleYamlDirective(state,
|
|
5210
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
5137
5211
|
var match, major, minor;
|
|
5138
5212
|
if (state.version !== null) {
|
|
5139
5213
|
throwError(state, "duplication of %YAML directive");
|
|
@@ -5156,7 +5230,7 @@ var directiveHandlers = {
|
|
|
5156
5230
|
throwWarning(state, "unsupported YAML version of the document");
|
|
5157
5231
|
}
|
|
5158
5232
|
},
|
|
5159
|
-
TAG: function handleTagDirective(state,
|
|
5233
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
5160
5234
|
var handle, prefix;
|
|
5161
5235
|
if (args.length !== 2) {
|
|
5162
5236
|
throwError(state, "TAG directive accepts exactly two arguments");
|
|
@@ -7217,7 +7291,7 @@ function formatEditOutput(result) {
|
|
|
7217
7291
|
}
|
|
7218
7292
|
async function executeInteractiveEdit(options, context, config2) {
|
|
7219
7293
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
7220
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
7294
|
+
const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
7221
7295
|
const allReferences = await context.library.getAll();
|
|
7222
7296
|
const identifiers = await withAlternateScreen2(
|
|
7223
7297
|
() => selectReferencesOrExit(allReferences, { multiSelect: true }, config2.cli.tui)
|
|
@@ -7476,8 +7550,8 @@ class Directives {
|
|
|
7476
7550
|
this.atNextDocument = false;
|
|
7477
7551
|
}
|
|
7478
7552
|
const parts = line.trim().split(/[ \t]+/);
|
|
7479
|
-
const
|
|
7480
|
-
switch (
|
|
7553
|
+
const name = parts.shift();
|
|
7554
|
+
switch (name) {
|
|
7481
7555
|
case "%TAG": {
|
|
7482
7556
|
if (parts.length !== 2) {
|
|
7483
7557
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
@@ -7505,7 +7579,7 @@ class Directives {
|
|
|
7505
7579
|
}
|
|
7506
7580
|
}
|
|
7507
7581
|
default:
|
|
7508
|
-
onError(0, `Unknown directive ${
|
|
7582
|
+
onError(0, `Unknown directive ${name}`, true);
|
|
7509
7583
|
return false;
|
|
7510
7584
|
}
|
|
7511
7585
|
}
|
|
@@ -7604,9 +7678,9 @@ function anchorNames(root) {
|
|
|
7604
7678
|
}
|
|
7605
7679
|
function findNewAnchor(prefix, exclude) {
|
|
7606
7680
|
for (let i = 1; true; ++i) {
|
|
7607
|
-
const
|
|
7608
|
-
if (!exclude.has(
|
|
7609
|
-
return
|
|
7681
|
+
const name = `${prefix}${i}`;
|
|
7682
|
+
if (!exclude.has(name))
|
|
7683
|
+
return name;
|
|
7610
7684
|
}
|
|
7611
7685
|
}
|
|
7612
7686
|
function createNodeAnchors(doc, prefix) {
|
|
@@ -8515,8 +8589,8 @@ function getTagObject(tags, item) {
|
|
|
8515
8589
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
8516
8590
|
}
|
|
8517
8591
|
if (!tagObj) {
|
|
8518
|
-
const
|
|
8519
|
-
throw new Error(`Tag not resolved for ${
|
|
8592
|
+
const name = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
|
|
8593
|
+
throw new Error(`Tag not resolved for ${name} value`);
|
|
8520
8594
|
}
|
|
8521
8595
|
return tagObj;
|
|
8522
8596
|
}
|
|
@@ -10104,11 +10178,11 @@ class Document {
|
|
|
10104
10178
|
* `name` will be used as a prefix for a new unique anchor.
|
|
10105
10179
|
* If `name` is undefined, the generated anchor will use 'a' as a prefix.
|
|
10106
10180
|
*/
|
|
10107
|
-
createAlias(node,
|
|
10181
|
+
createAlias(node, name) {
|
|
10108
10182
|
if (!node.anchor) {
|
|
10109
10183
|
const prev = anchorNames(this);
|
|
10110
10184
|
node.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
10111
|
-
!
|
|
10185
|
+
!name || prev.has(name) ? findNewAnchor(name || "a", prev) : name;
|
|
10112
10186
|
}
|
|
10113
10187
|
return new Alias(node.anchor);
|
|
10114
10188
|
}
|
|
@@ -10362,8 +10436,8 @@ function formatBibtexAuthor(author) {
|
|
|
10362
10436
|
function formatBibtexAuthors(authors) {
|
|
10363
10437
|
return authors.map(formatBibtexAuthor).join(" and ");
|
|
10364
10438
|
}
|
|
10365
|
-
function formatField(
|
|
10366
|
-
return ` ${
|
|
10439
|
+
function formatField(name, value) {
|
|
10440
|
+
return ` ${name} = {${value}},`;
|
|
10367
10441
|
}
|
|
10368
10442
|
function addBasicFields(lines, item) {
|
|
10369
10443
|
if (item.title) {
|
|
@@ -10793,7 +10867,7 @@ function getFulltextExitCode(result) {
|
|
|
10793
10867
|
}
|
|
10794
10868
|
async function executeInteractiveSelect$1(context, config2, multiSelect = false) {
|
|
10795
10869
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
10796
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
10870
|
+
const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
10797
10871
|
const allReferences = await context.library.getAll();
|
|
10798
10872
|
const identifiers = await withAlternateScreen2(
|
|
10799
10873
|
() => selectReferencesOrExit(allReferences, { multiSelect }, config2.cli.tui)
|
|
@@ -14989,7 +15063,7 @@ ZodEnum$1.create;
|
|
|
14989
15063
|
ZodPromise.create;
|
|
14990
15064
|
ZodOptional$1.create;
|
|
14991
15065
|
ZodNullable$1.create;
|
|
14992
|
-
function $constructor(
|
|
15066
|
+
function $constructor(name, initializer2, params) {
|
|
14993
15067
|
function init(inst, def) {
|
|
14994
15068
|
if (!inst._zod) {
|
|
14995
15069
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -15001,10 +15075,10 @@ function $constructor(name2, initializer2, params) {
|
|
|
15001
15075
|
enumerable: false
|
|
15002
15076
|
});
|
|
15003
15077
|
}
|
|
15004
|
-
if (inst._zod.traits.has(
|
|
15078
|
+
if (inst._zod.traits.has(name)) {
|
|
15005
15079
|
return;
|
|
15006
15080
|
}
|
|
15007
|
-
inst._zod.traits.add(
|
|
15081
|
+
inst._zod.traits.add(name);
|
|
15008
15082
|
initializer2(inst, def);
|
|
15009
15083
|
const proto = _.prototype;
|
|
15010
15084
|
const keys = Object.keys(proto);
|
|
@@ -15018,7 +15092,7 @@ function $constructor(name2, initializer2, params) {
|
|
|
15018
15092
|
const Parent = params?.Parent ?? Object;
|
|
15019
15093
|
class Definition extends Parent {
|
|
15020
15094
|
}
|
|
15021
|
-
Object.defineProperty(Definition, "name", { value:
|
|
15095
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
15022
15096
|
function _(def) {
|
|
15023
15097
|
var _a2;
|
|
15024
15098
|
const inst = params?.Parent ? new Definition() : this;
|
|
@@ -15034,10 +15108,10 @@ function $constructor(name2, initializer2, params) {
|
|
|
15034
15108
|
value: (inst) => {
|
|
15035
15109
|
if (params?.Parent && inst instanceof params.Parent)
|
|
15036
15110
|
return true;
|
|
15037
|
-
return inst?._zod?.traits?.has(
|
|
15111
|
+
return inst?._zod?.traits?.has(name);
|
|
15038
15112
|
}
|
|
15039
15113
|
});
|
|
15040
|
-
Object.defineProperty(_, "name", { value:
|
|
15114
|
+
Object.defineProperty(_, "name", { value: name });
|
|
15041
15115
|
return _;
|
|
15042
15116
|
}
|
|
15043
15117
|
class $ZodAsyncError extends Error {
|
|
@@ -15046,8 +15120,8 @@ class $ZodAsyncError extends Error {
|
|
|
15046
15120
|
}
|
|
15047
15121
|
}
|
|
15048
15122
|
class $ZodEncodeError extends Error {
|
|
15049
|
-
constructor(
|
|
15050
|
-
super(`Encountered unidirectional transform during encode: ${
|
|
15123
|
+
constructor(name) {
|
|
15124
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
15051
15125
|
this.name = "ZodEncodeError";
|
|
15052
15126
|
}
|
|
15053
15127
|
}
|
|
@@ -21060,11 +21134,11 @@ const getRefs = (options) => {
|
|
|
21060
21134
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
21061
21135
|
currentPath,
|
|
21062
21136
|
propertyPath: void 0,
|
|
21063
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
21137
|
+
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
21064
21138
|
def._def,
|
|
21065
21139
|
{
|
|
21066
21140
|
def: def._def,
|
|
21067
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
21141
|
+
path: [..._options.basePath, _options.definitionPath, name],
|
|
21068
21142
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
21069
21143
|
jsonSchema: void 0
|
|
21070
21144
|
}
|
|
@@ -22165,17 +22239,17 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
22165
22239
|
};
|
|
22166
22240
|
const zodToJsonSchema = (schema2, options) => {
|
|
22167
22241
|
const refs = getRefs(options);
|
|
22168
|
-
let definitions2 = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [
|
|
22242
|
+
let definitions2 = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
22169
22243
|
...acc,
|
|
22170
|
-
[
|
|
22244
|
+
[name2]: parseDef(schema3._def, {
|
|
22171
22245
|
...refs,
|
|
22172
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
22246
|
+
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
22173
22247
|
}, true) ?? parseAnyDef(refs)
|
|
22174
22248
|
}), {}) : void 0;
|
|
22175
|
-
const
|
|
22176
|
-
const main2 = parseDef(schema2._def,
|
|
22249
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
22250
|
+
const main2 = parseDef(schema2._def, name === void 0 ? refs : {
|
|
22177
22251
|
...refs,
|
|
22178
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
22252
|
+
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
22179
22253
|
}, false) ?? parseAnyDef(refs);
|
|
22180
22254
|
const title2 = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
22181
22255
|
if (title2 !== void 0) {
|
|
@@ -22199,18 +22273,18 @@ const zodToJsonSchema = (schema2, options) => {
|
|
|
22199
22273
|
};
|
|
22200
22274
|
}
|
|
22201
22275
|
}
|
|
22202
|
-
const combined =
|
|
22276
|
+
const combined = name === void 0 ? definitions2 ? {
|
|
22203
22277
|
...main2,
|
|
22204
22278
|
[refs.definitionPath]: definitions2
|
|
22205
22279
|
} : main2 : {
|
|
22206
22280
|
$ref: [
|
|
22207
22281
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
22208
22282
|
refs.definitionPath,
|
|
22209
|
-
|
|
22283
|
+
name
|
|
22210
22284
|
].join("/"),
|
|
22211
22285
|
[refs.definitionPath]: {
|
|
22212
22286
|
...definitions2,
|
|
22213
|
-
[
|
|
22287
|
+
[name]: main2
|
|
22214
22288
|
}
|
|
22215
22289
|
};
|
|
22216
22290
|
if (refs.target === "jsonSchema7") {
|
|
@@ -23369,9 +23443,9 @@ function requireScope() {
|
|
|
23369
23443
|
exports$1.ValueScope = exports$1.ValueScopeName = exports$1.Scope = exports$1.varKinds = exports$1.UsedValueState = void 0;
|
|
23370
23444
|
const code_1 = requireCode$1();
|
|
23371
23445
|
class ValueError extends Error {
|
|
23372
|
-
constructor(
|
|
23373
|
-
super(`CodeGen: "code" for ${
|
|
23374
|
-
this.value =
|
|
23446
|
+
constructor(name) {
|
|
23447
|
+
super(`CodeGen: "code" for ${name} not defined`);
|
|
23448
|
+
this.value = name.value;
|
|
23375
23449
|
}
|
|
23376
23450
|
}
|
|
23377
23451
|
var UsedValueState;
|
|
@@ -23438,8 +23512,8 @@ function requireScope() {
|
|
|
23438
23512
|
var _a2;
|
|
23439
23513
|
if (value.ref === void 0)
|
|
23440
23514
|
throw new Error("CodeGen: ref must be passed in value");
|
|
23441
|
-
const
|
|
23442
|
-
const { prefix } =
|
|
23515
|
+
const name = this.toName(nameOrPrefix);
|
|
23516
|
+
const { prefix } = name;
|
|
23443
23517
|
const valueKey = (_a2 = value.key) !== null && _a2 !== void 0 ? _a2 : value.ref;
|
|
23444
23518
|
let vs = this._values[prefix];
|
|
23445
23519
|
if (vs) {
|
|
@@ -23449,12 +23523,12 @@ function requireScope() {
|
|
|
23449
23523
|
} else {
|
|
23450
23524
|
vs = this._values[prefix] = /* @__PURE__ */ new Map();
|
|
23451
23525
|
}
|
|
23452
|
-
vs.set(valueKey,
|
|
23526
|
+
vs.set(valueKey, name);
|
|
23453
23527
|
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
|
23454
23528
|
const itemIndex = s.length;
|
|
23455
23529
|
s[itemIndex] = value.ref;
|
|
23456
|
-
|
|
23457
|
-
return
|
|
23530
|
+
name.setValue(value, { property: prefix, itemIndex });
|
|
23531
|
+
return name;
|
|
23458
23532
|
}
|
|
23459
23533
|
getValue(prefix, keyOrRef) {
|
|
23460
23534
|
const vs = this._values[prefix];
|
|
@@ -23463,17 +23537,17 @@ function requireScope() {
|
|
|
23463
23537
|
return vs.get(keyOrRef);
|
|
23464
23538
|
}
|
|
23465
23539
|
scopeRefs(scopeName, values = this._values) {
|
|
23466
|
-
return this._reduceValues(values, (
|
|
23467
|
-
if (
|
|
23468
|
-
throw new Error(`CodeGen: name "${
|
|
23469
|
-
return (0, code_1._)`${scopeName}${
|
|
23540
|
+
return this._reduceValues(values, (name) => {
|
|
23541
|
+
if (name.scopePath === void 0)
|
|
23542
|
+
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
23543
|
+
return (0, code_1._)`${scopeName}${name.scopePath}`;
|
|
23470
23544
|
});
|
|
23471
23545
|
}
|
|
23472
23546
|
scopeCode(values = this._values, usedValues, getCode) {
|
|
23473
|
-
return this._reduceValues(values, (
|
|
23474
|
-
if (
|
|
23475
|
-
throw new Error(`CodeGen: name "${
|
|
23476
|
-
return
|
|
23547
|
+
return this._reduceValues(values, (name) => {
|
|
23548
|
+
if (name.value === void 0)
|
|
23549
|
+
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
23550
|
+
return name.value.code;
|
|
23477
23551
|
}, usedValues, getCode);
|
|
23478
23552
|
}
|
|
23479
23553
|
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
|
@@ -23483,20 +23557,20 @@ function requireScope() {
|
|
|
23483
23557
|
if (!vs)
|
|
23484
23558
|
continue;
|
|
23485
23559
|
const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
|
|
23486
|
-
vs.forEach((
|
|
23487
|
-
if (nameSet.has(
|
|
23560
|
+
vs.forEach((name) => {
|
|
23561
|
+
if (nameSet.has(name))
|
|
23488
23562
|
return;
|
|
23489
|
-
nameSet.set(
|
|
23490
|
-
let c = valueCode(
|
|
23563
|
+
nameSet.set(name, UsedValueState.Started);
|
|
23564
|
+
let c = valueCode(name);
|
|
23491
23565
|
if (c) {
|
|
23492
23566
|
const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
|
|
23493
|
-
code2 = (0, code_1._)`${code2}${def} ${
|
|
23494
|
-
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(
|
|
23567
|
+
code2 = (0, code_1._)`${code2}${def} ${name} = ${c};${this.opts._n}`;
|
|
23568
|
+
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) {
|
|
23495
23569
|
code2 = (0, code_1._)`${code2}${c}${this.opts._n}`;
|
|
23496
23570
|
} else {
|
|
23497
|
-
throw new ValueError(
|
|
23571
|
+
throw new ValueError(name);
|
|
23498
23572
|
}
|
|
23499
|
-
nameSet.set(
|
|
23573
|
+
nameSet.set(name, UsedValueState.Completed);
|
|
23500
23574
|
});
|
|
23501
23575
|
}
|
|
23502
23576
|
return code2;
|
|
@@ -23574,10 +23648,10 @@ function requireCodegen() {
|
|
|
23574
23648
|
}
|
|
23575
23649
|
}
|
|
23576
23650
|
class Def extends Node {
|
|
23577
|
-
constructor(varKind,
|
|
23651
|
+
constructor(varKind, name, rhs) {
|
|
23578
23652
|
super();
|
|
23579
23653
|
this.varKind = varKind;
|
|
23580
|
-
this.name =
|
|
23654
|
+
this.name = name;
|
|
23581
23655
|
this.rhs = rhs;
|
|
23582
23656
|
}
|
|
23583
23657
|
render({ es5, _n }) {
|
|
@@ -23797,17 +23871,17 @@ function requireCodegen() {
|
|
|
23797
23871
|
}
|
|
23798
23872
|
}
|
|
23799
23873
|
class ForRange extends For {
|
|
23800
|
-
constructor(varKind,
|
|
23874
|
+
constructor(varKind, name, from, to) {
|
|
23801
23875
|
super();
|
|
23802
23876
|
this.varKind = varKind;
|
|
23803
|
-
this.name =
|
|
23877
|
+
this.name = name;
|
|
23804
23878
|
this.from = from;
|
|
23805
23879
|
this.to = to;
|
|
23806
23880
|
}
|
|
23807
23881
|
render(opts) {
|
|
23808
23882
|
const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
|
|
23809
|
-
const { name
|
|
23810
|
-
return `for(${varKind} ${
|
|
23883
|
+
const { name, from, to } = this;
|
|
23884
|
+
return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
|
|
23811
23885
|
}
|
|
23812
23886
|
get names() {
|
|
23813
23887
|
const names2 = addExprNames(super.names, this.from);
|
|
@@ -23815,11 +23889,11 @@ function requireCodegen() {
|
|
|
23815
23889
|
}
|
|
23816
23890
|
}
|
|
23817
23891
|
class ForIter extends For {
|
|
23818
|
-
constructor(loop, varKind,
|
|
23892
|
+
constructor(loop, varKind, name, iterable) {
|
|
23819
23893
|
super();
|
|
23820
23894
|
this.loop = loop;
|
|
23821
23895
|
this.varKind = varKind;
|
|
23822
|
-
this.name =
|
|
23896
|
+
this.name = name;
|
|
23823
23897
|
this.iterable = iterable;
|
|
23824
23898
|
}
|
|
23825
23899
|
render(opts) {
|
|
@@ -23836,9 +23910,9 @@ function requireCodegen() {
|
|
|
23836
23910
|
}
|
|
23837
23911
|
}
|
|
23838
23912
|
class Func extends BlockNode {
|
|
23839
|
-
constructor(
|
|
23913
|
+
constructor(name, args, async) {
|
|
23840
23914
|
super();
|
|
23841
|
-
this.name =
|
|
23915
|
+
this.name = name;
|
|
23842
23916
|
this.args = args;
|
|
23843
23917
|
this.async = async;
|
|
23844
23918
|
}
|
|
@@ -23925,10 +23999,10 @@ function requireCodegen() {
|
|
|
23925
23999
|
}
|
|
23926
24000
|
// reserves unique name in the external scope and assigns value to it
|
|
23927
24001
|
scopeValue(prefixOrName, value) {
|
|
23928
|
-
const
|
|
23929
|
-
const vs = this._values[
|
|
23930
|
-
vs.add(
|
|
23931
|
-
return
|
|
24002
|
+
const name = this._extScope.value(prefixOrName, value);
|
|
24003
|
+
const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set());
|
|
24004
|
+
vs.add(name);
|
|
24005
|
+
return name;
|
|
23932
24006
|
}
|
|
23933
24007
|
getScopeValue(prefix, keyOrRef) {
|
|
23934
24008
|
return this._extScope.getValue(prefix, keyOrRef);
|
|
@@ -23942,11 +24016,11 @@ function requireCodegen() {
|
|
|
23942
24016
|
return this._extScope.scopeCode(this._values);
|
|
23943
24017
|
}
|
|
23944
24018
|
_def(varKind, nameOrPrefix, rhs, constant) {
|
|
23945
|
-
const
|
|
24019
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
23946
24020
|
if (rhs !== void 0 && constant)
|
|
23947
|
-
this._constants[
|
|
23948
|
-
this._leafNode(new Def(varKind,
|
|
23949
|
-
return
|
|
24021
|
+
this._constants[name.str] = rhs;
|
|
24022
|
+
this._leafNode(new Def(varKind, name, rhs));
|
|
24023
|
+
return name;
|
|
23950
24024
|
}
|
|
23951
24025
|
// `const` declaration (`var` in es5 mode)
|
|
23952
24026
|
const(nameOrPrefix, rhs, _constant) {
|
|
@@ -24027,20 +24101,20 @@ function requireCodegen() {
|
|
|
24027
24101
|
}
|
|
24028
24102
|
// `for` statement for a range of values
|
|
24029
24103
|
forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
|
|
24030
|
-
const
|
|
24031
|
-
return this._for(new ForRange(varKind,
|
|
24104
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24105
|
+
return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
|
|
24032
24106
|
}
|
|
24033
24107
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
24034
24108
|
forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
|
|
24035
|
-
const
|
|
24109
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24036
24110
|
if (this.opts.es5) {
|
|
24037
24111
|
const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
|
|
24038
24112
|
return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
|
|
24039
|
-
this.var(
|
|
24040
|
-
forBody(
|
|
24113
|
+
this.var(name, (0, code_1._)`${arr}[${i}]`);
|
|
24114
|
+
forBody(name);
|
|
24041
24115
|
});
|
|
24042
24116
|
}
|
|
24043
|
-
return this._for(new ForIter("of", varKind,
|
|
24117
|
+
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
|
|
24044
24118
|
}
|
|
24045
24119
|
// `for-in` statement.
|
|
24046
24120
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
@@ -24048,8 +24122,8 @@ function requireCodegen() {
|
|
|
24048
24122
|
if (this.opts.ownProperties) {
|
|
24049
24123
|
return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
|
|
24050
24124
|
}
|
|
24051
|
-
const
|
|
24052
|
-
return this._for(new ForIter("in", varKind,
|
|
24125
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24126
|
+
return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
|
|
24053
24127
|
}
|
|
24054
24128
|
// end `for` loop
|
|
24055
24129
|
endFor() {
|
|
@@ -24114,8 +24188,8 @@ function requireCodegen() {
|
|
|
24114
24188
|
return this;
|
|
24115
24189
|
}
|
|
24116
24190
|
// `function` heading (or definition if funcBody is passed)
|
|
24117
|
-
func(
|
|
24118
|
-
this._blockNode(new Func(
|
|
24191
|
+
func(name, args = code_1.nil, async, funcBody) {
|
|
24192
|
+
this._blockNode(new Func(name, args, async));
|
|
24119
24193
|
if (funcBody)
|
|
24120
24194
|
this.code(funcBody).endFunc();
|
|
24121
24195
|
return this;
|
|
@@ -26548,10 +26622,10 @@ function requireSchemes() {
|
|
|
26548
26622
|
"urn:uuid"
|
|
26549
26623
|
]
|
|
26550
26624
|
);
|
|
26551
|
-
function isValidSchemeName(
|
|
26625
|
+
function isValidSchemeName(name) {
|
|
26552
26626
|
return supportedSchemeNames.indexOf(
|
|
26553
26627
|
/** @type {*} */
|
|
26554
|
-
|
|
26628
|
+
name
|
|
26555
26629
|
) !== -1;
|
|
26556
26630
|
}
|
|
26557
26631
|
function wsIsSecure(wsComponent) {
|
|
@@ -27388,10 +27462,10 @@ function requireCore$1() {
|
|
|
27388
27462
|
return this;
|
|
27389
27463
|
}
|
|
27390
27464
|
// Add format
|
|
27391
|
-
addFormat(
|
|
27465
|
+
addFormat(name, format2) {
|
|
27392
27466
|
if (typeof format2 == "string")
|
|
27393
27467
|
format2 = new RegExp(format2);
|
|
27394
|
-
this.formats[
|
|
27468
|
+
this.formats[name] = format2;
|
|
27395
27469
|
return this;
|
|
27396
27470
|
}
|
|
27397
27471
|
errorsText(errors2 = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
@@ -27508,10 +27582,10 @@ function requireCore$1() {
|
|
|
27508
27582
|
this.addSchema(optsSchemas[key], key);
|
|
27509
27583
|
}
|
|
27510
27584
|
function addInitialFormats() {
|
|
27511
|
-
for (const
|
|
27512
|
-
const format2 = this.opts.formats[
|
|
27585
|
+
for (const name in this.opts.formats) {
|
|
27586
|
+
const format2 = this.opts.formats[name];
|
|
27513
27587
|
if (format2)
|
|
27514
|
-
this.addFormat(
|
|
27588
|
+
this.addFormat(name, format2);
|
|
27515
27589
|
}
|
|
27516
27590
|
}
|
|
27517
27591
|
function addInitialKeywords(defs) {
|
|
@@ -29811,11 +29885,11 @@ function requireDist() {
|
|
|
29811
29885
|
(0, limit_1.default)(ajv2);
|
|
29812
29886
|
return ajv2;
|
|
29813
29887
|
};
|
|
29814
|
-
formatsPlugin.get = (
|
|
29888
|
+
formatsPlugin.get = (name, mode = "full") => {
|
|
29815
29889
|
const formats2 = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
|
|
29816
|
-
const f = formats2[
|
|
29890
|
+
const f = formats2[name];
|
|
29817
29891
|
if (!f)
|
|
29818
|
-
throw new Error(`Unknown format "${
|
|
29892
|
+
throw new Error(`Unknown format "${name}"`);
|
|
29819
29893
|
return f;
|
|
29820
29894
|
};
|
|
29821
29895
|
function addFormats(ajv2, list, fs2, exportName) {
|
|
@@ -30428,11 +30502,11 @@ class UriTemplate {
|
|
|
30428
30502
|
const operator = this.getOperator(expr);
|
|
30429
30503
|
const exploded = expr.includes("*");
|
|
30430
30504
|
const names2 = this.getNames(expr);
|
|
30431
|
-
const
|
|
30432
|
-
for (const
|
|
30433
|
-
UriTemplate.validateLength(
|
|
30505
|
+
const name = names2[0];
|
|
30506
|
+
for (const name2 of names2) {
|
|
30507
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
30434
30508
|
}
|
|
30435
|
-
parts.push({ name
|
|
30509
|
+
parts.push({ name, operator, names: names2, exploded });
|
|
30436
30510
|
i = end + 1;
|
|
30437
30511
|
} else {
|
|
30438
30512
|
currentText += template[i];
|
|
@@ -30450,7 +30524,7 @@ class UriTemplate {
|
|
|
30450
30524
|
}
|
|
30451
30525
|
getNames(expr) {
|
|
30452
30526
|
const operator = this.getOperator(expr);
|
|
30453
|
-
return expr.slice(operator.length).split(",").map((
|
|
30527
|
+
return expr.slice(operator.length).split(",").map((name) => name.replace("*", "").trim()).filter((name) => name.length > 0);
|
|
30454
30528
|
}
|
|
30455
30529
|
encodeValue(value, operator) {
|
|
30456
30530
|
UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, "Variable value");
|
|
@@ -30461,12 +30535,12 @@ class UriTemplate {
|
|
|
30461
30535
|
}
|
|
30462
30536
|
expandPart(part, variables) {
|
|
30463
30537
|
if (part.operator === "?" || part.operator === "&") {
|
|
30464
|
-
const pairs2 = part.names.map((
|
|
30465
|
-
const value2 = variables[
|
|
30538
|
+
const pairs2 = part.names.map((name) => {
|
|
30539
|
+
const value2 = variables[name];
|
|
30466
30540
|
if (value2 === void 0)
|
|
30467
30541
|
return "";
|
|
30468
30542
|
const encoded2 = Array.isArray(value2) ? value2.map((v) => this.encodeValue(v, part.operator)).join(",") : this.encodeValue(value2.toString(), part.operator);
|
|
30469
|
-
return `${
|
|
30543
|
+
return `${name}=${encoded2}`;
|
|
30470
30544
|
}).filter((pair) => pair.length > 0);
|
|
30471
30545
|
if (pairs2.length === 0)
|
|
30472
30546
|
return "";
|
|
@@ -30474,7 +30548,7 @@ class UriTemplate {
|
|
|
30474
30548
|
return separator + pairs2.join("&");
|
|
30475
30549
|
}
|
|
30476
30550
|
if (part.names.length > 1) {
|
|
30477
|
-
const values2 = part.names.map((
|
|
30551
|
+
const values2 = part.names.map((name) => variables[name]).filter((v) => v !== void 0);
|
|
30478
30552
|
if (values2.length === 0)
|
|
30479
30553
|
return "";
|
|
30480
30554
|
return values2.map((v) => Array.isArray(v) ? v[0] : v).join(",");
|
|
@@ -30526,22 +30600,22 @@ class UriTemplate {
|
|
|
30526
30600
|
}
|
|
30527
30601
|
partToRegExp(part) {
|
|
30528
30602
|
const patterns = [];
|
|
30529
|
-
for (const
|
|
30530
|
-
UriTemplate.validateLength(
|
|
30603
|
+
for (const name2 of part.names) {
|
|
30604
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
30531
30605
|
}
|
|
30532
30606
|
if (part.operator === "?" || part.operator === "&") {
|
|
30533
30607
|
for (let i = 0; i < part.names.length; i++) {
|
|
30534
|
-
const
|
|
30608
|
+
const name2 = part.names[i];
|
|
30535
30609
|
const prefix = i === 0 ? "\\" + part.operator : "&";
|
|
30536
30610
|
patterns.push({
|
|
30537
|
-
pattern: prefix + this.escapeRegExp(
|
|
30538
|
-
name:
|
|
30611
|
+
pattern: prefix + this.escapeRegExp(name2) + "=([^&]+)",
|
|
30612
|
+
name: name2
|
|
30539
30613
|
});
|
|
30540
30614
|
}
|
|
30541
30615
|
return patterns;
|
|
30542
30616
|
}
|
|
30543
30617
|
let pattern2;
|
|
30544
|
-
const
|
|
30618
|
+
const name = part.name;
|
|
30545
30619
|
switch (part.operator) {
|
|
30546
30620
|
case "":
|
|
30547
30621
|
pattern2 = part.exploded ? "([^/]+(?:,[^/]+)*)" : "([^/,]+)";
|
|
@@ -30559,7 +30633,7 @@ class UriTemplate {
|
|
|
30559
30633
|
default:
|
|
30560
30634
|
pattern2 = "([^/]+)";
|
|
30561
30635
|
}
|
|
30562
|
-
patterns.push({ pattern: pattern2, name
|
|
30636
|
+
patterns.push({ pattern: pattern2, name });
|
|
30563
30637
|
return patterns;
|
|
30564
30638
|
}
|
|
30565
30639
|
match(uri2) {
|
|
@@ -30571,9 +30645,9 @@ class UriTemplate {
|
|
|
30571
30645
|
pattern2 += this.escapeRegExp(part);
|
|
30572
30646
|
} else {
|
|
30573
30647
|
const patterns = this.partToRegExp(part);
|
|
30574
|
-
for (const { pattern: partPattern, name
|
|
30648
|
+
for (const { pattern: partPattern, name } of patterns) {
|
|
30575
30649
|
pattern2 += partPattern;
|
|
30576
|
-
names2.push({ name
|
|
30650
|
+
names2.push({ name, exploded: part.exploded });
|
|
30577
30651
|
}
|
|
30578
30652
|
}
|
|
30579
30653
|
}
|
|
@@ -30585,9 +30659,9 @@ class UriTemplate {
|
|
|
30585
30659
|
return null;
|
|
30586
30660
|
const result = {};
|
|
30587
30661
|
for (let i = 0; i < names2.length; i++) {
|
|
30588
|
-
const { name
|
|
30662
|
+
const { name, exploded } = names2[i];
|
|
30589
30663
|
const value = match[i + 1];
|
|
30590
|
-
const cleanName =
|
|
30664
|
+
const cleanName = name.replace("*", "");
|
|
30591
30665
|
if (exploded && value.includes(",")) {
|
|
30592
30666
|
result[cleanName] = value.split(",");
|
|
30593
30667
|
} else {
|
|
@@ -30598,34 +30672,34 @@ class UriTemplate {
|
|
|
30598
30672
|
}
|
|
30599
30673
|
}
|
|
30600
30674
|
const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
30601
|
-
function validateToolName(
|
|
30675
|
+
function validateToolName(name) {
|
|
30602
30676
|
const warnings = [];
|
|
30603
|
-
if (
|
|
30677
|
+
if (name.length === 0) {
|
|
30604
30678
|
return {
|
|
30605
30679
|
isValid: false,
|
|
30606
30680
|
warnings: ["Tool name cannot be empty"]
|
|
30607
30681
|
};
|
|
30608
30682
|
}
|
|
30609
|
-
if (
|
|
30683
|
+
if (name.length > 128) {
|
|
30610
30684
|
return {
|
|
30611
30685
|
isValid: false,
|
|
30612
|
-
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${
|
|
30686
|
+
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]
|
|
30613
30687
|
};
|
|
30614
30688
|
}
|
|
30615
|
-
if (
|
|
30689
|
+
if (name.includes(" ")) {
|
|
30616
30690
|
warnings.push("Tool name contains spaces, which may cause parsing issues");
|
|
30617
30691
|
}
|
|
30618
|
-
if (
|
|
30692
|
+
if (name.includes(",")) {
|
|
30619
30693
|
warnings.push("Tool name contains commas, which may cause parsing issues");
|
|
30620
30694
|
}
|
|
30621
|
-
if (
|
|
30695
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
30622
30696
|
warnings.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");
|
|
30623
30697
|
}
|
|
30624
|
-
if (
|
|
30698
|
+
if (name.startsWith(".") || name.endsWith(".")) {
|
|
30625
30699
|
warnings.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");
|
|
30626
30700
|
}
|
|
30627
|
-
if (!TOOL_NAME_REGEX.test(
|
|
30628
|
-
const invalidChars =
|
|
30701
|
+
if (!TOOL_NAME_REGEX.test(name)) {
|
|
30702
|
+
const invalidChars = name.split("").filter((char) => !/[A-Za-z0-9._-]/.test(char)).filter((char, index, arr) => arr.indexOf(char) === index);
|
|
30629
30703
|
warnings.push(`Tool name contains invalid characters: ${invalidChars.map((c) => `"${c}"`).join(", ")}`, "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)");
|
|
30630
30704
|
return {
|
|
30631
30705
|
isValid: false,
|
|
@@ -30637,9 +30711,9 @@ function validateToolName(name2) {
|
|
|
30637
30711
|
warnings
|
|
30638
30712
|
};
|
|
30639
30713
|
}
|
|
30640
|
-
function issueToolNameWarning(
|
|
30714
|
+
function issueToolNameWarning(name, warnings) {
|
|
30641
30715
|
if (warnings.length > 0) {
|
|
30642
|
-
console.warn(`Tool name validation warning for "${
|
|
30716
|
+
console.warn(`Tool name validation warning for "${name}":`);
|
|
30643
30717
|
for (const warning of warnings) {
|
|
30644
30718
|
console.warn(` - ${warning}`);
|
|
30645
30719
|
}
|
|
@@ -30648,22 +30722,22 @@ function issueToolNameWarning(name2, warnings) {
|
|
|
30648
30722
|
console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.");
|
|
30649
30723
|
}
|
|
30650
30724
|
}
|
|
30651
|
-
function validateAndWarnToolName(
|
|
30652
|
-
const result = validateToolName(
|
|
30653
|
-
issueToolNameWarning(
|
|
30725
|
+
function validateAndWarnToolName(name) {
|
|
30726
|
+
const result = validateToolName(name);
|
|
30727
|
+
issueToolNameWarning(name, result.warnings);
|
|
30654
30728
|
return result.isValid;
|
|
30655
30729
|
}
|
|
30656
30730
|
class ExperimentalMcpServerTasks {
|
|
30657
30731
|
constructor(_mcpServer) {
|
|
30658
30732
|
this._mcpServer = _mcpServer;
|
|
30659
30733
|
}
|
|
30660
|
-
registerToolTask(
|
|
30734
|
+
registerToolTask(name, config2, handler) {
|
|
30661
30735
|
const execution = { taskSupport: "required", ...config2.execution };
|
|
30662
30736
|
if (execution.taskSupport === "forbidden") {
|
|
30663
|
-
throw new Error(`Cannot register task-based tool '${
|
|
30737
|
+
throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);
|
|
30664
30738
|
}
|
|
30665
30739
|
const mcpServerInternal = this._mcpServer;
|
|
30666
|
-
return mcpServerInternal._createRegisteredTool(
|
|
30740
|
+
return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
|
|
30667
30741
|
}
|
|
30668
30742
|
}
|
|
30669
30743
|
class McpServer {
|
|
@@ -30719,9 +30793,9 @@ class McpServer {
|
|
|
30719
30793
|
}
|
|
30720
30794
|
});
|
|
30721
30795
|
this.server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
30722
|
-
tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([
|
|
30796
|
+
tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name, tool]) => {
|
|
30723
30797
|
const toolDefinition = {
|
|
30724
|
-
name
|
|
30798
|
+
name,
|
|
30725
30799
|
title: tool.title,
|
|
30726
30800
|
description: tool.description,
|
|
30727
30801
|
inputSchema: (() => {
|
|
@@ -30993,8 +31067,8 @@ class McpServer {
|
|
|
30993
31067
|
return { resources: [...resources, ...templateResources] };
|
|
30994
31068
|
});
|
|
30995
31069
|
this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
|
|
30996
|
-
const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([
|
|
30997
|
-
name
|
|
31070
|
+
const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({
|
|
31071
|
+
name,
|
|
30998
31072
|
uriTemplate: template.resourceTemplate.uriTemplate.toString(),
|
|
30999
31073
|
...template.metadata
|
|
31000
31074
|
}));
|
|
@@ -31031,9 +31105,9 @@ class McpServer {
|
|
|
31031
31105
|
}
|
|
31032
31106
|
});
|
|
31033
31107
|
this.server.setRequestHandler(ListPromptsRequestSchema, () => ({
|
|
31034
|
-
prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([
|
|
31108
|
+
prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name, prompt]) => {
|
|
31035
31109
|
return {
|
|
31036
|
-
name
|
|
31110
|
+
name,
|
|
31037
31111
|
title: prompt.title,
|
|
31038
31112
|
description: prompt.description,
|
|
31039
31113
|
arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : void 0
|
|
@@ -31066,7 +31140,7 @@ class McpServer {
|
|
|
31066
31140
|
});
|
|
31067
31141
|
this._promptHandlersInitialized = true;
|
|
31068
31142
|
}
|
|
31069
|
-
resource(
|
|
31143
|
+
resource(name, uriOrTemplate, ...rest) {
|
|
31070
31144
|
let metadata2;
|
|
31071
31145
|
if (typeof rest[0] === "object") {
|
|
31072
31146
|
metadata2 = rest.shift();
|
|
@@ -31076,42 +31150,42 @@ class McpServer {
|
|
|
31076
31150
|
if (this._registeredResources[uriOrTemplate]) {
|
|
31077
31151
|
throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
31078
31152
|
}
|
|
31079
|
-
const registeredResource = this._createRegisteredResource(
|
|
31153
|
+
const registeredResource = this._createRegisteredResource(name, void 0, uriOrTemplate, metadata2, readCallback);
|
|
31080
31154
|
this.setResourceRequestHandlers();
|
|
31081
31155
|
this.sendResourceListChanged();
|
|
31082
31156
|
return registeredResource;
|
|
31083
31157
|
} else {
|
|
31084
|
-
if (this._registeredResourceTemplates[
|
|
31085
|
-
throw new Error(`Resource template ${
|
|
31158
|
+
if (this._registeredResourceTemplates[name]) {
|
|
31159
|
+
throw new Error(`Resource template ${name} is already registered`);
|
|
31086
31160
|
}
|
|
31087
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(
|
|
31161
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, void 0, uriOrTemplate, metadata2, readCallback);
|
|
31088
31162
|
this.setResourceRequestHandlers();
|
|
31089
31163
|
this.sendResourceListChanged();
|
|
31090
31164
|
return registeredResourceTemplate;
|
|
31091
31165
|
}
|
|
31092
31166
|
}
|
|
31093
|
-
registerResource(
|
|
31167
|
+
registerResource(name, uriOrTemplate, config2, readCallback) {
|
|
31094
31168
|
if (typeof uriOrTemplate === "string") {
|
|
31095
31169
|
if (this._registeredResources[uriOrTemplate]) {
|
|
31096
31170
|
throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
31097
31171
|
}
|
|
31098
|
-
const registeredResource = this._createRegisteredResource(
|
|
31172
|
+
const registeredResource = this._createRegisteredResource(name, config2.title, uriOrTemplate, config2, readCallback);
|
|
31099
31173
|
this.setResourceRequestHandlers();
|
|
31100
31174
|
this.sendResourceListChanged();
|
|
31101
31175
|
return registeredResource;
|
|
31102
31176
|
} else {
|
|
31103
|
-
if (this._registeredResourceTemplates[
|
|
31104
|
-
throw new Error(`Resource template ${
|
|
31177
|
+
if (this._registeredResourceTemplates[name]) {
|
|
31178
|
+
throw new Error(`Resource template ${name} is already registered`);
|
|
31105
31179
|
}
|
|
31106
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(
|
|
31180
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config2.title, uriOrTemplate, config2, readCallback);
|
|
31107
31181
|
this.setResourceRequestHandlers();
|
|
31108
31182
|
this.sendResourceListChanged();
|
|
31109
31183
|
return registeredResourceTemplate;
|
|
31110
31184
|
}
|
|
31111
31185
|
}
|
|
31112
|
-
_createRegisteredResource(
|
|
31186
|
+
_createRegisteredResource(name, title2, uri2, metadata2, readCallback) {
|
|
31113
31187
|
const registeredResource = {
|
|
31114
|
-
name
|
|
31188
|
+
name,
|
|
31115
31189
|
title: title2,
|
|
31116
31190
|
metadata: metadata2,
|
|
31117
31191
|
readCallback,
|
|
@@ -31141,7 +31215,7 @@ class McpServer {
|
|
|
31141
31215
|
this._registeredResources[uri2] = registeredResource;
|
|
31142
31216
|
return registeredResource;
|
|
31143
31217
|
}
|
|
31144
|
-
_createRegisteredResourceTemplate(
|
|
31218
|
+
_createRegisteredResourceTemplate(name, title2, template, metadata2, readCallback) {
|
|
31145
31219
|
const registeredResourceTemplate = {
|
|
31146
31220
|
resourceTemplate: template,
|
|
31147
31221
|
title: title2,
|
|
@@ -31152,8 +31226,8 @@ class McpServer {
|
|
|
31152
31226
|
enable: () => registeredResourceTemplate.update({ enabled: true }),
|
|
31153
31227
|
remove: () => registeredResourceTemplate.update({ name: null }),
|
|
31154
31228
|
update: (updates) => {
|
|
31155
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31156
|
-
delete this._registeredResourceTemplates[
|
|
31229
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31230
|
+
delete this._registeredResourceTemplates[name];
|
|
31157
31231
|
if (updates.name)
|
|
31158
31232
|
this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
|
|
31159
31233
|
}
|
|
@@ -31170,7 +31244,7 @@ class McpServer {
|
|
|
31170
31244
|
this.sendResourceListChanged();
|
|
31171
31245
|
}
|
|
31172
31246
|
};
|
|
31173
|
-
this._registeredResourceTemplates[
|
|
31247
|
+
this._registeredResourceTemplates[name] = registeredResourceTemplate;
|
|
31174
31248
|
const variableNames = template.uriTemplate.variableNames;
|
|
31175
31249
|
const hasCompleter = Array.isArray(variableNames) && variableNames.some((v) => !!template.completeCallback(v));
|
|
31176
31250
|
if (hasCompleter) {
|
|
@@ -31178,7 +31252,7 @@ class McpServer {
|
|
|
31178
31252
|
}
|
|
31179
31253
|
return registeredResourceTemplate;
|
|
31180
31254
|
}
|
|
31181
|
-
_createRegisteredPrompt(
|
|
31255
|
+
_createRegisteredPrompt(name, title2, description2, argsSchema, callback) {
|
|
31182
31256
|
const registeredPrompt = {
|
|
31183
31257
|
title: title2,
|
|
31184
31258
|
description: description2,
|
|
@@ -31189,8 +31263,8 @@ class McpServer {
|
|
|
31189
31263
|
enable: () => registeredPrompt.update({ enabled: true }),
|
|
31190
31264
|
remove: () => registeredPrompt.update({ name: null }),
|
|
31191
31265
|
update: (updates) => {
|
|
31192
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31193
|
-
delete this._registeredPrompts[
|
|
31266
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31267
|
+
delete this._registeredPrompts[name];
|
|
31194
31268
|
if (updates.name)
|
|
31195
31269
|
this._registeredPrompts[updates.name] = registeredPrompt;
|
|
31196
31270
|
}
|
|
@@ -31207,7 +31281,7 @@ class McpServer {
|
|
|
31207
31281
|
this.sendPromptListChanged();
|
|
31208
31282
|
}
|
|
31209
31283
|
};
|
|
31210
|
-
this._registeredPrompts[
|
|
31284
|
+
this._registeredPrompts[name] = registeredPrompt;
|
|
31211
31285
|
if (argsSchema) {
|
|
31212
31286
|
const hasCompletable = Object.values(argsSchema).some((field) => {
|
|
31213
31287
|
const inner = field instanceof ZodOptional$2 ? field._def?.innerType : field;
|
|
@@ -31219,8 +31293,8 @@ class McpServer {
|
|
|
31219
31293
|
}
|
|
31220
31294
|
return registeredPrompt;
|
|
31221
31295
|
}
|
|
31222
|
-
_createRegisteredTool(
|
|
31223
|
-
validateAndWarnToolName(
|
|
31296
|
+
_createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, execution, _meta, handler) {
|
|
31297
|
+
validateAndWarnToolName(name);
|
|
31224
31298
|
const registeredTool = {
|
|
31225
31299
|
title: title2,
|
|
31226
31300
|
description: description2,
|
|
@@ -31235,11 +31309,11 @@ class McpServer {
|
|
|
31235
31309
|
enable: () => registeredTool.update({ enabled: true }),
|
|
31236
31310
|
remove: () => registeredTool.update({ name: null }),
|
|
31237
31311
|
update: (updates) => {
|
|
31238
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31312
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31239
31313
|
if (typeof updates.name === "string") {
|
|
31240
31314
|
validateAndWarnToolName(updates.name);
|
|
31241
31315
|
}
|
|
31242
|
-
delete this._registeredTools[
|
|
31316
|
+
delete this._registeredTools[name];
|
|
31243
31317
|
if (updates.name)
|
|
31244
31318
|
this._registeredTools[updates.name] = registeredTool;
|
|
31245
31319
|
}
|
|
@@ -31262,7 +31336,7 @@ class McpServer {
|
|
|
31262
31336
|
this.sendToolListChanged();
|
|
31263
31337
|
}
|
|
31264
31338
|
};
|
|
31265
|
-
this._registeredTools[
|
|
31339
|
+
this._registeredTools[name] = registeredTool;
|
|
31266
31340
|
this.setToolRequestHandlers();
|
|
31267
31341
|
this.sendToolListChanged();
|
|
31268
31342
|
return registeredTool;
|
|
@@ -31270,9 +31344,9 @@ class McpServer {
|
|
|
31270
31344
|
/**
|
|
31271
31345
|
* tool() implementation. Parses arguments passed to overrides defined above.
|
|
31272
31346
|
*/
|
|
31273
|
-
tool(
|
|
31274
|
-
if (this._registeredTools[
|
|
31275
|
-
throw new Error(`Tool ${
|
|
31347
|
+
tool(name, ...rest) {
|
|
31348
|
+
if (this._registeredTools[name]) {
|
|
31349
|
+
throw new Error(`Tool ${name} is already registered`);
|
|
31276
31350
|
}
|
|
31277
31351
|
let description2;
|
|
31278
31352
|
let inputSchema;
|
|
@@ -31293,21 +31367,21 @@ class McpServer {
|
|
|
31293
31367
|
}
|
|
31294
31368
|
}
|
|
31295
31369
|
const callback = rest[0];
|
|
31296
|
-
return this._createRegisteredTool(
|
|
31370
|
+
return this._createRegisteredTool(name, void 0, description2, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
|
|
31297
31371
|
}
|
|
31298
31372
|
/**
|
|
31299
31373
|
* Registers a tool with a config object and callback.
|
|
31300
31374
|
*/
|
|
31301
|
-
registerTool(
|
|
31302
|
-
if (this._registeredTools[
|
|
31303
|
-
throw new Error(`Tool ${
|
|
31375
|
+
registerTool(name, config2, cb) {
|
|
31376
|
+
if (this._registeredTools[name]) {
|
|
31377
|
+
throw new Error(`Tool ${name} is already registered`);
|
|
31304
31378
|
}
|
|
31305
31379
|
const { title: title2, description: description2, inputSchema, outputSchema, annotations, _meta } = config2;
|
|
31306
|
-
return this._createRegisteredTool(
|
|
31380
|
+
return this._createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb);
|
|
31307
31381
|
}
|
|
31308
|
-
prompt(
|
|
31309
|
-
if (this._registeredPrompts[
|
|
31310
|
-
throw new Error(`Prompt ${
|
|
31382
|
+
prompt(name, ...rest) {
|
|
31383
|
+
if (this._registeredPrompts[name]) {
|
|
31384
|
+
throw new Error(`Prompt ${name} is already registered`);
|
|
31311
31385
|
}
|
|
31312
31386
|
let description2;
|
|
31313
31387
|
if (typeof rest[0] === "string") {
|
|
@@ -31318,7 +31392,7 @@ class McpServer {
|
|
|
31318
31392
|
argsSchema = rest.shift();
|
|
31319
31393
|
}
|
|
31320
31394
|
const cb = rest[0];
|
|
31321
|
-
const registeredPrompt = this._createRegisteredPrompt(
|
|
31395
|
+
const registeredPrompt = this._createRegisteredPrompt(name, void 0, description2, argsSchema, cb);
|
|
31322
31396
|
this.setPromptRequestHandlers();
|
|
31323
31397
|
this.sendPromptListChanged();
|
|
31324
31398
|
return registeredPrompt;
|
|
@@ -31326,12 +31400,12 @@ class McpServer {
|
|
|
31326
31400
|
/**
|
|
31327
31401
|
* Registers a prompt with a config object and callback.
|
|
31328
31402
|
*/
|
|
31329
|
-
registerPrompt(
|
|
31330
|
-
if (this._registeredPrompts[
|
|
31331
|
-
throw new Error(`Prompt ${
|
|
31403
|
+
registerPrompt(name, config2, cb) {
|
|
31404
|
+
if (this._registeredPrompts[name]) {
|
|
31405
|
+
throw new Error(`Prompt ${name} is already registered`);
|
|
31332
31406
|
}
|
|
31333
31407
|
const { title: title2, description: description2, argsSchema } = config2;
|
|
31334
|
-
const registeredPrompt = this._createRegisteredPrompt(
|
|
31408
|
+
const registeredPrompt = this._createRegisteredPrompt(name, title2, description2, argsSchema, cb);
|
|
31335
31409
|
this.setPromptRequestHandlers();
|
|
31336
31410
|
this.sendPromptListChanged();
|
|
31337
31411
|
return registeredPrompt;
|
|
@@ -31437,11 +31511,11 @@ function promptArgumentsFromSchema(schema2) {
|
|
|
31437
31511
|
const shape = getObjectShape(schema2);
|
|
31438
31512
|
if (!shape)
|
|
31439
31513
|
return [];
|
|
31440
|
-
return Object.entries(shape).map(([
|
|
31514
|
+
return Object.entries(shape).map(([name, field]) => {
|
|
31441
31515
|
const description2 = getSchemaDescription(field);
|
|
31442
31516
|
const isOptional = isSchemaOptional(field);
|
|
31443
31517
|
return {
|
|
31444
|
-
name
|
|
31518
|
+
name,
|
|
31445
31519
|
description: description2,
|
|
31446
31520
|
required: !isOptional
|
|
31447
31521
|
};
|
|
@@ -32261,7 +32335,7 @@ async function mcpStart(options) {
|
|
|
32261
32335
|
async function executeRemove(options, context) {
|
|
32262
32336
|
const { identifier, idType = "id", fulltextDirectory, deleteFulltext = false } = options;
|
|
32263
32337
|
if (context.mode === "local" && deleteFulltext && fulltextDirectory) {
|
|
32264
|
-
const { removeReference } = await import("./index-
|
|
32338
|
+
const { removeReference } = await import("./index-C_mW5LMY.js").then((n) => n.A);
|
|
32265
32339
|
return removeReference(context.library, {
|
|
32266
32340
|
identifier,
|
|
32267
32341
|
idType,
|
|
@@ -32316,7 +32390,7 @@ Continue?`;
|
|
|
32316
32390
|
}
|
|
32317
32391
|
async function executeInteractiveRemove(context, config2) {
|
|
32318
32392
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32319
|
-
const { selectReferenceItemsOrExit } = await import("./reference-select-
|
|
32393
|
+
const { selectReferenceItemsOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
32320
32394
|
const allReferences = await context.library.getAll();
|
|
32321
32395
|
const selectedItems = await withAlternateScreen2(
|
|
32322
32396
|
() => selectReferenceItemsOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -32541,7 +32615,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
32541
32615
|
validateInteractiveOptions(options);
|
|
32542
32616
|
const { checkTTY } = await import("./tty-BMyaEOhX.js");
|
|
32543
32617
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32544
|
-
const { runSearchFlow } = await import("./index-
|
|
32618
|
+
const { runSearchFlow } = await import("./index-CA9y5wSm.js");
|
|
32545
32619
|
const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
|
|
32546
32620
|
const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
|
|
32547
32621
|
checkTTY();
|
|
@@ -32560,7 +32634,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
32560
32634
|
})
|
|
32561
32635
|
);
|
|
32562
32636
|
if (result.selectedItems && !result.cancelled) {
|
|
32563
|
-
const { isSideEffectAction } = await import("./action-menu-
|
|
32637
|
+
const { isSideEffectAction } = await import("./action-menu-DCZcb0HB.js");
|
|
32564
32638
|
if (isSideEffectAction(result.action)) {
|
|
32565
32639
|
await executeSideEffectAction(result.action, result.selectedItems, context, config2);
|
|
32566
32640
|
return { output: "", cancelled: false, action: result.action };
|
|
@@ -32576,7 +32650,7 @@ async function executeSideEffectAction(action, items2, context, config2) {
|
|
|
32576
32650
|
switch (action) {
|
|
32577
32651
|
case "open-url": {
|
|
32578
32652
|
const { resolveDefaultUrl: resolveDefaultUrl2 } = await Promise.resolve().then(() => url);
|
|
32579
|
-
const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-
|
|
32653
|
+
const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-BG2eomDC.js").then((n) => n.j);
|
|
32580
32654
|
const item = items2[0];
|
|
32581
32655
|
if (!item) return;
|
|
32582
32656
|
const url$1 = resolveDefaultUrl2(item);
|
|
@@ -32971,7 +33045,7 @@ function formatUpdateOutput(result, identifier) {
|
|
|
32971
33045
|
}
|
|
32972
33046
|
async function executeInteractiveUpdate(context, config2) {
|
|
32973
33047
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32974
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
33048
|
+
const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
32975
33049
|
const allReferences = await context.library.getAll();
|
|
32976
33050
|
const identifiers = await withAlternateScreen2(
|
|
32977
33051
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -33266,7 +33340,7 @@ function getUrlExitCode(result) {
|
|
|
33266
33340
|
}
|
|
33267
33341
|
async function executeInteractiveSelect(context, config2) {
|
|
33268
33342
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
33269
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
33343
|
+
const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
|
|
33270
33344
|
const allReferences = await context.library.getAll();
|
|
33271
33345
|
const identifiers = await withAlternateScreen2(
|
|
33272
33346
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -33378,7 +33452,7 @@ const ID_COMPLETION_COMMANDS = /* @__PURE__ */ new Set(["cite", "remove", "updat
|
|
|
33378
33452
|
const ID_COMPLETION_FULLTEXT_SUBCOMMANDS = /* @__PURE__ */ new Set(["attach", "get", "detach", "open"]);
|
|
33379
33453
|
const ID_COMPLETION_ATTACH_SUBCOMMANDS = /* @__PURE__ */ new Set(["open", "add", "list", "get", "detach", "sync"]);
|
|
33380
33454
|
function toCompletionItems(values) {
|
|
33381
|
-
return values.map((
|
|
33455
|
+
return values.map((name) => ({ name }));
|
|
33382
33456
|
}
|
|
33383
33457
|
function extractSubcommands(program) {
|
|
33384
33458
|
return program.commands.map((cmd) => ({
|
|
@@ -33407,8 +33481,8 @@ function extractGlobalOptions(program) {
|
|
|
33407
33481
|
options.push({ name: "--version", description: "output the version number" });
|
|
33408
33482
|
return options;
|
|
33409
33483
|
}
|
|
33410
|
-
function findSubcommand(program,
|
|
33411
|
-
return program.commands.find((cmd) => cmd.name() ===
|
|
33484
|
+
function findSubcommand(program, name) {
|
|
33485
|
+
return program.commands.find((cmd) => cmd.name() === name);
|
|
33412
33486
|
}
|
|
33413
33487
|
function parseCommandContext(env) {
|
|
33414
33488
|
const words = env.line.trim().split(/\s+/);
|
|
@@ -33601,6 +33675,54 @@ function registerCompletionCommand(program) {
|
|
|
33601
33675
|
}
|
|
33602
33676
|
});
|
|
33603
33677
|
}
|
|
33678
|
+
function buildConvertHelpText() {
|
|
33679
|
+
const rows = BUILTIN_CONVERTER_NAMES.map((name) => {
|
|
33680
|
+
const info = BUILTIN_CONVERTER_INFO[name];
|
|
33681
|
+
return ` ${name.padEnd(10)}${info.install.padEnd(28)}${info.description}`;
|
|
33682
|
+
});
|
|
33683
|
+
const priority = BUILTIN_CONVERTER_NAMES.join(" > ");
|
|
33684
|
+
return `
|
|
33685
|
+
BUILT-IN CONVERTERS
|
|
33686
|
+
Name Install Notes
|
|
33687
|
+
${rows.join("\n")}
|
|
33688
|
+
|
|
33689
|
+
In auto mode (default), the first available converter is used.
|
|
33690
|
+
Priority: ${priority}
|
|
33691
|
+
|
|
33692
|
+
CUSTOM CONVERTERS
|
|
33693
|
+
Add via config set:
|
|
33694
|
+
ref config set fulltext.converters.my-tool.command "my-tool {input} -o {output}"
|
|
33695
|
+
ref config set fulltext.converters.my-tool.check_command "my-tool --version"
|
|
33696
|
+
|
|
33697
|
+
Or edit config.toml directly (ref config edit):
|
|
33698
|
+
[fulltext.converters.my-tool]
|
|
33699
|
+
command = "my-tool convert {input} -o {output}"
|
|
33700
|
+
check_command = "my-tool --version"
|
|
33701
|
+
|
|
33702
|
+
Template placeholders:
|
|
33703
|
+
{input} Input PDF path
|
|
33704
|
+
{output} Output Markdown path
|
|
33705
|
+
{input_dir} Directory of input file
|
|
33706
|
+
{input_name} Basename of input file
|
|
33707
|
+
{output_name} Basename of output file
|
|
33708
|
+
|
|
33709
|
+
Additional options:
|
|
33710
|
+
output_mode "file" (default) or "stdout"
|
|
33711
|
+
timeout Seconds (default: 300)
|
|
33712
|
+
progress "inherit" (default) or "quiet"
|
|
33713
|
+
|
|
33714
|
+
Use with: ref fulltext convert <ref> --converter my-tool
|
|
33715
|
+
|
|
33716
|
+
CONFIGURATION
|
|
33717
|
+
ref config set fulltext.pdf_converter marker
|
|
33718
|
+
ref config set fulltext.pdf_converter_timeout 600
|
|
33719
|
+
ref config edit # Edit config.toml directly
|
|
33720
|
+
|
|
33721
|
+
EXAMPLES
|
|
33722
|
+
$ ref fulltext convert smith2023
|
|
33723
|
+
$ ref fulltext convert smith2023 --converter marker
|
|
33724
|
+
$ ref fulltext convert smith2023 --from pdf --force`;
|
|
33725
|
+
}
|
|
33604
33726
|
function buildSearchHelpText() {
|
|
33605
33727
|
return `
|
|
33606
33728
|
QUERY SYNTAX
|
|
@@ -33823,7 +33945,7 @@ function shouldAutoFetch(cliFlag, configEnabled) {
|
|
|
33823
33945
|
return configEnabled;
|
|
33824
33946
|
}
|
|
33825
33947
|
async function performAutoFetch(addedItems, context, config2) {
|
|
33826
|
-
const { fulltextFetch: fulltextFetch2 } = await import("./index-
|
|
33948
|
+
const { fulltextFetch: fulltextFetch2 } = await import("./index-C_mW5LMY.js").then((n) => n.z);
|
|
33827
33949
|
const fetchResults = await autoFetchFulltext(addedItems, context, {
|
|
33828
33950
|
fulltextConfig: config2.fulltext,
|
|
33829
33951
|
fulltextDirectory: config2.attachments.directory,
|
|
@@ -34079,7 +34201,7 @@ function registerFulltextCommand(program) {
|
|
|
34079
34201
|
fulltextCmd.command("convert").description("Convert attached fulltext (XML or PDF) to Markdown").argument("[identifier]", "Citation key or UUID (interactive selection if omitted)").option("--uuid", "Interpret identifier as UUID").option("--from <format>", "Input format: xml, pdf (default: auto-detect)").option(
|
|
34080
34202
|
"--converter <name>",
|
|
34081
34203
|
"PDF converter: auto, marker, docling, mineru, pymupdf, or custom name"
|
|
34082
|
-
).option("--force", "Overwrite existing markdown attachment").action(async (identifier, options) => {
|
|
34204
|
+
).option("--force", "Overwrite existing markdown attachment").addHelpText("after", buildConvertHelpText()).action(async (identifier, options) => {
|
|
34083
34205
|
await handleFulltextConvertAction(identifier, options, program.opts());
|
|
34084
34206
|
});
|
|
34085
34207
|
}
|
|
@@ -34118,4 +34240,4 @@ export {
|
|
|
34118
34240
|
restoreStdinAfterInk as r,
|
|
34119
34241
|
syncAttachments as s
|
|
34120
34242
|
};
|
|
34121
|
-
//# sourceMappingURL=index-
|
|
34243
|
+
//# sourceMappingURL=index-4w0pu_0o.js.map
|