@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.mjs
CHANGED
|
@@ -510,7 +510,7 @@ var require_cross_spawn = __commonJS({
|
|
|
510
510
|
var cp = __require("child_process");
|
|
511
511
|
var parse2 = require_parse();
|
|
512
512
|
var enoent = require_enoent();
|
|
513
|
-
function
|
|
513
|
+
function spawn3(command, args, options) {
|
|
514
514
|
const parsed = parse2(command, args, options);
|
|
515
515
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
516
516
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -522,8 +522,8 @@ var require_cross_spawn = __commonJS({
|
|
|
522
522
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
523
523
|
return result;
|
|
524
524
|
}
|
|
525
|
-
module.exports =
|
|
526
|
-
module.exports.spawn =
|
|
525
|
+
module.exports = spawn3;
|
|
526
|
+
module.exports.spawn = spawn3;
|
|
527
527
|
module.exports.sync = spawnSync;
|
|
528
528
|
module.exports._parse = parse2;
|
|
529
529
|
module.exports._enoent = enoent;
|
|
@@ -2386,7 +2386,7 @@ if (typeof global.crypto === "undefined") {
|
|
|
2386
2386
|
var outgoingEnded = Symbol("outgoingEnded");
|
|
2387
2387
|
|
|
2388
2388
|
// __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
|
|
2389
|
-
var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value
|
|
2389
|
+
var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s;
|
|
2390
2390
|
var LETTER_REGEXP = /[A-Za-z]/;
|
|
2391
2391
|
var NUMBER_REGEXP = /-?\d+(\.\d*)?(e-?\d+)?$/;
|
|
2392
2392
|
var HYPHEN_REGEXP = /^(-|--)[^-]/;
|
|
@@ -2397,12 +2397,19 @@ var NON_WHITESPACE_REGEXP = /\S/;
|
|
|
2397
2397
|
function isNumber(string3) {
|
|
2398
2398
|
return NON_WHITESPACE_REGEXP.test(string3) && Number.isFinite(Number(string3));
|
|
2399
2399
|
}
|
|
2400
|
+
function isConstructorOrProto(obj, key) {
|
|
2401
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
2402
|
+
}
|
|
2400
2403
|
function setNested(object5, keys, value, collect = false) {
|
|
2401
2404
|
keys = [
|
|
2402
2405
|
...keys
|
|
2403
2406
|
];
|
|
2404
2407
|
const key = keys.pop();
|
|
2405
|
-
|
|
2408
|
+
for (const k of keys) {
|
|
2409
|
+
if (isConstructorOrProto(object5, k)) return;
|
|
2410
|
+
object5 = object5[k] ??= {};
|
|
2411
|
+
}
|
|
2412
|
+
if (isConstructorOrProto(object5, key)) return;
|
|
2406
2413
|
if (collect) {
|
|
2407
2414
|
const v = object5[key];
|
|
2408
2415
|
if (Array.isArray(v)) {
|
|
@@ -2533,7 +2540,7 @@ function parseArgs(args, options) {
|
|
|
2533
2540
|
let key = groups.key;
|
|
2534
2541
|
let value = groups.value;
|
|
2535
2542
|
if (doubleDash2) {
|
|
2536
|
-
if (value) {
|
|
2543
|
+
if (value != null) {
|
|
2537
2544
|
if (booleanSet.has(key)) value = parseBooleanString(value);
|
|
2538
2545
|
setArgument(key, value, arg, true);
|
|
2539
2546
|
continue;
|
|
@@ -2571,6 +2578,10 @@ function parseArgs(args, options) {
|
|
|
2571
2578
|
setArgument(letter, next, arg, true);
|
|
2572
2579
|
continue;
|
|
2573
2580
|
}
|
|
2581
|
+
if (next === "=") {
|
|
2582
|
+
setArgument(letter, "", arg, true);
|
|
2583
|
+
continue argsLoop;
|
|
2584
|
+
}
|
|
2574
2585
|
if (LETTER_REGEXP.test(letter)) {
|
|
2575
2586
|
const groups2 = VALUE_REGEXP.exec(next)?.groups;
|
|
2576
2587
|
if (groups2) {
|
|
@@ -2647,7 +2658,7 @@ function parseArgs(args, options) {
|
|
|
2647
2658
|
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
2648
2659
|
import { homedir } from "node:os";
|
|
2649
2660
|
import { dirname, join as join3, resolve as resolve4 } from "node:path";
|
|
2650
|
-
import
|
|
2661
|
+
import process6 from "node:process";
|
|
2651
2662
|
|
|
2652
2663
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
2653
2664
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
@@ -3065,7 +3076,7 @@ Usage:
|
|
|
3065
3076
|
- ${toolName}({ skill: "skill-name" }) - Load main SKILL.md content
|
|
3066
3077
|
- ${toolName}({ skill: "skill-name", ref: "path/to/file" }) - Load reference file
|
|
3067
3078
|
|
|
3068
|
-
Note: For scripts
|
|
3079
|
+
Note: For scripts/, use the bash tool with the script path to execute.`;
|
|
3069
3080
|
}
|
|
3070
3081
|
function createSkillsPlugin(options) {
|
|
3071
3082
|
const { paths } = options;
|
|
@@ -3173,11 +3184,15 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
|
|
|
3173
3184
|
try {
|
|
3174
3185
|
const content = await readFile(join2(meta.basePath, "SKILL.md"), "utf-8");
|
|
3175
3186
|
const body = extractBody(content);
|
|
3187
|
+
const skillPathInfo = `
|
|
3188
|
+
---
|
|
3189
|
+
Skill path: ${meta.basePath}
|
|
3190
|
+
`;
|
|
3176
3191
|
return {
|
|
3177
3192
|
content: [
|
|
3178
3193
|
{
|
|
3179
3194
|
type: "text",
|
|
3180
|
-
text: body
|
|
3195
|
+
text: body + skillPathInfo
|
|
3181
3196
|
}
|
|
3182
3197
|
]
|
|
3183
3198
|
};
|
|
@@ -3204,6 +3219,152 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
|
|
|
3204
3219
|
};
|
|
3205
3220
|
}
|
|
3206
3221
|
|
|
3222
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
3223
|
+
import { spawn } from "node:child_process";
|
|
3224
|
+
import process3 from "node:process";
|
|
3225
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
3226
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
3227
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
3228
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
3229
|
+
const fullOutput = (stderr ? `STDERR:
|
|
3230
|
+
${stderr}
|
|
3231
|
+
|
|
3232
|
+
STDOUT:
|
|
3233
|
+
` : "") + stdout;
|
|
3234
|
+
const lines = fullOutput.split("\n");
|
|
3235
|
+
if (lines.length > maxLines) {
|
|
3236
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
3237
|
+
return {
|
|
3238
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
3239
|
+
|
|
3240
|
+
` + truncatedLines.join("\n"),
|
|
3241
|
+
truncated: true
|
|
3242
|
+
};
|
|
3243
|
+
}
|
|
3244
|
+
if (fullOutput.length > maxBytes) {
|
|
3245
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
3246
|
+
return {
|
|
3247
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
3248
|
+
|
|
3249
|
+
` + truncatedBytes,
|
|
3250
|
+
truncated: true
|
|
3251
|
+
};
|
|
3252
|
+
}
|
|
3253
|
+
return {
|
|
3254
|
+
output: fullOutput,
|
|
3255
|
+
truncated: false
|
|
3256
|
+
};
|
|
3257
|
+
}
|
|
3258
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
3259
|
+
return new Promise((resolve5) => {
|
|
3260
|
+
const stdout = [];
|
|
3261
|
+
const stderr = [];
|
|
3262
|
+
const proc = spawn("bash", [
|
|
3263
|
+
"-c",
|
|
3264
|
+
command
|
|
3265
|
+
], {
|
|
3266
|
+
cwd: cwd2,
|
|
3267
|
+
stdio: [
|
|
3268
|
+
"ignore",
|
|
3269
|
+
"pipe",
|
|
3270
|
+
"pipe"
|
|
3271
|
+
]
|
|
3272
|
+
});
|
|
3273
|
+
proc.stdout?.on("data", (data) => {
|
|
3274
|
+
stdout.push(data.toString());
|
|
3275
|
+
});
|
|
3276
|
+
proc.stderr?.on("data", (data) => {
|
|
3277
|
+
stderr.push(data.toString());
|
|
3278
|
+
});
|
|
3279
|
+
proc.on("close", (code) => {
|
|
3280
|
+
resolve5({
|
|
3281
|
+
stdout: stdout.join(""),
|
|
3282
|
+
stderr: stderr.join(""),
|
|
3283
|
+
exitCode: code
|
|
3284
|
+
});
|
|
3285
|
+
});
|
|
3286
|
+
proc.on("error", (err) => {
|
|
3287
|
+
resolve5({
|
|
3288
|
+
stdout: "",
|
|
3289
|
+
stderr: err.message,
|
|
3290
|
+
exitCode: null
|
|
3291
|
+
});
|
|
3292
|
+
});
|
|
3293
|
+
setTimeout(() => {
|
|
3294
|
+
proc.kill("SIGTERM");
|
|
3295
|
+
resolve5({
|
|
3296
|
+
stdout: stdout.join(""),
|
|
3297
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
3298
|
+
exitCode: null
|
|
3299
|
+
});
|
|
3300
|
+
}, timeoutMs);
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
function createBashPlugin(options = {}) {
|
|
3304
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
3305
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
3306
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
3307
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
3308
|
+
...options
|
|
3309
|
+
};
|
|
3310
|
+
let serverRef = null;
|
|
3311
|
+
return {
|
|
3312
|
+
name: "plugin-bash",
|
|
3313
|
+
version: "1.0.0",
|
|
3314
|
+
// Store server reference for tool registration
|
|
3315
|
+
configureServer: (server) => {
|
|
3316
|
+
serverRef = server;
|
|
3317
|
+
},
|
|
3318
|
+
// Register bash tool with agent name prefix
|
|
3319
|
+
composeStart: (context2) => {
|
|
3320
|
+
if (!serverRef) return;
|
|
3321
|
+
const agentName = context2.serverName;
|
|
3322
|
+
const toolName = `${agentName}__bash`;
|
|
3323
|
+
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.", {
|
|
3324
|
+
type: "object",
|
|
3325
|
+
properties: {
|
|
3326
|
+
command: {
|
|
3327
|
+
type: "string",
|
|
3328
|
+
description: "The bash command to execute"
|
|
3329
|
+
},
|
|
3330
|
+
cwd: {
|
|
3331
|
+
type: "string",
|
|
3332
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
3333
|
+
}
|
|
3334
|
+
},
|
|
3335
|
+
required: [
|
|
3336
|
+
"command"
|
|
3337
|
+
]
|
|
3338
|
+
}, async (args) => {
|
|
3339
|
+
const cwd2 = args.cwd || process3.cwd();
|
|
3340
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
3341
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
3342
|
+
let finalOutput = output;
|
|
3343
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
3344
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
3345
|
+
` + finalOutput;
|
|
3346
|
+
}
|
|
3347
|
+
if (truncated) {
|
|
3348
|
+
finalOutput += `
|
|
3349
|
+
|
|
3350
|
+
[Note: Output was truncated]`;
|
|
3351
|
+
}
|
|
3352
|
+
return {
|
|
3353
|
+
content: [
|
|
3354
|
+
{
|
|
3355
|
+
type: "text",
|
|
3356
|
+
text: finalOutput
|
|
3357
|
+
}
|
|
3358
|
+
],
|
|
3359
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
3360
|
+
};
|
|
3361
|
+
}, {
|
|
3362
|
+
internal: true
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3207
3368
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
3208
3369
|
import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
|
|
3209
3370
|
|
|
@@ -4048,12 +4209,29 @@ function writeFoldedLines(count) {
|
|
|
4048
4209
|
if (count > 1) return "\n".repeat(count - 1);
|
|
4049
4210
|
return "";
|
|
4050
4211
|
}
|
|
4212
|
+
var Scanner = class {
|
|
4213
|
+
source;
|
|
4214
|
+
#length;
|
|
4215
|
+
position = 0;
|
|
4216
|
+
constructor(source) {
|
|
4217
|
+
source += "\0";
|
|
4218
|
+
this.source = source;
|
|
4219
|
+
this.#length = source.length;
|
|
4220
|
+
}
|
|
4221
|
+
peek(offset = 0) {
|
|
4222
|
+
return this.source.charCodeAt(this.position + offset);
|
|
4223
|
+
}
|
|
4224
|
+
next() {
|
|
4225
|
+
this.position += 1;
|
|
4226
|
+
}
|
|
4227
|
+
eof() {
|
|
4228
|
+
return this.position >= this.#length - 1;
|
|
4229
|
+
}
|
|
4230
|
+
};
|
|
4051
4231
|
var LoaderState = class {
|
|
4052
|
-
|
|
4053
|
-
length;
|
|
4232
|
+
#scanner;
|
|
4054
4233
|
lineIndent = 0;
|
|
4055
4234
|
lineStart = 0;
|
|
4056
|
-
position = 0;
|
|
4057
4235
|
line = 0;
|
|
4058
4236
|
onWarning;
|
|
4059
4237
|
allowDuplicateKeys;
|
|
@@ -4063,44 +4241,40 @@ var LoaderState = class {
|
|
|
4063
4241
|
tagMap = /* @__PURE__ */ new Map();
|
|
4064
4242
|
anchorMap = /* @__PURE__ */ new Map();
|
|
4065
4243
|
constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false }) {
|
|
4066
|
-
this
|
|
4244
|
+
this.#scanner = new Scanner(input);
|
|
4067
4245
|
this.onWarning = onWarning;
|
|
4068
4246
|
this.allowDuplicateKeys = allowDuplicateKeys;
|
|
4069
4247
|
this.implicitTypes = schema.implicitTypes;
|
|
4070
4248
|
this.typeMap = schema.typeMap;
|
|
4071
|
-
this.length = input.length;
|
|
4072
4249
|
this.readIndent();
|
|
4073
4250
|
}
|
|
4074
4251
|
skipWhitespaces() {
|
|
4075
|
-
let ch = this.peek();
|
|
4252
|
+
let ch = this.#scanner.peek();
|
|
4076
4253
|
while (isWhiteSpace(ch)) {
|
|
4077
|
-
|
|
4254
|
+
this.#scanner.next();
|
|
4255
|
+
ch = this.#scanner.peek();
|
|
4078
4256
|
}
|
|
4079
4257
|
}
|
|
4080
4258
|
skipComment() {
|
|
4081
|
-
let ch = this.peek();
|
|
4259
|
+
let ch = this.#scanner.peek();
|
|
4082
4260
|
if (ch !== SHARP) return;
|
|
4083
|
-
|
|
4261
|
+
this.#scanner.next();
|
|
4262
|
+
ch = this.#scanner.peek();
|
|
4084
4263
|
while (ch !== 0 && !isEOL(ch)) {
|
|
4085
|
-
|
|
4264
|
+
this.#scanner.next();
|
|
4265
|
+
ch = this.#scanner.peek();
|
|
4086
4266
|
}
|
|
4087
4267
|
}
|
|
4088
4268
|
readIndent() {
|
|
4089
|
-
let
|
|
4090
|
-
while (
|
|
4269
|
+
let ch = this.#scanner.peek();
|
|
4270
|
+
while (ch === SPACE) {
|
|
4091
4271
|
this.lineIndent += 1;
|
|
4092
|
-
|
|
4272
|
+
this.#scanner.next();
|
|
4273
|
+
ch = this.#scanner.peek();
|
|
4093
4274
|
}
|
|
4094
4275
|
}
|
|
4095
|
-
peek(offset = 0) {
|
|
4096
|
-
return this.input.charCodeAt(this.position + offset);
|
|
4097
|
-
}
|
|
4098
|
-
next() {
|
|
4099
|
-
this.position += 1;
|
|
4100
|
-
return this.peek();
|
|
4101
|
-
}
|
|
4102
4276
|
#createError(message) {
|
|
4103
|
-
const mark = markToString(this.
|
|
4277
|
+
const mark = markToString(this.#scanner.source, this.#scanner.position, this.line, this.#scanner.position - this.lineStart);
|
|
4104
4278
|
return new SyntaxError(`${message} ${mark}`);
|
|
4105
4279
|
}
|
|
4106
4280
|
dispatchWarning(message) {
|
|
@@ -4145,7 +4319,7 @@ var LoaderState = class {
|
|
|
4145
4319
|
}
|
|
4146
4320
|
captureSegment(start, end, checkJson) {
|
|
4147
4321
|
if (start < end) {
|
|
4148
|
-
const result = this.
|
|
4322
|
+
const result = this.#scanner.source.slice(start, end);
|
|
4149
4323
|
if (checkJson) {
|
|
4150
4324
|
for (let position = 0; position < result.length; position++) {
|
|
4151
4325
|
const character = result.charCodeAt(position);
|
|
@@ -4163,21 +4337,21 @@ var LoaderState = class {
|
|
|
4163
4337
|
let detected = false;
|
|
4164
4338
|
const result = [];
|
|
4165
4339
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4166
|
-
let ch = this.peek();
|
|
4340
|
+
let ch = this.#scanner.peek();
|
|
4167
4341
|
while (ch !== 0) {
|
|
4168
4342
|
if (ch !== MINUS) {
|
|
4169
4343
|
break;
|
|
4170
4344
|
}
|
|
4171
|
-
const following = this.peek(1);
|
|
4345
|
+
const following = this.#scanner.peek(1);
|
|
4172
4346
|
if (!isWhiteSpaceOrEOL(following)) {
|
|
4173
4347
|
break;
|
|
4174
4348
|
}
|
|
4175
4349
|
detected = true;
|
|
4176
|
-
this.
|
|
4350
|
+
this.#scanner.next();
|
|
4177
4351
|
if (this.skipSeparationSpace(true, -1)) {
|
|
4178
4352
|
if (this.lineIndent <= nodeIndent) {
|
|
4179
4353
|
result.push(null);
|
|
4180
|
-
ch = this.peek();
|
|
4354
|
+
ch = this.#scanner.peek();
|
|
4181
4355
|
continue;
|
|
4182
4356
|
}
|
|
4183
4357
|
}
|
|
@@ -4190,7 +4364,7 @@ var LoaderState = class {
|
|
|
4190
4364
|
});
|
|
4191
4365
|
if (newState) result.push(newState.result);
|
|
4192
4366
|
this.skipSeparationSpace(true, -1);
|
|
4193
|
-
ch = this.peek();
|
|
4367
|
+
ch = this.#scanner.peek();
|
|
4194
4368
|
if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
|
|
4195
4369
|
throw this.#createError("Cannot read block sequence: bad indentation of a sequence entry");
|
|
4196
4370
|
} else if (this.lineIndent < nodeIndent) {
|
|
@@ -4246,7 +4420,7 @@ var LoaderState = class {
|
|
|
4246
4420
|
} else {
|
|
4247
4421
|
if (!this.allowDuplicateKeys && !overridableKeys.has(keyNode) && Object.hasOwn(result, keyNode)) {
|
|
4248
4422
|
this.line = startLine || this.line;
|
|
4249
|
-
this.position = startPos || this.position;
|
|
4423
|
+
this.#scanner.position = startPos || this.#scanner.position;
|
|
4250
4424
|
throw this.#createError("Cannot store mapping pair: duplicated key");
|
|
4251
4425
|
}
|
|
4252
4426
|
Object.defineProperty(result, keyNode, {
|
|
@@ -4260,37 +4434,37 @@ var LoaderState = class {
|
|
|
4260
4434
|
return result;
|
|
4261
4435
|
}
|
|
4262
4436
|
readLineBreak() {
|
|
4263
|
-
const ch = this.peek();
|
|
4437
|
+
const ch = this.#scanner.peek();
|
|
4264
4438
|
if (ch === LINE_FEED) {
|
|
4265
|
-
this.
|
|
4439
|
+
this.#scanner.next();
|
|
4266
4440
|
} else if (ch === CARRIAGE_RETURN) {
|
|
4267
|
-
this.
|
|
4268
|
-
if (this.peek() === LINE_FEED) {
|
|
4269
|
-
this.
|
|
4441
|
+
this.#scanner.next();
|
|
4442
|
+
if (this.#scanner.peek() === LINE_FEED) {
|
|
4443
|
+
this.#scanner.next();
|
|
4270
4444
|
}
|
|
4271
4445
|
} else {
|
|
4272
4446
|
throw this.#createError("Cannot read line: line break not found");
|
|
4273
4447
|
}
|
|
4274
4448
|
this.line += 1;
|
|
4275
|
-
this.lineStart = this.position;
|
|
4449
|
+
this.lineStart = this.#scanner.position;
|
|
4276
4450
|
}
|
|
4277
4451
|
skipSeparationSpace(allowComments, checkIndent) {
|
|
4278
4452
|
let lineBreaks = 0;
|
|
4279
|
-
let ch = this.peek();
|
|
4453
|
+
let ch = this.#scanner.peek();
|
|
4280
4454
|
while (ch !== 0) {
|
|
4281
4455
|
this.skipWhitespaces();
|
|
4282
|
-
ch = this.peek();
|
|
4456
|
+
ch = this.#scanner.peek();
|
|
4283
4457
|
if (allowComments) {
|
|
4284
4458
|
this.skipComment();
|
|
4285
|
-
ch = this.peek();
|
|
4459
|
+
ch = this.#scanner.peek();
|
|
4286
4460
|
}
|
|
4287
4461
|
if (isEOL(ch)) {
|
|
4288
4462
|
this.readLineBreak();
|
|
4289
|
-
ch = this.peek();
|
|
4463
|
+
ch = this.#scanner.peek();
|
|
4290
4464
|
lineBreaks++;
|
|
4291
4465
|
this.lineIndent = 0;
|
|
4292
4466
|
this.readIndent();
|
|
4293
|
-
ch = this.peek();
|
|
4467
|
+
ch = this.#scanner.peek();
|
|
4294
4468
|
} else {
|
|
4295
4469
|
break;
|
|
4296
4470
|
}
|
|
@@ -4301,9 +4475,9 @@ var LoaderState = class {
|
|
|
4301
4475
|
return lineBreaks;
|
|
4302
4476
|
}
|
|
4303
4477
|
testDocumentSeparator() {
|
|
4304
|
-
let ch = this.peek();
|
|
4305
|
-
if ((ch === MINUS || ch === DOT) && ch === this.peek(1) && ch === this.peek(2)) {
|
|
4306
|
-
ch = this.peek(3);
|
|
4478
|
+
let ch = this.#scanner.peek();
|
|
4479
|
+
if ((ch === MINUS || ch === DOT) && ch === this.#scanner.peek(1) && ch === this.#scanner.peek(2)) {
|
|
4480
|
+
ch = this.#scanner.peek(3);
|
|
4307
4481
|
if (ch === 0 || isWhiteSpaceOrEOL(ch)) {
|
|
4308
4482
|
return true;
|
|
4309
4483
|
}
|
|
@@ -4311,34 +4485,34 @@ var LoaderState = class {
|
|
|
4311
4485
|
return false;
|
|
4312
4486
|
}
|
|
4313
4487
|
readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
|
|
4314
|
-
let ch = this.peek();
|
|
4488
|
+
let ch = this.#scanner.peek();
|
|
4315
4489
|
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) {
|
|
4316
4490
|
return;
|
|
4317
4491
|
}
|
|
4318
4492
|
let following;
|
|
4319
4493
|
if (ch === QUESTION || ch === MINUS) {
|
|
4320
|
-
following = this.peek(1);
|
|
4494
|
+
following = this.#scanner.peek(1);
|
|
4321
4495
|
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4322
4496
|
return;
|
|
4323
4497
|
}
|
|
4324
4498
|
}
|
|
4325
4499
|
let result = "";
|
|
4326
|
-
let captureEnd = this.position;
|
|
4327
|
-
let captureStart = this.position;
|
|
4500
|
+
let captureEnd = this.#scanner.position;
|
|
4501
|
+
let captureStart = this.#scanner.position;
|
|
4328
4502
|
let hasPendingContent = false;
|
|
4329
4503
|
let line = 0;
|
|
4330
4504
|
while (ch !== 0) {
|
|
4331
4505
|
if (ch === COLON) {
|
|
4332
|
-
following = this.peek(1);
|
|
4506
|
+
following = this.#scanner.peek(1);
|
|
4333
4507
|
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4334
4508
|
break;
|
|
4335
4509
|
}
|
|
4336
4510
|
} else if (ch === SHARP) {
|
|
4337
|
-
const preceding = this.peek(-1);
|
|
4511
|
+
const preceding = this.#scanner.peek(-1);
|
|
4338
4512
|
if (isWhiteSpaceOrEOL(preceding)) {
|
|
4339
4513
|
break;
|
|
4340
4514
|
}
|
|
4341
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4515
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4342
4516
|
break;
|
|
4343
4517
|
} else if (isEOL(ch)) {
|
|
4344
4518
|
line = this.line;
|
|
@@ -4347,10 +4521,10 @@ var LoaderState = class {
|
|
|
4347
4521
|
this.skipSeparationSpace(false, -1);
|
|
4348
4522
|
if (this.lineIndent >= nodeIndent) {
|
|
4349
4523
|
hasPendingContent = true;
|
|
4350
|
-
ch = this.peek();
|
|
4524
|
+
ch = this.#scanner.peek();
|
|
4351
4525
|
continue;
|
|
4352
4526
|
} else {
|
|
4353
|
-
this.position = captureEnd;
|
|
4527
|
+
this.#scanner.position = captureEnd;
|
|
4354
4528
|
this.line = line;
|
|
4355
4529
|
this.lineStart = lineStart;
|
|
4356
4530
|
this.lineIndent = lineIndent;
|
|
@@ -4361,13 +4535,14 @@ var LoaderState = class {
|
|
|
4361
4535
|
const segment2 = this.captureSegment(captureStart, captureEnd, false);
|
|
4362
4536
|
if (segment2) result += segment2;
|
|
4363
4537
|
result += writeFoldedLines(this.line - line);
|
|
4364
|
-
captureStart = captureEnd = this.position;
|
|
4538
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4365
4539
|
hasPendingContent = false;
|
|
4366
4540
|
}
|
|
4367
4541
|
if (!isWhiteSpace(ch)) {
|
|
4368
|
-
captureEnd = this.position + 1;
|
|
4542
|
+
captureEnd = this.#scanner.position + 1;
|
|
4369
4543
|
}
|
|
4370
|
-
|
|
4544
|
+
this.#scanner.next();
|
|
4545
|
+
ch = this.#scanner.peek();
|
|
4371
4546
|
}
|
|
4372
4547
|
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
4373
4548
|
if (segment) result += segment;
|
|
@@ -4380,22 +4555,23 @@ var LoaderState = class {
|
|
|
4380
4555
|
};
|
|
4381
4556
|
}
|
|
4382
4557
|
readSingleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4383
|
-
let ch = this.peek();
|
|
4558
|
+
let ch = this.#scanner.peek();
|
|
4384
4559
|
if (ch !== SINGLE_QUOTE) return;
|
|
4385
4560
|
let result = "";
|
|
4386
|
-
this.
|
|
4387
|
-
let captureStart = this.position;
|
|
4388
|
-
let captureEnd = this.position;
|
|
4389
|
-
ch = this.peek();
|
|
4561
|
+
this.#scanner.next();
|
|
4562
|
+
let captureStart = this.#scanner.position;
|
|
4563
|
+
let captureEnd = this.#scanner.position;
|
|
4564
|
+
ch = this.#scanner.peek();
|
|
4390
4565
|
while (ch !== 0) {
|
|
4391
4566
|
if (ch === SINGLE_QUOTE) {
|
|
4392
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4567
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4393
4568
|
if (segment) result += segment;
|
|
4394
|
-
|
|
4569
|
+
this.#scanner.next();
|
|
4570
|
+
ch = this.#scanner.peek();
|
|
4395
4571
|
if (ch === SINGLE_QUOTE) {
|
|
4396
|
-
captureStart = this.position;
|
|
4397
|
-
this.
|
|
4398
|
-
captureEnd = this.position;
|
|
4572
|
+
captureStart = this.#scanner.position;
|
|
4573
|
+
this.#scanner.next();
|
|
4574
|
+
captureEnd = this.#scanner.position;
|
|
4399
4575
|
} else {
|
|
4400
4576
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4401
4577
|
return {
|
|
@@ -4409,31 +4585,31 @@ var LoaderState = class {
|
|
|
4409
4585
|
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4410
4586
|
if (segment) result += segment;
|
|
4411
4587
|
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4412
|
-
captureStart = captureEnd = this.position;
|
|
4413
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4588
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4589
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4414
4590
|
throw this.#createError("Unexpected end of the document within a single quoted scalar");
|
|
4415
4591
|
} else {
|
|
4416
|
-
this.
|
|
4417
|
-
captureEnd = this.position;
|
|
4592
|
+
this.#scanner.next();
|
|
4593
|
+
captureEnd = this.#scanner.position;
|
|
4418
4594
|
}
|
|
4419
|
-
ch = this.peek();
|
|
4595
|
+
ch = this.#scanner.peek();
|
|
4420
4596
|
}
|
|
4421
4597
|
throw this.#createError("Unexpected end of the stream within a single quoted scalar");
|
|
4422
4598
|
}
|
|
4423
4599
|
readDoubleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4424
|
-
let ch = this.peek();
|
|
4600
|
+
let ch = this.#scanner.peek();
|
|
4425
4601
|
if (ch !== DOUBLE_QUOTE) return;
|
|
4426
4602
|
let result = "";
|
|
4427
|
-
this.
|
|
4428
|
-
let captureEnd = this.position;
|
|
4429
|
-
let captureStart = this.position;
|
|
4603
|
+
this.#scanner.next();
|
|
4604
|
+
let captureEnd = this.#scanner.position;
|
|
4605
|
+
let captureStart = this.#scanner.position;
|
|
4430
4606
|
let tmp;
|
|
4431
|
-
ch = this.peek();
|
|
4607
|
+
ch = this.#scanner.peek();
|
|
4432
4608
|
while (ch !== 0) {
|
|
4433
4609
|
if (ch === DOUBLE_QUOTE) {
|
|
4434
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4610
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4435
4611
|
if (segment) result += segment;
|
|
4436
|
-
this.
|
|
4612
|
+
this.#scanner.next();
|
|
4437
4613
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4438
4614
|
return {
|
|
4439
4615
|
tag,
|
|
@@ -4443,19 +4619,21 @@ var LoaderState = class {
|
|
|
4443
4619
|
};
|
|
4444
4620
|
}
|
|
4445
4621
|
if (ch === BACKSLASH) {
|
|
4446
|
-
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4622
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, true);
|
|
4447
4623
|
if (segment) result += segment;
|
|
4448
|
-
|
|
4624
|
+
this.#scanner.next();
|
|
4625
|
+
ch = this.#scanner.peek();
|
|
4449
4626
|
if (isEOL(ch)) {
|
|
4450
4627
|
this.skipSeparationSpace(false, nodeIndent);
|
|
4451
4628
|
} else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
|
|
4452
4629
|
result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
|
|
4453
|
-
this.
|
|
4630
|
+
this.#scanner.next();
|
|
4454
4631
|
} else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
|
|
4455
4632
|
let hexLength = tmp;
|
|
4456
4633
|
let hexResult = 0;
|
|
4457
4634
|
for (; hexLength > 0; hexLength--) {
|
|
4458
|
-
|
|
4635
|
+
this.#scanner.next();
|
|
4636
|
+
ch = this.#scanner.peek();
|
|
4459
4637
|
if ((tmp = hexCharCodeToNumber(ch)) >= 0) {
|
|
4460
4638
|
hexResult = (hexResult << 4) + tmp;
|
|
4461
4639
|
} else {
|
|
@@ -4463,28 +4641,28 @@ var LoaderState = class {
|
|
|
4463
4641
|
}
|
|
4464
4642
|
}
|
|
4465
4643
|
result += codepointToChar(hexResult);
|
|
4466
|
-
this.
|
|
4644
|
+
this.#scanner.next();
|
|
4467
4645
|
} else {
|
|
4468
4646
|
throw this.#createError("Cannot read double quoted scalar: unknown escape sequence");
|
|
4469
4647
|
}
|
|
4470
|
-
captureStart = captureEnd = this.position;
|
|
4648
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4471
4649
|
} else if (isEOL(ch)) {
|
|
4472
4650
|
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4473
4651
|
if (segment) result += segment;
|
|
4474
4652
|
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4475
|
-
captureStart = captureEnd = this.position;
|
|
4476
|
-
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4653
|
+
captureStart = captureEnd = this.#scanner.position;
|
|
4654
|
+
} else if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4477
4655
|
throw this.#createError("Unexpected end of the document within a double quoted scalar");
|
|
4478
4656
|
} else {
|
|
4479
|
-
this.
|
|
4480
|
-
captureEnd = this.position;
|
|
4657
|
+
this.#scanner.next();
|
|
4658
|
+
captureEnd = this.#scanner.position;
|
|
4481
4659
|
}
|
|
4482
|
-
ch = this.peek();
|
|
4660
|
+
ch = this.#scanner.peek();
|
|
4483
4661
|
}
|
|
4484
4662
|
throw this.#createError("Unexpected end of the stream within a double quoted scalar");
|
|
4485
4663
|
}
|
|
4486
4664
|
readFlowCollection(tag, anchor, nodeIndent) {
|
|
4487
|
-
let ch = this.peek();
|
|
4665
|
+
let ch = this.#scanner.peek();
|
|
4488
4666
|
let terminator;
|
|
4489
4667
|
let isMapping = true;
|
|
4490
4668
|
let result = {};
|
|
@@ -4498,7 +4676,8 @@ var LoaderState = class {
|
|
|
4498
4676
|
return;
|
|
4499
4677
|
}
|
|
4500
4678
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4501
|
-
|
|
4679
|
+
this.#scanner.next();
|
|
4680
|
+
ch = this.#scanner.peek();
|
|
4502
4681
|
let readNext = true;
|
|
4503
4682
|
let valueNode = null;
|
|
4504
4683
|
let keyNode = null;
|
|
@@ -4510,9 +4689,9 @@ var LoaderState = class {
|
|
|
4510
4689
|
const overridableKeys = /* @__PURE__ */ new Set();
|
|
4511
4690
|
while (ch !== 0) {
|
|
4512
4691
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4513
|
-
ch = this.peek();
|
|
4692
|
+
ch = this.#scanner.peek();
|
|
4514
4693
|
if (ch === terminator) {
|
|
4515
|
-
this.
|
|
4694
|
+
this.#scanner.next();
|
|
4516
4695
|
const kind = isMapping ? "mapping" : "sequence";
|
|
4517
4696
|
return {
|
|
4518
4697
|
tag,
|
|
@@ -4527,10 +4706,10 @@ var LoaderState = class {
|
|
|
4527
4706
|
keyTag = keyNode = valueNode = null;
|
|
4528
4707
|
isPair = isExplicitPair = false;
|
|
4529
4708
|
if (ch === QUESTION) {
|
|
4530
|
-
following = this.peek(1);
|
|
4709
|
+
following = this.#scanner.peek(1);
|
|
4531
4710
|
if (isWhiteSpaceOrEOL(following)) {
|
|
4532
4711
|
isPair = isExplicitPair = true;
|
|
4533
|
-
this.
|
|
4712
|
+
this.#scanner.next();
|
|
4534
4713
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4535
4714
|
}
|
|
4536
4715
|
}
|
|
@@ -4546,10 +4725,11 @@ var LoaderState = class {
|
|
|
4546
4725
|
keyNode = newState.result;
|
|
4547
4726
|
}
|
|
4548
4727
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4549
|
-
ch = this.peek();
|
|
4728
|
+
ch = this.#scanner.peek();
|
|
4550
4729
|
if ((isExplicitPair || this.line === line) && ch === COLON) {
|
|
4551
4730
|
isPair = true;
|
|
4552
|
-
|
|
4731
|
+
this.#scanner.next();
|
|
4732
|
+
ch = this.#scanner.peek();
|
|
4553
4733
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4554
4734
|
const newState2 = this.composeNode({
|
|
4555
4735
|
parentIndent: nodeIndent,
|
|
@@ -4567,10 +4747,11 @@ var LoaderState = class {
|
|
|
4567
4747
|
result.push(keyNode);
|
|
4568
4748
|
}
|
|
4569
4749
|
this.skipSeparationSpace(true, nodeIndent);
|
|
4570
|
-
ch = this.peek();
|
|
4750
|
+
ch = this.#scanner.peek();
|
|
4571
4751
|
if (ch === COMMA) {
|
|
4572
4752
|
readNext = true;
|
|
4573
|
-
|
|
4753
|
+
this.#scanner.next();
|
|
4754
|
+
ch = this.#scanner.peek();
|
|
4574
4755
|
} else {
|
|
4575
4756
|
readNext = false;
|
|
4576
4757
|
}
|
|
@@ -4586,7 +4767,7 @@ var LoaderState = class {
|
|
|
4586
4767
|
let textIndent = nodeIndent;
|
|
4587
4768
|
let emptyLines = 0;
|
|
4588
4769
|
let atMoreIndented = false;
|
|
4589
|
-
let ch = this.peek();
|
|
4770
|
+
let ch = this.#scanner.peek();
|
|
4590
4771
|
let folding = false;
|
|
4591
4772
|
if (ch === VERTICAL_LINE) {
|
|
4592
4773
|
folding = false;
|
|
@@ -4598,7 +4779,8 @@ var LoaderState = class {
|
|
|
4598
4779
|
let result = "";
|
|
4599
4780
|
let tmp = 0;
|
|
4600
4781
|
while (ch !== 0) {
|
|
4601
|
-
|
|
4782
|
+
this.#scanner.next();
|
|
4783
|
+
ch = this.#scanner.peek();
|
|
4602
4784
|
if (ch === PLUS || ch === MINUS) {
|
|
4603
4785
|
if (CHOMPING_CLIP === chomping) {
|
|
4604
4786
|
chomping = ch === PLUS ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
@@ -4621,15 +4803,16 @@ var LoaderState = class {
|
|
|
4621
4803
|
if (isWhiteSpace(ch)) {
|
|
4622
4804
|
this.skipWhitespaces();
|
|
4623
4805
|
this.skipComment();
|
|
4624
|
-
ch = this.peek();
|
|
4806
|
+
ch = this.#scanner.peek();
|
|
4625
4807
|
}
|
|
4626
4808
|
while (ch !== 0) {
|
|
4627
4809
|
this.readLineBreak();
|
|
4628
4810
|
this.lineIndent = 0;
|
|
4629
|
-
ch = this.peek();
|
|
4811
|
+
ch = this.#scanner.peek();
|
|
4630
4812
|
while ((!detectedIndent || this.lineIndent < textIndent) && ch === SPACE) {
|
|
4631
4813
|
this.lineIndent++;
|
|
4632
|
-
|
|
4814
|
+
this.#scanner.next();
|
|
4815
|
+
ch = this.#scanner.peek();
|
|
4633
4816
|
}
|
|
4634
4817
|
if (!detectedIndent && this.lineIndent > textIndent) {
|
|
4635
4818
|
textIndent = this.lineIndent;
|
|
@@ -4668,11 +4851,12 @@ var LoaderState = class {
|
|
|
4668
4851
|
didReadContent = true;
|
|
4669
4852
|
detectedIndent = true;
|
|
4670
4853
|
emptyLines = 0;
|
|
4671
|
-
const captureStart = this.position;
|
|
4854
|
+
const captureStart = this.#scanner.position;
|
|
4672
4855
|
while (!isEOL(ch) && ch !== 0) {
|
|
4673
|
-
|
|
4856
|
+
this.#scanner.next();
|
|
4857
|
+
ch = this.#scanner.peek();
|
|
4674
4858
|
}
|
|
4675
|
-
const segment = this.captureSegment(captureStart, this.position, false);
|
|
4859
|
+
const segment = this.captureSegment(captureStart, this.#scanner.position, false);
|
|
4676
4860
|
if (segment) result += segment;
|
|
4677
4861
|
}
|
|
4678
4862
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
@@ -4695,11 +4879,11 @@ var LoaderState = class {
|
|
|
4695
4879
|
let atExplicitKey = false;
|
|
4696
4880
|
let detected = false;
|
|
4697
4881
|
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4698
|
-
let ch = this.peek();
|
|
4882
|
+
let ch = this.#scanner.peek();
|
|
4699
4883
|
while (ch !== 0) {
|
|
4700
|
-
const following = this.peek(1);
|
|
4884
|
+
const following = this.#scanner.peek(1);
|
|
4701
4885
|
line = this.line;
|
|
4702
|
-
pos = this.position;
|
|
4886
|
+
pos = this.#scanner.position;
|
|
4703
4887
|
if ((ch === QUESTION || ch === COLON) && isWhiteSpaceOrEOL(following)) {
|
|
4704
4888
|
if (ch === QUESTION) {
|
|
4705
4889
|
if (atExplicitKey) {
|
|
@@ -4717,7 +4901,7 @@ var LoaderState = class {
|
|
|
4717
4901
|
} else {
|
|
4718
4902
|
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");
|
|
4719
4903
|
}
|
|
4720
|
-
this.
|
|
4904
|
+
this.#scanner.next();
|
|
4721
4905
|
ch = following;
|
|
4722
4906
|
} else {
|
|
4723
4907
|
const newState = this.composeNode({
|
|
@@ -4728,11 +4912,12 @@ var LoaderState = class {
|
|
|
4728
4912
|
});
|
|
4729
4913
|
if (!newState) break;
|
|
4730
4914
|
if (this.line === line) {
|
|
4731
|
-
ch = this.peek();
|
|
4915
|
+
ch = this.#scanner.peek();
|
|
4732
4916
|
this.skipWhitespaces();
|
|
4733
|
-
ch = this.peek();
|
|
4917
|
+
ch = this.#scanner.peek();
|
|
4734
4918
|
if (ch === COLON) {
|
|
4735
|
-
|
|
4919
|
+
this.#scanner.next();
|
|
4920
|
+
ch = this.#scanner.peek();
|
|
4736
4921
|
if (!isWhiteSpaceOrEOL(ch)) {
|
|
4737
4922
|
throw this.#createError("Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");
|
|
4738
4923
|
}
|
|
@@ -4789,7 +4974,7 @@ var LoaderState = class {
|
|
|
4789
4974
|
keyTag = keyNode = valueNode = null;
|
|
4790
4975
|
}
|
|
4791
4976
|
this.skipSeparationSpace(true, -1);
|
|
4792
|
-
ch = this.peek();
|
|
4977
|
+
ch = this.#scanner.peek();
|
|
4793
4978
|
}
|
|
4794
4979
|
if (this.lineIndent > nodeIndent && ch !== 0) {
|
|
4795
4980
|
throw this.#createError("Cannot read block: bad indentation of a mapping entry");
|
|
@@ -4812,30 +4997,35 @@ var LoaderState = class {
|
|
|
4812
4997
|
let isNamed = false;
|
|
4813
4998
|
let tagHandle = "";
|
|
4814
4999
|
let tagName;
|
|
4815
|
-
let ch = this.peek();
|
|
5000
|
+
let ch = this.#scanner.peek();
|
|
4816
5001
|
if (ch !== EXCLAMATION) return;
|
|
4817
5002
|
if (tag !== null) {
|
|
4818
5003
|
throw this.#createError("Cannot read tag property: duplication of a tag property");
|
|
4819
5004
|
}
|
|
4820
|
-
|
|
5005
|
+
this.#scanner.next();
|
|
5006
|
+
ch = this.#scanner.peek();
|
|
4821
5007
|
if (ch === SMALLER_THAN) {
|
|
4822
5008
|
isVerbatim = true;
|
|
4823
|
-
|
|
5009
|
+
this.#scanner.next();
|
|
5010
|
+
ch = this.#scanner.peek();
|
|
4824
5011
|
} else if (ch === EXCLAMATION) {
|
|
4825
5012
|
isNamed = true;
|
|
4826
5013
|
tagHandle = "!!";
|
|
4827
|
-
|
|
5014
|
+
this.#scanner.next();
|
|
5015
|
+
ch = this.#scanner.peek();
|
|
4828
5016
|
} else {
|
|
4829
5017
|
tagHandle = "!";
|
|
4830
5018
|
}
|
|
4831
|
-
let position = this.position;
|
|
5019
|
+
let position = this.#scanner.position;
|
|
4832
5020
|
if (isVerbatim) {
|
|
4833
5021
|
do {
|
|
4834
|
-
|
|
5022
|
+
this.#scanner.next();
|
|
5023
|
+
ch = this.#scanner.peek();
|
|
4835
5024
|
} while (ch !== 0 && ch !== GREATER_THAN);
|
|
4836
|
-
if (this.
|
|
4837
|
-
tagName = this.
|
|
4838
|
-
|
|
5025
|
+
if (!this.#scanner.eof()) {
|
|
5026
|
+
tagName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
5027
|
+
this.#scanner.next();
|
|
5028
|
+
ch = this.#scanner.peek();
|
|
4839
5029
|
} else {
|
|
4840
5030
|
throw this.#createError("Cannot read tag property: unexpected end of stream");
|
|
4841
5031
|
}
|
|
@@ -4843,19 +5033,20 @@ var LoaderState = class {
|
|
|
4843
5033
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
4844
5034
|
if (ch === EXCLAMATION) {
|
|
4845
5035
|
if (!isNamed) {
|
|
4846
|
-
tagHandle = this.
|
|
5036
|
+
tagHandle = this.#scanner.source.slice(position - 1, this.#scanner.position + 1);
|
|
4847
5037
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
4848
5038
|
throw this.#createError("Cannot read tag property: named tag handle contains invalid characters");
|
|
4849
5039
|
}
|
|
4850
5040
|
isNamed = true;
|
|
4851
|
-
position = this.position + 1;
|
|
5041
|
+
position = this.#scanner.position + 1;
|
|
4852
5042
|
} else {
|
|
4853
5043
|
throw this.#createError("Cannot read tag property: tag suffix cannot contain an exclamation mark");
|
|
4854
5044
|
}
|
|
4855
5045
|
}
|
|
4856
|
-
|
|
5046
|
+
this.#scanner.next();
|
|
5047
|
+
ch = this.#scanner.peek();
|
|
4857
5048
|
}
|
|
4858
|
-
tagName = this.
|
|
5049
|
+
tagName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
4859
5050
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
4860
5051
|
throw this.#createError("Cannot read tag property: tag suffix cannot contain flow indicator characters");
|
|
4861
5052
|
}
|
|
@@ -4875,32 +5066,36 @@ var LoaderState = class {
|
|
|
4875
5066
|
throw this.#createError(`Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
4876
5067
|
}
|
|
4877
5068
|
readAnchorProperty(anchor) {
|
|
4878
|
-
let ch = this.peek();
|
|
5069
|
+
let ch = this.#scanner.peek();
|
|
4879
5070
|
if (ch !== AMPERSAND) return;
|
|
4880
5071
|
if (anchor !== null) {
|
|
4881
5072
|
throw this.#createError("Cannot read anchor property: duplicate anchor property");
|
|
4882
5073
|
}
|
|
4883
|
-
|
|
4884
|
-
|
|
5074
|
+
this.#scanner.next();
|
|
5075
|
+
ch = this.#scanner.peek();
|
|
5076
|
+
const position = this.#scanner.position;
|
|
4885
5077
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4886
|
-
|
|
5078
|
+
this.#scanner.next();
|
|
5079
|
+
ch = this.#scanner.peek();
|
|
4887
5080
|
}
|
|
4888
|
-
if (this.position === position) {
|
|
5081
|
+
if (this.#scanner.position === position) {
|
|
4889
5082
|
throw this.#createError("Cannot read anchor property: name of an anchor node must contain at least one character");
|
|
4890
5083
|
}
|
|
4891
|
-
return this.
|
|
5084
|
+
return this.#scanner.source.slice(position, this.#scanner.position);
|
|
4892
5085
|
}
|
|
4893
5086
|
readAlias() {
|
|
4894
|
-
if (this.peek() !== ASTERISK) return;
|
|
4895
|
-
|
|
4896
|
-
|
|
5087
|
+
if (this.#scanner.peek() !== ASTERISK) return;
|
|
5088
|
+
this.#scanner.next();
|
|
5089
|
+
let ch = this.#scanner.peek();
|
|
5090
|
+
const position = this.#scanner.position;
|
|
4897
5091
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4898
|
-
|
|
5092
|
+
this.#scanner.next();
|
|
5093
|
+
ch = this.#scanner.peek();
|
|
4899
5094
|
}
|
|
4900
|
-
if (this.position === position) {
|
|
5095
|
+
if (this.#scanner.position === position) {
|
|
4901
5096
|
throw this.#createError("Cannot read alias: alias name must contain at least one character");
|
|
4902
5097
|
}
|
|
4903
|
-
const alias = this.
|
|
5098
|
+
const alias = this.#scanner.source.slice(position, this.#scanner.position);
|
|
4904
5099
|
if (!this.anchorMap.has(alias)) {
|
|
4905
5100
|
throw this.#createError(`Cannot read alias: unidentified alias "${alias}"`);
|
|
4906
5101
|
}
|
|
@@ -4983,7 +5178,7 @@ var LoaderState = class {
|
|
|
4983
5178
|
const cond = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext;
|
|
4984
5179
|
const flowIndent = cond ? parentIndent : parentIndent + 1;
|
|
4985
5180
|
if (allowBlockCollections) {
|
|
4986
|
-
const blockIndent = this.position - this.lineStart;
|
|
5181
|
+
const blockIndent = this.#scanner.position - this.lineStart;
|
|
4987
5182
|
const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
4988
5183
|
if (blockSequenceState) return this.resolveTag(blockSequenceState);
|
|
4989
5184
|
const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
|
|
@@ -5017,7 +5212,7 @@ var LoaderState = class {
|
|
|
5017
5212
|
return this.resolveTag(plainScalarState);
|
|
5018
5213
|
}
|
|
5019
5214
|
} else if (indentStatus === 0 && CONTEXT_BLOCK_OUT === nodeContext && allowBlockCollections) {
|
|
5020
|
-
const blockIndent = this.position - this.lineStart;
|
|
5215
|
+
const blockIndent = this.#scanner.position - this.lineStart;
|
|
5021
5216
|
const newState2 = this.readBlockSequence(tag, anchor, blockIndent);
|
|
5022
5217
|
if (newState2) return this.resolveTag(newState2);
|
|
5023
5218
|
}
|
|
@@ -5032,20 +5227,22 @@ var LoaderState = class {
|
|
|
5032
5227
|
readDirectives() {
|
|
5033
5228
|
let hasDirectives = false;
|
|
5034
5229
|
let version = null;
|
|
5035
|
-
let ch = this.peek();
|
|
5230
|
+
let ch = this.#scanner.peek();
|
|
5036
5231
|
while (ch !== 0) {
|
|
5037
5232
|
this.skipSeparationSpace(true, -1);
|
|
5038
|
-
ch = this.peek();
|
|
5233
|
+
ch = this.#scanner.peek();
|
|
5039
5234
|
if (this.lineIndent > 0 || ch !== PERCENT) {
|
|
5040
5235
|
break;
|
|
5041
5236
|
}
|
|
5042
5237
|
hasDirectives = true;
|
|
5043
|
-
|
|
5044
|
-
|
|
5238
|
+
this.#scanner.next();
|
|
5239
|
+
ch = this.#scanner.peek();
|
|
5240
|
+
let position = this.#scanner.position;
|
|
5045
5241
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5046
|
-
|
|
5242
|
+
this.#scanner.next();
|
|
5243
|
+
ch = this.#scanner.peek();
|
|
5047
5244
|
}
|
|
5048
|
-
const directiveName = this.
|
|
5245
|
+
const directiveName = this.#scanner.source.slice(position, this.#scanner.position);
|
|
5049
5246
|
const directiveArgs = [];
|
|
5050
5247
|
if (directiveName.length < 1) {
|
|
5051
5248
|
throw this.#createError("Cannot read document: directive name length must be greater than zero");
|
|
@@ -5053,13 +5250,14 @@ var LoaderState = class {
|
|
|
5053
5250
|
while (ch !== 0) {
|
|
5054
5251
|
this.skipWhitespaces();
|
|
5055
5252
|
this.skipComment();
|
|
5056
|
-
ch = this.peek();
|
|
5253
|
+
ch = this.#scanner.peek();
|
|
5057
5254
|
if (isEOL(ch)) break;
|
|
5058
|
-
position = this.position;
|
|
5255
|
+
position = this.#scanner.position;
|
|
5059
5256
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5060
|
-
|
|
5257
|
+
this.#scanner.next();
|
|
5258
|
+
ch = this.#scanner.peek();
|
|
5061
5259
|
}
|
|
5062
|
-
directiveArgs.push(this.
|
|
5260
|
+
directiveArgs.push(this.#scanner.source.slice(position, this.#scanner.position));
|
|
5063
5261
|
}
|
|
5064
5262
|
if (ch !== 0) this.readLineBreak();
|
|
5065
5263
|
switch (directiveName) {
|
|
@@ -5076,20 +5274,20 @@ var LoaderState = class {
|
|
|
5076
5274
|
this.dispatchWarning(`unknown document directive "${directiveName}"`);
|
|
5077
5275
|
break;
|
|
5078
5276
|
}
|
|
5079
|
-
ch = this.peek();
|
|
5277
|
+
ch = this.#scanner.peek();
|
|
5080
5278
|
}
|
|
5081
5279
|
return hasDirectives;
|
|
5082
5280
|
}
|
|
5083
5281
|
readDocument() {
|
|
5084
|
-
const documentStart = this.position;
|
|
5282
|
+
const documentStart = this.#scanner.position;
|
|
5085
5283
|
this.checkLineBreaks = false;
|
|
5086
5284
|
this.tagMap = /* @__PURE__ */ new Map();
|
|
5087
5285
|
this.anchorMap = /* @__PURE__ */ new Map();
|
|
5088
5286
|
const hasDirectives = this.readDirectives();
|
|
5089
5287
|
this.skipSeparationSpace(true, -1);
|
|
5090
5288
|
let result = null;
|
|
5091
|
-
if (this.lineIndent === 0 && this.peek() === MINUS && this.peek(1) === MINUS && this.peek(2) === MINUS) {
|
|
5092
|
-
this.position += 3;
|
|
5289
|
+
if (this.lineIndent === 0 && this.#scanner.peek() === MINUS && this.#scanner.peek(1) === MINUS && this.#scanner.peek(2) === MINUS) {
|
|
5290
|
+
this.#scanner.position += 3;
|
|
5093
5291
|
this.skipSeparationSpace(true, -1);
|
|
5094
5292
|
} else if (hasDirectives) {
|
|
5095
5293
|
throw this.#createError("Cannot read document: directives end mark is expected");
|
|
@@ -5102,21 +5300,21 @@ var LoaderState = class {
|
|
|
5102
5300
|
});
|
|
5103
5301
|
if (newState) result = newState.result;
|
|
5104
5302
|
this.skipSeparationSpace(true, -1);
|
|
5105
|
-
if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.
|
|
5303
|
+
if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.#scanner.source.slice(documentStart, this.#scanner.position))) {
|
|
5106
5304
|
this.dispatchWarning("non-ASCII line breaks are interpreted as content");
|
|
5107
5305
|
}
|
|
5108
|
-
if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
5109
|
-
if (this.peek() === DOT) {
|
|
5110
|
-
this.position += 3;
|
|
5306
|
+
if (this.#scanner.position === this.lineStart && this.testDocumentSeparator()) {
|
|
5307
|
+
if (this.#scanner.peek() === DOT) {
|
|
5308
|
+
this.#scanner.position += 3;
|
|
5111
5309
|
this.skipSeparationSpace(true, -1);
|
|
5112
5310
|
}
|
|
5113
|
-
} else if (this.
|
|
5311
|
+
} else if (!this.#scanner.eof()) {
|
|
5114
5312
|
throw this.#createError("Cannot read document: end of the stream or a document separator is expected");
|
|
5115
5313
|
}
|
|
5116
5314
|
return result;
|
|
5117
5315
|
}
|
|
5118
5316
|
*readDocuments() {
|
|
5119
|
-
while (this.
|
|
5317
|
+
while (!this.#scanner.eof()) {
|
|
5120
5318
|
yield this.readDocument();
|
|
5121
5319
|
}
|
|
5122
5320
|
}
|
|
@@ -5129,7 +5327,6 @@ function sanitizeInput(input) {
|
|
|
5129
5327
|
if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
|
|
5130
5328
|
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
5131
5329
|
}
|
|
5132
|
-
input += "\0";
|
|
5133
5330
|
return input;
|
|
5134
5331
|
}
|
|
5135
5332
|
function parse(content, options = {}) {
|
|
@@ -5147,10 +5344,10 @@ function parse(content, options = {}) {
|
|
|
5147
5344
|
}
|
|
5148
5345
|
|
|
5149
5346
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
5150
|
-
import
|
|
5347
|
+
import process4 from "node:process";
|
|
5151
5348
|
function replaceEnvVars(str2) {
|
|
5152
5349
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
5153
|
-
const value =
|
|
5350
|
+
const value = process4.env[varName];
|
|
5154
5351
|
if (value !== void 0) {
|
|
5155
5352
|
return value;
|
|
5156
5353
|
}
|
|
@@ -5249,18 +5446,19 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
5249
5446
|
|
|
5250
5447
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
5251
5448
|
import { resolve as resolve3 } from "node:path";
|
|
5252
|
-
import
|
|
5449
|
+
import process5 from "node:process";
|
|
5253
5450
|
var DEFAULT_SKILLS_PATHS = [
|
|
5254
5451
|
".agent/skills"
|
|
5255
5452
|
];
|
|
5256
5453
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
5257
5454
|
function getGlobalPlugins(skillsPaths) {
|
|
5258
|
-
const resolvedPaths = skillsPaths.map((p2) => resolve3(
|
|
5455
|
+
const resolvedPaths = skillsPaths.map((p2) => resolve3(process5.cwd(), p2));
|
|
5259
5456
|
return [
|
|
5260
5457
|
markdownLoaderPlugin(),
|
|
5261
5458
|
createSkillsPlugin({
|
|
5262
5459
|
paths: resolvedPaths
|
|
5263
|
-
})
|
|
5460
|
+
}),
|
|
5461
|
+
createBashPlugin()
|
|
5264
5462
|
];
|
|
5265
5463
|
}
|
|
5266
5464
|
function getAgentPlugins() {
|
|
@@ -5289,7 +5487,7 @@ function getDefaultAgents() {
|
|
|
5289
5487
|
}
|
|
5290
5488
|
|
|
5291
5489
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
5292
|
-
var CLI_VERSION = "0.1.
|
|
5490
|
+
var CLI_VERSION = "0.1.52";
|
|
5293
5491
|
function extractServerName(command, commandArgs) {
|
|
5294
5492
|
for (const arg of commandArgs) {
|
|
5295
5493
|
if (!arg.startsWith("-")) {
|
|
@@ -5349,7 +5547,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
5349
5547
|
async function createWrapConfig(args) {
|
|
5350
5548
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
5351
5549
|
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'");
|
|
5352
|
-
|
|
5550
|
+
process6.exit(1);
|
|
5353
5551
|
}
|
|
5354
5552
|
const mcpServers = {};
|
|
5355
5553
|
const serverNames = [];
|
|
@@ -5472,7 +5670,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
5472
5670
|
};
|
|
5473
5671
|
}
|
|
5474
5672
|
function parseCLIArgs() {
|
|
5475
|
-
const args = parseArgs(
|
|
5673
|
+
const args = parseArgs(process6.argv.slice(2), {
|
|
5476
5674
|
boolean: [
|
|
5477
5675
|
"help",
|
|
5478
5676
|
"version",
|
|
@@ -5561,15 +5759,15 @@ async function loadConfig() {
|
|
|
5561
5759
|
const args = parseCLIArgs();
|
|
5562
5760
|
if (args.version) {
|
|
5563
5761
|
printVersion();
|
|
5564
|
-
|
|
5762
|
+
process6.exit(0);
|
|
5565
5763
|
}
|
|
5566
5764
|
if (args.help) {
|
|
5567
5765
|
printHelp();
|
|
5568
|
-
|
|
5766
|
+
process6.exit(0);
|
|
5569
5767
|
}
|
|
5570
5768
|
if (args.cwd) {
|
|
5571
|
-
const targetCwd = resolve4(
|
|
5572
|
-
|
|
5769
|
+
const targetCwd = resolve4(process6.cwd(), args.cwd);
|
|
5770
|
+
process6.chdir(targetCwd);
|
|
5573
5771
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
5574
5772
|
}
|
|
5575
5773
|
const mergeSkills = (config) => {
|
|
@@ -5581,7 +5779,7 @@ async function loadConfig() {
|
|
|
5581
5779
|
...args,
|
|
5582
5780
|
saveConfig: true
|
|
5583
5781
|
});
|
|
5584
|
-
|
|
5782
|
+
process6.exit(0);
|
|
5585
5783
|
}
|
|
5586
5784
|
if (args.wrap) {
|
|
5587
5785
|
return mergeSkills(await createWrapConfig({
|
|
@@ -5598,16 +5796,16 @@ async function loadConfig() {
|
|
|
5598
5796
|
throw error;
|
|
5599
5797
|
}
|
|
5600
5798
|
}
|
|
5601
|
-
if (
|
|
5799
|
+
if (process6.env.MCPC_CONFIG) {
|
|
5602
5800
|
try {
|
|
5603
|
-
const parsed = JSON.parse(
|
|
5801
|
+
const parsed = JSON.parse(process6.env.MCPC_CONFIG);
|
|
5604
5802
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
5605
5803
|
} catch (error) {
|
|
5606
5804
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
5607
5805
|
throw error;
|
|
5608
5806
|
}
|
|
5609
5807
|
}
|
|
5610
|
-
const configUrl = args.configUrl ||
|
|
5808
|
+
const configUrl = args.configUrl || process6.env.MCPC_CONFIG_URL;
|
|
5611
5809
|
if (configUrl) {
|
|
5612
5810
|
try {
|
|
5613
5811
|
const headers = {
|
|
@@ -5628,7 +5826,7 @@ async function loadConfig() {
|
|
|
5628
5826
|
throw error;
|
|
5629
5827
|
}
|
|
5630
5828
|
}
|
|
5631
|
-
const configFile = args.configFile ||
|
|
5829
|
+
const configFile = args.configFile || process6.env.MCPC_CONFIG_FILE;
|
|
5632
5830
|
if (configFile) {
|
|
5633
5831
|
try {
|
|
5634
5832
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -5653,7 +5851,7 @@ async function loadConfig() {
|
|
|
5653
5851
|
throw error;
|
|
5654
5852
|
}
|
|
5655
5853
|
}
|
|
5656
|
-
const defaultJsonConfigPath = resolve4(
|
|
5854
|
+
const defaultJsonConfigPath = resolve4(process6.cwd(), "mcpc.config.json");
|
|
5657
5855
|
try {
|
|
5658
5856
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
5659
5857
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -5668,7 +5866,7 @@ async function loadConfig() {
|
|
|
5668
5866
|
}
|
|
5669
5867
|
function replaceEnvVars2(str2) {
|
|
5670
5868
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
5671
|
-
return
|
|
5869
|
+
return process6.env[varName] || "";
|
|
5672
5870
|
});
|
|
5673
5871
|
}
|
|
5674
5872
|
function isMarkdownFile2(path) {
|
|
@@ -6898,6 +7096,147 @@ var ExperimentalServerTasks = class {
|
|
|
6898
7096
|
requestStream(request, resultSchema, options) {
|
|
6899
7097
|
return this._server.requestStream(request, resultSchema, options);
|
|
6900
7098
|
}
|
|
7099
|
+
/**
|
|
7100
|
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
|
7101
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
7102
|
+
*
|
|
7103
|
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
|
7104
|
+
* before the final result.
|
|
7105
|
+
*
|
|
7106
|
+
* @example
|
|
7107
|
+
* ```typescript
|
|
7108
|
+
* const stream = server.experimental.tasks.createMessageStream({
|
|
7109
|
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
|
7110
|
+
* maxTokens: 100
|
|
7111
|
+
* }, {
|
|
7112
|
+
* onprogress: (progress) => {
|
|
7113
|
+
* // Handle streaming tokens via progress notifications
|
|
7114
|
+
* console.log('Progress:', progress.message);
|
|
7115
|
+
* }
|
|
7116
|
+
* });
|
|
7117
|
+
*
|
|
7118
|
+
* for await (const message of stream) {
|
|
7119
|
+
* switch (message.type) {
|
|
7120
|
+
* case 'taskCreated':
|
|
7121
|
+
* console.log('Task created:', message.task.taskId);
|
|
7122
|
+
* break;
|
|
7123
|
+
* case 'taskStatus':
|
|
7124
|
+
* console.log('Task status:', message.task.status);
|
|
7125
|
+
* break;
|
|
7126
|
+
* case 'result':
|
|
7127
|
+
* console.log('Final result:', message.result);
|
|
7128
|
+
* break;
|
|
7129
|
+
* case 'error':
|
|
7130
|
+
* console.error('Error:', message.error);
|
|
7131
|
+
* break;
|
|
7132
|
+
* }
|
|
7133
|
+
* }
|
|
7134
|
+
* ```
|
|
7135
|
+
*
|
|
7136
|
+
* @param params - The sampling request parameters
|
|
7137
|
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
|
7138
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
7139
|
+
*
|
|
7140
|
+
* @experimental
|
|
7141
|
+
*/
|
|
7142
|
+
createMessageStream(params, options) {
|
|
7143
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
7144
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
7145
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
7146
|
+
}
|
|
7147
|
+
if (params.messages.length > 0) {
|
|
7148
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
7149
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
7150
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
7151
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
|
|
7152
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
7153
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
7154
|
+
if (hasToolResults) {
|
|
7155
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
7156
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
7157
|
+
}
|
|
7158
|
+
if (!hasPreviousToolUse) {
|
|
7159
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
7160
|
+
}
|
|
7161
|
+
}
|
|
7162
|
+
if (hasPreviousToolUse) {
|
|
7163
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
7164
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
7165
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
7166
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
7167
|
+
}
|
|
7168
|
+
}
|
|
7169
|
+
}
|
|
7170
|
+
return this.requestStream({
|
|
7171
|
+
method: "sampling/createMessage",
|
|
7172
|
+
params
|
|
7173
|
+
}, CreateMessageResultSchema, options);
|
|
7174
|
+
}
|
|
7175
|
+
/**
|
|
7176
|
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
|
7177
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
7178
|
+
*
|
|
7179
|
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
|
7180
|
+
* and 'taskStatus' messages before the final result.
|
|
7181
|
+
*
|
|
7182
|
+
* @example
|
|
7183
|
+
* ```typescript
|
|
7184
|
+
* const stream = server.experimental.tasks.elicitInputStream({
|
|
7185
|
+
* mode: 'url',
|
|
7186
|
+
* message: 'Please authenticate',
|
|
7187
|
+
* elicitationId: 'auth-123',
|
|
7188
|
+
* url: 'https://example.com/auth'
|
|
7189
|
+
* }, {
|
|
7190
|
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
|
7191
|
+
* });
|
|
7192
|
+
*
|
|
7193
|
+
* for await (const message of stream) {
|
|
7194
|
+
* switch (message.type) {
|
|
7195
|
+
* case 'taskCreated':
|
|
7196
|
+
* console.log('Task created:', message.task.taskId);
|
|
7197
|
+
* break;
|
|
7198
|
+
* case 'taskStatus':
|
|
7199
|
+
* console.log('Task status:', message.task.status);
|
|
7200
|
+
* break;
|
|
7201
|
+
* case 'result':
|
|
7202
|
+
* console.log('User action:', message.result.action);
|
|
7203
|
+
* break;
|
|
7204
|
+
* case 'error':
|
|
7205
|
+
* console.error('Error:', message.error);
|
|
7206
|
+
* break;
|
|
7207
|
+
* }
|
|
7208
|
+
* }
|
|
7209
|
+
* ```
|
|
7210
|
+
*
|
|
7211
|
+
* @param params - The elicitation request parameters
|
|
7212
|
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
7213
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
7214
|
+
*
|
|
7215
|
+
* @experimental
|
|
7216
|
+
*/
|
|
7217
|
+
elicitInputStream(params, options) {
|
|
7218
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
7219
|
+
const mode = params.mode ?? "form";
|
|
7220
|
+
switch (mode) {
|
|
7221
|
+
case "url": {
|
|
7222
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
7223
|
+
throw new Error("Client does not support url elicitation.");
|
|
7224
|
+
}
|
|
7225
|
+
break;
|
|
7226
|
+
}
|
|
7227
|
+
case "form": {
|
|
7228
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
7229
|
+
throw new Error("Client does not support form elicitation.");
|
|
7230
|
+
}
|
|
7231
|
+
break;
|
|
7232
|
+
}
|
|
7233
|
+
}
|
|
7234
|
+
const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
|
|
7235
|
+
return this.requestStream({
|
|
7236
|
+
method: "elicitation/create",
|
|
7237
|
+
params: normalizedParams
|
|
7238
|
+
}, ElicitResultSchema, options);
|
|
7239
|
+
}
|
|
6901
7240
|
/**
|
|
6902
7241
|
* Gets the current status of a task.
|
|
6903
7242
|
*
|
|
@@ -8097,9 +8436,9 @@ var Client = class extends Protocol {
|
|
|
8097
8436
|
|
|
8098
8437
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
8099
8438
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
8100
|
-
import
|
|
8439
|
+
import process7 from "node:process";
|
|
8101
8440
|
import { PassThrough } from "node:stream";
|
|
8102
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
8441
|
+
var DEFAULT_INHERITED_ENV_VARS = process7.platform === "win32" ? [
|
|
8103
8442
|
"APPDATA",
|
|
8104
8443
|
"HOMEDRIVE",
|
|
8105
8444
|
"HOMEPATH",
|
|
@@ -8119,7 +8458,7 @@ var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
|
|
|
8119
8458
|
function getDefaultEnvironment() {
|
|
8120
8459
|
const env = {};
|
|
8121
8460
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
8122
|
-
const value =
|
|
8461
|
+
const value = process7.env[key];
|
|
8123
8462
|
if (value === void 0) {
|
|
8124
8463
|
continue;
|
|
8125
8464
|
}
|
|
@@ -8155,7 +8494,7 @@ var StdioClientTransport = class {
|
|
|
8155
8494
|
},
|
|
8156
8495
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
8157
8496
|
shell: false,
|
|
8158
|
-
windowsHide:
|
|
8497
|
+
windowsHide: process7.platform === "win32" && isElectron(),
|
|
8159
8498
|
cwd: this._serverParams.cwd
|
|
8160
8499
|
});
|
|
8161
8500
|
this._process.on("error", (error) => {
|
|
@@ -8263,7 +8602,7 @@ var StdioClientTransport = class {
|
|
|
8263
8602
|
}
|
|
8264
8603
|
};
|
|
8265
8604
|
function isElectron() {
|
|
8266
|
-
return "type" in
|
|
8605
|
+
return "type" in process7;
|
|
8267
8606
|
}
|
|
8268
8607
|
|
|
8269
8608
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -9086,22 +9425,45 @@ async function auth(provider, options) {
|
|
|
9086
9425
|
}
|
|
9087
9426
|
}
|
|
9088
9427
|
async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
|
|
9428
|
+
const cachedState = await provider.discoveryState?.();
|
|
9089
9429
|
let resourceMetadata;
|
|
9090
9430
|
let authorizationServerUrl;
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9431
|
+
let metadata;
|
|
9432
|
+
let effectiveResourceMetadataUrl = resourceMetadataUrl;
|
|
9433
|
+
if (!effectiveResourceMetadataUrl && cachedState?.resourceMetadataUrl) {
|
|
9434
|
+
effectiveResourceMetadataUrl = new URL(cachedState.resourceMetadataUrl);
|
|
9435
|
+
}
|
|
9436
|
+
if (cachedState?.authorizationServerUrl) {
|
|
9437
|
+
authorizationServerUrl = cachedState.authorizationServerUrl;
|
|
9438
|
+
resourceMetadata = cachedState.resourceMetadata;
|
|
9439
|
+
metadata = cachedState.authorizationServerMetadata ?? await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn });
|
|
9440
|
+
if (!resourceMetadata) {
|
|
9441
|
+
try {
|
|
9442
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl }, fetchFn);
|
|
9443
|
+
} catch {
|
|
9444
|
+
}
|
|
9095
9445
|
}
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9446
|
+
if (metadata !== cachedState.authorizationServerMetadata || resourceMetadata !== cachedState.resourceMetadata) {
|
|
9447
|
+
await provider.saveDiscoveryState?.({
|
|
9448
|
+
authorizationServerUrl: String(authorizationServerUrl),
|
|
9449
|
+
resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
|
|
9450
|
+
resourceMetadata,
|
|
9451
|
+
authorizationServerMetadata: metadata
|
|
9452
|
+
});
|
|
9453
|
+
}
|
|
9454
|
+
} else {
|
|
9455
|
+
const serverInfo = await discoverOAuthServerInfo(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl, fetchFn });
|
|
9456
|
+
authorizationServerUrl = serverInfo.authorizationServerUrl;
|
|
9457
|
+
metadata = serverInfo.authorizationServerMetadata;
|
|
9458
|
+
resourceMetadata = serverInfo.resourceMetadata;
|
|
9459
|
+
await provider.saveDiscoveryState?.({
|
|
9460
|
+
authorizationServerUrl: String(authorizationServerUrl),
|
|
9461
|
+
resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
|
|
9462
|
+
resourceMetadata,
|
|
9463
|
+
authorizationServerMetadata: metadata
|
|
9464
|
+
});
|
|
9100
9465
|
}
|
|
9101
9466
|
const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
9102
|
-
const metadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
9103
|
-
fetchFn
|
|
9104
|
-
});
|
|
9105
9467
|
let clientInformation = await Promise.resolve(provider.clientInformation());
|
|
9106
9468
|
if (!clientInformation) {
|
|
9107
9469
|
if (authorizationCode !== void 0) {
|
|
@@ -9356,6 +9718,26 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
9356
9718
|
}
|
|
9357
9719
|
return void 0;
|
|
9358
9720
|
}
|
|
9721
|
+
async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
9722
|
+
let resourceMetadata;
|
|
9723
|
+
let authorizationServerUrl;
|
|
9724
|
+
try {
|
|
9725
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: opts?.resourceMetadataUrl }, opts?.fetchFn);
|
|
9726
|
+
if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
|
|
9727
|
+
authorizationServerUrl = resourceMetadata.authorization_servers[0];
|
|
9728
|
+
}
|
|
9729
|
+
} catch {
|
|
9730
|
+
}
|
|
9731
|
+
if (!authorizationServerUrl) {
|
|
9732
|
+
authorizationServerUrl = String(new URL("/", serverUrl));
|
|
9733
|
+
}
|
|
9734
|
+
const authorizationServerMetadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn: opts?.fetchFn });
|
|
9735
|
+
return {
|
|
9736
|
+
authorizationServerUrl,
|
|
9737
|
+
authorizationServerMetadata,
|
|
9738
|
+
resourceMetadata
|
|
9739
|
+
};
|
|
9740
|
+
}
|
|
9359
9741
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
9360
9742
|
let authorizationUrl;
|
|
9361
9743
|
if (metadata) {
|
|
@@ -10144,8 +10526,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
10144
10526
|
};
|
|
10145
10527
|
|
|
10146
10528
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
10147
|
-
import
|
|
10148
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
10529
|
+
import process8 from "node:process";
|
|
10530
|
+
var GEMINI_PREFERRED_FORMAT = process8.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
10149
10531
|
|
|
10150
10532
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
10151
10533
|
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
@@ -10218,20 +10600,8 @@ var cleanToolSchema = (schema) => {
|
|
|
10218
10600
|
|
|
10219
10601
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
10220
10602
|
import { cwd } from "node:process";
|
|
10221
|
-
import
|
|
10603
|
+
import process9 from "node:process";
|
|
10222
10604
|
import { createHash } from "node:crypto";
|
|
10223
|
-
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
10224
|
-
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
10225
|
-
var shortHash = (s) => createHash("sha256").update(s).digest("hex").slice(0, 8);
|
|
10226
|
-
function defSignature(def) {
|
|
10227
|
-
const defCopy = {
|
|
10228
|
-
...def
|
|
10229
|
-
};
|
|
10230
|
-
if (defCopy.transportType === "memory" || defCopy.transport) {
|
|
10231
|
-
return `memory:${Date.now()}:${Math.random()}`;
|
|
10232
|
-
}
|
|
10233
|
-
return JSON.stringify(defCopy);
|
|
10234
|
-
}
|
|
10235
10605
|
function createTransport(def) {
|
|
10236
10606
|
const defAny = def;
|
|
10237
10607
|
const explicitType = defAny.transportType || defAny.type;
|
|
@@ -10271,7 +10641,7 @@ function createTransport(def) {
|
|
|
10271
10641
|
command: defAny.command,
|
|
10272
10642
|
args: defAny.args,
|
|
10273
10643
|
env: {
|
|
10274
|
-
...
|
|
10644
|
+
...process9.env,
|
|
10275
10645
|
...defAny.env ?? {}
|
|
10276
10646
|
},
|
|
10277
10647
|
cwd: cwd()
|
|
@@ -10279,90 +10649,43 @@ function createTransport(def) {
|
|
|
10279
10649
|
}
|
|
10280
10650
|
throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
|
|
10281
10651
|
}
|
|
10282
|
-
|
|
10283
|
-
const
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
const existingConnecting = mcpClientConnecting.get(defKey);
|
|
10289
|
-
if (existingConnecting) {
|
|
10290
|
-
const client = await existingConnecting;
|
|
10291
|
-
const entry = mcpClientPool.get(defKey);
|
|
10292
|
-
if (entry) entry.refCount += 1;
|
|
10293
|
-
return client;
|
|
10294
|
-
}
|
|
10295
|
-
const transport = createTransport(def);
|
|
10296
|
-
const connecting = (async () => {
|
|
10297
|
-
const client = new Client({
|
|
10298
|
-
name: `mcp_${shortHash(defSignature(def))}`,
|
|
10299
|
-
version: "1.0.0"
|
|
10300
|
-
});
|
|
10301
|
-
await client.connect(transport, {
|
|
10302
|
-
timeout: 6e4 * 10
|
|
10303
|
-
});
|
|
10304
|
-
return client;
|
|
10305
|
-
})();
|
|
10306
|
-
mcpClientConnecting.set(defKey, connecting);
|
|
10307
|
-
try {
|
|
10308
|
-
const client = await connecting;
|
|
10309
|
-
mcpClientPool.set(defKey, {
|
|
10310
|
-
client,
|
|
10311
|
-
refCount: 1
|
|
10312
|
-
});
|
|
10313
|
-
return client;
|
|
10314
|
-
} finally {
|
|
10315
|
-
mcpClientConnecting.delete(defKey);
|
|
10652
|
+
function defSignature(def) {
|
|
10653
|
+
const defCopy = {
|
|
10654
|
+
...def
|
|
10655
|
+
};
|
|
10656
|
+
if (defCopy.transportType === "memory" || defCopy.transport) {
|
|
10657
|
+
return `memory:${Date.now()}:${Math.random()}`;
|
|
10316
10658
|
}
|
|
10659
|
+
return JSON.stringify(defCopy);
|
|
10317
10660
|
}
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
}
|
|
10661
|
+
var shortHash = (s) => createHash("sha256").update(s).digest("hex").slice(0, 8);
|
|
10662
|
+
async function createMcpClient(def) {
|
|
10663
|
+
const transport = createTransport(def);
|
|
10664
|
+
const client = new Client({
|
|
10665
|
+
name: `mcp_${shortHash(defSignature(def))}`,
|
|
10666
|
+
version: "1.0.0"
|
|
10667
|
+
});
|
|
10668
|
+
await client.connect(transport, {
|
|
10669
|
+
timeout: 6e4 * 10
|
|
10670
|
+
});
|
|
10671
|
+
return client;
|
|
10330
10672
|
}
|
|
10331
|
-
var cleanupAllPooledClients = async () => {
|
|
10332
|
-
const entries = Array.from(mcpClientPool.entries());
|
|
10333
|
-
mcpClientPool.clear();
|
|
10334
|
-
await Promise.all(entries.map(async ([, { client }]) => {
|
|
10335
|
-
try {
|
|
10336
|
-
await client.close();
|
|
10337
|
-
} catch (err) {
|
|
10338
|
-
console.error("Error closing MCP client:", err);
|
|
10339
|
-
}
|
|
10340
|
-
}));
|
|
10341
|
-
};
|
|
10342
|
-
process8.once?.("exit", () => {
|
|
10343
|
-
cleanupAllPooledClients();
|
|
10344
|
-
});
|
|
10345
|
-
process8.once?.("SIGINT", () => {
|
|
10346
|
-
cleanupAllPooledClients().finally(() => process8.exit(0));
|
|
10347
|
-
});
|
|
10348
10673
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
10349
10674
|
const allTools = {};
|
|
10350
10675
|
const allClients = {};
|
|
10351
|
-
const
|
|
10676
|
+
const clientsToClose = [];
|
|
10352
10677
|
for (const [name, definition] of Object.entries(mcpConfig.mcpServers)) {
|
|
10353
10678
|
const def = definition;
|
|
10354
10679
|
if (def.disabled) continue;
|
|
10355
|
-
const defKey = shortHash(defSignature(def));
|
|
10356
|
-
const serverId = name;
|
|
10357
10680
|
try {
|
|
10358
|
-
const client = await
|
|
10359
|
-
|
|
10360
|
-
allClients[
|
|
10681
|
+
const client = await createMcpClient(def);
|
|
10682
|
+
clientsToClose.push(client);
|
|
10683
|
+
allClients[name] = client;
|
|
10361
10684
|
const { tools } = await client.listTools();
|
|
10362
10685
|
tools.forEach((tool2) => {
|
|
10363
10686
|
const toolNameWithScope = `${name}.${tool2.name}`;
|
|
10364
10687
|
const internalToolName = tool2.name;
|
|
10365
|
-
const rawToolId = `${
|
|
10688
|
+
const rawToolId = `${name}_${internalToolName}`;
|
|
10366
10689
|
const toolId = sanitizePropertyKey(rawToolId);
|
|
10367
10690
|
if (filterIn && !filterIn({
|
|
10368
10691
|
action: internalToolName,
|
|
@@ -10374,7 +10697,7 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
10374
10697
|
})) {
|
|
10375
10698
|
return;
|
|
10376
10699
|
}
|
|
10377
|
-
const execute = (args) => allClients[
|
|
10700
|
+
const execute = (args) => allClients[name].callTool({
|
|
10378
10701
|
name: internalToolName,
|
|
10379
10702
|
arguments: args
|
|
10380
10703
|
}, void 0, {
|
|
@@ -10391,10 +10714,12 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
10391
10714
|
}
|
|
10392
10715
|
}
|
|
10393
10716
|
const cleanupClients = async () => {
|
|
10394
|
-
await Promise.all(
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10717
|
+
await Promise.all(clientsToClose.map((client) => {
|
|
10718
|
+
try {
|
|
10719
|
+
return client.close();
|
|
10720
|
+
} catch {
|
|
10721
|
+
}
|
|
10722
|
+
}));
|
|
10398
10723
|
};
|
|
10399
10724
|
return {
|
|
10400
10725
|
tools: allTools,
|
|
@@ -10966,7 +11291,7 @@ function endSpan(span, error) {
|
|
|
10966
11291
|
}
|
|
10967
11292
|
|
|
10968
11293
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
10969
|
-
import
|
|
11294
|
+
import process10 from "node:process";
|
|
10970
11295
|
var AgenticExecutor = class {
|
|
10971
11296
|
name;
|
|
10972
11297
|
allToolNames;
|
|
@@ -10986,13 +11311,13 @@ var AgenticExecutor = class {
|
|
|
10986
11311
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
10987
11312
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
10988
11313
|
try {
|
|
10989
|
-
this.tracingEnabled =
|
|
11314
|
+
this.tracingEnabled = process10.env.MCPC_TRACING_ENABLED === "true";
|
|
10990
11315
|
if (this.tracingEnabled) {
|
|
10991
11316
|
initializeTracing({
|
|
10992
11317
|
enabled: true,
|
|
10993
11318
|
serviceName: `mcpc-agentic-${name}`,
|
|
10994
|
-
exportTo:
|
|
10995
|
-
otlpEndpoint:
|
|
11319
|
+
exportTo: process10.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
11320
|
+
otlpEndpoint: process10.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
10996
11321
|
});
|
|
10997
11322
|
}
|
|
10998
11323
|
} catch {
|
|
@@ -13706,12 +14031,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
13706
14031
|
};
|
|
13707
14032
|
|
|
13708
14033
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
13709
|
-
import
|
|
13710
|
-
var isSCF = () => Boolean(
|
|
14034
|
+
import process11 from "node:process";
|
|
14035
|
+
var isSCF = () => Boolean(process11.env.SCF_RUNTIME || process11.env.PROD_SCF);
|
|
13711
14036
|
if (isSCF()) {
|
|
13712
14037
|
console.log({
|
|
13713
14038
|
isSCF: isSCF(),
|
|
13714
|
-
SCF_RUNTIME:
|
|
14039
|
+
SCF_RUNTIME: process11.env.SCF_RUNTIME
|
|
13715
14040
|
});
|
|
13716
14041
|
}
|
|
13717
14042
|
|