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