@agntn/tools 0.3.0 → 0.3.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/causes.mjs +71 -0
- package/dist/_chunks/index.d.mts +3 -2
- package/dist/_chunks/libs/typebox.d.mts +43 -63
- package/dist/_chunks/libs/typebox.mjs +252 -268
- package/dist/_chunks/mcp-answers.d.mts +8 -0
- package/dist/_chunks/mcp-answers.mjs +12 -2
- package/dist/ai.mjs +2 -1
- package/dist/cli.d.mts +16 -3
- package/dist/cli.mjs +101 -30
- package/dist/h3.d.mts +5 -1
- package/dist/h3.mjs +5 -1
- package/dist/index.d.mts +2 -2
- package/dist/mcp.d.mts +4 -2
- package/dist/mcp.mjs +7 -2
- package/dist/omp.mjs +3 -1
- package/dist/pi.mjs +3 -1
- package/dist/toolkit.d.mts +16 -1
- package/dist/toolkit.mjs +22 -1
- package/package.json +7 -7
|
@@ -12,6 +12,14 @@ export interface McpServerInfo {
|
|
|
12
12
|
/** Project home a client can link to. */
|
|
13
13
|
readonly websiteUrl?: string;
|
|
14
14
|
}
|
|
15
|
+
/** What a tool finds in `host` over MCP. The client wrote all of it, so none of it is proof. */
|
|
16
|
+
export interface McpHost {
|
|
17
|
+
readonly mcp: true;
|
|
18
|
+
/** The HTTP request behind the call, headers included. Absent over stdio. */
|
|
19
|
+
readonly request?: Request;
|
|
20
|
+
/** The call's `_meta` as the transport hands it over, such as a harness's session id. */
|
|
21
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
22
|
+
}
|
|
15
23
|
/**
|
|
16
24
|
* Maps a tool's title and declared effect to MCP annotations. Claude Code reads its label here.
|
|
17
25
|
* A process the tool starts can delete anything, so `exec` counts as destructive.
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Check, Errors } from "./libs/typebox.mjs";
|
|
2
2
|
import { ToolInputError, indexTools, invokeTool, sanitizeLine, wireSchema } from "./src.mjs";
|
|
3
|
+
import { causeLines } from "./causes.mjs";
|
|
3
4
|
import { hostAsk, readAnswer } from "./questions.mjs";
|
|
5
|
+
function mcpHost(from) {
|
|
6
|
+
const { request, meta } = from;
|
|
7
|
+
if (request === void 0 && meta === void 0) return {};
|
|
8
|
+
return { host: {
|
|
9
|
+
mcp: true,
|
|
10
|
+
...request === void 0 ? {} : { request },
|
|
11
|
+
...meta === void 0 ? {} : { meta }
|
|
12
|
+
} };
|
|
13
|
+
}
|
|
4
14
|
function toolAnnotations(tool) {
|
|
5
15
|
return {
|
|
6
16
|
title: tool.title,
|
|
@@ -45,7 +55,7 @@ async function callTool(info, tools, name, args = {}, context = {}) {
|
|
|
45
55
|
return answer(tool, await invokeTool(tool, args, context));
|
|
46
56
|
} catch (error) {
|
|
47
57
|
if (error instanceof ToolInputError) return errorResult(...error.lines);
|
|
48
|
-
return errorResult(`${tool.name} failed: ${error instanceof Error ? error.message : String(error)}
|
|
58
|
+
return errorResult(`${tool.name} failed: ${error instanceof Error ? error.message : String(error)}`, ...causeLines(error));
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
61
|
function answer(tool, result) {
|
|
@@ -180,4 +190,4 @@ function progressSteps(notify) {
|
|
|
180
190
|
});
|
|
181
191
|
};
|
|
182
192
|
}
|
|
183
|
-
export { callAsking, callTool, canAsk, copyIcons, errorResult, listTools, progressSteps, questionRound, toolAnnotations };
|
|
193
|
+
export { callAsking, callTool, canAsk, copyIcons, errorResult, listTools, mcpHost, progressSteps, questionRound, toolAnnotations };
|
package/dist/ai.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ToolDefinitionError, indexTools, invokeTool, resultText, validateInput, wireSchema } from "./_chunks/src.mjs";
|
|
2
|
+
import { throwWithCauses } from "./_chunks/causes.mjs";
|
|
2
3
|
import { jsonSchema, tool } from "ai";
|
|
3
4
|
function toAiTool(definition) {
|
|
4
5
|
return tool({
|
|
@@ -15,7 +16,7 @@ function toAiTool(definition) {
|
|
|
15
16
|
};
|
|
16
17
|
} }),
|
|
17
18
|
async execute(input, { abortSignal }) {
|
|
18
|
-
const result = await invokeTool(definition, input, abortSignal ? { signal: abortSignal } : {});
|
|
19
|
+
const result = await invokeTool(definition, input, abortSignal ? { signal: abortSignal } : {}).catch(throwWithCauses);
|
|
19
20
|
const text = resultText(result);
|
|
20
21
|
if (result.isError) throw new Error(text);
|
|
21
22
|
return aiOutput(definition.name, result, text);
|
package/dist/cli.d.mts
CHANGED
|
@@ -16,7 +16,12 @@ export interface CliOptions {
|
|
|
16
16
|
* and leaves `progress` alone: on a terminal its line would sit in front of the rows.
|
|
17
17
|
*/
|
|
18
18
|
readonly commands?: readonly ToolDefinition[];
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Groups the `cli.command` hints open with a first word, as `servers` in
|
|
21
|
+
* `servers list`: their line in the command list and more words for them.
|
|
22
|
+
*/
|
|
23
|
+
readonly groups?: Readonly<Record<string, CliGroup>>;
|
|
24
|
+
/** Command for an empty command line, two words for a command in a group. */
|
|
20
25
|
readonly default?: string;
|
|
21
26
|
/** Command for a first word that names no command: `hashes sha256 x` runs `hashes hash sha256 x`. */
|
|
22
27
|
readonly fallback?: string;
|
|
@@ -28,6 +33,12 @@ export interface CliOptions {
|
|
|
28
33
|
*/
|
|
29
34
|
readonly expected?: (error: unknown) => boolean;
|
|
30
35
|
}
|
|
36
|
+
/** A group of commands: `servers` in `servers list` and `servers add`. */
|
|
37
|
+
export interface CliGroup {
|
|
38
|
+
/** Line in the command list. Defaults to the names of its commands. */
|
|
39
|
+
readonly description?: string;
|
|
40
|
+
readonly aliases?: readonly string[];
|
|
41
|
+
}
|
|
31
42
|
/** What a CLI command finds in `host`: narrow to it and look at `json` before writing a byte. */
|
|
32
43
|
export interface CliHost {
|
|
33
44
|
readonly cli: true;
|
|
@@ -36,7 +47,8 @@ export interface CliHost {
|
|
|
36
47
|
}
|
|
37
48
|
/**
|
|
38
49
|
* @param tool - Tool to name.
|
|
39
|
-
* @returns {string} The hinted command,
|
|
50
|
+
* @returns {string} The hinted command, two words for one in a group, or the tool name without
|
|
51
|
+
* its package prefix, in kebab case.
|
|
40
52
|
*/
|
|
41
53
|
export declare function commandName(tool: ToolDefinition): string;
|
|
42
54
|
/** A built command line interface. */
|
|
@@ -50,7 +62,8 @@ export interface Cli {
|
|
|
50
62
|
*
|
|
51
63
|
* @param options - CLI options.
|
|
52
64
|
* @returns {Cli} The CLI.
|
|
53
|
-
* @throws {ToolDefinitionError} When two commands share a name or alias, a hint does not fit its
|
|
65
|
+
* @throws {ToolDefinitionError} When two commands share a name or alias, a hint does not fit its
|
|
66
|
+
* schema, `groups` names no group, or `default` or `fallback` names no command.
|
|
54
67
|
*/
|
|
55
68
|
export declare function createCli(options: CliOptions): Cli;
|
|
56
69
|
/**
|
package/dist/cli.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function flagName(key) {
|
|
|
22
22
|
return key.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").replaceAll("_", "-").toLowerCase();
|
|
23
23
|
}
|
|
24
24
|
function commandName(tool) {
|
|
25
|
-
if (tool.cli?.command !== void 0) return
|
|
25
|
+
if (tool.cli?.command !== void 0) return commandPath(tool.name, tool.cli.command);
|
|
26
26
|
const separator = tool.name.indexOf("_");
|
|
27
27
|
const derived = separator === -1 ? tool.name : tool.name.slice(separator + 1);
|
|
28
28
|
return commandWord(tool.name, derived.replaceAll("_", "-"));
|
|
@@ -32,6 +32,12 @@ function commandWord(owner, word) {
|
|
|
32
32
|
if (!COMMAND_WORD.test(word)) throw new ToolDefinitionError(`${owner}: command ${JSON.stringify(word)} must match ${COMMAND_WORD}`);
|
|
33
33
|
return word;
|
|
34
34
|
}
|
|
35
|
+
function commandPath(owner, path) {
|
|
36
|
+
const words = path.split(" ");
|
|
37
|
+
if (words.length > 2) throw new ToolDefinitionError(`${owner}: command ${JSON.stringify(path)} takes two words at most`);
|
|
38
|
+
for (const word of words) commandWord(owner, word);
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
35
41
|
function fieldKind(schema) {
|
|
36
42
|
if (Array.isArray(schema.enum) && schema.enum.every((value) => typeof value === "string")) return "enum";
|
|
37
43
|
if ((Array.isArray(schema.anyOf) ? schema.anyOf : []).some((branch) => fieldKind(branch) === "json")) return "json";
|
|
@@ -465,9 +471,9 @@ function detailsJson(details) {
|
|
|
465
471
|
return (JSON.stringify(details, (_key, value) => typeof value === "bigint" ? value.toString() : value, 2) ?? "null").replaceAll(JSON_FORGING, (character) => `\\u${(character.codePointAt(0) ?? 0).toString(16).padStart(4, "0")}`);
|
|
466
472
|
}
|
|
467
473
|
const JSON_FORGING = /[\u007F-\u009F\u061C\u200E\u200F\u2028\u2029\u202A-\u202E\u2066-\u206F]/g;
|
|
468
|
-
|
|
474
|
+
let graphemes;
|
|
469
475
|
const WIDE = /^(?:\p{Extended_Pictographic}|[\u1100-\u115F\u231A\u231B\u2329\u232A\u2630-\u2637\u268A-\u268F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DFF\u4E00-\u9FFF\uA000-\uA4CF\uA960-\uA97F\uAC00-\uD7A3\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6\u{16FE0}-\u{18DFF}\u{1AFF0}-\u{1B2FF}\u{1D15E}-\u{1D164}\u{1D1BB}-\u{1D1C0}\u{1D300}-\u{1D376}\u{1F000}-\u{1FAFF}\u{20000}-\u{3FFFD}])$/u;
|
|
470
|
-
|
|
476
|
+
let emoji;
|
|
471
477
|
const ZERO_WIDTH = /^[\p{Mn}\p{Me}]$/u;
|
|
472
478
|
function pointCells(point) {
|
|
473
479
|
if (WIDE.test(point)) return 2;
|
|
@@ -476,12 +482,14 @@ function pointCells(point) {
|
|
|
476
482
|
function graphemeCells(grapheme) {
|
|
477
483
|
let size = 0;
|
|
478
484
|
for (const point of grapheme.normalize("NFC")) size += pointCells(point);
|
|
479
|
-
|
|
485
|
+
emoji ??= /^\p{RGI_Emoji}$/v;
|
|
486
|
+
return Math.max(emoji.test(grapheme) ? 2 : 1, size);
|
|
480
487
|
}
|
|
481
488
|
function fitLine(text, room) {
|
|
482
489
|
let fitted = "";
|
|
483
490
|
let used = 0;
|
|
484
|
-
|
|
491
|
+
graphemes ??= new Intl.Segmenter();
|
|
492
|
+
for (const { segment } of graphemes.segment(text)) {
|
|
485
493
|
const size = graphemeCells(segment);
|
|
486
494
|
if (used + size > room) break;
|
|
487
495
|
fitted += segment;
|
|
@@ -521,8 +529,10 @@ function progressLine() {
|
|
|
521
529
|
function toolCommand(tool) {
|
|
522
530
|
const fields = toolFields(tool);
|
|
523
531
|
const [summary = tool.title] = tool.description.split(/(?<=[.!?])\s/, 1);
|
|
532
|
+
const name = commandName(tool);
|
|
524
533
|
return {
|
|
525
|
-
name
|
|
534
|
+
name,
|
|
535
|
+
word: name.slice(name.indexOf(" ") + 1),
|
|
526
536
|
aliases: (tool.cli?.aliases ?? []).map((alias) => commandWord(tool.name, alias)),
|
|
527
537
|
summary: tool.cli?.description ?? summary,
|
|
528
538
|
fields,
|
|
@@ -559,6 +569,7 @@ function toolCommand(tool) {
|
|
|
559
569
|
function mcpCommand(options) {
|
|
560
570
|
return {
|
|
561
571
|
name: "mcp",
|
|
572
|
+
word: "mcp",
|
|
562
573
|
aliases: [],
|
|
563
574
|
summary: `Run the ${options.name} MCP server over stdio`,
|
|
564
575
|
fields: [],
|
|
@@ -579,19 +590,67 @@ function commandTools(options) {
|
|
|
579
590
|
function builtInMcp(options) {
|
|
580
591
|
return options.mcp !== void 0 && options.mcp !== false && !(options.commands ?? []).some((command) => commandName(command) === "mcp");
|
|
581
592
|
}
|
|
582
|
-
function
|
|
583
|
-
return [
|
|
593
|
+
function leadWords(options) {
|
|
594
|
+
return [
|
|
595
|
+
...commandTools(options).flatMap((tool) => {
|
|
596
|
+
const [lead = "", word] = commandName(tool).split(" ");
|
|
597
|
+
return word === void 0 ? [lead, ...tool.cli?.aliases ?? []] : [lead];
|
|
598
|
+
}),
|
|
599
|
+
...Object.values(options.groups ?? {}).flatMap((group) => group.aliases ?? []),
|
|
600
|
+
...builtInMcp(options) ? ["mcp"] : []
|
|
601
|
+
];
|
|
602
|
+
}
|
|
603
|
+
function findEntry(entries, word) {
|
|
604
|
+
return entries.find((entry) => entry.word === word || entry.aliases.includes(word));
|
|
605
|
+
}
|
|
606
|
+
function findCommand(entries, words) {
|
|
607
|
+
const [first, ...rest] = words;
|
|
608
|
+
const entry = first === void 0 ? void 0 : findEntry(entries, first);
|
|
609
|
+
if (entry !== void 0 && "scope" in entry) return findCommand(entry.scope.entries, rest);
|
|
610
|
+
return rest.length === 0 ? entry : void 0;
|
|
611
|
+
}
|
|
612
|
+
function assertUnique(prefix, entries) {
|
|
613
|
+
const words = entries.flatMap((entry) => [entry.word, ...entry.aliases]);
|
|
614
|
+
const repeated = words.find((word, index) => words.indexOf(word) !== index);
|
|
615
|
+
if (repeated !== void 0) throw new ToolDefinitionError(`Two commands are named ${prefix}${repeated}`);
|
|
616
|
+
}
|
|
617
|
+
function commandGroup(options, word, commands) {
|
|
618
|
+
const hints = options.groups?.[word] ?? {};
|
|
619
|
+
assertUnique(`${word} `, commands);
|
|
620
|
+
return {
|
|
621
|
+
word,
|
|
622
|
+
aliases: (hints.aliases ?? []).map((alias) => commandWord(`${options.name} ${word}`, alias)),
|
|
623
|
+
summary: hints.description ?? commands.map((command) => command.word).join(", "),
|
|
624
|
+
scope: {
|
|
625
|
+
words: [word],
|
|
626
|
+
title: `${hints.description ?? `Commands of ${word}`} (${options.name} ${word} v${options.version})`,
|
|
627
|
+
entries: commands
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function rootEntries(options, commands) {
|
|
632
|
+
const entries = [...Map.groupBy(commands, (command) => command.name.split(" ", 1)[0] ?? "")].flatMap(([lead, members]) => {
|
|
633
|
+
const grouped = members.filter((command) => command.name !== command.word);
|
|
634
|
+
const single = members.filter((command) => command.name === command.word);
|
|
635
|
+
return grouped.length === 0 ? single : [...single, commandGroup(options, lead, grouped)];
|
|
636
|
+
});
|
|
637
|
+
const unknown = Object.keys(options.groups ?? {}).find((word) => !entries.some((entry) => "scope" in entry && entry.word === word));
|
|
638
|
+
if (unknown !== void 0) throw new ToolDefinitionError(`${options.name}: no group ${unknown}`);
|
|
639
|
+
assertUnique("", entries);
|
|
640
|
+
return entries;
|
|
584
641
|
}
|
|
585
642
|
function createCli(options) {
|
|
586
643
|
indexTools(options.tools);
|
|
587
644
|
indexTools(options.commands ?? []);
|
|
588
645
|
const commands = [...commandTools(options).map((tool) => toolCommand(tool)), ...builtInMcp(options) ? [mcpCommand(options)] : []];
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
646
|
+
const root = {
|
|
647
|
+
words: [],
|
|
648
|
+
title: `${options.description} (${options.name} v${options.version})`,
|
|
649
|
+
entries: rootEntries(options, commands)
|
|
650
|
+
};
|
|
651
|
+
const missing = [options.default, options.fallback].find((name) => name !== void 0 && findCommand(root.entries, name.split(" ")) === void 0);
|
|
593
652
|
if (missing !== void 0) throw new ToolDefinitionError(`${options.name}: no command ${missing}`);
|
|
594
|
-
return { run: (argv) => dispatch(options,
|
|
653
|
+
return { run: (argv) => dispatch(options, root, normalizeArgv(options, argv)) };
|
|
595
654
|
}
|
|
596
655
|
const ROOT_FLAGS = /* @__PURE__ */ new Set([
|
|
597
656
|
"--help",
|
|
@@ -601,22 +660,30 @@ const ROOT_FLAGS = /* @__PURE__ */ new Set([
|
|
|
601
660
|
]);
|
|
602
661
|
function normalizeArgv(options, argv) {
|
|
603
662
|
const [first] = argv;
|
|
604
|
-
if (first === void 0) return options.default
|
|
605
|
-
if (options.fallback === void 0 || ROOT_FLAGS.has(first) ||
|
|
606
|
-
return [options.fallback, ...argv];
|
|
663
|
+
if (first === void 0) return options.default?.split(" ") ?? [];
|
|
664
|
+
if (options.fallback === void 0 || ROOT_FLAGS.has(first) || leadWords(options).includes(first)) return [...argv];
|
|
665
|
+
return [...options.fallback.split(" "), ...argv];
|
|
607
666
|
}
|
|
608
|
-
async function dispatch(options,
|
|
609
|
-
const [first
|
|
667
|
+
async function dispatch(options, root, argv) {
|
|
668
|
+
const [first] = argv;
|
|
610
669
|
if (argv.length === 1 && (first === "--version" || first === "-v")) writeLine("stdout", sanitizeLine(options.version));
|
|
611
|
-
else
|
|
612
|
-
|
|
613
|
-
|
|
670
|
+
else await dispatchIn(options, root, argv);
|
|
671
|
+
}
|
|
672
|
+
async function dispatchIn(options, scope, argv) {
|
|
673
|
+
const [first, ...rest] = argv;
|
|
674
|
+
if (first === void 0) {
|
|
675
|
+
writeLine("stderr", sanitizeText(scopeUsage(options, scope)));
|
|
614
676
|
fail(["No command specified"]);
|
|
615
|
-
|
|
616
|
-
const command = commands.find((each) => each.name === first || each.aliases.includes(first));
|
|
617
|
-
if (command === void 0) fail([`Unknown command ${JSON.stringify(first)}`, `Run ${options.name} --help for the commands`]);
|
|
618
|
-
else await runCommand(options, command, rest);
|
|
677
|
+
return;
|
|
619
678
|
}
|
|
679
|
+
if (first === "--help" || first === "-h") {
|
|
680
|
+
writeLine("stdout", sanitizeText(scopeUsage(options, scope)));
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const entry = findEntry(scope.entries, first);
|
|
684
|
+
if (entry === void 0) fail([`Unknown command ${JSON.stringify([...scope.words, first].join(" "))}`, `Run ${scopePath(options, scope)} --help for the commands`]);
|
|
685
|
+
else if ("scope" in entry) await dispatchIn(options, entry.scope, rest);
|
|
686
|
+
else await runCommand(options, entry, rest);
|
|
620
687
|
}
|
|
621
688
|
async function runCommand(options, command, rawArgs) {
|
|
622
689
|
const words = parseWords(rawArgs, command.fields, command.json);
|
|
@@ -635,17 +702,21 @@ function table(rows) {
|
|
|
635
702
|
const width = Math.max(0, ...rows.map(([left]) => left.length));
|
|
636
703
|
return rows.map(([left, right]) => ` ${left.padEnd(width)} ${right}`.trimEnd());
|
|
637
704
|
}
|
|
638
|
-
function
|
|
705
|
+
function scopePath(options, scope) {
|
|
706
|
+
return [options.name, ...scope.words].join(" ");
|
|
707
|
+
}
|
|
708
|
+
function scopeUsage(options, scope) {
|
|
709
|
+
const path = scopePath(options, scope);
|
|
639
710
|
return [
|
|
640
|
-
|
|
711
|
+
scope.title,
|
|
641
712
|
"",
|
|
642
|
-
`USAGE ${
|
|
713
|
+
`USAGE ${path} <command> [OPTIONS]`,
|
|
643
714
|
"",
|
|
644
715
|
"COMMANDS",
|
|
645
716
|
"",
|
|
646
|
-
...table(
|
|
717
|
+
...table(scope.entries.map((entry) => [[entry.word, ...entry.aliases].join(", "), entry.summary])),
|
|
647
718
|
"",
|
|
648
|
-
`Use ${
|
|
719
|
+
`Use ${path} <command> --help for more information about a command.`
|
|
649
720
|
].join("\n");
|
|
650
721
|
}
|
|
651
722
|
function commandUsage(options, command) {
|
package/dist/h3.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ToolDefinition as ToolDefinition$1 } from "./_chunks/index.mjs";
|
|
2
|
+
import { McpHost } from "./_chunks/mcp-answers.mjs";
|
|
2
3
|
import { JsonSchema, ToolDefinition } from "h3-mcp";
|
|
3
4
|
/** An h3-mcp tool whose `inputSchema` is the plain JSON Schema `tools/list` sends. */
|
|
4
5
|
export type H3Tool = ToolDefinition<JsonSchema>;
|
|
@@ -12,6 +13,8 @@ export type H3Tool = ToolDefinition<JsonSchema>;
|
|
|
12
13
|
* instead. An unknown name never reaches a handler: h3-mcp answers it itself
|
|
13
14
|
* with a JSON-RPC error.
|
|
14
15
|
*
|
|
16
|
+
* `host` is an {@link McpHost} with the event's request and the call's raw `_meta`.
|
|
17
|
+
*
|
|
15
18
|
* `ask` reaches a client with `elicitation` on the 2026 revision only: h3-mcp has no 2025 shim.
|
|
16
19
|
*
|
|
17
20
|
* Imports only types from h3-mcp, so the adapter loads neither h3-mcp nor the MCP SDK.
|
|
@@ -23,4 +26,5 @@ export type H3Tool = ToolDefinition<JsonSchema>;
|
|
|
23
26
|
*/
|
|
24
27
|
export declare function toH3Tools(info: {
|
|
25
28
|
readonly name: string;
|
|
26
|
-
}, tools: readonly ToolDefinition$1[]): H3Tool[];
|
|
29
|
+
}, tools: readonly ToolDefinition$1[]): H3Tool[];
|
|
30
|
+
export type { McpHost };
|
package/dist/h3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./_chunks/src.mjs";
|
|
2
|
-
import { callAsking, canAsk, listTools, progressSteps, questionRound } from "./_chunks/mcp-answers.mjs";
|
|
2
|
+
import { callAsking, canAsk, listTools, mcpHost, progressSteps, questionRound } from "./_chunks/mcp-answers.mjs";
|
|
3
3
|
function toH3Tools(info, tools) {
|
|
4
4
|
return listTools(tools).map((entry) => ({
|
|
5
5
|
name: entry.name,
|
|
@@ -16,6 +16,10 @@ function toH3Tools(info, tools) {
|
|
|
16
16
|
const progress = mcp?.progressToken === void 0 ? void 0 : mcp.progress;
|
|
17
17
|
const context = {
|
|
18
18
|
signal: mcp?.signal,
|
|
19
|
+
...mcpHost({
|
|
20
|
+
request: event.req,
|
|
21
|
+
meta: mcp?.meta
|
|
22
|
+
}),
|
|
19
23
|
...progress === void 0 ? {} : { progress: numbered(progress) }
|
|
20
24
|
};
|
|
21
25
|
return await callAsking(info, tools, entry.name, args, context, round);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AddImmutable, AddImmutableDeferred, AddOptional, AddOptionalDeferred, AddReadonly, AddReadonlyDeferred, Any, ArrayOptions, BigInt, BigIntPattern, Boolean, Broaden, Call, CallConstruct,
|
|
1
|
+
import { AddImmutable, AddImmutableDeferred, AddOptional, AddOptionalDeferred, AddReadonly, AddReadonlyDeferred, Any, ArrayOptions, BigInt, BigIntPattern, Boolean, Broaden, Call, CallConstruct, Capitalize, CapitalizeAction, CapitalizeDeferred, CapitalizeInstantiate, Codec, CollapseToObject, Compare, CompareResultDisjoint, CompareResultEqual, CompareResultLeftInside, CompareResultRightInside, Composite, Conditional, ConditionalAction, ConditionalDeferred, ConditionalInstantiate, Constructor, ConstructorOptions, ConstructorParameters, ConstructorParametersAction, ConstructorParametersDeferred, ConstructorParametersInstantiate, ConvertToIntegerKey, Cyclic, CyclicCandidates, CyclicCheck, CyclicDependencies, CyclicExtends, CyclicOptions, CyclicTarget, Decode, DecodeBuilder, Deferred, Dependent, DependentOptions, Distribute, Encode, EncodeBuilder, Enum, Evaluate, EvaluateAction, EvaluateDeferred, EvaluateDependent, EvaluateEnum, EvaluateInstantiate, EvaluateIntersect, EvaluatePropertyIntersect, EvaluatePropertyUnion, EvaluateTemplateLiteral, EvaluateType, EvaluateUnion, EvaluateUnionFast, Exclude, ExcludeAction, ExcludeDeferred, ExcludeInstantiate, Extends, Extract, ExtractAction, ExtractDeferred, ExtractInstantiate, Flatten, FunctionOptions, Generic, Identifier, Immutable, Index, IndexAction, IndexDeferred, IndexInstantiate, Infer, InstanceType, InstanceTypeAction, InstanceTypeDeferred, InstanceTypeInstantiate, Instantiate, InstantiateCyclic, Integer, IntegerKey, IntegerPattern, Interface, InterfaceAction, InterfaceDeferred, InterfaceInstantiate, Intersect, IntersectOptions, InvalidLiteralValue, IsAny, IsArray, IsBigInt, IsBoolean, IsCall, IsCodec, IsConstructor, IsCyclic, IsDeferred, IsDependent, IsEnum, IsEnumValue, IsFunction, IsGeneric, IsIdentifier, IsImmutable, IsInfer, IsInteger, IsInterfaceDeferred, IsIntersect, IsKind, IsLiteral, IsLiteralBigInt, IsLiteralBoolean, IsLiteralNumber, IsLiteralString, IsLiteralValue, IsNever, IsNull, IsNumber, IsObject, IsOptional, IsParameter, IsReadonly, IsRecord, IsRef, IsRefine, IsRefinement, IsRest, IsSchema, IsString, IsSymbol, IsTemplateLiteral, IsTemplateLiteralDeferred, IsTemplateLiteralFinite, IsTemplateLiteralPattern, IsThis, IsTuple, IsTypeScriptEnumLike, IsUndefined, IsUnion, IsUnknown, IsUnsafe, IsVoid, KeyOf, KeyOfAction, KeyOfDeferred, KeyOfInstantiate, KeysToIndexer, Literal, LiteralTypeName, Lowercase, LowercaseAction, LowercaseDeferred, LowercaseInstantiate, Mapped, MappedAction, MappedDeferred, MappedInstantiate, Module, ModuleDeferred, ModuleInstantiate, Narrow, Never, NeverPattern, NonNullable, NonNullableAction, NonNullableDeferred, NonNullableInstantiate, Null, Number, NumberKey, NumberPattern, ObjectOptions, Omit, OmitAction, OmitDeferred, OmitInstantiate, Optional, Parameter, Parameters, ParametersAction, ParametersDeferred, ParametersInstantiate, ParsePatternIntoTypes, ParseTemplateIntoTypes, Partial, PartialAction, PartialDeferred, PartialInstantiate, Pick, PickAction, PickDeferred, PickInstantiate, Priority, PropertyKeys, PropertyValues, Readonly, ReadonlyObject, ReadonlyObjectAction, ReadonlyObjectDeferred, ReadonlyObjectInstantiate, ReadonlyType, Record, RecordAction, RecordDeferred, RecordFromPattern, RecordInstantiate, RecordKey, RecordOptions, RecordPattern, RecordPatternToType, RecordValue, Ref, RefInstantiate, Refine, RefineAdd, RemoveImmutable, RemoveImmutableDeferred, RemoveOptional, RemoveOptionalDeferred, RemoveReadonly, RemoveReadonlyDeferred, Required, RequiredAction, RequiredArray, RequiredDeferred, RequiredInstantiate, Rest, ReturnType, ReturnTypeAction, ReturnTypeDeferred, ReturnTypeInstantiate, Script, Static, StaticAny, StaticArray, StaticBigInt, StaticBoolean, StaticCodec, StaticConstructor, StaticCyclic, StaticDecode, StaticDependent, StaticDirection, StaticEncode, StaticEnum, StaticEvaluate, StaticFunction, StaticInstantiatedParameters, StaticInteger, StaticIntersect, StaticLiteral, StaticNever, StaticNull, StaticNumber, StaticObject, StaticParse, StaticProperties, StaticRecord, StaticRef, StaticString, StaticSymbol, StaticTemplateLiteral, StaticThis, StaticTuple, StaticType, StaticUndefined, StaticUnion, StaticUnknown, StaticUnsafe, StaticVoid, String, StringKey, StringPattern, Symbol, TAddImmutable, TAddImmutableDeferred, TAddOptional, TAddOptionalDeferred, TAddReadonly, TAddReadonlyDeferred, TAny, TArray, TArrayOptions, TBigInt, TBoolean, TBroaden, TCall, TCallConstruct, TCapitalize, TCapitalizeAction, TCapitalizeDeferred, TCapitalizeInstantiate, TCodec, TCollapseToObject, TCompare, TCompareResult, TComposite, TConditional, TConditionalAction, TConditionalDeferred, TConditionalInstantiate, TConstructor, TConstructorParameters, TConstructorParametersAction, TConstructorParametersDeferred, TConstructorParametersInstantiate, TConvertToIntegerKey, TCyclic, TCyclicCandidates, TCyclicCheck, TCyclicDependencies, TCyclicExtends, TCyclicTarget, TDecodeCallback, TDeferred, TDependent, TDistribute, TEncodeCallback, TEnum, TEnumValue, TEvaluate, TEvaluateAction, TEvaluateDeferred, TEvaluateDependent, TEvaluateEnum, TEvaluateInstantiate, TEvaluateIntersect, TEvaluatePropertyIntersect, TEvaluatePropertyUnion, TEvaluateTemplateLiteral, TEvaluateType, TEvaluateUnion, TEvaluateUnionFast, TExclude, TExcludeAction, TExcludeDeferred, TExcludeInstantiate, TExtends, TExtract, TExtractAction, TExtractDeferred, TExtractInstantiate, TFlatten, TFormat, TFunction, TGeneric, TIdentifier, TImmutable, TIndex, TIndexAction, TIndexDeferred, TIndexInstantiate, TInfer, TInstanceType, TInstanceTypeAction, TInstanceTypeDeferred, TInstanceTypeInstantiate, TInstantiate, TInstantiateCyclic, TInteger, TIntegerKey, TInterface, TInterfaceAction, TInterfaceDeferred, TInterfaceInstantiate, TIntersect, TIntersectOptions, TIsTemplateLiteralFinite, TIsTemplateLiteralPattern, TKeyOf, TKeyOfAction, TKeyOfDeferred, TKeyOfInstantiate, TKeysToIndexer, TLiteral, TLiteralTypeName, TLiteralValue, TLowercase, TLowercaseAction, TLowercaseDeferred, TLowercaseInstantiate, TMapped, TMappedAction, TMappedDeferred, TMappedInstantiate, TModule, TModuleDeferred, TModuleInstantiate, TNarrow, TNever, TNonNullable, TNonNullableAction, TNonNullableDeferred, TNonNullableInstantiate, TNull, TNumber, TNumberKey, TNumberOptions, TObject, TObjectOptions, TOmit, TOmitAction, TOmitDeferred, TOmitInstantiate, TOptional, TParameter, TParameters, TParametersAction, TParametersDeferred, TParametersInstantiate, TParsePatternIntoTypes, TParseTemplateIntoTypes, TPartial, TPartialAction, TPartialDeferred, TPartialInstantiate, TPick, TPickAction, TPickDeferred, TPickInstantiate, TPriority, TProperties, TPropertyKeys, TPropertyValues, TReadonly, TReadonlyObject, TReadonlyObjectAction, TReadonlyObjectDeferred, TReadonlyObjectInstantiate, TRecord, TRecordAction, TRecordDeferred, TRecordInstantiate, TRecordKey, TRecordPattern, TRecordPatternToType, TRecordValue, TRef, TRefInstantiate, TRefine, TRefineAdd, TRefineCheckCallback, TRefineErrorCallback, TRefinement, TRemoveImmutable, TRemoveImmutableDeferred, TRemoveOptional, TRemoveOptionalDeferred, TRemoveReadonly, TRemoveReadonlyDeferred, TRequired, TRequiredAction, TRequiredArray, TRequiredDeferred, TRequiredInstantiate, TRest, TReturnType, TReturnTypeAction, TReturnTypeDeferred, TReturnTypeInstantiate, TSchema, TSchemaOptions, TScript, TScriptOptions, TStaticElements, TString, TStringKey, TStringOptions, TSymbol, TTemplateLiteral, TTemplateLiteralDecode, TTemplateLiteralDecodeUnsafe, TTemplateLiteralDeferred, TTemplateLiteralEncode, TTemplateLiteralFromString, TTemplateLiteralFromTypes, TTemplateLiteralStatic, TThis, TTuple, TTupleOptions, TTupleToIntersect, TTupleToUnion, TTypeScriptEnumLike, TTypeScriptEnumToEnumValues, TUncapitalize, TUncapitalizeAction, TUncapitalizeDeferred, TUncapitalizeInstantiate, TUndefined, TUnion, TUnionLast, TUnionToIntersect, TUnionToTuple, TUnknown, TUnsafe, TUppercase, TUppercaseAction, TUppercaseDeferred, TUppercaseInstantiate, TVoid, TWith, TWithAction, TWithDeferred, TWithInstantiate, TemplateLiteral, TemplateLiteralCreate, TemplateLiteralDecode, TemplateLiteralDecodeUnsafe, TemplateLiteralDeferred, TemplateLiteralEncode, TemplateLiteralFromString, TemplateLiteralFromTypes, This, Tuple, TupleOptions, TypeScriptEnumToEnumValues, Uncapitalize, UncapitalizeAction, UncapitalizeDeferred, UncapitalizeInstantiate, Undefined, Union, UnionOptions, Unknown, Unsafe, Uppercase, UppercaseAction, UppercaseDeferred, UppercaseInstantiate, Void, With, WithAction, WithDeferred, WithInstantiate, _Array_, _Function_, _Object_, index_d_exports, result_d_exports } from "./_chunks/libs/typebox.mjs";
|
|
2
2
|
import { Icon, InputCheck, InputIssue, ToolAnswer, ToolAsk, ToolCallContext, ToolCliHints, ToolContent, ToolDefinition, ToolDefinitionError, ToolEffect, ToolInputError, ToolProgress, ToolQuestion, ToolResult, defineTool, indexTools, invokeTool, resultText, sanitizeLine, sanitizeText, validateInput, wireSchema } from "./_chunks/index.mjs";
|
|
3
|
-
export { type AddImmutable, type AddImmutableDeferred, type AddOptional, type AddOptionalDeferred, type AddReadonly, type AddReadonlyDeferred, type Any, type _Array_ as Array, type _Array_, type ArrayOptions, type BigInt, type BigIntPattern, type Boolean, type Broaden, type Call, type CallConstruct, type CanComposite, type Capitalize, type CapitalizeAction, type CapitalizeDeferred, type CapitalizeInstantiate, type Codec, type CollapseToObject, type Compare, type CompareResultDisjoint, type CompareResultEqual, type CompareResultLeftInside, type CompareResultRightInside, type Composite, type Conditional, type ConditionalAction, type ConditionalDeferred, type ConditionalInstantiate, type Constructor, type ConstructorOptions, type ConstructorParameters, type ConstructorParametersAction, type ConstructorParametersDeferred, type ConstructorParametersInstantiate, type ConvertToIntegerKey, type Cyclic, type CyclicCandidates, type CyclicCheck, type CyclicDependencies, type CyclicExtends, type CyclicOptions, type CyclicTarget, type Decode, type DecodeBuilder, type Deferred, type Dependent, type DependentOptions, type Distribute, type Encode, type EncodeBuilder, type Enum, type Evaluate, type EvaluateAction, type EvaluateDeferred, type EvaluateDependent, type EvaluateEnum, type EvaluateInstantiate, type EvaluateIntersect, type EvaluateTemplateLiteral, type EvaluateType, type EvaluateUnion, type EvaluateUnionFast, type Exclude, type ExcludeAction, type ExcludeDeferred, type ExcludeInstantiate, type Extends, type result_d_exports as ExtendsResult, type Extract, type ExtractAction, type ExtractDeferred, type ExtractInstantiate, type Flatten, type _Function_ as Function, type _Function_, type FunctionOptions, type Generic, Icon, type Identifier, type Immutable, type Index, type IndexAction, type IndexDeferred, type IndexInstantiate, type Infer, InputCheck, InputIssue, type InstanceType, type InstanceTypeAction, type InstanceTypeDeferred, type InstanceTypeInstantiate, type Instantiate, type InstantiateCyclic, type Integer, type IntegerKey, type IntegerPattern, type Interface, type InterfaceAction, type InterfaceDeferred, type InterfaceInstantiate, type Intersect, type IntersectOptions, type InvalidLiteralValue, type IsAny, type IsArray, type IsBigInt, type IsBoolean, type IsCall, type IsCodec, type IsConstructor, type IsCyclic, type IsDeferred, type IsDependent, type IsEnum, type IsEnumValue, type IsFunction, type IsGeneric, type IsIdentifier, type IsImmutable, type IsInfer, type IsInteger, type IsInterfaceDeferred, type IsIntersect, type IsKind, type IsLiteral, type IsLiteralBigInt, type IsLiteralBoolean, type IsLiteralNumber, type IsLiteralString, type IsLiteralValue, type IsNever, type IsNull, type IsNumber, type IsObject, type IsOptional, type IsParameter, type IsReadonly, type IsRecord, type IsRef, type IsRefine, type IsRefinement, type IsRest, type IsSchema, type IsString, type IsSymbol, type IsTemplateLiteral, type IsTemplateLiteralDeferred, type IsTemplateLiteralFinite, type IsTemplateLiteralPattern, type IsThis, type IsTuple, type IsTypeScriptEnumLike, type IsUndefined, type IsUnion, type IsUnknown, type IsUnsafe, type IsVoid, type KeyOf, type KeyOfAction, type KeyOfDeferred, type KeyOfInstantiate, type KeysToIndexer, type Literal, type LiteralTypeName, type Lowercase, type LowercaseAction, type LowercaseDeferred, type LowercaseInstantiate, type Mapped, type MappedAction, type MappedDeferred, type MappedInstantiate, type Module, type ModuleDeferred, type ModuleInstantiate, type Narrow, type Never, type NeverPattern, type NonNullable, type NonNullableAction, type NonNullableDeferred, type NonNullableInstantiate, type Null, type Number, type NumberKey, type NumberPattern, type _Object_ as Object, type _Object_, type ObjectOptions, type Omit, type OmitAction, type OmitDeferred, type OmitInstantiate, type Optional, type Parameter, type Parameters, type ParametersAction, type ParametersDeferred, type ParametersInstantiate, type ParsePatternIntoTypes, type ParseTemplateIntoTypes, type Partial, type PartialAction, type PartialDeferred, type PartialInstantiate, type Pick, type PickAction, type PickDeferred, type PickInstantiate, type Priority, type PropertyKeys, type PropertyValues, type Readonly, type ReadonlyObject, type ReadonlyObjectAction, type ReadonlyObjectDeferred, type ReadonlyObjectInstantiate, type ReadonlyType, type Record, type RecordAction, type RecordDeferred, type RecordFromPattern, type RecordInstantiate, type RecordKey, type RecordOptions, type RecordPattern, type RecordPatternToType, type RecordValue, type Ref, type RefInstantiate, type Refine, type RefineAdd, type RemoveImmutable, type RemoveImmutableDeferred, type RemoveOptional, type RemoveOptionalDeferred, type RemoveReadonly, type RemoveReadonlyDeferred, type Required, type RequiredAction, type RequiredArray, type RequiredDeferred, type RequiredInstantiate, type Rest, type ReturnType, type ReturnTypeAction, type ReturnTypeDeferred, type ReturnTypeInstantiate, type Script, type Static, type StaticAny, type StaticArray, type StaticBigInt, type StaticBoolean, type StaticCodec, type StaticConstructor, type StaticCyclic, type StaticDecode, type StaticDependent, type StaticDirection, type StaticEncode, type StaticEnum, type StaticEvaluate, type StaticFunction, type StaticInstantiatedParameters, type StaticInteger, type StaticIntersect, type StaticLiteral, type StaticNever, type StaticNull, type StaticNumber, type StaticObject, type StaticParse, type StaticProperties, type StaticRecord, type StaticRef, type StaticString, type StaticSymbol, type StaticTemplateLiteral, type StaticThis, type StaticTuple, type StaticType, type StaticUndefined, type StaticUnion, type StaticUnknown, type StaticUnsafe, type StaticVoid, type String, type StringKey, type StringPattern, type Symbol, type TAddImmutable, type TAddImmutableDeferred, type TAddOptional, type TAddOptionalDeferred, type TAddReadonly, type TAddReadonlyDeferred, type TAny, type TArray, type TArrayOptions, type TBigInt, type TBoolean, type TBroaden, type TCall, type TCallConstruct, type TCanComposite, type TCapitalize, type TCapitalizeAction, type TCapitalizeDeferred, type TCapitalizeInstantiate, type TCodec, type TCollapseToObject, type TCompare, type TCompareResult, type TComposite, type TConditional, type TConditionalAction, type TConditionalDeferred, type TConditionalInstantiate, type TConstructor, type TConstructorParameters, type TConstructorParametersAction, type TConstructorParametersDeferred, type TConstructorParametersInstantiate, type TConvertToIntegerKey, type TCyclic, type TCyclicCandidates, type TCyclicCheck, type TCyclicDependencies, type TCyclicExtends, type TCyclicTarget, type TDecodeCallback, type TDeferred, type TDependent, type TDistribute, type TEncodeCallback, type TEnum, type TEnumValue, type TEvaluate, type TEvaluateAction, type TEvaluateDeferred, type TEvaluateDependent, type TEvaluateEnum, type TEvaluateInstantiate, type TEvaluateIntersect, type TEvaluateTemplateLiteral, type TEvaluateType, type TEvaluateUnion, type TEvaluateUnionFast, type TExclude, type TExcludeAction, type TExcludeDeferred, type TExcludeInstantiate, type TExtends, type TExtract, type TExtractAction, type TExtractDeferred, type TExtractInstantiate, type TFlatten, type TFormat, type TFunction, type TGeneric, type TIdentifier, type TImmutable, type TIndex, type TIndexAction, type TIndexDeferred, type TIndexInstantiate, type TInfer, type TInstanceType, type TInstanceTypeAction, type TInstanceTypeDeferred, type TInstanceTypeInstantiate, type TInstantiate, type TInstantiateCyclic, type TInteger, type TIntegerKey, type TInterface, type TInterfaceAction, type TInterfaceDeferred, type TInterfaceInstantiate, type TIntersect, type TIntersectOptions, type TIsTemplateLiteralFinite, type TIsTemplateLiteralPattern, type TKeyOf, type TKeyOfAction, type TKeyOfDeferred, type TKeyOfInstantiate, type TKeysToIndexer, type TLiteral, type TLiteralTypeName, type TLiteralValue, type TLowercase, type TLowercaseAction, type TLowercaseDeferred, type TLowercaseInstantiate, type TMapped, type TMappedAction, type TMappedDeferred, type TMappedInstantiate, type TModule, type TModuleDeferred, type TModuleInstantiate, type TNarrow, type TNever, type TNonNullable, type TNonNullableAction, type TNonNullableDeferred, type TNonNullableInstantiate, type TNull, type TNumber, type TNumberKey, type TNumberOptions, type TObject, type TObjectOptions, type TOmit, type TOmitAction, type TOmitDeferred, type TOmitInstantiate, type TOptional, type TParameter, type TParameters, type TParametersAction, type TParametersDeferred, type TParametersInstantiate, type TParsePatternIntoTypes, type TParseTemplateIntoTypes, type TPartial, type TPartialAction, type TPartialDeferred, type TPartialInstantiate, type TPick, type TPickAction, type TPickDeferred, type TPickInstantiate, type TPriority, type TProperties, type TPropertyKeys, type TPropertyValues, type TReadonly, type TReadonlyObject, type TReadonlyObjectAction, type TReadonlyObjectDeferred, type TReadonlyObjectInstantiate, type TRecord, type TRecordAction, type TRecordDeferred, type TRecordInstantiate, type TRecordKey, type TRecordPattern, type TRecordPatternToType, type TRecordValue, type TRef, type TRefInstantiate, type TRefine, type TRefineAdd, type TRefineCheckCallback, type TRefineErrorCallback, type TRefinement, type TRemoveImmutable, type TRemoveImmutableDeferred, type TRemoveOptional, type TRemoveOptionalDeferred, type TRemoveReadonly, type TRemoveReadonlyDeferred, type TRequired, type TRequiredAction, type TRequiredArray, type TRequiredDeferred, type TRequiredInstantiate, type TRest, type TReturnType, type TReturnTypeAction, type TReturnTypeDeferred, type TReturnTypeInstantiate, type TSchema, type TSchemaOptions, type TScript, type TScriptOptions, type TStaticElements, type TString, type TStringKey, type TStringOptions, type TSymbol, type TTemplateLiteral, type TTemplateLiteralDecode, type TTemplateLiteralDecodeUnsafe, type TTemplateLiteralDeferred, type TTemplateLiteralEncode, type TTemplateLiteralFromString, type TTemplateLiteralFromTypes, type TTemplateLiteralStatic, type TThis, type TTuple, type TTupleOptions, type TTupleToIntersect, type TTupleToUnion, type TTypeScriptEnumLike, type TTypeScriptEnumToEnumValues, type TUncapitalize, type TUncapitalizeAction, type TUncapitalizeDeferred, type TUncapitalizeInstantiate, type TUndefined, type TUnion, type TUnionLast, type TUnionToIntersect, type TUnionToTuple, type TUnknown, type TUnsafe, type TUppercase, type TUppercaseAction, type TUppercaseDeferred, type TUppercaseInstantiate, type TVoid, type TWith, type TWithAction, type TWithDeferred, type TWithInstantiate, type TemplateLiteral, type TemplateLiteralCreate, type TemplateLiteralDecode, type TemplateLiteralDecodeUnsafe, type TemplateLiteralDeferred, type TemplateLiteralEncode, type TemplateLiteralFromString, type TemplateLiteralFromTypes, type This, ToolAnswer, ToolAsk, ToolCallContext, ToolCliHints, ToolContent, ToolDefinition, ToolDefinitionError, ToolEffect, ToolInputError, ToolProgress, ToolQuestion, ToolResult, type Tuple, type TupleOptions, index_d_exports as Type, type TypeScriptEnumToEnumValues, type Uncapitalize, type UncapitalizeAction, type UncapitalizeDeferred, type UncapitalizeInstantiate, type Undefined, type Union, type UnionOptions, type Unknown, type Unsafe, type Uppercase, type UppercaseAction, type UppercaseDeferred, type UppercaseInstantiate, type Void, type With, type WithAction, type WithDeferred, type WithInstantiate, defineTool, indexTools, invokeTool, resultText, sanitizeLine, sanitizeText, validateInput, wireSchema };
|
|
3
|
+
export { type AddImmutable, type AddImmutableDeferred, type AddOptional, type AddOptionalDeferred, type AddReadonly, type AddReadonlyDeferred, type Any, type _Array_ as Array, type _Array_, type ArrayOptions, type BigInt, type BigIntPattern, type Boolean, type Broaden, type Call, type CallConstruct, type Capitalize, type CapitalizeAction, type CapitalizeDeferred, type CapitalizeInstantiate, type Codec, type CollapseToObject, type Compare, type CompareResultDisjoint, type CompareResultEqual, type CompareResultLeftInside, type CompareResultRightInside, type Composite, type Conditional, type ConditionalAction, type ConditionalDeferred, type ConditionalInstantiate, type Constructor, type ConstructorOptions, type ConstructorParameters, type ConstructorParametersAction, type ConstructorParametersDeferred, type ConstructorParametersInstantiate, type ConvertToIntegerKey, type Cyclic, type CyclicCandidates, type CyclicCheck, type CyclicDependencies, type CyclicExtends, type CyclicOptions, type CyclicTarget, type Decode, type DecodeBuilder, type Deferred, type Dependent, type DependentOptions, type Distribute, type Encode, type EncodeBuilder, type Enum, type Evaluate, type EvaluateAction, type EvaluateDeferred, type EvaluateDependent, type EvaluateEnum, type EvaluateInstantiate, type EvaluateIntersect, type EvaluatePropertyIntersect, type EvaluatePropertyUnion, type EvaluateTemplateLiteral, type EvaluateType, type EvaluateUnion, type EvaluateUnionFast, type Exclude, type ExcludeAction, type ExcludeDeferred, type ExcludeInstantiate, type Extends, type result_d_exports as ExtendsResult, type Extract, type ExtractAction, type ExtractDeferred, type ExtractInstantiate, type Flatten, type _Function_ as Function, type _Function_, type FunctionOptions, type Generic, Icon, type Identifier, type Immutable, type Index, type IndexAction, type IndexDeferred, type IndexInstantiate, type Infer, InputCheck, InputIssue, type InstanceType, type InstanceTypeAction, type InstanceTypeDeferred, type InstanceTypeInstantiate, type Instantiate, type InstantiateCyclic, type Integer, type IntegerKey, type IntegerPattern, type Interface, type InterfaceAction, type InterfaceDeferred, type InterfaceInstantiate, type Intersect, type IntersectOptions, type InvalidLiteralValue, type IsAny, type IsArray, type IsBigInt, type IsBoolean, type IsCall, type IsCodec, type IsConstructor, type IsCyclic, type IsDeferred, type IsDependent, type IsEnum, type IsEnumValue, type IsFunction, type IsGeneric, type IsIdentifier, type IsImmutable, type IsInfer, type IsInteger, type IsInterfaceDeferred, type IsIntersect, type IsKind, type IsLiteral, type IsLiteralBigInt, type IsLiteralBoolean, type IsLiteralNumber, type IsLiteralString, type IsLiteralValue, type IsNever, type IsNull, type IsNumber, type IsObject, type IsOptional, type IsParameter, type IsReadonly, type IsRecord, type IsRef, type IsRefine, type IsRefinement, type IsRest, type IsSchema, type IsString, type IsSymbol, type IsTemplateLiteral, type IsTemplateLiteralDeferred, type IsTemplateLiteralFinite, type IsTemplateLiteralPattern, type IsThis, type IsTuple, type IsTypeScriptEnumLike, type IsUndefined, type IsUnion, type IsUnknown, type IsUnsafe, type IsVoid, type KeyOf, type KeyOfAction, type KeyOfDeferred, type KeyOfInstantiate, type KeysToIndexer, type Literal, type LiteralTypeName, type Lowercase, type LowercaseAction, type LowercaseDeferred, type LowercaseInstantiate, type Mapped, type MappedAction, type MappedDeferred, type MappedInstantiate, type Module, type ModuleDeferred, type ModuleInstantiate, type Narrow, type Never, type NeverPattern, type NonNullable, type NonNullableAction, type NonNullableDeferred, type NonNullableInstantiate, type Null, type Number, type NumberKey, type NumberPattern, type _Object_ as Object, type _Object_, type ObjectOptions, type Omit, type OmitAction, type OmitDeferred, type OmitInstantiate, type Optional, type Parameter, type Parameters, type ParametersAction, type ParametersDeferred, type ParametersInstantiate, type ParsePatternIntoTypes, type ParseTemplateIntoTypes, type Partial, type PartialAction, type PartialDeferred, type PartialInstantiate, type Pick, type PickAction, type PickDeferred, type PickInstantiate, type Priority, type PropertyKeys, type PropertyValues, type Readonly, type ReadonlyObject, type ReadonlyObjectAction, type ReadonlyObjectDeferred, type ReadonlyObjectInstantiate, type ReadonlyType, type Record, type RecordAction, type RecordDeferred, type RecordFromPattern, type RecordInstantiate, type RecordKey, type RecordOptions, type RecordPattern, type RecordPatternToType, type RecordValue, type Ref, type RefInstantiate, type Refine, type RefineAdd, type RemoveImmutable, type RemoveImmutableDeferred, type RemoveOptional, type RemoveOptionalDeferred, type RemoveReadonly, type RemoveReadonlyDeferred, type Required, type RequiredAction, type RequiredArray, type RequiredDeferred, type RequiredInstantiate, type Rest, type ReturnType, type ReturnTypeAction, type ReturnTypeDeferred, type ReturnTypeInstantiate, type Script, type Static, type StaticAny, type StaticArray, type StaticBigInt, type StaticBoolean, type StaticCodec, type StaticConstructor, type StaticCyclic, type StaticDecode, type StaticDependent, type StaticDirection, type StaticEncode, type StaticEnum, type StaticEvaluate, type StaticFunction, type StaticInstantiatedParameters, type StaticInteger, type StaticIntersect, type StaticLiteral, type StaticNever, type StaticNull, type StaticNumber, type StaticObject, type StaticParse, type StaticProperties, type StaticRecord, type StaticRef, type StaticString, type StaticSymbol, type StaticTemplateLiteral, type StaticThis, type StaticTuple, type StaticType, type StaticUndefined, type StaticUnion, type StaticUnknown, type StaticUnsafe, type StaticVoid, type String, type StringKey, type StringPattern, type Symbol, type TAddImmutable, type TAddImmutableDeferred, type TAddOptional, type TAddOptionalDeferred, type TAddReadonly, type TAddReadonlyDeferred, type TAny, type TArray, type TArrayOptions, type TBigInt, type TBoolean, type TBroaden, type TCall, type TCallConstruct, type TCapitalize, type TCapitalizeAction, type TCapitalizeDeferred, type TCapitalizeInstantiate, type TCodec, type TCollapseToObject, type TCompare, type TCompareResult, type TComposite, type TConditional, type TConditionalAction, type TConditionalDeferred, type TConditionalInstantiate, type TConstructor, type TConstructorParameters, type TConstructorParametersAction, type TConstructorParametersDeferred, type TConstructorParametersInstantiate, type TConvertToIntegerKey, type TCyclic, type TCyclicCandidates, type TCyclicCheck, type TCyclicDependencies, type TCyclicExtends, type TCyclicTarget, type TDecodeCallback, type TDeferred, type TDependent, type TDistribute, type TEncodeCallback, type TEnum, type TEnumValue, type TEvaluate, type TEvaluateAction, type TEvaluateDeferred, type TEvaluateDependent, type TEvaluateEnum, type TEvaluateInstantiate, type TEvaluateIntersect, type TEvaluatePropertyIntersect, type TEvaluatePropertyUnion, type TEvaluateTemplateLiteral, type TEvaluateType, type TEvaluateUnion, type TEvaluateUnionFast, type TExclude, type TExcludeAction, type TExcludeDeferred, type TExcludeInstantiate, type TExtends, type TExtract, type TExtractAction, type TExtractDeferred, type TExtractInstantiate, type TFlatten, type TFormat, type TFunction, type TGeneric, type TIdentifier, type TImmutable, type TIndex, type TIndexAction, type TIndexDeferred, type TIndexInstantiate, type TInfer, type TInstanceType, type TInstanceTypeAction, type TInstanceTypeDeferred, type TInstanceTypeInstantiate, type TInstantiate, type TInstantiateCyclic, type TInteger, type TIntegerKey, type TInterface, type TInterfaceAction, type TInterfaceDeferred, type TInterfaceInstantiate, type TIntersect, type TIntersectOptions, type TIsTemplateLiteralFinite, type TIsTemplateLiteralPattern, type TKeyOf, type TKeyOfAction, type TKeyOfDeferred, type TKeyOfInstantiate, type TKeysToIndexer, type TLiteral, type TLiteralTypeName, type TLiteralValue, type TLowercase, type TLowercaseAction, type TLowercaseDeferred, type TLowercaseInstantiate, type TMapped, type TMappedAction, type TMappedDeferred, type TMappedInstantiate, type TModule, type TModuleDeferred, type TModuleInstantiate, type TNarrow, type TNever, type TNonNullable, type TNonNullableAction, type TNonNullableDeferred, type TNonNullableInstantiate, type TNull, type TNumber, type TNumberKey, type TNumberOptions, type TObject, type TObjectOptions, type TOmit, type TOmitAction, type TOmitDeferred, type TOmitInstantiate, type TOptional, type TParameter, type TParameters, type TParametersAction, type TParametersDeferred, type TParametersInstantiate, type TParsePatternIntoTypes, type TParseTemplateIntoTypes, type TPartial, type TPartialAction, type TPartialDeferred, type TPartialInstantiate, type TPick, type TPickAction, type TPickDeferred, type TPickInstantiate, type TPriority, type TProperties, type TPropertyKeys, type TPropertyValues, type TReadonly, type TReadonlyObject, type TReadonlyObjectAction, type TReadonlyObjectDeferred, type TReadonlyObjectInstantiate, type TRecord, type TRecordAction, type TRecordDeferred, type TRecordInstantiate, type TRecordKey, type TRecordPattern, type TRecordPatternToType, type TRecordValue, type TRef, type TRefInstantiate, type TRefine, type TRefineAdd, type TRefineCheckCallback, type TRefineErrorCallback, type TRefinement, type TRemoveImmutable, type TRemoveImmutableDeferred, type TRemoveOptional, type TRemoveOptionalDeferred, type TRemoveReadonly, type TRemoveReadonlyDeferred, type TRequired, type TRequiredAction, type TRequiredArray, type TRequiredDeferred, type TRequiredInstantiate, type TRest, type TReturnType, type TReturnTypeAction, type TReturnTypeDeferred, type TReturnTypeInstantiate, type TSchema, type TSchemaOptions, type TScript, type TScriptOptions, type TStaticElements, type TString, type TStringKey, type TStringOptions, type TSymbol, type TTemplateLiteral, type TTemplateLiteralDecode, type TTemplateLiteralDecodeUnsafe, type TTemplateLiteralDeferred, type TTemplateLiteralEncode, type TTemplateLiteralFromString, type TTemplateLiteralFromTypes, type TTemplateLiteralStatic, type TThis, type TTuple, type TTupleOptions, type TTupleToIntersect, type TTupleToUnion, type TTypeScriptEnumLike, type TTypeScriptEnumToEnumValues, type TUncapitalize, type TUncapitalizeAction, type TUncapitalizeDeferred, type TUncapitalizeInstantiate, type TUndefined, type TUnion, type TUnionLast, type TUnionToIntersect, type TUnionToTuple, type TUnknown, type TUnsafe, type TUppercase, type TUppercaseAction, type TUppercaseDeferred, type TUppercaseInstantiate, type TVoid, type TWith, type TWithAction, type TWithDeferred, type TWithInstantiate, type TemplateLiteral, type TemplateLiteralCreate, type TemplateLiteralDecode, type TemplateLiteralDecodeUnsafe, type TemplateLiteralDeferred, type TemplateLiteralEncode, type TemplateLiteralFromString, type TemplateLiteralFromTypes, type This, ToolAnswer, ToolAsk, ToolCallContext, ToolCliHints, ToolContent, ToolDefinition, ToolDefinitionError, ToolEffect, ToolInputError, ToolProgress, ToolQuestion, ToolResult, type Tuple, type TupleOptions, index_d_exports as Type, type TypeScriptEnumToEnumValues, type Uncapitalize, type UncapitalizeAction, type UncapitalizeDeferred, type UncapitalizeInstantiate, type Undefined, type Union, type UnionOptions, type Unknown, type Unsafe, type Uppercase, type UppercaseAction, type UppercaseDeferred, type UppercaseInstantiate, type Void, type With, type WithAction, type WithDeferred, type WithInstantiate, defineTool, indexTools, invokeTool, resultText, sanitizeLine, sanitizeText, validateInput, wireSchema };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolDefinition } from "./_chunks/index.mjs";
|
|
2
|
-
import { McpServerInfo, callTool, errorResult, listTools, toolAnnotations } from "./_chunks/mcp-answers.mjs";
|
|
2
|
+
import { McpHost, McpServerInfo, callTool, errorResult, listTools, toolAnnotations } from "./_chunks/mcp-answers.mjs";
|
|
3
3
|
import { Server } from "@modelcontextprotocol/server";
|
|
4
4
|
/**
|
|
5
5
|
* Creates an unconnected MCP server exposing the tools.
|
|
@@ -20,10 +20,12 @@ import { Server } from "@modelcontextprotocol/server";
|
|
|
20
20
|
* A client that declares `elicitation` gets `ask`, through `input_required` on both revisions.
|
|
21
21
|
* A 2026 request carries its capabilities itself, a 2025 one declared them at `initialize`.
|
|
22
22
|
*
|
|
23
|
+
* `host` is an {@link McpHost}: the HTTP request on an HTTP transport, the call's `_meta` on any.
|
|
24
|
+
*
|
|
23
25
|
* @param info - Name, version and optional title, description, icons and website, sent as given.
|
|
24
26
|
* @param tools - Tools to serve.
|
|
25
27
|
* @returns {Server} Unconnected MCP server.
|
|
26
28
|
* @throws {ToolDefinitionError} When two tools share a name.
|
|
27
29
|
*/
|
|
28
30
|
export declare function createMcpServer(info: McpServerInfo, tools: readonly ToolDefinition[]): Server;
|
|
29
|
-
export { type McpServerInfo, callTool, errorResult, listTools, toolAnnotations };
|
|
31
|
+
export { type McpHost, type McpServerInfo, callTool, errorResult, listTools, toolAnnotations };
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { indexTools } from "./_chunks/src.mjs";
|
|
2
|
-
import { callAsking, callTool, canAsk, copyIcons, errorResult, listTools, progressSteps, questionRound, toolAnnotations } from "./_chunks/mcp-answers.mjs";
|
|
2
|
+
import { callAsking, callTool, canAsk, copyIcons, errorResult, listTools, mcpHost, progressSteps, questionRound, toolAnnotations } from "./_chunks/mcp-answers.mjs";
|
|
3
3
|
import { Server } from "@modelcontextprotocol/server";
|
|
4
4
|
function createMcpServer(info, tools) {
|
|
5
5
|
indexTools(tools);
|
|
@@ -14,7 +14,8 @@ function createMcpServer(info, tools) {
|
|
|
14
14
|
}, { capabilities: { tools: {} } });
|
|
15
15
|
server.setRequestHandler("tools/list", () => ({ tools: listTools(tools) }));
|
|
16
16
|
server.setRequestHandler("tools/call", async (request, ctx) => {
|
|
17
|
-
const
|
|
17
|
+
const meta = ctx.mcpReq._meta;
|
|
18
|
+
const progressToken = meta?.progressToken;
|
|
18
19
|
const notify = (params) => {
|
|
19
20
|
ctx.mcpReq.notify({
|
|
20
21
|
method: "notifications/progress",
|
|
@@ -30,6 +31,10 @@ function createMcpServer(info, tools) {
|
|
|
30
31
|
const round = canAsk(capabilities) ? questionRound(ctx.mcpReq.inputResponses, stateOf(ctx.mcpReq.requestState())) : void 0;
|
|
31
32
|
const context = {
|
|
32
33
|
signal: ctx.mcpReq.signal,
|
|
34
|
+
...mcpHost({
|
|
35
|
+
request: ctx.http?.req,
|
|
36
|
+
meta
|
|
37
|
+
}),
|
|
33
38
|
...progressToken === void 0 ? {} : { progress: progressSteps(notify) }
|
|
34
39
|
};
|
|
35
40
|
const { name, arguments: args } = request.params;
|
package/dist/omp.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { indexTools, invokeTool, sanitizeLine, wireSchema } from "./_chunks/src.mjs";
|
|
2
|
+
import { throwWithCauses } from "./_chunks/causes.mjs";
|
|
2
3
|
import { hostContext } from "./_chunks/updates.mjs";
|
|
3
4
|
const APPROVAL = {
|
|
4
5
|
read: "read",
|
|
@@ -21,7 +22,8 @@ function registerOmpTools(pi, tools, options) {
|
|
|
21
22
|
loadMode: options.loadMode,
|
|
22
23
|
strict: false,
|
|
23
24
|
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
24
|
-
|
|
25
|
+
const context = hostContext(signal, onUpdate, ctx);
|
|
26
|
+
return await invokeTool(tool, params, context).catch(throwWithCauses);
|
|
25
27
|
},
|
|
26
28
|
renderCall(args, renderOptions, theme) {
|
|
27
29
|
if (renderers?.renderCall) return renderers.renderCall(args, renderOptions, theme);
|
package/dist/pi.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ToolDefinitionError, ToolInputError, indexTools, invokeTool, resultText, sanitizeLine, sanitizeText, validateInput } from "./_chunks/src.mjs";
|
|
2
|
+
import { throwWithCauses } from "./_chunks/causes.mjs";
|
|
2
3
|
import { hostContext } from "./_chunks/updates.mjs";
|
|
3
4
|
function registerPiTools(pi, tools, options = {}) {
|
|
4
5
|
const names = [...indexTools(tools).keys()];
|
|
@@ -20,7 +21,8 @@ function registerPiTools(pi, tools, options = {}) {
|
|
|
20
21
|
parameters: tool.input,
|
|
21
22
|
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
22
23
|
if (ask) await approve(tool, ask, params, signal, ctx);
|
|
23
|
-
const
|
|
24
|
+
const context = hostContext(signal, onUpdate, ctx);
|
|
25
|
+
const result = await invokeTool(tool, params, context).catch(throwWithCauses);
|
|
24
26
|
if (result.isError && failures === "throw") throw new Error(resultText(result));
|
|
25
27
|
return result;
|
|
26
28
|
}
|
package/dist/toolkit.d.mts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { ToolDefinition } from "./_chunks/index.mjs";
|
|
2
|
+
import { McpHost } from "./_chunks/mcp-answers.mjs";
|
|
3
|
+
/** What SDK v1 keeps of the HTTP request. */
|
|
4
|
+
export interface ToolkitRequestInfo {
|
|
5
|
+
readonly headers: Readonly<Record<string, string | readonly string[] | undefined>>;
|
|
6
|
+
readonly url?: {
|
|
7
|
+
readonly href: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
2
10
|
/** The part of the SDK v1 request `extra` a handler reads: abort signal, progress and questions. */
|
|
3
11
|
export interface ToolkitExtra {
|
|
4
12
|
readonly signal?: AbortSignal;
|
|
13
|
+
/** Present on an HTTP transport. */
|
|
14
|
+
readonly requestInfo?: ToolkitRequestInfo;
|
|
5
15
|
readonly _meta?: {
|
|
16
|
+
readonly [key: string]: unknown;
|
|
6
17
|
readonly progressToken?: string | number;
|
|
7
18
|
};
|
|
8
19
|
readonly sendNotification?: (notification: {
|
|
@@ -64,6 +75,9 @@ export interface ToolkitTool {
|
|
|
64
75
|
/**
|
|
65
76
|
* Turns tools into toolkit entries that list what `listTools` lists and answer via `callTool`.
|
|
66
77
|
*
|
|
78
|
+
* `host` is an {@link McpHost} with the call's `_meta` and a `Request` rebuilt from SDK v1's
|
|
79
|
+
* `requestInfo`: the caller's URL and headers, but no body and always `GET`.
|
|
80
|
+
*
|
|
67
81
|
* Progress and questions need the toolkit's sessions: its stateless default answers in plain JSON.
|
|
68
82
|
* `useMcpElicitation` also needs Nitro's `asyncContext`, since it finds the server in the request.
|
|
69
83
|
*
|
|
@@ -75,4 +89,5 @@ export interface ToolkitTool {
|
|
|
75
89
|
*/
|
|
76
90
|
export declare function toToolkitTools(info: {
|
|
77
91
|
readonly name: string;
|
|
78
|
-
}, tools: readonly ToolDefinition[], options?: ToolkitOptions): ToolkitTool[];
|
|
92
|
+
}, tools: readonly ToolDefinition[], options?: ToolkitOptions): ToolkitTool[];
|
|
93
|
+
export type { McpHost };
|
package/dist/toolkit.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./_chunks/src.mjs";
|
|
2
2
|
import { hostAsk } from "./_chunks/questions.mjs";
|
|
3
|
-
import { callTool, listTools, progressSteps } from "./_chunks/mcp-answers.mjs";
|
|
3
|
+
import { callTool, listTools, mcpHost, progressSteps } from "./_chunks/mcp-answers.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
function toToolkitTools(info, tools, options = {}) {
|
|
6
6
|
return listTools(tools).map((entry) => ({
|
|
@@ -35,6 +35,10 @@ function callContext(extra) {
|
|
|
35
35
|
const send = extra?.sendNotification;
|
|
36
36
|
return {
|
|
37
37
|
signal: extra?.signal,
|
|
38
|
+
...mcpHost({
|
|
39
|
+
request: rebuiltRequest(extra?.requestInfo),
|
|
40
|
+
meta: extra?._meta
|
|
41
|
+
}),
|
|
38
42
|
...progressToken === void 0 || send === void 0 ? {} : { progress: progressSteps((params) => {
|
|
39
43
|
send({
|
|
40
44
|
method: "notifications/progress",
|
|
@@ -46,6 +50,23 @@ function callContext(extra) {
|
|
|
46
50
|
}) }
|
|
47
51
|
};
|
|
48
52
|
}
|
|
53
|
+
function rebuiltRequest(info) {
|
|
54
|
+
if (info?.url === void 0) return void 0;
|
|
55
|
+
const headers = new Headers();
|
|
56
|
+
for (const [name, value] of Object.entries(info.headers)) for (const item of [value ?? []].flat()) if (isHeader(name, item)) headers.append(name, item);
|
|
57
|
+
try {
|
|
58
|
+
return new Request(info.url.href, { headers });
|
|
59
|
+
} catch {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function isHeader(name, value) {
|
|
64
|
+
try {
|
|
65
|
+
return new Headers([[name, value]]).has(name);
|
|
66
|
+
} catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
49
70
|
function formAsk(extra, elicitation) {
|
|
50
71
|
const send = extra?.sendRequest;
|
|
51
72
|
if (send === void 0 || elicitation?.().supports("form") !== true) return {};
|