@mcpc-tech/cli 0.1.50 → 0.1.52
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/app.cjs +632 -289
- package/app.mjs +632 -289
- package/bin/mcpc.cjs +630 -305
- package/bin/mcpc.mjs +628 -303
- package/bin.cjs +630 -305
- package/bin.mjs +628 -303
- package/index.cjs +652 -309
- package/index.mjs +650 -307
- package/package.json +1 -1
- package/server.cjs +652 -309
- package/server.mjs +650 -307
package/bin.cjs
CHANGED
|
@@ -501,7 +501,7 @@ var require_cross_spawn = __commonJS({
|
|
|
501
501
|
var cp = require("child_process");
|
|
502
502
|
var parse2 = require_parse();
|
|
503
503
|
var enoent = require_enoent();
|
|
504
|
-
function
|
|
504
|
+
function spawn3(command, args, options) {
|
|
505
505
|
const parsed = parse2(command, args, options);
|
|
506
506
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
507
507
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -513,8 +513,8 @@ var require_cross_spawn = __commonJS({
|
|
|
513
513
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
514
514
|
return result;
|
|
515
515
|
}
|
|
516
|
-
module2.exports =
|
|
517
|
-
module2.exports.spawn =
|
|
516
|
+
module2.exports = spawn3;
|
|
517
|
+
module2.exports.spawn = spawn3;
|
|
518
518
|
module2.exports.sync = spawnSync;
|
|
519
519
|
module2.exports._parse = parse2;
|
|
520
520
|
module2.exports._enoent = enoent;
|
|
@@ -2377,7 +2377,7 @@ if (typeof global.crypto === "undefined") {
|
|
|
2377
2377
|
var outgoingEnded = Symbol("outgoingEnded");
|
|
2378
2378
|
|
|
2379
2379
|
// __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
|
|
2380
|
-
var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value
|
|
2380
|
+
var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s;
|
|
2381
2381
|
var LETTER_REGEXP = /[A-Za-z]/;
|
|
2382
2382
|
var NUMBER_REGEXP = /-?\d+(\.\d*)?(e-?\d+)?$/;
|
|
2383
2383
|
var HYPHEN_REGEXP = /^(-|--)[^-]/;
|
|
@@ -2388,12 +2388,19 @@ var NON_WHITESPACE_REGEXP = /\S/;
|
|
|
2388
2388
|
function isNumber(string3) {
|
|
2389
2389
|
return NON_WHITESPACE_REGEXP.test(string3) && Number.isFinite(Number(string3));
|
|
2390
2390
|
}
|
|
2391
|
+
function isConstructorOrProto(obj, key) {
|
|
2392
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
2393
|
+
}
|
|
2391
2394
|
function setNested(object5, keys, value, collect = false) {
|
|
2392
2395
|
keys = [
|
|
2393
2396
|
...keys
|
|
2394
2397
|
];
|
|
2395
2398
|
const key = keys.pop();
|
|
2396
|
-
|
|
2399
|
+
for (const k of keys) {
|
|
2400
|
+
if (isConstructorOrProto(object5, k)) return;
|
|
2401
|
+
object5 = object5[k] ??= {};
|
|
2402
|
+
}
|
|
2403
|
+
if (isConstructorOrProto(object5, key)) return;
|
|
2397
2404
|
if (collect) {
|
|
2398
2405
|
const v = object5[key];
|
|
2399
2406
|
if (Array.isArray(v)) {
|
|
@@ -2524,7 +2531,7 @@ function parseArgs(args, options) {
|
|
|
2524
2531
|
let key = groups.key;
|
|
2525
2532
|
let value = groups.value;
|
|
2526
2533
|
if (doubleDash2) {
|
|
2527
|
-
if (value) {
|
|
2534
|
+
if (value != null) {
|
|
2528
2535
|
if (booleanSet.has(key)) value = parseBooleanString(value);
|
|
2529
2536
|
setArgument(key, value, arg, true);
|
|
2530
2537
|
continue;
|
|
@@ -2562,6 +2569,10 @@ function parseArgs(args, options) {
|
|
|
2562
2569
|
setArgument(letter, next, arg, true);
|
|
2563
2570
|
continue;
|
|
2564
2571
|
}
|
|
2572
|
+
if (next === "=") {
|
|
2573
|
+
setArgument(letter, "", arg, true);
|
|
2574
|
+
continue argsLoop;
|
|
2575
|
+
}
|
|
2565
2576
|
if (LETTER_REGEXP.test(letter)) {
|
|
2566
2577
|
const groups2 = VALUE_REGEXP.exec(next)?.groups;
|
|
2567
2578
|
if (groups2) {
|
|
@@ -2638,7 +2649,7 @@ function parseArgs(args, options) {
|
|
|
2638
2649
|
var import_promises4 = require("node:fs/promises");
|
|
2639
2650
|
var import_node_os3 = require("node:os");
|
|
2640
2651
|
var import_node_path6 = require("node:path");
|
|
2641
|
-
var
|
|
2652
|
+
var import_node_process5 = __toESM(require("node:process"), 1);
|
|
2642
2653
|
|
|
2643
2654
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
2644
2655
|
var import_promises = require("node:fs/promises");
|
|
@@ -3056,7 +3067,7 @@ Usage:
|
|
|
3056
3067
|
- ${toolName}({ skill: "skill-name" }) - Load main SKILL.md content
|
|
3057
3068
|
- ${toolName}({ skill: "skill-name", ref: "path/to/file" }) - Load reference file
|
|
3058
3069
|
|
|
3059
|
-
Note: For scripts
|
|
3070
|
+
Note: For scripts/, use the bash tool with the script path to execute.`;
|
|
3060
3071
|
}
|
|
3061
3072
|
function createSkillsPlugin(options) {
|
|
3062
3073
|
const { paths } = options;
|
|
@@ -3164,11 +3175,15 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
|
|
|
3164
3175
|
try {
|
|
3165
3176
|
const content = await (0, import_promises2.readFile)((0, import_node_path4.join)(meta.basePath, "SKILL.md"), "utf-8");
|
|
3166
3177
|
const body = extractBody(content);
|
|
3178
|
+
const skillPathInfo = `
|
|
3179
|
+
---
|
|
3180
|
+
Skill path: ${meta.basePath}
|
|
3181
|
+
`;
|
|
3167
3182
|
return {
|
|
3168
3183
|
content: [
|
|
3169
3184
|
{
|
|
3170
3185
|
type: "text",
|
|
3171
|
-
text: body
|
|
3186
|
+
text: body + skillPathInfo
|
|
3172
3187
|
}
|
|
3173
3188
|
]
|
|
3174
3189
|
};
|
|
@@ -3195,6 +3210,152 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
|
|
|
3195
3210
|
};
|
|
3196
3211
|
}
|
|
3197
3212
|
|
|
3213
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
3214
|
+
var import_node_child_process = require("node:child_process");
|
|
3215
|
+
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
3216
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
3217
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
3218
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
3219
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
3220
|
+
const fullOutput = (stderr ? `STDERR:
|
|
3221
|
+
${stderr}
|
|
3222
|
+
|
|
3223
|
+
STDOUT:
|
|
3224
|
+
` : "") + stdout;
|
|
3225
|
+
const lines = fullOutput.split("\n");
|
|
3226
|
+
if (lines.length > maxLines) {
|
|
3227
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
3228
|
+
return {
|
|
3229
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
3230
|
+
|
|
3231
|
+
` + truncatedLines.join("\n"),
|
|
3232
|
+
truncated: true
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
if (fullOutput.length > maxBytes) {
|
|
3236
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
3237
|
+
return {
|
|
3238
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
3239
|
+
|
|
3240
|
+
` + truncatedBytes,
|
|
3241
|
+
truncated: true
|
|
3242
|
+
};
|
|
3243
|
+
}
|
|
3244
|
+
return {
|
|
3245
|
+
output: fullOutput,
|
|
3246
|
+
truncated: false
|
|
3247
|
+
};
|
|
3248
|
+
}
|
|
3249
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
3250
|
+
return new Promise((resolve5) => {
|
|
3251
|
+
const stdout = [];
|
|
3252
|
+
const stderr = [];
|
|
3253
|
+
const proc = (0, import_node_child_process.spawn)("bash", [
|
|
3254
|
+
"-c",
|
|
3255
|
+
command
|
|
3256
|
+
], {
|
|
3257
|
+
cwd: cwd2,
|
|
3258
|
+
stdio: [
|
|
3259
|
+
"ignore",
|
|
3260
|
+
"pipe",
|
|
3261
|
+
"pipe"
|
|
3262
|
+
]
|
|
3263
|
+
});
|
|
3264
|
+
proc.stdout?.on("data", (data) => {
|
|
3265
|
+
stdout.push(data.toString());
|
|
3266
|
+
});
|
|
3267
|
+
proc.stderr?.on("data", (data) => {
|
|
3268
|
+
stderr.push(data.toString());
|
|
3269
|
+
});
|
|
3270
|
+
proc.on("close", (code) => {
|
|
3271
|
+
resolve5({
|
|
3272
|
+
stdout: stdout.join(""),
|
|
3273
|
+
stderr: stderr.join(""),
|
|
3274
|
+
exitCode: code
|
|
3275
|
+
});
|
|
3276
|
+
});
|
|
3277
|
+
proc.on("error", (err) => {
|
|
3278
|
+
resolve5({
|
|
3279
|
+
stdout: "",
|
|
3280
|
+
stderr: err.message,
|
|
3281
|
+
exitCode: null
|
|
3282
|
+
});
|
|
3283
|
+
});
|
|
3284
|
+
setTimeout(() => {
|
|
3285
|
+
proc.kill("SIGTERM");
|
|
3286
|
+
resolve5({
|
|
3287
|
+
stdout: stdout.join(""),
|
|
3288
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
3289
|
+
exitCode: null
|
|
3290
|
+
});
|
|
3291
|
+
}, timeoutMs);
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3294
|
+
function createBashPlugin(options = {}) {
|
|
3295
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
3296
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
3297
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
3298
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
3299
|
+
...options
|
|
3300
|
+
};
|
|
3301
|
+
let serverRef = null;
|
|
3302
|
+
return {
|
|
3303
|
+
name: "plugin-bash",
|
|
3304
|
+
version: "1.0.0",
|
|
3305
|
+
// Store server reference for tool registration
|
|
3306
|
+
configureServer: (server) => {
|
|
3307
|
+
serverRef = server;
|
|
3308
|
+
},
|
|
3309
|
+
// Register bash tool with agent name prefix
|
|
3310
|
+
composeStart: (context2) => {
|
|
3311
|
+
if (!serverRef) return;
|
|
3312
|
+
const agentName = context2.serverName;
|
|
3313
|
+
const toolName = `${agentName}__bash`;
|
|
3314
|
+
serverRef.tool(toolName, "Execute a bash command and return its output.\n\nUse this for:\n- Running shell commands\n- Executing scripts\n- System operations\n\nNote: Output is truncated if too large.", {
|
|
3315
|
+
type: "object",
|
|
3316
|
+
properties: {
|
|
3317
|
+
command: {
|
|
3318
|
+
type: "string",
|
|
3319
|
+
description: "The bash command to execute"
|
|
3320
|
+
},
|
|
3321
|
+
cwd: {
|
|
3322
|
+
type: "string",
|
|
3323
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
3324
|
+
}
|
|
3325
|
+
},
|
|
3326
|
+
required: [
|
|
3327
|
+
"command"
|
|
3328
|
+
]
|
|
3329
|
+
}, async (args) => {
|
|
3330
|
+
const cwd2 = args.cwd || import_node_process2.default.cwd();
|
|
3331
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
3332
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
3333
|
+
let finalOutput = output;
|
|
3334
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
3335
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
3336
|
+
` + finalOutput;
|
|
3337
|
+
}
|
|
3338
|
+
if (truncated) {
|
|
3339
|
+
finalOutput += `
|
|
3340
|
+
|
|
3341
|
+
[Note: Output was truncated]`;
|
|
3342
|
+
}
|
|
3343
|
+
return {
|
|
3344
|
+
content: [
|
|
3345
|
+
{
|
|
3346
|
+
type: "text",
|
|
3347
|
+
text: finalOutput
|
|
3348
|
+
}
|
|
3349
|
+
],
|
|
3350
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
3351
|
+
};
|
|
3352
|
+
}, {
|
|
3353
|
+
internal: true
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3198
3359
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
3199
3360
|
var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
|
|
3200
3361
|
|
|
@@ -4039,12 +4200,29 @@ function writeFoldedLines(count) {
|
|
|
4039
4200
|
if (count > 1) return "\n".repeat(count - 1);
|
|
4040
4201
|
return "";
|
|
4041
4202
|
}
|
|
4203
|
+
var Scanner = class {
|
|
4204
|
+
source;
|
|
4205
|
+
#length;
|
|
4206
|
+
position = 0;
|
|
4207
|
+
constructor(source) {
|
|
4208
|
+
source += "\0";
|
|
4209
|
+
this.source = source;
|
|
4210
|
+
this.#length = source.length;
|
|
4211
|
+
}
|
|
4212
|
+
peek(offset = 0) {
|
|
4213
|
+
return this.source.charCodeAt(this.position + offset);
|
|
4214
|
+
}
|
|
4215
|
+
next() {
|
|
4216
|
+
this.position += 1;
|
|
4217
|
+
}
|
|
4218
|
+
eof() {
|
|
4219
|
+
return this.position >= this.#length - 1;
|
|
4220
|
+
}
|
|
4221
|
+
};
|
|
4042
4222
|
var LoaderState = class {
|
|
4043
|
-
|
|
4044
|
-
length;
|
|
4223
|
+
#scanner;
|
|
4045
4224
|
lineIndent = 0;
|
|
4046
4225
|
lineStart = 0;
|
|
4047
|
-
position = 0;
|
|
4048
4226
|
line = 0;
|
|
4049
4227
|
onWarning;
|
|
4050
4228
|
allowDuplicateKeys;
|
|
@@ -4054,44 +4232,40 @@ var LoaderState = class {
|
|
|
4054
4232
|
tagMap = /* @__PURE__ */ new Map();
|
|
4055
4233
|
anchorMap = /* @__PURE__ */ new Map();
|
|
4056
4234
|
constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false }) {
|
|
4057
|
-
this
|
|
4235
|
+
this.#scanner = new Scanner(input);
|
|
4058
4236
|
this.onWarning = onWarning;
|
|
4059
4237
|
this.allowDuplicateKeys = allowDuplicateKeys;
|
|
4060
4238
|
this.implicitTypes = schema.implicitTypes;
|
|
4061
4239
|
this.typeMap = schema.typeMap;
|
|
4062
|
-
this.length = input.length;
|
|
4063
4240
|
this.readIndent();
|
|
4064
4241
|
}
|
|
4065
4242
|
skipWhitespaces() {
|
|
4066
|
-
let ch = this.peek();
|
|
4243
|
+
let ch = this.#scanner.peek();
|
|
4067
4244
|
while (isWhiteSpace(ch)) {
|
|
4068
|
-
|
|
4245
|
+
this.#scanner.next();
|
|
4246
|
+
ch = this.#scanner.peek();
|
|
4069
4247
|
}
|
|
4070
4248
|
}
|
|
4071
4249
|
skipComment() {
|
|
4072
|
-
let ch = this.peek();
|
|
4250
|
+
let ch = this.#scanner.peek();
|
|
4073
4251
|
if (ch !== SHARP) return;
|
|
4074
|
-
|
|
4252
|
+
this.#scanner.next();
|
|
4253
|
+
ch = this.#scanner.peek();
|
|
4075
4254
|
while (ch !== 0 && !isEOL(ch)) {
|
|
4076
|
-
|
|
4255
|
+
this.#scanner.next();
|
|
4256
|
+
ch = this.#scanner.peek();
|
|
4077
4257
|
}
|
|
4078
4258
|
}
|
|
4079
4259
|
readIndent() {
|
|
4080
|
-
let
|
|
4081
|
-
while (
|
|
4260
|
+
let ch = this.#scanner.peek();
|
|
4261
|
+
while (ch === SPACE) {
|
|
4082
4262
|
this.lineIndent += 1;
|
|
4083
|
-
|
|
4263
|
+
this.#scanner.next();
|
|
4264
|
+
ch = this.#scanner.peek();
|
|
4084
4265
|
}
|
|
4085
4266
|
}
|
|
4086
|
-
peek(offset = 0) {
|
|
4087
|
-
return this.input.charCodeAt(this.position + offset);
|
|
4088
|
-
}
|
|
4089
|
-
next() {
|
|
4090
|
-
this.position += 1;
|
|
4091
|
-
return this.peek();
|
|
4092
|
-
}
|
|
4093
4267
|
#createError(message) {
|
|
4094
|
-
const mark = markToString(this.
|
|
4268
|
+
const mark = markToString(this.#scanner.source, this.#scanner.position, this.line, this.#scanner.position - this.lineStart);
|
|
4095
4269
|
return new SyntaxError(`${message} ${mark}`);
|
|
4096
4270
|
}
|
|
4097
4271
|
dispatchWarning(message) {
|
|
@@ -4136,7 +4310,7 @@ var LoaderState = class {
|
|
|
4136
4310
|
}
|
|
4137
4311
|
captureSegment(start, end, checkJson) {
|
|
4138
4312
|
if (start < end) {
|
|
4139
|
-
const result = this.
|
|
4313
|
+
const result = this.#scanner.source.slice(start, end);
|
|
4140
4314
|
if (checkJson) {
|
|
4141
4315
|
for (let position = 0; position < result.length; position++) {
|
|
4142
4316
|
const character = result.charCodeAt(position);
|
|
@@ -4154,21 +4328,21 @@ var LoaderState = class {
|
|
|
4154
4328
|
let detected = false;
|
|
4155
4329
|
const result = [];
|
|
4156
4330
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4157
|
-
let ch = this.peek();
|
|
4331
|
+
let ch = this.#scanner.peek();
|
|
4158
4332
|
while (ch !== 0) {
|
|
4159
4333
|
if (ch !== MINUS) {
|
|
4160
4334
|
break;
|
|
4161
4335
|
}
|
|
4162
|
-
const following = this.peek(1);
|
|
4336
|
+
const following = this.#scanner.peek(1);
|
|
4163
4337
|
if (!isWhiteSpaceOrEOL(following)) {
|
|
4164
4338
|
break;
|
|
4165
4339
|
}
|
|
4166
4340
|
detected = true;
|
|
4167
|
-
this.
|
|
4341
|
+
this.#scanner.next();
|
|
4168
4342
|
if (this.skipSeparationSpace(true, -1)) {
|
|
4169
4343
|
if (this.lineIndent <= nodeIndent) {
|
|
4170
4344
|
result.push(null);
|
|
4171
|
-
ch = this.peek();
|
|
4345
|
+
ch = this.#scanner.peek();
|
|
4172
4346
|
continue;
|
|
4173
4347
|
}
|
|
4174
4348
|
}
|
|
@@ -4181,7 +4355,7 @@ var LoaderState = class {
|
|
|
4181
4355
|
});
|
|
4182
4356
|
if (newState) result.push(newState.result);
|
|
4183
4357
|
this.skipSeparationSpace(true, -1);
|
|
4184
|
-
ch = this.peek();
|
|
4358
|
+
ch = this.#scanner.peek();
|
|
4185
4359
|
if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
|
|
4186
4360
|
throw this.#createError("Cannot read block sequence: bad indentation of a sequence entry");
|
|
4187
4361
|
} else if (this.lineIndent < nodeIndent) {
|
|
@@ -4237,7 +4411,7 @@ var LoaderState = class {
|
|
|
4237
4411
|
} else {
|
|
4238
4412
|
if (!this.allowDuplicateKeys && !overridableKeys.has(keyNode) && Object.hasOwn(result, keyNode)) {
|
|
4239
4413
|
this.line = startLine || this.line;
|
|
4240
|
-
this.position = startPos || this.position;
|
|
4414
|
+
this.#scanner.position = startPos || this.#scanner.position;
|
|
4241
4415
|
throw this.#createError("Cannot store mapping pair: duplicated key");
|
|
4242
4416
|
}
|
|
4243
4417
|
Object.defineProperty(result, keyNode, {
|
|
@@ -4251,37 +4425,37 @@ var LoaderState = class {
|
|
|
4251
4425
|
return result;
|
|
4252
4426
|
}
|
|
4253
4427
|
readLineBreak() {
|
|
4254
|
-
const ch = this.peek();
|
|
4428
|
+
const ch = this.#scanner.peek();
|
|
4255
4429
|
if (ch === LINE_FEED) {
|
|
4256
|
-
this.
|
|
4430
|
+
this.#scanner.next();
|
|
4257
4431
|
} else if (ch === CARRIAGE_RETURN) {
|
|
4258
|
-
this.
|
|
4259
|
-
if (this.peek() === LINE_FEED) {
|
|
4260
|
-
this.
|
|
4432
|
+
this.#scanner.next();
|
|
4433
|
+
if (this.#scanner.peek() === LINE_FEED) {
|
|
4434
|
+
this.#scanner.next();
|
|
4261
4435
|
}
|
|
4262
4436
|
} else {
|
|
4263
4437
|
throw this.#createError("Cannot read line: line break not found");
|
|
4264
4438
|
}
|
|
4265
4439
|
this.line += 1;
|
|
4266
|
-
this.lineStart = this.position;
|
|
4440
|
+
this.lineStart = this.#scanner.position;
|
|
4267
4441
|
}
|
|
4268
4442
|
skipSeparationSpace(allowComments, checkIndent) {
|
|
4269
4443
|
let lineBreaks = 0;
|
|
4270
|
-
let ch = this.peek();
|
|
4444
|
+
let ch = this.#scanner.peek();
|
|
4271
4445
|
while (ch !== 0) {
|
|
4272
4446
|
this.skipWhitespaces();
|
|
4273
|
-
ch = this.peek();
|
|
4447
|
+
ch = this.#scanner.peek();
|
|
4274
4448
|
if (allowComments) {
|
|
4275
4449
|
this.skipComment();
|
|
4276
|
-
ch = this.peek();
|
|
4450
|
+
ch = this.#scanner.peek();
|
|
4277
4451
|
}
|
|
4278
4452
|
if (isEOL(ch)) {
|
|
4279
4453
|
this.readLineBreak();
|
|
4280
|
-
ch = this.peek();
|
|
4454
|
+
ch = this.#scanner.peek();
|
|
4281
4455
|
lineBreaks++;
|
|
4282
4456
|
this.lineIndent = 0;
|
|
4283
4457
|
this.readIndent();
|
|
4284
|
-
ch = this.peek();
|
|
4458
|
+
ch = this.#scanner.peek();
|
|
4285
4459
|
} else {
|
|
4286
4460
|
break;
|
|
4287
4461
|
}
|
|
@@ -4292,9 +4466,9 @@ var LoaderState = class {
|
|
|
4292
4466
|
return lineBreaks;
|
|
4293
4467
|
}
|
|
4294
4468
|
testDocumentSeparator() {
|
|
4295
|
-
let ch = this.peek();
|
|
4296
|
-
if ((ch === MINUS || ch === DOT) && ch === this.peek(1) && ch === this.peek(2)) {
|
|
4297
|
-
ch = this.peek(3);
|
|
4469
|
+
let ch = this.#scanner.peek();
|
|
4470
|
+
if ((ch === MINUS || ch === DOT) && ch === this.#scanner.peek(1) && ch === this.#scanner.peek(2)) {
|
|
4471
|
+
ch = this.#scanner.peek(3);
|
|
4298
4472
|
if (ch === 0 || isWhiteSpaceOrEOL(ch)) {
|
|
4299
4473
|
return true;
|
|
4300
4474
|
}
|
|
@@ -4302,34 +4476,34 @@ var LoaderState = class {
|
|
|
4302
4476
|
return false;
|
|
4303
4477
|
}
|
|
4304
4478
|
readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
|
|
4305
|
-
let ch = this.peek();
|
|
4479
|
+
let ch = this.#scanner.peek();
|
|
4306
4480
|
if (isWhiteSpaceOrEOL(ch) || isFlowIndicator(ch) || ch === SHARP || ch === AMPERSAND || ch === ASTERISK || ch === EXCLAMATION || ch === VERTICAL_LINE || ch === GREATER_THAN || ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE || ch === PERCENT || ch === COMMERCIAL_AT || ch === GRAVE_ACCENT) {
|
|
4307
4481
|
return;
|
|
4308
4482
|
}
|
|
4309
4483
|
let following;
|
|
4310
4484
|
if (ch === QUESTION || ch === MINUS) {
|
|
4311
|
-
following = this.peek(1);
|
|
4485
|
+
following = this.#scanner.peek(1);
|
|
4312
4486
|
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4313
4487
|
return;
|
|
4314
4488
|
}
|
|
4315
4489
|
}
|
|
4316
4490
|
let result = "";
|
|
4317
|
-
let captureEnd = this.position;
|
|
4318
|
-
let captureStart = this.position;
|
|
4491
|
+
let captureEnd = this.#scanner.position;
|
|
4492
|
+
let captureStart = this.#scanner.position;
|
|
4319
4493
|
let hasPendingContent = false;
|
|
4320
4494
|
let line = 0;
|
|
4321
4495
|
while (ch !== 0) {
|
|
4322
4496
|
if (ch === COLON) {
|
|
4323
|
-
following = this.peek(1);
|
|
4497
|
+
following = this.#scanner.peek(1);
|
|
4324
4498
|
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4325
4499
|
break;
|
|
4326
4500
|
}
|
|
4327
4501
|
} else if (ch === SHARP) {
|
|
4328
|
-
const preceding = this.peek(-1);
|
|
4502
|
+
const preceding = this.#scanner.peek(-1);
|
|
4329
4503
|
if (isWhiteSpaceOrEOL(preceding)) {
|
|
4330
4504
|
break;
|
|
4331
4505
|
}
|
|
4332
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4506
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4333
4507
|
break;
|
|
4334
4508
|
} else if (isEOL(ch)) {
|
|
4335
4509
|
line = this.line;
|
|
@@ -4338,10 +4512,10 @@ var LoaderState = class {
|
|
|
4338
4512
|
this.skipSeparationSpace(false, -1);
|
|
4339
4513
|
if (this.lineIndent >= nodeIndent) {
|
|
4340
4514
|
hasPendingContent = true;
|
|
4341
|
-
ch = this.peek();
|
|
4515
|
+
ch = this.#scanner.peek();
|
|
4342
4516
|
continue;
|
|
4343
4517
|
} else {
|
|
4344
|
-
this.position = captureEnd;
|
|
4518
|
+
this.#scanner.position = captureEnd;
|
|
4345
4519
|
this.line = line;
|
|
4346
4520
|
this.lineStart = lineStart;
|
|
4347
4521
|
this.lineIndent = lineIndent;
|
|
@@ -4352,13 +4526,14 @@ var LoaderState = class {
|
|
|
4352
4526
|
const segment2 = this.captureSegment(captureStart, captureEnd, false);
|
|
4353
4527
|
if (segment2) result += segment2;
|
|
4354
4528
|
result += writeFoldedLines(this.line - line);
|
|
4355
|
-
captureStart = captureEnd = this.position;
|
|
4529
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4356
4530
|
hasPendingContent = false;
|
|
4357
4531
|
}
|
|
4358
4532
|
if (!isWhiteSpace(ch)) {
|
|
4359
|
-
captureEnd = this.position + 1;
|
|
4533
|
+
captureEnd = this.#scanner.position + 1;
|
|
4360
4534
|
}
|
|
4361
|
-
|
|
4535
|
+
this.#scanner.next();
|
|
4536
|
+
ch = this.#scanner.peek();
|
|
4362
4537
|
}
|
|
4363
4538
|
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
4364
4539
|
if (segment) result += segment;
|
|
@@ -4371,22 +4546,23 @@ var LoaderState = class {
|
|
|
4371
4546
|
};
|
|
4372
4547
|
}
|
|
4373
4548
|
readSingleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4374
|
-
let ch = this.peek();
|
|
4549
|
+
let ch = this.#scanner.peek();
|
|
4375
4550
|
if (ch !== SINGLE_QUOTE) return;
|
|
4376
4551
|
let result = "";
|
|
4377
|
-
this.
|
|
4378
|
-
let captureStart = this.position;
|
|
4379
|
-
let captureEnd = this.position;
|
|
4380
|
-
ch = this.peek();
|
|
4552
|
+
this.#scanner.next();
|
|
4553
|
+
let captureStart = this.#scanner.position;
|
|
4554
|
+
let captureEnd = this.#scanner.position;
|
|
4555
|
+
ch = this.#scanner.peek();
|
|
4381
4556
|
while (ch !== 0) {
|
|
4382
4557
|
if (ch === SINGLE_QUOTE) {
|
|
4383
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4558
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4384
4559
|
if (segment) result += segment;
|
|
4385
|
-
|
|
4560
|
+
this.#scanner.next();
|
|
4561
|
+
ch = this.#scanner.peek();
|
|
4386
4562
|
if (ch === SINGLE_QUOTE) {
|
|
4387
|
-
captureStart = this.position;
|
|
4388
|
-
this.
|
|
4389
|
-
captureEnd = this.position;
|
|
4563
|
+
captureStart = this.#scanner.position;
|
|
4564
|
+
this.#scanner.next();
|
|
4565
|
+
captureEnd = this.#scanner.position;
|
|
4390
4566
|
} else {
|
|
4391
4567
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4392
4568
|
return {
|
|
@@ -4400,31 +4576,31 @@ var LoaderState = class {
|
|
|
4400
4576
|
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4401
4577
|
if (segment) result += segment;
|
|
4402
4578
|
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4403
|
-
captureStart = captureEnd = this.position;
|
|
4404
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4579
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4580
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4405
4581
|
throw this.#createError("Unexpected end of the document within a single quoted scalar");
|
|
4406
4582
|
} else {
|
|
4407
|
-
this.
|
|
4408
|
-
captureEnd = this.position;
|
|
4583
|
+
this.#scanner.next();
|
|
4584
|
+
captureEnd = this.#scanner.position;
|
|
4409
4585
|
}
|
|
4410
|
-
ch = this.peek();
|
|
4586
|
+
ch = this.#scanner.peek();
|
|
4411
4587
|
}
|
|
4412
4588
|
throw this.#createError("Unexpected end of the stream within a single quoted scalar");
|
|
4413
4589
|
}
|
|
4414
4590
|
readDoubleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4415
|
-
let ch = this.peek();
|
|
4591
|
+
let ch = this.#scanner.peek();
|
|
4416
4592
|
if (ch !== DOUBLE_QUOTE) return;
|
|
4417
4593
|
let result = "";
|
|
4418
|
-
this.
|
|
4419
|
-
let captureEnd = this.position;
|
|
4420
|
-
let captureStart = this.position;
|
|
4594
|
+
this.#scanner.next();
|
|
4595
|
+
let captureEnd = this.#scanner.position;
|
|
4596
|
+
let captureStart = this.#scanner.position;
|
|
4421
4597
|
let tmp;
|
|
4422
|
-
ch = this.peek();
|
|
4598
|
+
ch = this.#scanner.peek();
|
|
4423
4599
|
while (ch !== 0) {
|
|
4424
4600
|
if (ch === DOUBLE_QUOTE) {
|
|
4425
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4601
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4426
4602
|
if (segment) result += segment;
|
|
4427
|
-
this.
|
|
4603
|
+
this.#scanner.next();
|
|
4428
4604
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4429
4605
|
return {
|
|
4430
4606
|
tag,
|
|
@@ -4434,19 +4610,21 @@ var LoaderState = class {
|
|
|
4434
4610
|
};
|
|
4435
4611
|
}
|
|
4436
4612
|
if (ch === BACKSLASH) {
|
|
4437
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4613
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4438
4614
|
if (segment) result += segment;
|
|
4439
|
-
|
|
4615
|
+
this.#scanner.next();
|
|
4616
|
+
ch = this.#scanner.peek();
|
|
4440
4617
|
if (isEOL(ch)) {
|
|
4441
4618
|
this.skipSeparationSpace(false, nodeIndent);
|
|
4442
4619
|
} else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
|
|
4443
4620
|
result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
|
|
4444
|
-
this.
|
|
4621
|
+
this.#scanner.next();
|
|
4445
4622
|
} else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
|
|
4446
4623
|
let hexLength = tmp;
|
|
4447
4624
|
let hexResult = 0;
|
|
4448
4625
|
for (; hexLength > 0; hexLength--) {
|
|
4449
|
-
|
|
4626
|
+
this.#scanner.next();
|
|
4627
|
+
ch = this.#scanner.peek();
|
|
4450
4628
|
if ((tmp = hexCharCodeToNumber(ch)) >= 0) {
|
|
4451
4629
|
hexResult = (hexResult << 4) + tmp;
|
|
4452
4630
|
} else {
|
|
@@ -4454,28 +4632,28 @@ var LoaderState = class {
|
|
|
4454
4632
|
}
|
|
4455
4633
|
}
|
|
4456
4634
|
result += codepointToChar(hexResult);
|
|
4457
|
-
this.
|
|
4635
|
+
this.#scanner.next();
|
|
4458
4636
|
} else {
|
|
4459
4637
|
throw this.#createError("Cannot read double quoted scalar: unknown escape sequence");
|
|
4460
4638
|
}
|
|
4461
|
-
captureStart = captureEnd = this.position;
|
|
4639
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4462
4640
|
} else if (isEOL(ch)) {
|
|
4463
4641
|
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4464
4642
|
if (segment) result += segment;
|
|
4465
4643
|
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4466
|
-
captureStart = captureEnd = this.position;
|
|
4467
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4644
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4645
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4468
4646
|
throw this.#createError("Unexpected end of the document within a double quoted scalar");
|
|
4469
4647
|
} else {
|
|
4470
|
-
this.
|
|
4471
|
-
captureEnd = this.position;
|
|
4648
|
+
this.#scanner.next();
|
|
4649
|
+
captureEnd = this.#scanner.position;
|
|
4472
4650
|
}
|
|
4473
|
-
ch = this.peek();
|
|
4651
|
+
ch = this.#scanner.peek();
|
|
4474
4652
|
}
|
|
4475
4653
|
throw this.#createError("Unexpected end of the stream within a double quoted scalar");
|
|
4476
4654
|
}
|
|
4477
4655
|
readFlowCollection(tag, anchor, nodeIndent) {
|
|
4478
|
-
let ch = this.peek();
|
|
4656
|
+
let ch = this.#scanner.peek();
|
|
4479
4657
|
let terminator;
|
|
4480
4658
|
let isMapping = true;
|
|
4481
4659
|
let result = {};
|
|
@@ -4489,7 +4667,8 @@ var LoaderState = class {
|
|
|
4489
4667
|
return;
|
|
4490
4668
|
}
|
|
4491
4669
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4492
|
-
|
|
4670
|
+
this.#scanner.next();
|
|
4671
|
+
ch = this.#scanner.peek();
|
|
4493
4672
|
let readNext = true;
|
|
4494
4673
|
let valueNode = null;
|
|
4495
4674
|
let keyNode = null;
|
|
@@ -4501,9 +4680,9 @@ var LoaderState = class {
|
|
|
4501
4680
|
const overridableKeys = /* @__PURE__ */ new Set();
|
|
4502
4681
|
while (ch !== 0) {
|
|
4503
4682
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4504
|
-
ch = this.peek();
|
|
4683
|
+
ch = this.#scanner.peek();
|
|
4505
4684
|
if (ch === terminator) {
|
|
4506
|
-
this.
|
|
4685
|
+
this.#scanner.next();
|
|
4507
4686
|
const kind = isMapping ? "mapping" : "sequence";
|
|
4508
4687
|
return {
|
|
4509
4688
|
tag,
|
|
@@ -4518,10 +4697,10 @@ var LoaderState = class {
|
|
|
4518
4697
|
keyTag = keyNode = valueNode = null;
|
|
4519
4698
|
isPair = isExplicitPair = false;
|
|
4520
4699
|
if (ch === QUESTION) {
|
|
4521
|
-
following = this.peek(1);
|
|
4700
|
+
following = this.#scanner.peek(1);
|
|
4522
4701
|
if (isWhiteSpaceOrEOL(following)) {
|
|
4523
4702
|
isPair = isExplicitPair = true;
|
|
4524
|
-
this.
|
|
4703
|
+
this.#scanner.next();
|
|
4525
4704
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4526
4705
|
}
|
|
4527
4706
|
}
|
|
@@ -4537,10 +4716,11 @@ var LoaderState = class {
|
|
|
4537
4716
|
keyNode = newState.result;
|
|
4538
4717
|
}
|
|
4539
4718
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4540
|
-
ch = this.peek();
|
|
4719
|
+
ch = this.#scanner.peek();
|
|
4541
4720
|
if ((isExplicitPair || this.line === line) && ch === COLON) {
|
|
4542
4721
|
isPair = true;
|
|
4543
|
-
|
|
4722
|
+
this.#scanner.next();
|
|
4723
|
+
ch = this.#scanner.peek();
|
|
4544
4724
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4545
4725
|
const newState2 = this.composeNode({
|
|
4546
4726
|
parentIndent: nodeIndent,
|
|
@@ -4558,10 +4738,11 @@ var LoaderState = class {
|
|
|
4558
4738
|
result.push(keyNode);
|
|
4559
4739
|
}
|
|
4560
4740
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4561
|
-
ch = this.peek();
|
|
4741
|
+
ch = this.#scanner.peek();
|
|
4562
4742
|
if (ch === COMMA) {
|
|
4563
4743
|
readNext = true;
|
|
4564
|
-
|
|
4744
|
+
this.#scanner.next();
|
|
4745
|
+
ch = this.#scanner.peek();
|
|
4565
4746
|
} else {
|
|
4566
4747
|
readNext = false;
|
|
4567
4748
|
}
|
|
@@ -4577,7 +4758,7 @@ var LoaderState = class {
|
|
|
4577
4758
|
let textIndent = nodeIndent;
|
|
4578
4759
|
let emptyLines = 0;
|
|
4579
4760
|
let atMoreIndented = false;
|
|
4580
|
-
let ch = this.peek();
|
|
4761
|
+
let ch = this.#scanner.peek();
|
|
4581
4762
|
let folding = false;
|
|
4582
4763
|
if (ch === VERTICAL_LINE) {
|
|
4583
4764
|
folding = false;
|
|
@@ -4589,7 +4770,8 @@ var LoaderState = class {
|
|
|
4589
4770
|
let result = "";
|
|
4590
4771
|
let tmp = 0;
|
|
4591
4772
|
while (ch !== 0) {
|
|
4592
|
-
|
|
4773
|
+
this.#scanner.next();
|
|
4774
|
+
ch = this.#scanner.peek();
|
|
4593
4775
|
if (ch === PLUS || ch === MINUS) {
|
|
4594
4776
|
if (CHOMPING_CLIP === chomping) {
|
|
4595
4777
|
chomping = ch === PLUS ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
@@ -4612,15 +4794,16 @@ var LoaderState = class {
|
|
|
4612
4794
|
if (isWhiteSpace(ch)) {
|
|
4613
4795
|
this.skipWhitespaces();
|
|
4614
4796
|
this.skipComment();
|
|
4615
|
-
ch = this.peek();
|
|
4797
|
+
ch = this.#scanner.peek();
|
|
4616
4798
|
}
|
|
4617
4799
|
while (ch !== 0) {
|
|
4618
4800
|
this.readLineBreak();
|
|
4619
4801
|
this.lineIndent = 0;
|
|
4620
|
-
ch = this.peek();
|
|
4802
|
+
ch = this.#scanner.peek();
|
|
4621
4803
|
while ((!detectedIndent || this.lineIndent < textIndent) && ch === SPACE) {
|
|
4622
4804
|
this.lineIndent++;
|
|
4623
|
-
|
|
4805
|
+
this.#scanner.next();
|
|
4806
|
+
ch = this.#scanner.peek();
|
|
4624
4807
|
}
|
|
4625
4808
|
if (!detectedIndent && this.lineIndent > textIndent) {
|
|
4626
4809
|
textIndent = this.lineIndent;
|
|
@@ -4659,11 +4842,12 @@ var LoaderState = class {
|
|
|
4659
4842
|
didReadContent = true;
|
|
4660
4843
|
detectedIndent = true;
|
|
4661
4844
|
emptyLines = 0;
|
|
4662
|
-
const captureStart = this.position;
|
|
4845
|
+
const captureStart = this.#scanner.position;
|
|
4663
4846
|
while (!isEOL(ch) && ch !== 0) {
|
|
4664
|
-
|
|
4847
|
+
this.#scanner.next();
|
|
4848
|
+
ch = this.#scanner.peek();
|
|
4665
4849
|
}
|
|
4666
|
-
const segment = this.captureSegment(captureStart, this.position, false);
|
|
4850
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, false);
|
|
4667
4851
|
if (segment) result += segment;
|
|
4668
4852
|
}
|
|
4669
4853
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
@@ -4686,11 +4870,11 @@ var LoaderState = class {
|
|
|
4686
4870
|
let atExplicitKey = false;
|
|
4687
4871
|
let detected = false;
|
|
4688
4872
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4689
|
-
let ch = this.peek();
|
|
4873
|
+
let ch = this.#scanner.peek();
|
|
4690
4874
|
while (ch !== 0) {
|
|
4691
|
-
const following = this.peek(1);
|
|
4875
|
+
const following = this.#scanner.peek(1);
|
|
4692
4876
|
line = this.line;
|
|
4693
|
-
pos = this.position;
|
|
4877
|
+
pos = this.#scanner.position;
|
|
4694
4878
|
if ((ch === QUESTION || ch === COLON) && isWhiteSpaceOrEOL(following)) {
|
|
4695
4879
|
if (ch === QUESTION) {
|
|
4696
4880
|
if (atExplicitKey) {
|
|
@@ -4708,7 +4892,7 @@ var LoaderState = class {
|
|
|
4708
4892
|
} else {
|
|
4709
4893
|
throw this.#createError("Cannot read block as explicit mapping pair is incomplete: a key node is missed or followed by a non-tabulated empty line");
|
|
4710
4894
|
}
|
|
4711
|
-
this.
|
|
4895
|
+
this.#scanner.next();
|
|
4712
4896
|
ch = following;
|
|
4713
4897
|
} else {
|
|
4714
4898
|
const newState = this.composeNode({
|
|
@@ -4719,11 +4903,12 @@ var LoaderState = class {
|
|
|
4719
4903
|
});
|
|
4720
4904
|
if (!newState) break;
|
|
4721
4905
|
if (this.line === line) {
|
|
4722
|
-
ch = this.peek();
|
|
4906
|
+
ch = this.#scanner.peek();
|
|
4723
4907
|
this.skipWhitespaces();
|
|
4724
|
-
ch = this.peek();
|
|
4908
|
+
ch = this.#scanner.peek();
|
|
4725
4909
|
if (ch === COLON) {
|
|
4726
|
-
|
|
4910
|
+
this.#scanner.next();
|
|
4911
|
+
ch = this.#scanner.peek();
|
|
4727
4912
|
if (!isWhiteSpaceOrEOL(ch)) {
|
|
4728
4913
|
throw this.#createError("Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");
|
|
4729
4914
|
}
|
|
@@ -4780,7 +4965,7 @@ var LoaderState = class {
|
|
|
4780
4965
|
keyTag = keyNode = valueNode = null;
|
|
4781
4966
|
}
|
|
4782
4967
|
this.skipSeparationSpace(true, -1);
|
|
4783
|
-
ch = this.peek();
|
|
4968
|
+
ch = this.#scanner.peek();
|
|
4784
4969
|
}
|
|
4785
4970
|
if (this.lineIndent > nodeIndent && ch !== 0) {
|
|
4786
4971
|
throw this.#createError("Cannot read block: bad indentation of a mapping entry");
|
|
@@ -4803,30 +4988,35 @@ var LoaderState = class {
|
|
|
4803
4988
|
let isNamed = false;
|
|
4804
4989
|
let tagHandle = "";
|
|
4805
4990
|
let tagName;
|
|
4806
|
-
let ch = this.peek();
|
|
4991
|
+
let ch = this.#scanner.peek();
|
|
4807
4992
|
if (ch !== EXCLAMATION) return;
|
|
4808
4993
|
if (tag !== null) {
|
|
4809
4994
|
throw this.#createError("Cannot read tag property: duplication of a tag property");
|
|
4810
4995
|
}
|
|
4811
|
-
|
|
4996
|
+
this.#scanner.next();
|
|
4997
|
+
ch = this.#scanner.peek();
|
|
4812
4998
|
if (ch === SMALLER_THAN) {
|
|
4813
4999
|
isVerbatim = true;
|
|
4814
|
-
|
|
5000
|
+
this.#scanner.next();
|
|
5001
|
+
ch = this.#scanner.peek();
|
|
4815
5002
|
} else if (ch === EXCLAMATION) {
|
|
4816
5003
|
isNamed = true;
|
|
4817
5004
|
tagHandle = "!!";
|
|
4818
|
-
|
|
5005
|
+
this.#scanner.next();
|
|
5006
|
+
ch = this.#scanner.peek();
|
|
4819
5007
|
} else {
|
|
4820
5008
|
tagHandle = "!";
|
|
4821
5009
|
}
|
|
4822
|
-
let position = this.position;
|
|
5010
|
+
let position = this.#scanner.position;
|
|
4823
5011
|
if (isVerbatim) {
|
|
4824
5012
|
do {
|
|
4825
|
-
|
|
5013
|
+
this.#scanner.next();
|
|
5014
|
+
ch = this.#scanner.peek();
|
|
4826
5015
|
} while (ch !== 0 && ch !== GREATER_THAN);
|
|
4827
|
-
if (this.
|
|
4828
|
-
tagName = this.
|
|
4829
|
-
|
|
5016
|
+
if (!this.#scanner.eof()) {
|
|
5017
|
+
tagName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
5018
|
+
this.#scanner.next();
|
|
5019
|
+
ch = this.#scanner.peek();
|
|
4830
5020
|
} else {
|
|
4831
5021
|
throw this.#createError("Cannot read tag property: unexpected end of stream");
|
|
4832
5022
|
}
|
|
@@ -4834,19 +5024,20 @@ var LoaderState = class {
|
|
|
4834
5024
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
4835
5025
|
if (ch === EXCLAMATION) {
|
|
4836
5026
|
if (!isNamed) {
|
|
4837
|
-
tagHandle = this.
|
|
5027
|
+
tagHandle = this.#scanner.source.slice(position - 1, this.#scanner.position + 1);
|
|
4838
5028
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
4839
5029
|
throw this.#createError("Cannot read tag property: named tag handle contains invalid characters");
|
|
4840
5030
|
}
|
|
4841
5031
|
isNamed = true;
|
|
4842
|
-
position = this.position + 1;
|
|
5032
|
+
position = this.#scanner.position + 1;
|
|
4843
5033
|
} else {
|
|
4844
5034
|
throw this.#createError("Cannot read tag property: tag suffix cannot contain an exclamation mark");
|
|
4845
5035
|
}
|
|
4846
5036
|
}
|
|
4847
|
-
|
|
5037
|
+
this.#scanner.next();
|
|
5038
|
+
ch = this.#scanner.peek();
|
|
4848
5039
|
}
|
|
4849
|
-
tagName = this.
|
|
5040
|
+
tagName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
4850
5041
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
4851
5042
|
throw this.#createError("Cannot read tag property: tag suffix cannot contain flow indicator characters");
|
|
4852
5043
|
}
|
|
@@ -4866,32 +5057,36 @@ var LoaderState = class {
|
|
|
4866
5057
|
throw this.#createError(`Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
4867
5058
|
}
|
|
4868
5059
|
readAnchorProperty(anchor) {
|
|
4869
|
-
let ch = this.peek();
|
|
5060
|
+
let ch = this.#scanner.peek();
|
|
4870
5061
|
if (ch !== AMPERSAND) return;
|
|
4871
5062
|
if (anchor !== null) {
|
|
4872
5063
|
throw this.#createError("Cannot read anchor property: duplicate anchor property");
|
|
4873
5064
|
}
|
|
4874
|
-
|
|
4875
|
-
|
|
5065
|
+
this.#scanner.next();
|
|
5066
|
+
ch = this.#scanner.peek();
|
|
5067
|
+
const position = this.#scanner.position;
|
|
4876
5068
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4877
|
-
|
|
5069
|
+
this.#scanner.next();
|
|
5070
|
+
ch = this.#scanner.peek();
|
|
4878
5071
|
}
|
|
4879
|
-
if (this.position === position) {
|
|
5072
|
+
if (this.#scanner.position === position) {
|
|
4880
5073
|
throw this.#createError("Cannot read anchor property: name of an anchor node must contain at least one character");
|
|
4881
5074
|
}
|
|
4882
|
-
return this.
|
|
5075
|
+
return this.#scanner.source.slice(position, this.#scanner.position);
|
|
4883
5076
|
}
|
|
4884
5077
|
readAlias() {
|
|
4885
|
-
if (this.peek() !== ASTERISK) return;
|
|
4886
|
-
|
|
4887
|
-
|
|
5078
|
+
if (this.#scanner.peek() !== ASTERISK) return;
|
|
5079
|
+
this.#scanner.next();
|
|
5080
|
+
let ch = this.#scanner.peek();
|
|
5081
|
+
const position = this.#scanner.position;
|
|
4888
5082
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4889
|
-
|
|
5083
|
+
this.#scanner.next();
|
|
5084
|
+
ch = this.#scanner.peek();
|
|
4890
5085
|
}
|
|
4891
|
-
if (this.position === position) {
|
|
5086
|
+
if (this.#scanner.position === position) {
|
|
4892
5087
|
throw this.#createError("Cannot read alias: alias name must contain at least one character");
|
|
4893
5088
|
}
|
|
4894
|
-
const alias = this.
|
|
5089
|
+
const alias = this.#scanner.source.slice(position, this.#scanner.position);
|
|
4895
5090
|
if (!this.anchorMap.has(alias)) {
|
|
4896
5091
|
throw this.#createError(`Cannot read alias: unidentified alias "${alias}"`);
|
|
4897
5092
|
}
|
|
@@ -4974,7 +5169,7 @@ var LoaderState = class {
|
|
|
4974
5169
|
const cond = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext;
|
|
4975
5170
|
const flowIndent = cond ? parentIndent : parentIndent + 1;
|
|
4976
5171
|
if (allowBlockCollections) {
|
|
4977
|
-
const blockIndent = this.position - this.lineStart;
|
|
5172
|
+
const blockIndent = this.#scanner.position - this.lineStart;
|
|
4978
5173
|
const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
4979
5174
|
if (blockSequenceState) return this.resolveTag(blockSequenceState);
|
|
4980
5175
|
const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
|
|
@@ -5008,7 +5203,7 @@ var LoaderState = class {
|
|
|
5008
5203
|
return this.resolveTag(plainScalarState);
|
|
5009
5204
|
}
|
|
5010
5205
|
} else if (indentStatus === 0 && CONTEXT_BLOCK_OUT === nodeContext && allowBlockCollections) {
|
|
5011
|
-
const blockIndent = this.position - this.lineStart;
|
|
5206
|
+
const blockIndent = this.#scanner.position - this.lineStart;
|
|
5012
5207
|
const newState2 = this.readBlockSequence(tag, anchor, blockIndent);
|
|
5013
5208
|
if (newState2) return this.resolveTag(newState2);
|
|
5014
5209
|
}
|
|
@@ -5023,20 +5218,22 @@ var LoaderState = class {
|
|
|
5023
5218
|
readDirectives() {
|
|
5024
5219
|
let hasDirectives = false;
|
|
5025
5220
|
let version = null;
|
|
5026
|
-
let ch = this.peek();
|
|
5221
|
+
let ch = this.#scanner.peek();
|
|
5027
5222
|
while (ch !== 0) {
|
|
5028
5223
|
this.skipSeparationSpace(true, -1);
|
|
5029
|
-
ch = this.peek();
|
|
5224
|
+
ch = this.#scanner.peek();
|
|
5030
5225
|
if (this.lineIndent > 0 || ch !== PERCENT) {
|
|
5031
5226
|
break;
|
|
5032
5227
|
}
|
|
5033
5228
|
hasDirectives = true;
|
|
5034
|
-
|
|
5035
|
-
|
|
5229
|
+
this.#scanner.next();
|
|
5230
|
+
ch = this.#scanner.peek();
|
|
5231
|
+
let position = this.#scanner.position;
|
|
5036
5232
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5037
|
-
|
|
5233
|
+
this.#scanner.next();
|
|
5234
|
+
ch = this.#scanner.peek();
|
|
5038
5235
|
}
|
|
5039
|
-
const directiveName = this.
|
|
5236
|
+
const directiveName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
5040
5237
|
const directiveArgs = [];
|
|
5041
5238
|
if (directiveName.length < 1) {
|
|
5042
5239
|
throw this.#createError("Cannot read document: directive name length must be greater than zero");
|
|
@@ -5044,13 +5241,14 @@ var LoaderState = class {
|
|
|
5044
5241
|
while (ch !== 0) {
|
|
5045
5242
|
this.skipWhitespaces();
|
|
5046
5243
|
this.skipComment();
|
|
5047
|
-
ch = this.peek();
|
|
5244
|
+
ch = this.#scanner.peek();
|
|
5048
5245
|
if (isEOL(ch)) break;
|
|
5049
|
-
position = this.position;
|
|
5246
|
+
position = this.#scanner.position;
|
|
5050
5247
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5051
|
-
|
|
5248
|
+
this.#scanner.next();
|
|
5249
|
+
ch = this.#scanner.peek();
|
|
5052
5250
|
}
|
|
5053
|
-
directiveArgs.push(this.
|
|
5251
|
+
directiveArgs.push(this.#scanner.source.slice(position, this.#scanner.position));
|
|
5054
5252
|
}
|
|
5055
5253
|
if (ch !== 0) this.readLineBreak();
|
|
5056
5254
|
switch (directiveName) {
|
|
@@ -5067,20 +5265,20 @@ var LoaderState = class {
|
|
|
5067
5265
|
this.dispatchWarning(`unknown document directive "${directiveName}"`);
|
|
5068
5266
|
break;
|
|
5069
5267
|
}
|
|
5070
|
-
ch = this.peek();
|
|
5268
|
+
ch = this.#scanner.peek();
|
|
5071
5269
|
}
|
|
5072
5270
|
return hasDirectives;
|
|
5073
5271
|
}
|
|
5074
5272
|
readDocument() {
|
|
5075
|
-
const documentStart = this.position;
|
|
5273
|
+
const documentStart = this.#scanner.position;
|
|
5076
5274
|
this.checkLineBreaks = false;
|
|
5077
5275
|
this.tagMap = /* @__PURE__ */ new Map();
|
|
5078
5276
|
this.anchorMap = /* @__PURE__ */ new Map();
|
|
5079
5277
|
const hasDirectives = this.readDirectives();
|
|
5080
5278
|
this.skipSeparationSpace(true, -1);
|
|
5081
5279
|
let result = null;
|
|
5082
|
-
if (this.lineIndent === 0 && this.peek() === MINUS && this.peek(1) === MINUS && this.peek(2) === MINUS) {
|
|
5083
|
-
this.position += 3;
|
|
5280
|
+
if (this.lineIndent === 0 && this.#scanner.peek() === MINUS && this.#scanner.peek(1) === MINUS && this.#scanner.peek(2) === MINUS) {
|
|
5281
|
+
this.#scanner.position += 3;
|
|
5084
5282
|
this.skipSeparationSpace(true, -1);
|
|
5085
5283
|
} else if (hasDirectives) {
|
|
5086
5284
|
throw this.#createError("Cannot read document: directives end mark is expected");
|
|
@@ -5093,21 +5291,21 @@ var LoaderState = class {
|
|
|
5093
5291
|
});
|
|
5094
5292
|
if (newState) result = newState.result;
|
|
5095
5293
|
this.skipSeparationSpace(true, -1);
|
|
5096
|
-
if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.
|
|
5294
|
+
if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.#scanner.source.slice(documentStart, this.#scanner.position))) {
|
|
5097
5295
|
this.dispatchWarning("non-ASCII line breaks are interpreted as content");
|
|
5098
5296
|
}
|
|
5099
|
-
if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
5100
|
-
if (this.peek() === DOT) {
|
|
5101
|
-
this.position += 3;
|
|
5297
|
+
if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
5298
|
+
if (this.#scanner.peek() === DOT) {
|
|
5299
|
+
this.#scanner.position += 3;
|
|
5102
5300
|
this.skipSeparationSpace(true, -1);
|
|
5103
5301
|
}
|
|
5104
|
-
} else if (this.
|
|
5302
|
+
} else if (!this.#scanner.eof()) {
|
|
5105
5303
|
throw this.#createError("Cannot read document: end of the stream or a document separator is expected");
|
|
5106
5304
|
}
|
|
5107
5305
|
return result;
|
|
5108
5306
|
}
|
|
5109
5307
|
*readDocuments() {
|
|
5110
|
-
while (this.
|
|
5308
|
+
while (!this.#scanner.eof()) {
|
|
5111
5309
|
yield this.readDocument();
|
|
5112
5310
|
}
|
|
5113
5311
|
}
|
|
@@ -5120,7 +5318,6 @@ function sanitizeInput(input) {
|
|
|
5120
5318
|
if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
|
|
5121
5319
|
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
5122
5320
|
}
|
|
5123
|
-
input += "\0";
|
|
5124
5321
|
return input;
|
|
5125
5322
|
}
|
|
5126
5323
|
function parse(content, options = {}) {
|
|
@@ -5138,10 +5335,10 @@ function parse(content, options = {}) {
|
|
|
5138
5335
|
}
|
|
5139
5336
|
|
|
5140
5337
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
5141
|
-
var
|
|
5338
|
+
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
5142
5339
|
function replaceEnvVars(str2) {
|
|
5143
5340
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
5144
|
-
const value =
|
|
5341
|
+
const value = import_node_process3.default.env[varName];
|
|
5145
5342
|
if (value !== void 0) {
|
|
5146
5343
|
return value;
|
|
5147
5344
|
}
|
|
@@ -5240,18 +5437,19 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
5240
5437
|
|
|
5241
5438
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
5242
5439
|
var import_node_path5 = require("node:path");
|
|
5243
|
-
var
|
|
5440
|
+
var import_node_process4 = __toESM(require("node:process"), 1);
|
|
5244
5441
|
var DEFAULT_SKILLS_PATHS = [
|
|
5245
5442
|
".agent/skills"
|
|
5246
5443
|
];
|
|
5247
5444
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
5248
5445
|
function getGlobalPlugins(skillsPaths) {
|
|
5249
|
-
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(
|
|
5446
|
+
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process4.default.cwd(), p2));
|
|
5250
5447
|
return [
|
|
5251
5448
|
markdownLoaderPlugin(),
|
|
5252
5449
|
createSkillsPlugin({
|
|
5253
5450
|
paths: resolvedPaths
|
|
5254
|
-
})
|
|
5451
|
+
}),
|
|
5452
|
+
createBashPlugin()
|
|
5255
5453
|
];
|
|
5256
5454
|
}
|
|
5257
5455
|
function getAgentPlugins() {
|
|
@@ -5280,7 +5478,7 @@ function getDefaultAgents() {
|
|
|
5280
5478
|
}
|
|
5281
5479
|
|
|
5282
5480
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
5283
|
-
var CLI_VERSION = "0.1.
|
|
5481
|
+
var CLI_VERSION = "0.1.52";
|
|
5284
5482
|
function extractServerName(command, commandArgs) {
|
|
5285
5483
|
for (const arg of commandArgs) {
|
|
5286
5484
|
if (!arg.startsWith("-")) {
|
|
@@ -5340,7 +5538,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
5340
5538
|
async function createWrapConfig(args) {
|
|
5341
5539
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
5342
5540
|
console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
|
|
5343
|
-
|
|
5541
|
+
import_node_process5.default.exit(1);
|
|
5344
5542
|
}
|
|
5345
5543
|
const mcpServers = {};
|
|
5346
5544
|
const serverNames = [];
|
|
@@ -5463,7 +5661,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
5463
5661
|
};
|
|
5464
5662
|
}
|
|
5465
5663
|
function parseCLIArgs() {
|
|
5466
|
-
const args = parseArgs(
|
|
5664
|
+
const args = parseArgs(import_node_process5.default.argv.slice(2), {
|
|
5467
5665
|
boolean: [
|
|
5468
5666
|
"help",
|
|
5469
5667
|
"version",
|
|
@@ -5552,15 +5750,15 @@ async function loadConfig() {
|
|
|
5552
5750
|
const args = parseCLIArgs();
|
|
5553
5751
|
if (args.version) {
|
|
5554
5752
|
printVersion();
|
|
5555
|
-
|
|
5753
|
+
import_node_process5.default.exit(0);
|
|
5556
5754
|
}
|
|
5557
5755
|
if (args.help) {
|
|
5558
5756
|
printHelp();
|
|
5559
|
-
|
|
5757
|
+
import_node_process5.default.exit(0);
|
|
5560
5758
|
}
|
|
5561
5759
|
if (args.cwd) {
|
|
5562
|
-
const targetCwd = (0, import_node_path6.resolve)(
|
|
5563
|
-
|
|
5760
|
+
const targetCwd = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), args.cwd);
|
|
5761
|
+
import_node_process5.default.chdir(targetCwd);
|
|
5564
5762
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
5565
5763
|
}
|
|
5566
5764
|
const mergeSkills = (config) => {
|
|
@@ -5572,7 +5770,7 @@ async function loadConfig() {
|
|
|
5572
5770
|
...args,
|
|
5573
5771
|
saveConfig: true
|
|
5574
5772
|
});
|
|
5575
|
-
|
|
5773
|
+
import_node_process5.default.exit(0);
|
|
5576
5774
|
}
|
|
5577
5775
|
if (args.wrap) {
|
|
5578
5776
|
return mergeSkills(await createWrapConfig({
|
|
@@ -5589,16 +5787,16 @@ async function loadConfig() {
|
|
|
5589
5787
|
throw error;
|
|
5590
5788
|
}
|
|
5591
5789
|
}
|
|
5592
|
-
if (
|
|
5790
|
+
if (import_node_process5.default.env.MCPC_CONFIG) {
|
|
5593
5791
|
try {
|
|
5594
|
-
const parsed = JSON.parse(
|
|
5792
|
+
const parsed = JSON.parse(import_node_process5.default.env.MCPC_CONFIG);
|
|
5595
5793
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
5596
5794
|
} catch (error) {
|
|
5597
5795
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
5598
5796
|
throw error;
|
|
5599
5797
|
}
|
|
5600
5798
|
}
|
|
5601
|
-
const configUrl = args.configUrl ||
|
|
5799
|
+
const configUrl = args.configUrl || import_node_process5.default.env.MCPC_CONFIG_URL;
|
|
5602
5800
|
if (configUrl) {
|
|
5603
5801
|
try {
|
|
5604
5802
|
const headers = {
|
|
@@ -5619,7 +5817,7 @@ async function loadConfig() {
|
|
|
5619
5817
|
throw error;
|
|
5620
5818
|
}
|
|
5621
5819
|
}
|
|
5622
|
-
const configFile = args.configFile ||
|
|
5820
|
+
const configFile = args.configFile || import_node_process5.default.env.MCPC_CONFIG_FILE;
|
|
5623
5821
|
if (configFile) {
|
|
5624
5822
|
try {
|
|
5625
5823
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -5644,7 +5842,7 @@ async function loadConfig() {
|
|
|
5644
5842
|
throw error;
|
|
5645
5843
|
}
|
|
5646
5844
|
}
|
|
5647
|
-
const defaultJsonConfigPath = (0, import_node_path6.resolve)(
|
|
5845
|
+
const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), "mcpc.config.json");
|
|
5648
5846
|
try {
|
|
5649
5847
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
5650
5848
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -5659,7 +5857,7 @@ async function loadConfig() {
|
|
|
5659
5857
|
}
|
|
5660
5858
|
function replaceEnvVars2(str2) {
|
|
5661
5859
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
5662
|
-
return
|
|
5860
|
+
return import_node_process5.default.env[varName] || "";
|
|
5663
5861
|
});
|
|
5664
5862
|
}
|
|
5665
5863
|
function isMarkdownFile2(path) {
|
|
@@ -6889,6 +7087,147 @@ var ExperimentalServerTasks = class {
|
|
|
6889
7087
|
requestStream(request, resultSchema, options) {
|
|
6890
7088
|
return this._server.requestStream(request, resultSchema, options);
|
|
6891
7089
|
}
|
|
7090
|
+
/**
|
|
7091
|
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
|
7092
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
7093
|
+
*
|
|
7094
|
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
|
7095
|
+
* before the final result.
|
|
7096
|
+
*
|
|
7097
|
+
* @example
|
|
7098
|
+
* ```typescript
|
|
7099
|
+
* const stream = server.experimental.tasks.createMessageStream({
|
|
7100
|
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
|
7101
|
+
* maxTokens: 100
|
|
7102
|
+
* }, {
|
|
7103
|
+
* onprogress: (progress) => {
|
|
7104
|
+
* // Handle streaming tokens via progress notifications
|
|
7105
|
+
* console.log('Progress:', progress.message);
|
|
7106
|
+
* }
|
|
7107
|
+
* });
|
|
7108
|
+
*
|
|
7109
|
+
* for await (const message of stream) {
|
|
7110
|
+
* switch (message.type) {
|
|
7111
|
+
* case 'taskCreated':
|
|
7112
|
+
* console.log('Task created:', message.task.taskId);
|
|
7113
|
+
* break;
|
|
7114
|
+
* case 'taskStatus':
|
|
7115
|
+
* console.log('Task status:', message.task.status);
|
|
7116
|
+
* break;
|
|
7117
|
+
* case 'result':
|
|
7118
|
+
* console.log('Final result:', message.result);
|
|
7119
|
+
* break;
|
|
7120
|
+
* case 'error':
|
|
7121
|
+
* console.error('Error:', message.error);
|
|
7122
|
+
* break;
|
|
7123
|
+
* }
|
|
7124
|
+
* }
|
|
7125
|
+
* ```
|
|
7126
|
+
*
|
|
7127
|
+
* @param params - The sampling request parameters
|
|
7128
|
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
|
7129
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
7130
|
+
*
|
|
7131
|
+
* @experimental
|
|
7132
|
+
*/
|
|
7133
|
+
createMessageStream(params, options) {
|
|
7134
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
7135
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
7136
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
7137
|
+
}
|
|
7138
|
+
if (params.messages.length > 0) {
|
|
7139
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
7140
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
7141
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
7142
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
|
|
7143
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
7144
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
7145
|
+
if (hasToolResults) {
|
|
7146
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
7147
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
7148
|
+
}
|
|
7149
|
+
if (!hasPreviousToolUse) {
|
|
7150
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
if (hasPreviousToolUse) {
|
|
7154
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
7155
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
7156
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
7157
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
return this.requestStream({
|
|
7162
|
+
method: "sampling/createMessage",
|
|
7163
|
+
params
|
|
7164
|
+
}, CreateMessageResultSchema, options);
|
|
7165
|
+
}
|
|
7166
|
+
/**
|
|
7167
|
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
|
7168
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
7169
|
+
*
|
|
7170
|
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
|
7171
|
+
* and 'taskStatus' messages before the final result.
|
|
7172
|
+
*
|
|
7173
|
+
* @example
|
|
7174
|
+
* ```typescript
|
|
7175
|
+
* const stream = server.experimental.tasks.elicitInputStream({
|
|
7176
|
+
* mode: 'url',
|
|
7177
|
+
* message: 'Please authenticate',
|
|
7178
|
+
* elicitationId: 'auth-123',
|
|
7179
|
+
* url: 'https://example.com/auth'
|
|
7180
|
+
* }, {
|
|
7181
|
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
|
7182
|
+
* });
|
|
7183
|
+
*
|
|
7184
|
+
* for await (const message of stream) {
|
|
7185
|
+
* switch (message.type) {
|
|
7186
|
+
* case 'taskCreated':
|
|
7187
|
+
* console.log('Task created:', message.task.taskId);
|
|
7188
|
+
* break;
|
|
7189
|
+
* case 'taskStatus':
|
|
7190
|
+
* console.log('Task status:', message.task.status);
|
|
7191
|
+
* break;
|
|
7192
|
+
* case 'result':
|
|
7193
|
+
* console.log('User action:', message.result.action);
|
|
7194
|
+
* break;
|
|
7195
|
+
* case 'error':
|
|
7196
|
+
* console.error('Error:', message.error);
|
|
7197
|
+
* break;
|
|
7198
|
+
* }
|
|
7199
|
+
* }
|
|
7200
|
+
* ```
|
|
7201
|
+
*
|
|
7202
|
+
* @param params - The elicitation request parameters
|
|
7203
|
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
7204
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
7205
|
+
*
|
|
7206
|
+
* @experimental
|
|
7207
|
+
*/
|
|
7208
|
+
elicitInputStream(params, options) {
|
|
7209
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
7210
|
+
const mode = params.mode ?? "form";
|
|
7211
|
+
switch (mode) {
|
|
7212
|
+
case "url": {
|
|
7213
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
7214
|
+
throw new Error("Client does not support url elicitation.");
|
|
7215
|
+
}
|
|
7216
|
+
break;
|
|
7217
|
+
}
|
|
7218
|
+
case "form": {
|
|
7219
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
7220
|
+
throw new Error("Client does not support form elicitation.");
|
|
7221
|
+
}
|
|
7222
|
+
break;
|
|
7223
|
+
}
|
|
7224
|
+
}
|
|
7225
|
+
const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
|
|
7226
|
+
return this.requestStream({
|
|
7227
|
+
method: "elicitation/create",
|
|
7228
|
+
params: normalizedParams
|
|
7229
|
+
}, ElicitResultSchema, options);
|
|
7230
|
+
}
|
|
6892
7231
|
/**
|
|
6893
7232
|
* Gets the current status of a task.
|
|
6894
7233
|
*
|
|
@@ -8088,9 +8427,9 @@ var Client = class extends Protocol {
|
|
|
8088
8427
|
|
|
8089
8428
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
8090
8429
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
8091
|
-
var
|
|
8430
|
+
var import_node_process6 = __toESM(require("node:process"), 1);
|
|
8092
8431
|
var import_node_stream = require("node:stream");
|
|
8093
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
8432
|
+
var DEFAULT_INHERITED_ENV_VARS = import_node_process6.default.platform === "win32" ? [
|
|
8094
8433
|
"APPDATA",
|
|
8095
8434
|
"HOMEDRIVE",
|
|
8096
8435
|
"HOMEPATH",
|
|
@@ -8110,7 +8449,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win3
|
|
|
8110
8449
|
function getDefaultEnvironment() {
|
|
8111
8450
|
const env = {};
|
|
8112
8451
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
8113
|
-
const value =
|
|
8452
|
+
const value = import_node_process6.default.env[key];
|
|
8114
8453
|
if (value === void 0) {
|
|
8115
8454
|
continue;
|
|
8116
8455
|
}
|
|
@@ -8146,7 +8485,7 @@ var StdioClientTransport = class {
|
|
|
8146
8485
|
},
|
|
8147
8486
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
8148
8487
|
shell: false,
|
|
8149
|
-
windowsHide:
|
|
8488
|
+
windowsHide: import_node_process6.default.platform === "win32" && isElectron(),
|
|
8150
8489
|
cwd: this._serverParams.cwd
|
|
8151
8490
|
});
|
|
8152
8491
|
this._process.on("error", (error) => {
|
|
@@ -8254,7 +8593,7 @@ var StdioClientTransport = class {
|
|
|
8254
8593
|
}
|
|
8255
8594
|
};
|
|
8256
8595
|
function isElectron() {
|
|
8257
|
-
return "type" in
|
|
8596
|
+
return "type" in import_node_process6.default;
|
|
8258
8597
|
}
|
|
8259
8598
|
|
|
8260
8599
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -9077,22 +9416,45 @@ async function auth(provider, options) {
|
|
|
9077
9416
|
}
|
|
9078
9417
|
}
|
|
9079
9418
|
async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
|
|
9419
|
+
const cachedState = await provider.discoveryState?.();
|
|
9080
9420
|
let resourceMetadata;
|
|
9081
9421
|
let authorizationServerUrl;
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9422
|
+
let metadata;
|
|
9423
|
+
let effectiveResourceMetadataUrl = resourceMetadataUrl;
|
|
9424
|
+
if (!effectiveResourceMetadataUrl && cachedState?.resourceMetadataUrl) {
|
|
9425
|
+
effectiveResourceMetadataUrl = new URL(cachedState.resourceMetadataUrl);
|
|
9426
|
+
}
|
|
9427
|
+
if (cachedState?.authorizationServerUrl) {
|
|
9428
|
+
authorizationServerUrl = cachedState.authorizationServerUrl;
|
|
9429
|
+
resourceMetadata = cachedState.resourceMetadata;
|
|
9430
|
+
metadata = cachedState.authorizationServerMetadata ?? await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn });
|
|
9431
|
+
if (!resourceMetadata) {
|
|
9432
|
+
try {
|
|
9433
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl }, fetchFn);
|
|
9434
|
+
} catch {
|
|
9435
|
+
}
|
|
9086
9436
|
}
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9437
|
+
if (metadata !== cachedState.authorizationServerMetadata || resourceMetadata !== cachedState.resourceMetadata) {
|
|
9438
|
+
await provider.saveDiscoveryState?.({
|
|
9439
|
+
authorizationServerUrl: String(authorizationServerUrl),
|
|
9440
|
+
resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
|
|
9441
|
+
resourceMetadata,
|
|
9442
|
+
authorizationServerMetadata: metadata
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9445
|
+
} else {
|
|
9446
|
+
const serverInfo = await discoverOAuthServerInfo(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl, fetchFn });
|
|
9447
|
+
authorizationServerUrl = serverInfo.authorizationServerUrl;
|
|
9448
|
+
metadata = serverInfo.authorizationServerMetadata;
|
|
9449
|
+
resourceMetadata = serverInfo.resourceMetadata;
|
|
9450
|
+
await provider.saveDiscoveryState?.({
|
|
9451
|
+
authorizationServerUrl: String(authorizationServerUrl),
|
|
9452
|
+
resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
|
|
9453
|
+
resourceMetadata,
|
|
9454
|
+
authorizationServerMetadata: metadata
|
|
9455
|
+
});
|
|
9091
9456
|
}
|
|
9092
9457
|
const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
9093
|
-
const metadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
9094
|
-
fetchFn
|
|
9095
|
-
});
|
|
9096
9458
|
let clientInformation = await Promise.resolve(provider.clientInformation());
|
|
9097
9459
|
if (!clientInformation) {
|
|
9098
9460
|
if (authorizationCode !== void 0) {
|
|
@@ -9347,6 +9709,26 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
9347
9709
|
}
|
|
9348
9710
|
return void 0;
|
|
9349
9711
|
}
|
|
9712
|
+
async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
9713
|
+
let resourceMetadata;
|
|
9714
|
+
let authorizationServerUrl;
|
|
9715
|
+
try {
|
|
9716
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: opts?.resourceMetadataUrl }, opts?.fetchFn);
|
|
9717
|
+
if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
|
|
9718
|
+
authorizationServerUrl = resourceMetadata.authorization_servers[0];
|
|
9719
|
+
}
|
|
9720
|
+
} catch {
|
|
9721
|
+
}
|
|
9722
|
+
if (!authorizationServerUrl) {
|
|
9723
|
+
authorizationServerUrl = String(new URL("/", serverUrl));
|
|
9724
|
+
}
|
|
9725
|
+
const authorizationServerMetadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn: opts?.fetchFn });
|
|
9726
|
+
return {
|
|
9727
|
+
authorizationServerUrl,
|
|
9728
|
+
authorizationServerMetadata,
|
|
9729
|
+
resourceMetadata
|
|
9730
|
+
};
|
|
9731
|
+
}
|
|
9350
9732
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
9351
9733
|
let authorizationUrl;
|
|
9352
9734
|
if (metadata) {
|
|
@@ -10135,8 +10517,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
10135
10517
|
};
|
|
10136
10518
|
|
|
10137
10519
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
10138
|
-
var
|
|
10139
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
10520
|
+
var import_node_process7 = __toESM(require("node:process"), 1);
|
|
10521
|
+
var GEMINI_PREFERRED_FORMAT = import_node_process7.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
10140
10522
|
|
|
10141
10523
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
10142
10524
|
var import_jsonrepair2 = require("jsonrepair");
|
|
@@ -10208,21 +10590,9 @@ var cleanToolSchema = (schema) => {
|
|
|
10208
10590
|
};
|
|
10209
10591
|
|
|
10210
10592
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
10211
|
-
var
|
|
10212
|
-
var
|
|
10593
|
+
var import_node_process8 = require("node:process");
|
|
10594
|
+
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
10213
10595
|
var import_node_crypto = require("node:crypto");
|
|
10214
|
-
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
10215
|
-
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
10216
|
-
var shortHash = (s) => (0, import_node_crypto.createHash)("sha256").update(s).digest("hex").slice(0, 8);
|
|
10217
|
-
function defSignature(def) {
|
|
10218
|
-
const defCopy = {
|
|
10219
|
-
...def
|
|
10220
|
-
};
|
|
10221
|
-
if (defCopy.transportType === "memory" || defCopy.transport) {
|
|
10222
|
-
return `memory:${Date.now()}:${Math.random()}`;
|
|
10223
|
-
}
|
|
10224
|
-
return JSON.stringify(defCopy);
|
|
10225
|
-
}
|
|
10226
10596
|
function createTransport(def) {
|
|
10227
10597
|
const defAny = def;
|
|
10228
10598
|
const explicitType = defAny.transportType || defAny.type;
|
|
@@ -10262,98 +10632,51 @@ function createTransport(def) {
|
|
|
10262
10632
|
command: defAny.command,
|
|
10263
10633
|
args: defAny.args,
|
|
10264
10634
|
env: {
|
|
10265
|
-
...
|
|
10635
|
+
...import_node_process9.default.env,
|
|
10266
10636
|
...defAny.env ?? {}
|
|
10267
10637
|
},
|
|
10268
|
-
cwd: (0,
|
|
10638
|
+
cwd: (0, import_node_process8.cwd)()
|
|
10269
10639
|
});
|
|
10270
10640
|
}
|
|
10271
10641
|
throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
|
|
10272
10642
|
}
|
|
10273
|
-
|
|
10274
|
-
const
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
const existingConnecting = mcpClientConnecting.get(defKey);
|
|
10280
|
-
if (existingConnecting) {
|
|
10281
|
-
const client = await existingConnecting;
|
|
10282
|
-
const entry = mcpClientPool.get(defKey);
|
|
10283
|
-
if (entry) entry.refCount += 1;
|
|
10284
|
-
return client;
|
|
10285
|
-
}
|
|
10286
|
-
const transport = createTransport(def);
|
|
10287
|
-
const connecting = (async () => {
|
|
10288
|
-
const client = new Client({
|
|
10289
|
-
name: `mcp_${shortHash(defSignature(def))}`,
|
|
10290
|
-
version: "1.0.0"
|
|
10291
|
-
});
|
|
10292
|
-
await client.connect(transport, {
|
|
10293
|
-
timeout: 6e4 * 10
|
|
10294
|
-
});
|
|
10295
|
-
return client;
|
|
10296
|
-
})();
|
|
10297
|
-
mcpClientConnecting.set(defKey, connecting);
|
|
10298
|
-
try {
|
|
10299
|
-
const client = await connecting;
|
|
10300
|
-
mcpClientPool.set(defKey, {
|
|
10301
|
-
client,
|
|
10302
|
-
refCount: 1
|
|
10303
|
-
});
|
|
10304
|
-
return client;
|
|
10305
|
-
} finally {
|
|
10306
|
-
mcpClientConnecting.delete(defKey);
|
|
10643
|
+
function defSignature(def) {
|
|
10644
|
+
const defCopy = {
|
|
10645
|
+
...def
|
|
10646
|
+
};
|
|
10647
|
+
if (defCopy.transportType === "memory" || defCopy.transport) {
|
|
10648
|
+
return `memory:${Date.now()}:${Math.random()}`;
|
|
10307
10649
|
}
|
|
10650
|
+
return JSON.stringify(defCopy);
|
|
10308
10651
|
}
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
}
|
|
10652
|
+
var shortHash = (s) => (0, import_node_crypto.createHash)("sha256").update(s).digest("hex").slice(0, 8);
|
|
10653
|
+
async function createMcpClient(def) {
|
|
10654
|
+
const transport = createTransport(def);
|
|
10655
|
+
const client = new Client({
|
|
10656
|
+
name: `mcp_${shortHash(defSignature(def))}`,
|
|
10657
|
+
version: "1.0.0"
|
|
10658
|
+
});
|
|
10659
|
+
await client.connect(transport, {
|
|
10660
|
+
timeout: 6e4 * 10
|
|
10661
|
+
});
|
|
10662
|
+
return client;
|
|
10321
10663
|
}
|
|
10322
|
-
var cleanupAllPooledClients = async () => {
|
|
10323
|
-
const entries = Array.from(mcpClientPool.entries());
|
|
10324
|
-
mcpClientPool.clear();
|
|
10325
|
-
await Promise.all(entries.map(async ([, { client }]) => {
|
|
10326
|
-
try {
|
|
10327
|
-
await client.close();
|
|
10328
|
-
} catch (err) {
|
|
10329
|
-
console.error("Error closing MCP client:", err);
|
|
10330
|
-
}
|
|
10331
|
-
}));
|
|
10332
|
-
};
|
|
10333
|
-
import_node_process8.default.once?.("exit", () => {
|
|
10334
|
-
cleanupAllPooledClients();
|
|
10335
|
-
});
|
|
10336
|
-
import_node_process8.default.once?.("SIGINT", () => {
|
|
10337
|
-
cleanupAllPooledClients().finally(() => import_node_process8.default.exit(0));
|
|
10338
|
-
});
|
|
10339
10664
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
10340
10665
|
const allTools = {};
|
|
10341
10666
|
const allClients = {};
|
|
10342
|
-
const
|
|
10667
|
+
const clientsToClose = [];
|
|
10343
10668
|
for (const [name, definition] of Object.entries(mcpConfig.mcpServers)) {
|
|
10344
10669
|
const def = definition;
|
|
10345
10670
|
if (def.disabled) continue;
|
|
10346
|
-
const defKey = shortHash(defSignature(def));
|
|
10347
|
-
const serverId = name;
|
|
10348
10671
|
try {
|
|
10349
|
-
const client = await
|
|
10350
|
-
|
|
10351
|
-
allClients[
|
|
10672
|
+
const client = await createMcpClient(def);
|
|
10673
|
+
clientsToClose.push(client);
|
|
10674
|
+
allClients[name] = client;
|
|
10352
10675
|
const { tools } = await client.listTools();
|
|
10353
10676
|
tools.forEach((tool2) => {
|
|
10354
10677
|
const toolNameWithScope = `${name}.${tool2.name}`;
|
|
10355
10678
|
const internalToolName = tool2.name;
|
|
10356
|
-
const rawToolId = `${
|
|
10679
|
+
const rawToolId = `${name}_${internalToolName}`;
|
|
10357
10680
|
const toolId = sanitizePropertyKey(rawToolId);
|
|
10358
10681
|
if (filterIn && !filterIn({
|
|
10359
10682
|
action: internalToolName,
|
|
@@ -10365,7 +10688,7 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
10365
10688
|
})) {
|
|
10366
10689
|
return;
|
|
10367
10690
|
}
|
|
10368
|
-
const execute = (args) => allClients[
|
|
10691
|
+
const execute = (args) => allClients[name].callTool({
|
|
10369
10692
|
name: internalToolName,
|
|
10370
10693
|
arguments: args
|
|
10371
10694
|
}, void 0, {
|
|
@@ -10382,10 +10705,12 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
10382
10705
|
}
|
|
10383
10706
|
}
|
|
10384
10707
|
const cleanupClients = async () => {
|
|
10385
|
-
await Promise.all(
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10708
|
+
await Promise.all(clientsToClose.map((client) => {
|
|
10709
|
+
try {
|
|
10710
|
+
return client.close();
|
|
10711
|
+
} catch {
|
|
10712
|
+
}
|
|
10713
|
+
}));
|
|
10389
10714
|
};
|
|
10390
10715
|
return {
|
|
10391
10716
|
tools: allTools,
|
|
@@ -10957,7 +11282,7 @@ function endSpan(span, error) {
|
|
|
10957
11282
|
}
|
|
10958
11283
|
|
|
10959
11284
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
10960
|
-
var
|
|
11285
|
+
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
10961
11286
|
var AgenticExecutor = class {
|
|
10962
11287
|
name;
|
|
10963
11288
|
allToolNames;
|
|
@@ -10977,13 +11302,13 @@ var AgenticExecutor = class {
|
|
|
10977
11302
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
10978
11303
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
10979
11304
|
try {
|
|
10980
|
-
this.tracingEnabled =
|
|
11305
|
+
this.tracingEnabled = import_node_process10.default.env.MCPC_TRACING_ENABLED === "true";
|
|
10981
11306
|
if (this.tracingEnabled) {
|
|
10982
11307
|
initializeTracing({
|
|
10983
11308
|
enabled: true,
|
|
10984
11309
|
serviceName: `mcpc-agentic-${name}`,
|
|
10985
|
-
exportTo:
|
|
10986
|
-
otlpEndpoint:
|
|
11310
|
+
exportTo: import_node_process10.default.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
11311
|
+
otlpEndpoint: import_node_process10.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
10987
11312
|
});
|
|
10988
11313
|
}
|
|
10989
11314
|
} catch {
|
|
@@ -13698,12 +14023,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
13698
14023
|
};
|
|
13699
14024
|
|
|
13700
14025
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
13701
|
-
var
|
|
13702
|
-
var isSCF = () => Boolean(
|
|
14026
|
+
var import_node_process11 = __toESM(require("node:process"), 1);
|
|
14027
|
+
var isSCF = () => Boolean(import_node_process11.default.env.SCF_RUNTIME || import_node_process11.default.env.PROD_SCF);
|
|
13703
14028
|
if (isSCF()) {
|
|
13704
14029
|
console.log({
|
|
13705
14030
|
isSCF: isSCF(),
|
|
13706
|
-
SCF_RUNTIME:
|
|
14031
|
+
SCF_RUNTIME: import_node_process11.default.env.SCF_RUNTIME
|
|
13707
14032
|
});
|
|
13708
14033
|
}
|
|
13709
14034
|
|