@introspection-ai/recipes 0.13.0 → 0.14.0
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/README.md +45 -58
- package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
- package/dist/agents.d.ts.map +1 -0
- package/dist/{agent-tool.js → agents.js} +1 -1
- package/dist/agents.js.map +1 -0
- package/dist/api/extensions.d.ts +3 -0
- package/dist/api/extensions.d.ts.map +1 -0
- package/dist/api/extensions.js +2 -0
- package/dist/api/extensions.js.map +1 -0
- package/dist/api/mcp.d.ts +4 -0
- package/dist/api/mcp.d.ts.map +1 -0
- package/dist/api/mcp.js +2 -0
- package/dist/api/mcp.js.map +1 -0
- package/dist/api/session.d.ts +3 -0
- package/dist/api/session.d.ts.map +1 -0
- package/dist/api/session.js +2 -0
- package/dist/api/session.js.map +1 -0
- package/dist/child-agent.d.ts +5 -4
- package/dist/child-agent.d.ts.map +1 -1
- package/dist/child-agent.js +26 -117
- package/dist/child-agent.js.map +1 -1
- package/dist/child-session.d.ts +23 -0
- package/dist/child-session.d.ts.map +1 -0
- package/dist/child-session.js +48 -0
- package/dist/child-session.js.map +1 -0
- package/dist/extensions.d.ts +29 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +119 -0
- package/dist/extensions.js.map +1 -0
- package/dist/index.d.ts +4 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -13
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +38 -5
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +92 -41
- package/dist/inspect.js.map +1 -1
- package/dist/interactions.d.ts +18 -2
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +41 -10
- package/dist/interactions.js.map +1 -1
- package/dist/mcp-catalog.d.ts +1 -0
- package/dist/mcp-catalog.d.ts.map +1 -1
- package/dist/mcp-catalog.js +14 -6
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
- package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
- package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
- package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
- package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
- package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
- package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
- package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
- package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
- package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
- package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
- package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
- package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
- package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
- package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
- package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
- package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
- package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
- package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
- package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
- package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
- package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
- package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
- package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
- package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
- package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
- package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
- package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
- package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
- package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
- package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
- package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
- package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
- package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
- package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
- package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
- package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
- package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
- package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
- package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
- package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
- package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
- package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
- package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
- package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
- package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
- package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
- package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
- package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
- package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
- package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
- package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
- package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
- package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
- package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
- package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
- package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
- package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
- package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
- package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
- package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
- package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
- package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
- package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
- package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
- package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
- package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
- package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
- package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
- package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
- package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
- package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
- package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
- package/dist/mcp-daemon-client.d.ts +6 -1
- package/dist/mcp-daemon-client.d.ts.map +1 -1
- package/dist/mcp-daemon-client.js +119 -2
- package/dist/mcp-daemon-client.js.map +1 -1
- package/dist/mcp-daemon-protocol.d.ts +18 -1
- package/dist/mcp-daemon-protocol.d.ts.map +1 -1
- package/dist/mcp-daemon-protocol.js +31 -0
- package/dist/mcp-daemon-protocol.js.map +1 -1
- package/dist/mcp-daemon.js +169 -76602
- package/dist/mcp-daemon.js.map +1 -1
- package/dist/mcp-policy.d.ts +11 -0
- package/dist/mcp-policy.d.ts.map +1 -0
- package/dist/mcp-policy.js +27 -0
- package/dist/mcp-policy.js.map +1 -0
- package/dist/mcp-run-worker.js +38 -76540
- package/dist/mcp-tools.d.ts +39 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +493 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/mcp.d.ts +21 -9
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +101 -31
- package/dist/mcp.js.map +1 -1
- package/dist/model-binding.d.ts +39 -0
- package/dist/model-binding.d.ts.map +1 -0
- package/dist/model-binding.js +103 -0
- package/dist/model-binding.js.map +1 -0
- package/dist/pi-extension.d.ts +2 -22
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +296 -71
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/resolve.d.ts +43 -20
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +215 -70
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/recipe-agent.d.ts +24 -27
- package/dist/recipe-agent.d.ts.map +1 -1
- package/dist/recipe-agent.js +278 -230
- package/dist/recipe-agent.js.map +1 -1
- package/dist/recipe-check.d.ts +17 -0
- package/dist/recipe-check.d.ts.map +1 -0
- package/dist/recipe-check.js +258 -0
- package/dist/recipe-check.js.map +1 -0
- package/dist/recipe-extensions.d.ts.map +1 -1
- package/dist/recipe-extensions.js +0 -3
- package/dist/recipe-extensions.js.map +1 -1
- package/dist/recipe-model.d.ts +3 -1
- package/dist/recipe-model.d.ts.map +1 -1
- package/dist/recipe-model.js +15 -12
- package/dist/recipe-model.js.map +1 -1
- package/dist/recipe-package.d.ts +6 -28
- package/dist/recipe-package.d.ts.map +1 -1
- package/dist/recipe-package.js +248 -191
- package/dist/recipe-package.js.map +1 -1
- package/dist/recipe-skills.d.ts.map +1 -1
- package/dist/recipe-skills.js +42 -29
- package/dist/recipe-skills.js.map +1 -1
- package/dist/run-controller.d.ts +10 -9
- package/dist/run-controller.d.ts.map +1 -1
- package/dist/run-controller.js +28 -21
- package/dist/run-controller.js.map +1 -1
- package/dist/session.d.ts +40 -53
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +312 -173
- package/dist/session.js.map +1 -1
- package/dist/test-utils.d.ts +7 -7
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.js +32 -15
- package/dist/test-utils.js.map +1 -1
- package/docs/agent-composition.md +41 -35
- package/docs/host-api.md +201 -0
- package/docs/index.md +8 -14
- package/docs/interactions.md +12 -11
- package/docs/mcp-auth.md +6 -6
- package/docs/mcp-configuration.md +72 -24
- package/docs/pi-extension.md +39 -11
- package/docs/recipe-flow.md +9 -9
- package/docs/recipe-format.md +90 -41
- package/package.json +23 -17
- package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
- package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
- package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
- package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
- package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
- package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
- package/vendor/recipe-check/linux-x64/recipe-check +0 -0
- package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
- package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
- package/dist/agent-tool.d.ts.map +0 -1
- package/dist/agent-tool.js.map +0 -1
- package/dist/run.d.ts +0 -28
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -84
- package/dist/run.js.map +0 -1
- package/dist/testing.d.ts +0 -25
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -96
- package/dist/testing.js.map +0 -1
- package/docs/deployment-configuration.md +0 -65
- package/docs/migration.md +0 -70
- package/docs/python-bindings-release.md +0 -47
- package/docs/recipe-evals.md +0 -70
- package/docs/recipe-judges.md +0 -152
- package/docs/runtime-library.md +0 -171
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
buildFallbackLiteral,
|
|
4
|
+
pickExampleLiteral
|
|
5
|
+
} from "./chunk-XANPGTLI.js";
|
|
6
|
+
import {
|
|
7
|
+
cyanText,
|
|
8
|
+
dimText,
|
|
9
|
+
extraDimText,
|
|
10
|
+
yellowText
|
|
11
|
+
} from "./chunk-N46NEFAF.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/list-signature.js
|
|
14
|
+
function formatFunctionSignature(name, options, outputSchema, formatOptions) {
|
|
15
|
+
const colorize = formatOptions?.colorize !== false;
|
|
16
|
+
const keyword = colorize ? extraDimText("function") : "function";
|
|
17
|
+
const formattedName = colorize ? cyanText(name) : name;
|
|
18
|
+
const paramsText = options.map((option) => formatInlineParameter(option, colorize)).join(", ");
|
|
19
|
+
const returnType = inferReturnTypeName(outputSchema) ?? formatOptions?.defaultReturnType;
|
|
20
|
+
const signature = `${keyword} ${formattedName}(${paramsText})`;
|
|
21
|
+
return returnType ? `${signature}: ${returnType};` : `${signature};`;
|
|
22
|
+
}
|
|
23
|
+
function formatOptionalSummary(hiddenOptions, options) {
|
|
24
|
+
const colorize = options?.colorize !== false;
|
|
25
|
+
const maxNames = 5;
|
|
26
|
+
const names = hiddenOptions.map((option) => option.property);
|
|
27
|
+
if (names.length === 0) {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
const preview = names.slice(0, maxNames).join(", ");
|
|
31
|
+
const suffix = names.length > maxNames ? ", ..." : "";
|
|
32
|
+
const tint = colorize ? extraDimText : (value) => value;
|
|
33
|
+
return tint(`// optional (${names.length}): ${preview}${suffix}`);
|
|
34
|
+
}
|
|
35
|
+
function formatFlagUsage(options, extras, opts) {
|
|
36
|
+
const colorize = opts?.colorize !== false;
|
|
37
|
+
const entries = options.map((option) => ({
|
|
38
|
+
text: formatFlagLabel(option),
|
|
39
|
+
required: option.required
|
|
40
|
+
}));
|
|
41
|
+
if (extras) {
|
|
42
|
+
entries.push(...extras.map((extra) => ({
|
|
43
|
+
text: extra.text.trim(),
|
|
44
|
+
required: Boolean(extra.required)
|
|
45
|
+
})).filter((entry) => entry.text.length > 0));
|
|
46
|
+
}
|
|
47
|
+
const parts = entries.filter((entry) => entry.text.length > 0).map((entry) => entry.required ? entry.text : `[${entry.text}]`);
|
|
48
|
+
if (parts.length === 0) {
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
const rendered = parts.join(" ");
|
|
52
|
+
return colorize ? extraDimText(rendered) : rendered;
|
|
53
|
+
}
|
|
54
|
+
function formatFlagLabel(option) {
|
|
55
|
+
return `--${option.cliName} ${option.placeholder}`.trim();
|
|
56
|
+
}
|
|
57
|
+
function formatCallExpressionExample(serverName, toolName, options, extra) {
|
|
58
|
+
const assignments = options.map((option) => ({ option, literal: pickExampleLiteral(option) })).filter(({ option, literal }) => option.required || literal !== void 0).map(({ option, literal }) => {
|
|
59
|
+
const value = literal ?? buildFallbackLiteral(option);
|
|
60
|
+
return `${option.property}: ${value}`;
|
|
61
|
+
});
|
|
62
|
+
const args = assignments.join(", ");
|
|
63
|
+
const callSuffix = assignments.length > 0 ? `(${args})` : "()";
|
|
64
|
+
const selector = extra?.callSelector ?? serverName;
|
|
65
|
+
const expression = `${selector}.${toolName}${callSuffix}`;
|
|
66
|
+
const rendered = extra?.wrapExpression ? quoteShellExpression(expression) : expression;
|
|
67
|
+
return `mcporter call ${rendered}`;
|
|
68
|
+
}
|
|
69
|
+
function formatExampleBlock(examples, options) {
|
|
70
|
+
const maxExamples = options?.maxExamples ?? 1;
|
|
71
|
+
const maxLength = options?.maxLength ?? 80;
|
|
72
|
+
return Array.from(new Set(examples)).filter(Boolean).slice(0, maxExamples).map((example) => truncateExample(example, maxLength));
|
|
73
|
+
}
|
|
74
|
+
function truncateExample(example, maxLength) {
|
|
75
|
+
if (example.length <= maxLength) {
|
|
76
|
+
return example;
|
|
77
|
+
}
|
|
78
|
+
const openIndex = example.indexOf("(");
|
|
79
|
+
const closeIndex = example.lastIndexOf(")");
|
|
80
|
+
if (openIndex === -1 || closeIndex === -1 || closeIndex <= openIndex) {
|
|
81
|
+
return `${example.slice(0, Math.max(0, maxLength - 1))}\u2026`;
|
|
82
|
+
}
|
|
83
|
+
const prefix = example.slice(0, openIndex + 1);
|
|
84
|
+
const suffix = example.slice(closeIndex);
|
|
85
|
+
const available = maxLength - prefix.length - suffix.length - 5;
|
|
86
|
+
if (available <= 0) {
|
|
87
|
+
return `${prefix}...${suffix}`;
|
|
88
|
+
}
|
|
89
|
+
const args = example.slice(openIndex + 1, closeIndex).trim();
|
|
90
|
+
const shortened = args.slice(0, available).trimEnd().replace(/[\s,]+$/, "");
|
|
91
|
+
const ellipsis = shortened.length > 0 ? `${shortened}, ...` : "...";
|
|
92
|
+
return `${prefix}${ellipsis}${suffix}`;
|
|
93
|
+
}
|
|
94
|
+
function formatInlineParameter(option, colorize) {
|
|
95
|
+
const typeAnnotation = formatTypeAnnotation(option, colorize);
|
|
96
|
+
const optionalSuffix = option.required ? "" : "?";
|
|
97
|
+
return `${option.property}${optionalSuffix}: ${typeAnnotation}`;
|
|
98
|
+
}
|
|
99
|
+
function quoteShellExpression(expression) {
|
|
100
|
+
if (!expression.includes("'")) {
|
|
101
|
+
return `'${expression}'`;
|
|
102
|
+
}
|
|
103
|
+
const escaped = expression.replace(/(["\\$`])/g, "\\$1");
|
|
104
|
+
return `"${escaped}"`;
|
|
105
|
+
}
|
|
106
|
+
function inferReturnTypeName(schema) {
|
|
107
|
+
if (!schema || typeof schema !== "object") {
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
return inferSchemaDisplayType(schema);
|
|
111
|
+
}
|
|
112
|
+
function inferSchemaDisplayType(descriptor) {
|
|
113
|
+
const title = typeof descriptor.title === "string" ? descriptor.title.trim() : void 0;
|
|
114
|
+
if (title) {
|
|
115
|
+
return title;
|
|
116
|
+
}
|
|
117
|
+
const rawType = typeof descriptor.type === "string" ? descriptor.type : void 0;
|
|
118
|
+
const type = rawType === "integer" ? "number" : rawType;
|
|
119
|
+
if (!type && typeof descriptor.properties === "object") {
|
|
120
|
+
return "object";
|
|
121
|
+
}
|
|
122
|
+
if (!type && descriptor.items && typeof descriptor.items === "object") {
|
|
123
|
+
return `${inferSchemaDisplayType(descriptor.items)}[]`;
|
|
124
|
+
}
|
|
125
|
+
if (type === "array" && descriptor.items && typeof descriptor.items === "object") {
|
|
126
|
+
return `${inferSchemaDisplayType(descriptor.items)}[]`;
|
|
127
|
+
}
|
|
128
|
+
if (!type && Array.isArray(descriptor.enum)) {
|
|
129
|
+
const values = descriptor.enum.filter((entry) => typeof entry === "string");
|
|
130
|
+
if (values.length > 0) {
|
|
131
|
+
return values.map((entry) => JSON.stringify(entry)).join(" | ");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return type ?? "unknown";
|
|
135
|
+
}
|
|
136
|
+
function formatTypeAnnotation(option, colorize) {
|
|
137
|
+
let baseType;
|
|
138
|
+
if (option.enumValues && option.enumValues.length > 0) {
|
|
139
|
+
baseType = option.enumValues.map((value) => JSON.stringify(value)).join(" | ");
|
|
140
|
+
} else {
|
|
141
|
+
switch (option.type) {
|
|
142
|
+
case "number":
|
|
143
|
+
baseType = "number";
|
|
144
|
+
break;
|
|
145
|
+
case "boolean":
|
|
146
|
+
baseType = "boolean";
|
|
147
|
+
break;
|
|
148
|
+
case "array":
|
|
149
|
+
baseType = `${formatArrayItemType(option.arrayItemType)}[]`;
|
|
150
|
+
break;
|
|
151
|
+
case "object":
|
|
152
|
+
baseType = "Record<string, unknown>";
|
|
153
|
+
break;
|
|
154
|
+
case "string":
|
|
155
|
+
baseType = "string";
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
baseType = "unknown";
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const tint = colorize ? dimText : (value) => value;
|
|
163
|
+
const base = tint(baseType);
|
|
164
|
+
if (option.formatHint && option.type === "string" && (!option.enumValues || option.enumValues.length === 0)) {
|
|
165
|
+
const descriptionText = option.description?.toLowerCase() ?? "";
|
|
166
|
+
const hintLower = option.formatHint.toLowerCase();
|
|
167
|
+
const normalizedDescription = descriptionText.replace(/[\s_-]+/g, "");
|
|
168
|
+
const normalizedHint = hintLower.replace(/[\s_-]+/g, "");
|
|
169
|
+
const hasHintInDescription = descriptionText.includes(hintLower) || normalizedDescription.includes(normalizedHint);
|
|
170
|
+
if (hasHintInDescription) {
|
|
171
|
+
return base;
|
|
172
|
+
}
|
|
173
|
+
return `${base} ${tint(`/* ${option.formatHint} */`)}`;
|
|
174
|
+
}
|
|
175
|
+
return base;
|
|
176
|
+
}
|
|
177
|
+
function formatArrayItemType(type) {
|
|
178
|
+
switch (type) {
|
|
179
|
+
case "string":
|
|
180
|
+
return "string";
|
|
181
|
+
case "number":
|
|
182
|
+
return "number";
|
|
183
|
+
case "boolean":
|
|
184
|
+
return "boolean";
|
|
185
|
+
case "object":
|
|
186
|
+
return "Record<string, unknown>";
|
|
187
|
+
default:
|
|
188
|
+
return "unknown";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/list-doc-comments.js
|
|
193
|
+
var DEFAULT_WRAP_WIDTH = 100;
|
|
194
|
+
function buildDocComment(description, options, opts) {
|
|
195
|
+
const colorize = opts?.colorize !== false;
|
|
196
|
+
const descriptionLines = description?.split(/\r?\n/) ?? [];
|
|
197
|
+
const paramDocs = options.filter((option) => option.description);
|
|
198
|
+
if (descriptionLines.every((line) => line.trim().length === 0) && paramDocs.length === 0) {
|
|
199
|
+
return void 0;
|
|
200
|
+
}
|
|
201
|
+
const tint = colorize ? extraDimText : (value) => value;
|
|
202
|
+
const highlightParam = colorize ? (value) => yellowText(value) : (value) => value;
|
|
203
|
+
const highlightName = colorize ? (value) => cyanText(value) : (value) => value;
|
|
204
|
+
const lines = [];
|
|
205
|
+
lines.push(tint("/**"));
|
|
206
|
+
let hasDescription = false;
|
|
207
|
+
for (const line of descriptionLines) {
|
|
208
|
+
const trimmed = line.trimEnd();
|
|
209
|
+
if (trimmed.trim().length > 0) {
|
|
210
|
+
const wrapped = wrapCommentText(trimmed);
|
|
211
|
+
for (const segment of wrapped) {
|
|
212
|
+
lines.push(tint(` * ${segment}`));
|
|
213
|
+
}
|
|
214
|
+
hasDescription = true;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (hasDescription && paramDocs.length > 0) {
|
|
218
|
+
lines.push(tint(" *"));
|
|
219
|
+
}
|
|
220
|
+
for (const option of paramDocs) {
|
|
221
|
+
const optionLines = formatParamDoc(option, DEFAULT_WRAP_WIDTH, {
|
|
222
|
+
colorize,
|
|
223
|
+
highlightParam,
|
|
224
|
+
highlightName
|
|
225
|
+
});
|
|
226
|
+
lines.push(...optionLines);
|
|
227
|
+
}
|
|
228
|
+
lines.push(tint(" */"));
|
|
229
|
+
return lines;
|
|
230
|
+
}
|
|
231
|
+
function formatParamDoc(option, wrapWidth, config) {
|
|
232
|
+
const { colorize, highlightParam, highlightName } = config;
|
|
233
|
+
const descriptionLines = option.description?.split(/\r?\n/) ?? [""];
|
|
234
|
+
const optionalSuffix = option.required ? "" : "?";
|
|
235
|
+
const plainLabel = `@param ${option.property}${optionalSuffix}`;
|
|
236
|
+
const continuationPrefix = colorize ? extraDimText(` * ${" ".repeat(plainLabel.length + 1)}`) : ` * ${" ".repeat(plainLabel.length + 1)}`;
|
|
237
|
+
const rendered = [];
|
|
238
|
+
descriptionLines.forEach((entry, index) => {
|
|
239
|
+
const suffix = entry.trimEnd();
|
|
240
|
+
if (index === 0) {
|
|
241
|
+
const lineParts = [
|
|
242
|
+
colorize ? extraDimText(" * ") : " * ",
|
|
243
|
+
highlightParam("@param "),
|
|
244
|
+
highlightName(`${option.property}${optionalSuffix}`)
|
|
245
|
+
];
|
|
246
|
+
if (suffix.length > 0) {
|
|
247
|
+
const wrapped = wrapCommentText(suffix, wrapWidth - plainLabel.length - 1);
|
|
248
|
+
if (wrapped.length > 0) {
|
|
249
|
+
lineParts.push(colorize ? extraDimText(` ${wrapped[0]}`) : ` ${wrapped[0]}`);
|
|
250
|
+
rendered.push(lineParts.join(""));
|
|
251
|
+
for (const continuation of wrapped.slice(1)) {
|
|
252
|
+
rendered.push(`${continuationPrefix}${colorize ? extraDimText(continuation) : continuation}`);
|
|
253
|
+
}
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
rendered.push(lineParts.join(""));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (suffix.length > 0) {
|
|
261
|
+
const wrapped = wrapCommentText(suffix, wrapWidth - plainLabel.length - 1);
|
|
262
|
+
if (wrapped.length === 0) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const [first, ...rest] = wrapped;
|
|
266
|
+
if (!first) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
rendered.push(`${continuationPrefix}${colorize ? extraDimText(first) : first}`);
|
|
270
|
+
for (const segment of rest) {
|
|
271
|
+
rendered.push(`${continuationPrefix}${colorize ? extraDimText(segment) : segment}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
return rendered;
|
|
276
|
+
}
|
|
277
|
+
function wrapCommentText(text, width = DEFAULT_WRAP_WIDTH) {
|
|
278
|
+
if (!text) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
const words = text.split(/\s+/).filter(Boolean);
|
|
282
|
+
if (words.length === 0) {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
const lines = [];
|
|
286
|
+
let current = words[0] ?? "";
|
|
287
|
+
for (let index = 1; index < words.length; index += 1) {
|
|
288
|
+
const word = words[index];
|
|
289
|
+
if (!word) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (`${current} ${word}`.length > width) {
|
|
293
|
+
lines.push(current);
|
|
294
|
+
current = word;
|
|
295
|
+
} else {
|
|
296
|
+
current += ` ${word}`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
lines.push(current);
|
|
300
|
+
return lines;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/list-detail-helpers.js
|
|
304
|
+
var DEFAULT_MIN_VISIBLE_PARAMS = 5;
|
|
305
|
+
function selectDisplayOptions(options, requiredOnly, minVisible = DEFAULT_MIN_VISIBLE_PARAMS) {
|
|
306
|
+
if (!requiredOnly || options.length <= minVisible) {
|
|
307
|
+
return { displayOptions: options, hiddenOptions: [] };
|
|
308
|
+
}
|
|
309
|
+
const included = /* @__PURE__ */ new Set();
|
|
310
|
+
options.forEach((option, index) => {
|
|
311
|
+
if (option.required) {
|
|
312
|
+
included.add(index);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
let includedCount = included.size;
|
|
316
|
+
if (includedCount < minVisible) {
|
|
317
|
+
for (let index = 0; index < options.length && includedCount < minVisible; index += 1) {
|
|
318
|
+
if (included.has(index)) {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
included.add(index);
|
|
322
|
+
includedCount += 1;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const displayOptions = options.filter((_option, index) => included.has(index));
|
|
326
|
+
const hiddenOptions = options.filter((_option, index) => !included.has(index));
|
|
327
|
+
return { displayOptions, hiddenOptions };
|
|
328
|
+
}
|
|
329
|
+
function buildToolDoc(input) {
|
|
330
|
+
const { serverName, toolName, description, outputSchema, options, requiredOnly, colorize = true, exampleMaxLength, flagExtras, defaultReturnType } = input;
|
|
331
|
+
const { displayOptions, hiddenOptions } = selectDisplayOptions(options, requiredOnly);
|
|
332
|
+
const docLines = buildDocComment(description, options, { colorize });
|
|
333
|
+
const signature = formatFunctionSignature(toolName, displayOptions, outputSchema, {
|
|
334
|
+
colorize,
|
|
335
|
+
defaultReturnType
|
|
336
|
+
});
|
|
337
|
+
const tsSignature = formatFunctionSignature(toolName, displayOptions, outputSchema, {
|
|
338
|
+
colorize: false,
|
|
339
|
+
defaultReturnType
|
|
340
|
+
});
|
|
341
|
+
const flagUsage = formatFlagUsage(displayOptions, flagExtras, { colorize });
|
|
342
|
+
const optionalSummary = hiddenOptions.length > 0 ? formatOptionalSummary(hiddenOptions, { colorize }) : void 0;
|
|
343
|
+
const optionDocs = options.map((option) => buildOptionDoc(option, { colorize }));
|
|
344
|
+
const callExample = formatCallExpressionExample(serverName, toolName, displayOptions.length > 0 ? displayOptions : options, { callSelector: input.callSelector, wrapExpression: input.wrapExampleExpression });
|
|
345
|
+
const examples = callExample ? formatExampleBlock([callExample], { maxExamples: 1, maxLength: exampleMaxLength ?? 80 }) : [];
|
|
346
|
+
return {
|
|
347
|
+
docLines,
|
|
348
|
+
signature,
|
|
349
|
+
tsSignature,
|
|
350
|
+
flagUsage,
|
|
351
|
+
optionalSummary,
|
|
352
|
+
examples,
|
|
353
|
+
displayOptions,
|
|
354
|
+
hiddenOptions,
|
|
355
|
+
optionDocs
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function buildOptionDoc(option, opts) {
|
|
359
|
+
return {
|
|
360
|
+
option,
|
|
361
|
+
flagLabel: formatFlagLabel(option),
|
|
362
|
+
description: formatOptionDescription(option, opts)
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function formatOptionDescription(option, opts) {
|
|
366
|
+
const colorize = opts?.colorize ?? false;
|
|
367
|
+
const tint = colorize ? extraDimText : (value) => value;
|
|
368
|
+
let description = option.description ? option.description : `Set ${option.property}.`;
|
|
369
|
+
const detailParts = [];
|
|
370
|
+
if (option.enumValues && option.enumValues.length > 0) {
|
|
371
|
+
detailParts.push(`choices: ${option.enumValues.join(", ")}`);
|
|
372
|
+
}
|
|
373
|
+
if (option.defaultValue !== void 0) {
|
|
374
|
+
detailParts.push(`default: ${formatHelpValue(option.defaultValue)}`);
|
|
375
|
+
}
|
|
376
|
+
if (option.exampleValue) {
|
|
377
|
+
detailParts.push(`example: ${option.exampleValue}`);
|
|
378
|
+
}
|
|
379
|
+
if (detailParts.length > 0) {
|
|
380
|
+
description += ` (${detailParts.join("; ")})`;
|
|
381
|
+
}
|
|
382
|
+
return tint(description);
|
|
383
|
+
}
|
|
384
|
+
function formatHelpValue(value) {
|
|
385
|
+
if (Array.isArray(value)) {
|
|
386
|
+
return value.map((entry) => String(entry)).join(", ");
|
|
387
|
+
}
|
|
388
|
+
if (value instanceof Date) {
|
|
389
|
+
return value.toISOString();
|
|
390
|
+
}
|
|
391
|
+
if (value && typeof value === "object") {
|
|
392
|
+
return JSON.stringify(value);
|
|
393
|
+
}
|
|
394
|
+
return String(value);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export {
|
|
398
|
+
formatExampleBlock,
|
|
399
|
+
buildToolDoc
|
|
400
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/terminal.js
|
|
4
|
+
var forceColorRaw = process.env.FORCE_COLOR?.toLowerCase();
|
|
5
|
+
var forceDisableColor = forceColorRaw === "0" || forceColorRaw === "false";
|
|
6
|
+
var forceEnableColor = forceColorRaw === "1" || forceColorRaw === "true" || forceColorRaw === "2" || forceColorRaw === "3";
|
|
7
|
+
var hasNoColor = process.env.NO_COLOR !== void 0;
|
|
8
|
+
var stdoutStream = process.stdout;
|
|
9
|
+
var supportsAnsiColor = !hasNoColor && (forceEnableColor || !forceDisableColor && Boolean(stdoutStream?.isTTY));
|
|
10
|
+
function colorize(code, text) {
|
|
11
|
+
if (!supportsAnsiColor) {
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
return `\x1B[${code}m${text}\x1B[0m`;
|
|
15
|
+
}
|
|
16
|
+
var dimText = (text) => colorize(90, text);
|
|
17
|
+
var yellowText = (text) => colorize(33, text);
|
|
18
|
+
var redText = (text) => colorize(31, text);
|
|
19
|
+
var extraDimText = (text) => {
|
|
20
|
+
if (!supportsAnsiColor) {
|
|
21
|
+
return text;
|
|
22
|
+
}
|
|
23
|
+
return `\x1B[38;5;244m${text}\x1B[0m`;
|
|
24
|
+
};
|
|
25
|
+
var cyanText = (text) => colorize(36, text);
|
|
26
|
+
var boldText = (text) => {
|
|
27
|
+
if (!supportsAnsiColor) {
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
return `\x1B[1m${text}\x1B[0m`;
|
|
31
|
+
};
|
|
32
|
+
var isCI = Boolean(process.env.CI && process.env.CI !== "0" && process.env.CI.toLowerCase() !== "false");
|
|
33
|
+
var spinnerDisabled = process.env.MCPORTER_NO_SPINNER === "1";
|
|
34
|
+
var supportsSpinner = Boolean(stdoutStream?.isTTY && !isCI && !spinnerDisabled);
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
supportsAnsiColor,
|
|
38
|
+
dimText,
|
|
39
|
+
yellowText,
|
|
40
|
+
redText,
|
|
41
|
+
extraDimText,
|
|
42
|
+
cyanText,
|
|
43
|
+
boldText,
|
|
44
|
+
supportsSpinner
|
|
45
|
+
};
|