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