@mcpc-tech/cli 0.1.44 → 0.1.45
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/bin/mcpc.cjs +2182 -98
- package/bin/mcpc.mjs +2176 -92
- package/package.json +1 -2
package/bin/mcpc.mjs
CHANGED
|
@@ -56,15 +56,15 @@ var require_windows = __commonJS({
|
|
|
56
56
|
}
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
|
-
function checkStat(
|
|
60
|
-
if (!
|
|
59
|
+
function checkStat(stat2, path, options) {
|
|
60
|
+
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
63
|
return checkPathExt(path, options);
|
|
64
64
|
}
|
|
65
65
|
function isexe(path, options, cb) {
|
|
66
|
-
fs.stat(path, function(er,
|
|
67
|
-
cb(er, er ? false : checkStat(
|
|
66
|
+
fs.stat(path, function(er, stat2) {
|
|
67
|
+
cb(er, er ? false : checkStat(stat2, path, options));
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
function sync(path, options) {
|
|
@@ -80,20 +80,20 @@ var require_mode = __commonJS({
|
|
|
80
80
|
isexe.sync = sync;
|
|
81
81
|
var fs = __require("fs");
|
|
82
82
|
function isexe(path, options, cb) {
|
|
83
|
-
fs.stat(path, function(er,
|
|
84
|
-
cb(er, er ? false : checkStat(
|
|
83
|
+
fs.stat(path, function(er, stat2) {
|
|
84
|
+
cb(er, er ? false : checkStat(stat2, options));
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
function sync(path, options) {
|
|
88
88
|
return checkStat(fs.statSync(path), options);
|
|
89
89
|
}
|
|
90
|
-
function checkStat(
|
|
91
|
-
return
|
|
90
|
+
function checkStat(stat2, options) {
|
|
91
|
+
return stat2.isFile() && checkMode(stat2, options);
|
|
92
92
|
}
|
|
93
|
-
function checkMode(
|
|
94
|
-
var mod =
|
|
95
|
-
var uid =
|
|
96
|
-
var gid =
|
|
93
|
+
function checkMode(stat2, options) {
|
|
94
|
+
var mod = stat2.mode;
|
|
95
|
+
var uid = stat2.uid;
|
|
96
|
+
var gid = stat2.gid;
|
|
97
97
|
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
98
98
|
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
99
99
|
var u = parseInt("100", 8);
|
|
@@ -166,11 +166,11 @@ var require_which = __commonJS({
|
|
|
166
166
|
"__mcpc__cli_latest/node_modules/which/which.js"(exports, module) {
|
|
167
167
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
168
168
|
var path = __require("path");
|
|
169
|
-
var
|
|
169
|
+
var COLON2 = isWindows ? ";" : ":";
|
|
170
170
|
var isexe = require_isexe();
|
|
171
171
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
172
172
|
var getPathInfo = (cmd, opt) => {
|
|
173
|
-
const colon = opt.colon ||
|
|
173
|
+
const colon = opt.colon || COLON2;
|
|
174
174
|
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
175
175
|
// windows always checks the cwd first
|
|
176
176
|
...isWindows ? [process.cwd()] : [],
|
|
@@ -360,11 +360,11 @@ var require_shebang_command = __commonJS({
|
|
|
360
360
|
return null;
|
|
361
361
|
}
|
|
362
362
|
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
363
|
-
const
|
|
364
|
-
if (
|
|
363
|
+
const binary2 = path.split("/").pop();
|
|
364
|
+
if (binary2 === "env") {
|
|
365
365
|
return argument;
|
|
366
366
|
}
|
|
367
|
-
return argument ? `${
|
|
367
|
+
return argument ? `${binary2} ${argument}` : binary2;
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
370
|
});
|
|
@@ -430,7 +430,7 @@ var require_parse = __commonJS({
|
|
|
430
430
|
}
|
|
431
431
|
return parsed;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function parse2(command, args, options) {
|
|
434
434
|
if (args && !Array.isArray(args)) {
|
|
435
435
|
options = args;
|
|
436
436
|
args = null;
|
|
@@ -449,7 +449,7 @@ var require_parse = __commonJS({
|
|
|
449
449
|
};
|
|
450
450
|
return options.shell ? parsed : parseNonShell(parsed);
|
|
451
451
|
}
|
|
452
|
-
module.exports =
|
|
452
|
+
module.exports = parse2;
|
|
453
453
|
}
|
|
454
454
|
});
|
|
455
455
|
|
|
@@ -508,16 +508,16 @@ var require_cross_spawn = __commonJS({
|
|
|
508
508
|
"__mcpc__cli_latest/node_modules/cross-spawn/index.js"(exports, module) {
|
|
509
509
|
"use strict";
|
|
510
510
|
var cp = __require("child_process");
|
|
511
|
-
var
|
|
511
|
+
var parse2 = require_parse();
|
|
512
512
|
var enoent = require_enoent();
|
|
513
513
|
function spawn2(command, args, options) {
|
|
514
|
-
const parsed =
|
|
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);
|
|
517
517
|
return spawned;
|
|
518
518
|
}
|
|
519
519
|
function spawnSync(command, args, options) {
|
|
520
|
-
const parsed =
|
|
520
|
+
const parsed = parse2(command, args, options);
|
|
521
521
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
522
522
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
523
523
|
return result;
|
|
@@ -525,7 +525,7 @@ var require_cross_spawn = __commonJS({
|
|
|
525
525
|
module.exports = spawn2;
|
|
526
526
|
module.exports.spawn = spawn2;
|
|
527
527
|
module.exports.sync = spawnSync;
|
|
528
|
-
module.exports._parse =
|
|
528
|
+
module.exports._parse = parse2;
|
|
529
529
|
module.exports._enoent = enoent;
|
|
530
530
|
}
|
|
531
531
|
});
|
|
@@ -2427,9 +2427,9 @@ function hasNested(object5, keys) {
|
|
|
2427
2427
|
return true;
|
|
2428
2428
|
}
|
|
2429
2429
|
function aliasIsBoolean(aliasMap, booleanSet, key) {
|
|
2430
|
-
const
|
|
2431
|
-
if (
|
|
2432
|
-
for (const alias of
|
|
2430
|
+
const set2 = aliasMap.get(key);
|
|
2431
|
+
if (set2 === void 0) return false;
|
|
2432
|
+
for (const alias of set2) if (booleanSet.has(alias)) return true;
|
|
2433
2433
|
return false;
|
|
2434
2434
|
}
|
|
2435
2435
|
function isBooleanString(value) {
|
|
@@ -2644,10 +2644,10 @@ function parseArgs(args, options) {
|
|
|
2644
2644
|
}
|
|
2645
2645
|
|
|
2646
2646
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
2647
|
-
import { mkdir, readFile as
|
|
2647
|
+
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
2648
2648
|
import { homedir } from "node:os";
|
|
2649
2649
|
import { dirname, join as join3, resolve as resolve4 } from "node:path";
|
|
2650
|
-
import
|
|
2650
|
+
import process5 from "node:process";
|
|
2651
2651
|
|
|
2652
2652
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
2653
2653
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
@@ -3206,15 +3206,2056 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
|
|
|
3206
3206
|
|
|
3207
3207
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
3208
3208
|
import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
|
|
3209
|
-
|
|
3210
|
-
|
|
3209
|
+
|
|
3210
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
3211
|
+
import { readdir as readdir2, readFile as readFile2, stat } from "node:fs/promises";
|
|
3212
|
+
|
|
3213
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_chars.js
|
|
3214
|
+
var TAB = 9;
|
|
3215
|
+
var LINE_FEED = 10;
|
|
3216
|
+
var CARRIAGE_RETURN = 13;
|
|
3217
|
+
var SPACE = 32;
|
|
3218
|
+
var EXCLAMATION = 33;
|
|
3219
|
+
var DOUBLE_QUOTE = 34;
|
|
3220
|
+
var SHARP = 35;
|
|
3221
|
+
var PERCENT = 37;
|
|
3222
|
+
var AMPERSAND = 38;
|
|
3223
|
+
var SINGLE_QUOTE = 39;
|
|
3224
|
+
var ASTERISK = 42;
|
|
3225
|
+
var PLUS = 43;
|
|
3226
|
+
var COMMA = 44;
|
|
3227
|
+
var MINUS = 45;
|
|
3228
|
+
var DOT = 46;
|
|
3229
|
+
var COLON = 58;
|
|
3230
|
+
var SMALLER_THAN = 60;
|
|
3231
|
+
var GREATER_THAN = 62;
|
|
3232
|
+
var QUESTION = 63;
|
|
3233
|
+
var COMMERCIAL_AT = 64;
|
|
3234
|
+
var LEFT_SQUARE_BRACKET = 91;
|
|
3235
|
+
var BACKSLASH = 92;
|
|
3236
|
+
var RIGHT_SQUARE_BRACKET = 93;
|
|
3237
|
+
var GRAVE_ACCENT = 96;
|
|
3238
|
+
var LEFT_CURLY_BRACKET = 123;
|
|
3239
|
+
var VERTICAL_LINE = 124;
|
|
3240
|
+
var RIGHT_CURLY_BRACKET = 125;
|
|
3241
|
+
function isEOL(c) {
|
|
3242
|
+
return c === LINE_FEED || c === CARRIAGE_RETURN;
|
|
3243
|
+
}
|
|
3244
|
+
function isWhiteSpace(c) {
|
|
3245
|
+
return c === TAB || c === SPACE;
|
|
3246
|
+
}
|
|
3247
|
+
function isWhiteSpaceOrEOL(c) {
|
|
3248
|
+
return isWhiteSpace(c) || isEOL(c);
|
|
3249
|
+
}
|
|
3250
|
+
function isFlowIndicator(c) {
|
|
3251
|
+
return c === COMMA || c === LEFT_SQUARE_BRACKET || c === RIGHT_SQUARE_BRACKET || c === LEFT_CURLY_BRACKET || c === RIGHT_CURLY_BRACKET;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/binary.js
|
|
3255
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
3256
|
+
function resolveYamlBinary(data) {
|
|
3257
|
+
if (data === null) return false;
|
|
3258
|
+
let code;
|
|
3259
|
+
let bitlen = 0;
|
|
3260
|
+
const max = data.length;
|
|
3261
|
+
const map2 = BASE64_MAP;
|
|
3262
|
+
for (let idx = 0; idx < max; idx++) {
|
|
3263
|
+
code = map2.indexOf(data.charAt(idx));
|
|
3264
|
+
if (code > 64) continue;
|
|
3265
|
+
if (code < 0) return false;
|
|
3266
|
+
bitlen += 6;
|
|
3267
|
+
}
|
|
3268
|
+
return bitlen % 8 === 0;
|
|
3269
|
+
}
|
|
3270
|
+
function constructYamlBinary(data) {
|
|
3271
|
+
const input = data.replace(/[\r\n=]/g, "");
|
|
3272
|
+
const max = input.length;
|
|
3273
|
+
const map2 = BASE64_MAP;
|
|
3274
|
+
const result = [];
|
|
3275
|
+
let bits = 0;
|
|
3276
|
+
for (let idx = 0; idx < max; idx++) {
|
|
3277
|
+
if (idx % 4 === 0 && idx) {
|
|
3278
|
+
result.push(bits >> 16 & 255);
|
|
3279
|
+
result.push(bits >> 8 & 255);
|
|
3280
|
+
result.push(bits & 255);
|
|
3281
|
+
}
|
|
3282
|
+
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
3283
|
+
}
|
|
3284
|
+
const tailbits = max % 4 * 6;
|
|
3285
|
+
if (tailbits === 0) {
|
|
3286
|
+
result.push(bits >> 16 & 255);
|
|
3287
|
+
result.push(bits >> 8 & 255);
|
|
3288
|
+
result.push(bits & 255);
|
|
3289
|
+
} else if (tailbits === 18) {
|
|
3290
|
+
result.push(bits >> 10 & 255);
|
|
3291
|
+
result.push(bits >> 2 & 255);
|
|
3292
|
+
} else if (tailbits === 12) {
|
|
3293
|
+
result.push(bits >> 4 & 255);
|
|
3294
|
+
}
|
|
3295
|
+
return new Uint8Array(result);
|
|
3296
|
+
}
|
|
3297
|
+
function representYamlBinary(object5) {
|
|
3298
|
+
const max = object5.length;
|
|
3299
|
+
const map2 = BASE64_MAP;
|
|
3300
|
+
let result = "";
|
|
3301
|
+
let bits = 0;
|
|
3302
|
+
for (let idx = 0; idx < max; idx++) {
|
|
3303
|
+
if (idx % 3 === 0 && idx) {
|
|
3304
|
+
result += map2[bits >> 18 & 63];
|
|
3305
|
+
result += map2[bits >> 12 & 63];
|
|
3306
|
+
result += map2[bits >> 6 & 63];
|
|
3307
|
+
result += map2[bits & 63];
|
|
3308
|
+
}
|
|
3309
|
+
bits = (bits << 8) + object5[idx];
|
|
3310
|
+
}
|
|
3311
|
+
const tail = max % 3;
|
|
3312
|
+
if (tail === 0) {
|
|
3313
|
+
result += map2[bits >> 18 & 63];
|
|
3314
|
+
result += map2[bits >> 12 & 63];
|
|
3315
|
+
result += map2[bits >> 6 & 63];
|
|
3316
|
+
result += map2[bits & 63];
|
|
3317
|
+
} else if (tail === 2) {
|
|
3318
|
+
result += map2[bits >> 10 & 63];
|
|
3319
|
+
result += map2[bits >> 4 & 63];
|
|
3320
|
+
result += map2[bits << 2 & 63];
|
|
3321
|
+
result += map2[64];
|
|
3322
|
+
} else if (tail === 1) {
|
|
3323
|
+
result += map2[bits >> 2 & 63];
|
|
3324
|
+
result += map2[bits << 4 & 63];
|
|
3325
|
+
result += map2[64];
|
|
3326
|
+
result += map2[64];
|
|
3327
|
+
}
|
|
3328
|
+
return result;
|
|
3329
|
+
}
|
|
3330
|
+
function isBinary(obj) {
|
|
3331
|
+
return obj instanceof Uint8Array;
|
|
3332
|
+
}
|
|
3333
|
+
var binary = {
|
|
3334
|
+
tag: "tag:yaml.org,2002:binary",
|
|
3335
|
+
construct: constructYamlBinary,
|
|
3336
|
+
kind: "scalar",
|
|
3337
|
+
predicate: isBinary,
|
|
3338
|
+
represent: representYamlBinary,
|
|
3339
|
+
resolve: resolveYamlBinary
|
|
3340
|
+
};
|
|
3341
|
+
|
|
3342
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/bool.js
|
|
3343
|
+
var YAML_TRUE_BOOLEANS = [
|
|
3344
|
+
"true",
|
|
3345
|
+
"True",
|
|
3346
|
+
"TRUE"
|
|
3347
|
+
];
|
|
3348
|
+
var YAML_FALSE_BOOLEANS = [
|
|
3349
|
+
"false",
|
|
3350
|
+
"False",
|
|
3351
|
+
"FALSE"
|
|
3352
|
+
];
|
|
3353
|
+
var YAML_BOOLEANS = [
|
|
3354
|
+
...YAML_TRUE_BOOLEANS,
|
|
3355
|
+
...YAML_FALSE_BOOLEANS
|
|
3356
|
+
];
|
|
3357
|
+
var bool = {
|
|
3358
|
+
tag: "tag:yaml.org,2002:bool",
|
|
3359
|
+
kind: "scalar",
|
|
3360
|
+
defaultStyle: "lowercase",
|
|
3361
|
+
predicate: (value) => typeof value === "boolean" || value instanceof Boolean,
|
|
3362
|
+
construct: (data) => YAML_TRUE_BOOLEANS.includes(data),
|
|
3363
|
+
resolve: (data) => YAML_BOOLEANS.includes(data),
|
|
3364
|
+
represent: {
|
|
3365
|
+
// deno-lint-ignore ban-types
|
|
3366
|
+
lowercase: (object5) => {
|
|
3367
|
+
const value = object5 instanceof Boolean ? object5.valueOf() : object5;
|
|
3368
|
+
return value ? "true" : "false";
|
|
3369
|
+
},
|
|
3370
|
+
// deno-lint-ignore ban-types
|
|
3371
|
+
uppercase: (object5) => {
|
|
3372
|
+
const value = object5 instanceof Boolean ? object5.valueOf() : object5;
|
|
3373
|
+
return value ? "TRUE" : "FALSE";
|
|
3374
|
+
},
|
|
3375
|
+
// deno-lint-ignore ban-types
|
|
3376
|
+
camelcase: (object5) => {
|
|
3377
|
+
const value = object5 instanceof Boolean ? object5.valueOf() : object5;
|
|
3378
|
+
return value ? "True" : "False";
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3382
|
+
|
|
3383
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_utils.js
|
|
3384
|
+
function isObject(value) {
|
|
3385
|
+
return value !== null && typeof value === "object";
|
|
3386
|
+
}
|
|
3387
|
+
function isNegativeZero(i) {
|
|
3388
|
+
return i === 0 && Number.NEGATIVE_INFINITY === 1 / i;
|
|
3389
|
+
}
|
|
3390
|
+
function isPlainObject(object5) {
|
|
3391
|
+
return Object.prototype.toString.call(object5) === "[object Object]";
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/float.js
|
|
3395
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
3396
|
+
// 2.5e4, 2.5 and integers
|
|
3397
|
+
"^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
3398
|
+
);
|
|
3399
|
+
function resolveYamlFloat(data) {
|
|
3400
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
3401
|
+
// Probably should update regexp & check speed
|
|
3402
|
+
data[data.length - 1] === "_") {
|
|
3403
|
+
return false;
|
|
3404
|
+
}
|
|
3405
|
+
return true;
|
|
3406
|
+
}
|
|
3407
|
+
function constructYamlFloat(data) {
|
|
3408
|
+
let value = data.replace(/_/g, "").toLowerCase();
|
|
3409
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
3410
|
+
if (value[0] && "+-".includes(value[0])) {
|
|
3411
|
+
value = value.slice(1);
|
|
3412
|
+
}
|
|
3413
|
+
if (value === ".inf") {
|
|
3414
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
3415
|
+
}
|
|
3416
|
+
if (value === ".nan") {
|
|
3417
|
+
return NaN;
|
|
3418
|
+
}
|
|
3419
|
+
return sign * parseFloat(value);
|
|
3420
|
+
}
|
|
3421
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
3422
|
+
function representYamlFloat(object5, style) {
|
|
3423
|
+
const value = object5 instanceof Number ? object5.valueOf() : object5;
|
|
3424
|
+
if (isNaN(value)) {
|
|
3425
|
+
switch (style) {
|
|
3426
|
+
case "lowercase":
|
|
3427
|
+
return ".nan";
|
|
3428
|
+
case "uppercase":
|
|
3429
|
+
return ".NAN";
|
|
3430
|
+
case "camelcase":
|
|
3431
|
+
return ".NaN";
|
|
3432
|
+
}
|
|
3433
|
+
} else if (Number.POSITIVE_INFINITY === value) {
|
|
3434
|
+
switch (style) {
|
|
3435
|
+
case "lowercase":
|
|
3436
|
+
return ".inf";
|
|
3437
|
+
case "uppercase":
|
|
3438
|
+
return ".INF";
|
|
3439
|
+
case "camelcase":
|
|
3440
|
+
return ".Inf";
|
|
3441
|
+
}
|
|
3442
|
+
} else if (Number.NEGATIVE_INFINITY === value) {
|
|
3443
|
+
switch (style) {
|
|
3444
|
+
case "lowercase":
|
|
3445
|
+
return "-.inf";
|
|
3446
|
+
case "uppercase":
|
|
3447
|
+
return "-.INF";
|
|
3448
|
+
case "camelcase":
|
|
3449
|
+
return "-.Inf";
|
|
3450
|
+
}
|
|
3451
|
+
} else if (isNegativeZero(value)) {
|
|
3452
|
+
return "-0.0";
|
|
3453
|
+
}
|
|
3454
|
+
const res = value.toString(10);
|
|
3455
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
3456
|
+
}
|
|
3457
|
+
function isFloat(object5) {
|
|
3458
|
+
if (object5 instanceof Number) object5 = object5.valueOf();
|
|
3459
|
+
return typeof object5 === "number" && (object5 % 1 !== 0 || isNegativeZero(object5));
|
|
3460
|
+
}
|
|
3461
|
+
var float = {
|
|
3462
|
+
tag: "tag:yaml.org,2002:float",
|
|
3463
|
+
construct: constructYamlFloat,
|
|
3464
|
+
defaultStyle: "lowercase",
|
|
3465
|
+
kind: "scalar",
|
|
3466
|
+
predicate: isFloat,
|
|
3467
|
+
represent: representYamlFloat,
|
|
3468
|
+
resolve: resolveYamlFloat
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3471
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/int.js
|
|
3472
|
+
function isCharCodeInRange(c, lower, upper) {
|
|
3473
|
+
return lower <= c && c <= upper;
|
|
3474
|
+
}
|
|
3475
|
+
function isHexCode(c) {
|
|
3476
|
+
return isCharCodeInRange(c, 48, 57) || // 0-9
|
|
3477
|
+
isCharCodeInRange(c, 65, 70) || // A-F
|
|
3478
|
+
isCharCodeInRange(c, 97, 102);
|
|
3479
|
+
}
|
|
3480
|
+
function isOctCode(c) {
|
|
3481
|
+
return isCharCodeInRange(c, 48, 55);
|
|
3482
|
+
}
|
|
3483
|
+
function isDecCode(c) {
|
|
3484
|
+
return isCharCodeInRange(c, 48, 57);
|
|
3485
|
+
}
|
|
3486
|
+
function resolveYamlInteger(data) {
|
|
3487
|
+
const max = data.length;
|
|
3488
|
+
let index = 0;
|
|
3489
|
+
let hasDigits = false;
|
|
3490
|
+
if (!max) return false;
|
|
3491
|
+
let ch = data[index];
|
|
3492
|
+
if (ch === "-" || ch === "+") {
|
|
3493
|
+
ch = data[++index];
|
|
3494
|
+
}
|
|
3495
|
+
if (ch === "0") {
|
|
3496
|
+
if (index + 1 === max) return true;
|
|
3497
|
+
ch = data[++index];
|
|
3498
|
+
if (ch === "b") {
|
|
3499
|
+
index++;
|
|
3500
|
+
for (; index < max; index++) {
|
|
3501
|
+
ch = data[index];
|
|
3502
|
+
if (ch === "_") continue;
|
|
3503
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
3504
|
+
hasDigits = true;
|
|
3505
|
+
}
|
|
3506
|
+
return hasDigits && ch !== "_";
|
|
3507
|
+
}
|
|
3508
|
+
if (ch === "x") {
|
|
3509
|
+
index++;
|
|
3510
|
+
for (; index < max; index++) {
|
|
3511
|
+
ch = data[index];
|
|
3512
|
+
if (ch === "_") continue;
|
|
3513
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
3514
|
+
hasDigits = true;
|
|
3515
|
+
}
|
|
3516
|
+
return hasDigits && ch !== "_";
|
|
3517
|
+
}
|
|
3518
|
+
for (; index < max; index++) {
|
|
3519
|
+
ch = data[index];
|
|
3520
|
+
if (ch === "_") continue;
|
|
3521
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
3522
|
+
hasDigits = true;
|
|
3523
|
+
}
|
|
3524
|
+
return hasDigits && ch !== "_";
|
|
3525
|
+
}
|
|
3526
|
+
if (ch === "_") return false;
|
|
3527
|
+
for (; index < max; index++) {
|
|
3528
|
+
ch = data[index];
|
|
3529
|
+
if (ch === "_") continue;
|
|
3530
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
3531
|
+
return false;
|
|
3532
|
+
}
|
|
3533
|
+
hasDigits = true;
|
|
3534
|
+
}
|
|
3535
|
+
if (!hasDigits || ch === "_") return false;
|
|
3536
|
+
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
3537
|
+
}
|
|
3538
|
+
function constructYamlInteger(data) {
|
|
3539
|
+
let value = data;
|
|
3540
|
+
if (value.includes("_")) {
|
|
3541
|
+
value = value.replace(/_/g, "");
|
|
3542
|
+
}
|
|
3543
|
+
let sign = 1;
|
|
3544
|
+
let ch = value[0];
|
|
3545
|
+
if (ch === "-" || ch === "+") {
|
|
3546
|
+
if (ch === "-") sign = -1;
|
|
3547
|
+
value = value.slice(1);
|
|
3548
|
+
ch = value[0];
|
|
3549
|
+
}
|
|
3550
|
+
if (value === "0") return 0;
|
|
3551
|
+
if (ch === "0") {
|
|
3552
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
3553
|
+
if (value[1] === "x") return sign * parseInt(value, 16);
|
|
3554
|
+
return sign * parseInt(value, 8);
|
|
3555
|
+
}
|
|
3556
|
+
return sign * parseInt(value, 10);
|
|
3557
|
+
}
|
|
3558
|
+
function isInteger(object5) {
|
|
3559
|
+
if (object5 instanceof Number) object5 = object5.valueOf();
|
|
3560
|
+
return typeof object5 === "number" && object5 % 1 === 0 && !isNegativeZero(object5);
|
|
3561
|
+
}
|
|
3562
|
+
var int = {
|
|
3563
|
+
tag: "tag:yaml.org,2002:int",
|
|
3564
|
+
construct: constructYamlInteger,
|
|
3565
|
+
defaultStyle: "decimal",
|
|
3566
|
+
kind: "scalar",
|
|
3567
|
+
predicate: isInteger,
|
|
3568
|
+
represent: {
|
|
3569
|
+
// deno-lint-ignore ban-types
|
|
3570
|
+
binary(object5) {
|
|
3571
|
+
const value = object5 instanceof Number ? object5.valueOf() : object5;
|
|
3572
|
+
return value >= 0 ? `0b${value.toString(2)}` : `-0b${value.toString(2).slice(1)}`;
|
|
3573
|
+
},
|
|
3574
|
+
// deno-lint-ignore ban-types
|
|
3575
|
+
octal(object5) {
|
|
3576
|
+
const value = object5 instanceof Number ? object5.valueOf() : object5;
|
|
3577
|
+
return value >= 0 ? `0${value.toString(8)}` : `-0${value.toString(8).slice(1)}`;
|
|
3578
|
+
},
|
|
3579
|
+
// deno-lint-ignore ban-types
|
|
3580
|
+
decimal(object5) {
|
|
3581
|
+
const value = object5 instanceof Number ? object5.valueOf() : object5;
|
|
3582
|
+
return value.toString(10);
|
|
3583
|
+
},
|
|
3584
|
+
// deno-lint-ignore ban-types
|
|
3585
|
+
hexadecimal(object5) {
|
|
3586
|
+
const value = object5 instanceof Number ? object5.valueOf() : object5;
|
|
3587
|
+
return value >= 0 ? `0x${value.toString(16).toUpperCase()}` : `-0x${value.toString(16).toUpperCase().slice(1)}`;
|
|
3588
|
+
}
|
|
3589
|
+
},
|
|
3590
|
+
resolve: resolveYamlInteger
|
|
3591
|
+
};
|
|
3592
|
+
|
|
3593
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/map.js
|
|
3594
|
+
var map = {
|
|
3595
|
+
tag: "tag:yaml.org,2002:map",
|
|
3596
|
+
resolve() {
|
|
3597
|
+
return true;
|
|
3598
|
+
},
|
|
3599
|
+
construct(data) {
|
|
3600
|
+
return data !== null ? data : {};
|
|
3601
|
+
},
|
|
3602
|
+
kind: "mapping"
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3605
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/merge.js
|
|
3606
|
+
var merge = {
|
|
3607
|
+
tag: "tag:yaml.org,2002:merge",
|
|
3608
|
+
kind: "scalar",
|
|
3609
|
+
resolve: (data) => data === "<<" || data === null,
|
|
3610
|
+
construct: (data) => data
|
|
3611
|
+
};
|
|
3612
|
+
|
|
3613
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/nil.js
|
|
3614
|
+
var nil = {
|
|
3615
|
+
tag: "tag:yaml.org,2002:null",
|
|
3616
|
+
kind: "scalar",
|
|
3617
|
+
defaultStyle: "lowercase",
|
|
3618
|
+
predicate: (object5) => object5 === null,
|
|
3619
|
+
construct: () => null,
|
|
3620
|
+
resolve: (data) => {
|
|
3621
|
+
return data === "~" || data === "null" || data === "Null" || data === "NULL";
|
|
3622
|
+
},
|
|
3623
|
+
represent: {
|
|
3624
|
+
lowercase: () => "null",
|
|
3625
|
+
uppercase: () => "NULL",
|
|
3626
|
+
camelcase: () => "Null"
|
|
3627
|
+
}
|
|
3628
|
+
};
|
|
3629
|
+
|
|
3630
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/omap.js
|
|
3631
|
+
function resolveYamlOmap(data) {
|
|
3632
|
+
const objectKeys = /* @__PURE__ */ new Set();
|
|
3633
|
+
for (const object5 of data) {
|
|
3634
|
+
if (!isPlainObject(object5)) return false;
|
|
3635
|
+
const keys = Object.keys(object5);
|
|
3636
|
+
if (keys.length !== 1) return false;
|
|
3637
|
+
for (const key of keys) {
|
|
3638
|
+
if (objectKeys.has(key)) return false;
|
|
3639
|
+
objectKeys.add(key);
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
return true;
|
|
3643
|
+
}
|
|
3644
|
+
var omap = {
|
|
3645
|
+
tag: "tag:yaml.org,2002:omap",
|
|
3646
|
+
kind: "sequence",
|
|
3647
|
+
resolve: resolveYamlOmap,
|
|
3648
|
+
construct(data) {
|
|
3649
|
+
return data;
|
|
3650
|
+
}
|
|
3651
|
+
};
|
|
3652
|
+
|
|
3653
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/pairs.js
|
|
3654
|
+
function resolveYamlPairs(data) {
|
|
3655
|
+
if (data === null) return true;
|
|
3656
|
+
return data.every((it) => isPlainObject(it) && Object.keys(it).length === 1);
|
|
3657
|
+
}
|
|
3658
|
+
var pairs = {
|
|
3659
|
+
tag: "tag:yaml.org,2002:pairs",
|
|
3660
|
+
construct(data) {
|
|
3661
|
+
return data?.flatMap(Object.entries) ?? [];
|
|
3662
|
+
},
|
|
3663
|
+
kind: "sequence",
|
|
3664
|
+
resolve: resolveYamlPairs
|
|
3665
|
+
};
|
|
3666
|
+
|
|
3667
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/regexp.js
|
|
3668
|
+
var REGEXP = /^\/(?<regexp>[\s\S]+)\/(?<modifiers>[gismuy]*)$/;
|
|
3669
|
+
var regexp = {
|
|
3670
|
+
tag: "tag:yaml.org,2002:js/regexp",
|
|
3671
|
+
kind: "scalar",
|
|
3672
|
+
resolve(data) {
|
|
3673
|
+
if (data === null || !data.length) return false;
|
|
3674
|
+
if (data.charAt(0) === "/") {
|
|
3675
|
+
const groups = data.match(REGEXP)?.groups;
|
|
3676
|
+
if (!groups) return false;
|
|
3677
|
+
const modifiers = groups.modifiers ?? "";
|
|
3678
|
+
if (new Set(modifiers).size < modifiers.length) return false;
|
|
3679
|
+
}
|
|
3680
|
+
return true;
|
|
3681
|
+
},
|
|
3682
|
+
construct(data) {
|
|
3683
|
+
const { regexp: regexp2 = data, modifiers = "" } = data.match(REGEXP)?.groups ?? {};
|
|
3684
|
+
return new RegExp(regexp2, modifiers);
|
|
3685
|
+
},
|
|
3686
|
+
predicate: (object5) => object5 instanceof RegExp,
|
|
3687
|
+
represent: (object5) => object5.toString()
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/seq.js
|
|
3691
|
+
var seq = {
|
|
3692
|
+
tag: "tag:yaml.org,2002:seq",
|
|
3693
|
+
kind: "sequence",
|
|
3694
|
+
resolve: () => true,
|
|
3695
|
+
construct: (data) => data !== null ? data : []
|
|
3696
|
+
};
|
|
3697
|
+
|
|
3698
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/set.js
|
|
3699
|
+
var set = {
|
|
3700
|
+
tag: "tag:yaml.org,2002:set",
|
|
3701
|
+
kind: "mapping",
|
|
3702
|
+
construct: (data) => data !== null ? data : {},
|
|
3703
|
+
resolve: (data) => {
|
|
3704
|
+
if (data === null) return true;
|
|
3705
|
+
return Object.values(data).every((it) => it === null);
|
|
3706
|
+
}
|
|
3707
|
+
};
|
|
3708
|
+
|
|
3709
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/str.js
|
|
3710
|
+
var str = {
|
|
3711
|
+
tag: "tag:yaml.org,2002:str",
|
|
3712
|
+
kind: "scalar",
|
|
3713
|
+
resolve: () => true,
|
|
3714
|
+
construct: (data) => data !== null ? data : ""
|
|
3715
|
+
};
|
|
3716
|
+
|
|
3717
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/timestamp.js
|
|
3718
|
+
var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
3719
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
3720
|
+
function resolveYamlTimestamp(data) {
|
|
3721
|
+
if (data === null) return false;
|
|
3722
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
3723
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
3724
|
+
return false;
|
|
3725
|
+
}
|
|
3726
|
+
function constructYamlTimestamp(data) {
|
|
3727
|
+
let match = YAML_DATE_REGEXP.exec(data);
|
|
3728
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
3729
|
+
if (match === null) {
|
|
3730
|
+
throw new Error("Cannot construct YAML timestamp: date resolve error");
|
|
3731
|
+
}
|
|
3732
|
+
const year = +match[1];
|
|
3733
|
+
const month = +match[2] - 1;
|
|
3734
|
+
const day = +match[3];
|
|
3735
|
+
if (!match[4]) {
|
|
3736
|
+
return new Date(Date.UTC(year, month, day));
|
|
3737
|
+
}
|
|
3738
|
+
const hour = +match[4];
|
|
3739
|
+
const minute = +match[5];
|
|
3740
|
+
const second = +match[6];
|
|
3741
|
+
let fraction = 0;
|
|
3742
|
+
if (match[7]) {
|
|
3743
|
+
let partFraction = match[7].slice(0, 3);
|
|
3744
|
+
while (partFraction.length < 3) {
|
|
3745
|
+
partFraction += "0";
|
|
3746
|
+
}
|
|
3747
|
+
fraction = +partFraction;
|
|
3748
|
+
}
|
|
3749
|
+
let delta = null;
|
|
3750
|
+
if (match[9] && match[10]) {
|
|
3751
|
+
const tzHour = +match[10];
|
|
3752
|
+
const tzMinute = +(match[11] || 0);
|
|
3753
|
+
delta = (tzHour * 60 + tzMinute) * 6e4;
|
|
3754
|
+
if (match[9] === "-") delta = -delta;
|
|
3755
|
+
}
|
|
3756
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
3757
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
3758
|
+
return date;
|
|
3759
|
+
}
|
|
3760
|
+
function representYamlTimestamp(date) {
|
|
3761
|
+
return date.toISOString();
|
|
3762
|
+
}
|
|
3763
|
+
var timestamp = {
|
|
3764
|
+
tag: "tag:yaml.org,2002:timestamp",
|
|
3765
|
+
construct: constructYamlTimestamp,
|
|
3766
|
+
predicate(object5) {
|
|
3767
|
+
return object5 instanceof Date;
|
|
3768
|
+
},
|
|
3769
|
+
kind: "scalar",
|
|
3770
|
+
represent: representYamlTimestamp,
|
|
3771
|
+
resolve: resolveYamlTimestamp
|
|
3772
|
+
};
|
|
3773
|
+
|
|
3774
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/undefined.js
|
|
3775
|
+
var undefinedType = {
|
|
3776
|
+
tag: "tag:yaml.org,2002:js/undefined",
|
|
3777
|
+
kind: "scalar",
|
|
3778
|
+
resolve() {
|
|
3779
|
+
return true;
|
|
3780
|
+
},
|
|
3781
|
+
construct() {
|
|
3782
|
+
return void 0;
|
|
3783
|
+
},
|
|
3784
|
+
predicate(object5) {
|
|
3785
|
+
return typeof object5 === "undefined";
|
|
3786
|
+
},
|
|
3787
|
+
represent() {
|
|
3788
|
+
return "";
|
|
3789
|
+
}
|
|
3790
|
+
};
|
|
3791
|
+
|
|
3792
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_schema.js
|
|
3793
|
+
function createTypeMap(implicitTypes, explicitTypes) {
|
|
3794
|
+
const result = {
|
|
3795
|
+
fallback: /* @__PURE__ */ new Map(),
|
|
3796
|
+
mapping: /* @__PURE__ */ new Map(),
|
|
3797
|
+
scalar: /* @__PURE__ */ new Map(),
|
|
3798
|
+
sequence: /* @__PURE__ */ new Map()
|
|
3799
|
+
};
|
|
3800
|
+
const fallbackMap = result.fallback;
|
|
3801
|
+
for (const type of [
|
|
3802
|
+
...implicitTypes,
|
|
3803
|
+
...explicitTypes
|
|
3804
|
+
]) {
|
|
3805
|
+
const map2 = result[type.kind];
|
|
3806
|
+
map2.set(type.tag, type);
|
|
3807
|
+
fallbackMap.set(type.tag, type);
|
|
3808
|
+
}
|
|
3809
|
+
return result;
|
|
3810
|
+
}
|
|
3811
|
+
function createSchema({ explicitTypes = [], implicitTypes = [], include }) {
|
|
3812
|
+
if (include) {
|
|
3813
|
+
implicitTypes.push(...include.implicitTypes);
|
|
3814
|
+
explicitTypes.push(...include.explicitTypes);
|
|
3815
|
+
}
|
|
3816
|
+
const typeMap = createTypeMap(implicitTypes, explicitTypes);
|
|
3817
|
+
return {
|
|
3818
|
+
implicitTypes,
|
|
3819
|
+
explicitTypes,
|
|
3820
|
+
typeMap
|
|
3821
|
+
};
|
|
3822
|
+
}
|
|
3823
|
+
var FAILSAFE_SCHEMA = createSchema({
|
|
3824
|
+
explicitTypes: [
|
|
3825
|
+
str,
|
|
3826
|
+
seq,
|
|
3827
|
+
map
|
|
3828
|
+
]
|
|
3829
|
+
});
|
|
3830
|
+
var JSON_SCHEMA = createSchema({
|
|
3831
|
+
implicitTypes: [
|
|
3832
|
+
nil,
|
|
3833
|
+
bool,
|
|
3834
|
+
int,
|
|
3835
|
+
float
|
|
3836
|
+
],
|
|
3837
|
+
include: FAILSAFE_SCHEMA
|
|
3838
|
+
});
|
|
3839
|
+
var CORE_SCHEMA = createSchema({
|
|
3840
|
+
include: JSON_SCHEMA
|
|
3841
|
+
});
|
|
3842
|
+
var DEFAULT_SCHEMA = createSchema({
|
|
3843
|
+
explicitTypes: [
|
|
3844
|
+
binary,
|
|
3845
|
+
omap,
|
|
3846
|
+
pairs,
|
|
3847
|
+
set
|
|
3848
|
+
],
|
|
3849
|
+
implicitTypes: [
|
|
3850
|
+
timestamp,
|
|
3851
|
+
merge
|
|
3852
|
+
],
|
|
3853
|
+
include: CORE_SCHEMA
|
|
3854
|
+
});
|
|
3855
|
+
var EXTENDED_SCHEMA = createSchema({
|
|
3856
|
+
explicitTypes: [
|
|
3857
|
+
regexp,
|
|
3858
|
+
undefinedType
|
|
3859
|
+
],
|
|
3860
|
+
include: DEFAULT_SCHEMA
|
|
3861
|
+
});
|
|
3862
|
+
var SCHEMA_MAP = /* @__PURE__ */ new Map([
|
|
3863
|
+
[
|
|
3864
|
+
"core",
|
|
3865
|
+
CORE_SCHEMA
|
|
3866
|
+
],
|
|
3867
|
+
[
|
|
3868
|
+
"default",
|
|
3869
|
+
DEFAULT_SCHEMA
|
|
3870
|
+
],
|
|
3871
|
+
[
|
|
3872
|
+
"failsafe",
|
|
3873
|
+
FAILSAFE_SCHEMA
|
|
3874
|
+
],
|
|
3875
|
+
[
|
|
3876
|
+
"json",
|
|
3877
|
+
JSON_SCHEMA
|
|
3878
|
+
],
|
|
3879
|
+
[
|
|
3880
|
+
"extended",
|
|
3881
|
+
EXTENDED_SCHEMA
|
|
3882
|
+
]
|
|
3883
|
+
]);
|
|
3884
|
+
|
|
3885
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/_loader_state.js
|
|
3886
|
+
var CONTEXT_FLOW_IN = 1;
|
|
3887
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
3888
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
3889
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
3890
|
+
var CHOMPING_CLIP = 1;
|
|
3891
|
+
var CHOMPING_STRIP = 2;
|
|
3892
|
+
var CHOMPING_KEEP = 3;
|
|
3893
|
+
var PATTERN_NON_PRINTABLE = (
|
|
3894
|
+
// deno-lint-ignore no-control-regex
|
|
3895
|
+
/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
|
|
3896
|
+
);
|
|
3897
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
3898
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
3899
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
3900
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
3901
|
+
var ESCAPED_HEX_LENGTHS = /* @__PURE__ */ new Map([
|
|
3902
|
+
[
|
|
3903
|
+
120,
|
|
3904
|
+
2
|
|
3905
|
+
],
|
|
3906
|
+
[
|
|
3907
|
+
117,
|
|
3908
|
+
4
|
|
3909
|
+
],
|
|
3910
|
+
[
|
|
3911
|
+
85,
|
|
3912
|
+
8
|
|
3913
|
+
]
|
|
3914
|
+
]);
|
|
3915
|
+
var SIMPLE_ESCAPE_SEQUENCES = /* @__PURE__ */ new Map([
|
|
3916
|
+
[
|
|
3917
|
+
48,
|
|
3918
|
+
"\0"
|
|
3919
|
+
],
|
|
3920
|
+
[
|
|
3921
|
+
97,
|
|
3922
|
+
"\x07"
|
|
3923
|
+
],
|
|
3924
|
+
[
|
|
3925
|
+
98,
|
|
3926
|
+
"\b"
|
|
3927
|
+
],
|
|
3928
|
+
[
|
|
3929
|
+
116,
|
|
3930
|
+
" "
|
|
3931
|
+
],
|
|
3932
|
+
[
|
|
3933
|
+
9,
|
|
3934
|
+
" "
|
|
3935
|
+
],
|
|
3936
|
+
[
|
|
3937
|
+
110,
|
|
3938
|
+
"\n"
|
|
3939
|
+
],
|
|
3940
|
+
[
|
|
3941
|
+
118,
|
|
3942
|
+
"\v"
|
|
3943
|
+
],
|
|
3944
|
+
[
|
|
3945
|
+
102,
|
|
3946
|
+
"\f"
|
|
3947
|
+
],
|
|
3948
|
+
[
|
|
3949
|
+
114,
|
|
3950
|
+
"\r"
|
|
3951
|
+
],
|
|
3952
|
+
[
|
|
3953
|
+
101,
|
|
3954
|
+
"\x1B"
|
|
3955
|
+
],
|
|
3956
|
+
[
|
|
3957
|
+
32,
|
|
3958
|
+
" "
|
|
3959
|
+
],
|
|
3960
|
+
[
|
|
3961
|
+
34,
|
|
3962
|
+
'"'
|
|
3963
|
+
],
|
|
3964
|
+
[
|
|
3965
|
+
47,
|
|
3966
|
+
"/"
|
|
3967
|
+
],
|
|
3968
|
+
[
|
|
3969
|
+
92,
|
|
3970
|
+
"\\"
|
|
3971
|
+
],
|
|
3972
|
+
[
|
|
3973
|
+
78,
|
|
3974
|
+
"\x85"
|
|
3975
|
+
],
|
|
3976
|
+
[
|
|
3977
|
+
95,
|
|
3978
|
+
"\xA0"
|
|
3979
|
+
],
|
|
3980
|
+
[
|
|
3981
|
+
76,
|
|
3982
|
+
"\u2028"
|
|
3983
|
+
],
|
|
3984
|
+
[
|
|
3985
|
+
80,
|
|
3986
|
+
"\u2029"
|
|
3987
|
+
]
|
|
3988
|
+
]);
|
|
3989
|
+
function hexCharCodeToNumber(charCode) {
|
|
3990
|
+
if (48 <= charCode && charCode <= 57) return charCode - 48;
|
|
3991
|
+
const lc = charCode | 32;
|
|
3992
|
+
if (97 <= lc && lc <= 102) return lc - 97 + 10;
|
|
3993
|
+
return -1;
|
|
3994
|
+
}
|
|
3995
|
+
function decimalCharCodeToNumber(charCode) {
|
|
3996
|
+
if (48 <= charCode && charCode <= 57) return charCode - 48;
|
|
3997
|
+
return -1;
|
|
3998
|
+
}
|
|
3999
|
+
function codepointToChar(codepoint) {
|
|
4000
|
+
if (codepoint <= 65535) return String.fromCharCode(codepoint);
|
|
4001
|
+
return String.fromCharCode((codepoint - 65536 >> 10) + 55296, (codepoint - 65536 & 1023) + 56320);
|
|
4002
|
+
}
|
|
4003
|
+
var INDENT = 4;
|
|
4004
|
+
var MAX_LENGTH = 75;
|
|
4005
|
+
var DELIMITERS = "\0\r\n\x85\u2028\u2029";
|
|
4006
|
+
function getSnippet(buffer, position) {
|
|
4007
|
+
if (!buffer) return null;
|
|
4008
|
+
let start = position;
|
|
4009
|
+
let end = position;
|
|
4010
|
+
let head = "";
|
|
4011
|
+
let tail = "";
|
|
4012
|
+
while (start > 0 && !DELIMITERS.includes(buffer.charAt(start - 1))) {
|
|
4013
|
+
start--;
|
|
4014
|
+
if (position - start > MAX_LENGTH / 2 - 1) {
|
|
4015
|
+
head = " ... ";
|
|
4016
|
+
start += 5;
|
|
4017
|
+
break;
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
while (end < buffer.length && !DELIMITERS.includes(buffer.charAt(end))) {
|
|
4021
|
+
end++;
|
|
4022
|
+
if (end - position > MAX_LENGTH / 2 - 1) {
|
|
4023
|
+
tail = " ... ";
|
|
4024
|
+
end -= 5;
|
|
4025
|
+
break;
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
const snippet = buffer.slice(start, end);
|
|
4029
|
+
const indent = " ".repeat(INDENT);
|
|
4030
|
+
const caretIndent = " ".repeat(INDENT + position - start + head.length);
|
|
4031
|
+
return `${indent + head + snippet + tail}
|
|
4032
|
+
${caretIndent}^`;
|
|
4033
|
+
}
|
|
4034
|
+
function markToString(buffer, position, line, column) {
|
|
4035
|
+
let where = `at line ${line + 1}, column ${column + 1}`;
|
|
4036
|
+
const snippet = getSnippet(buffer, position);
|
|
4037
|
+
if (snippet) where += `:
|
|
4038
|
+
${snippet}`;
|
|
4039
|
+
return where;
|
|
4040
|
+
}
|
|
4041
|
+
function getIndentStatus(lineIndent, parentIndent) {
|
|
4042
|
+
if (lineIndent > parentIndent) return 1;
|
|
4043
|
+
if (lineIndent < parentIndent) return -1;
|
|
4044
|
+
return 0;
|
|
4045
|
+
}
|
|
4046
|
+
function writeFoldedLines(count) {
|
|
4047
|
+
if (count === 1) return " ";
|
|
4048
|
+
if (count > 1) return "\n".repeat(count - 1);
|
|
4049
|
+
return "";
|
|
4050
|
+
}
|
|
4051
|
+
var LoaderState = class {
|
|
4052
|
+
input;
|
|
4053
|
+
length;
|
|
4054
|
+
lineIndent = 0;
|
|
4055
|
+
lineStart = 0;
|
|
4056
|
+
position = 0;
|
|
4057
|
+
line = 0;
|
|
4058
|
+
onWarning;
|
|
4059
|
+
allowDuplicateKeys;
|
|
4060
|
+
implicitTypes;
|
|
4061
|
+
typeMap;
|
|
4062
|
+
checkLineBreaks = false;
|
|
4063
|
+
tagMap = /* @__PURE__ */ new Map();
|
|
4064
|
+
anchorMap = /* @__PURE__ */ new Map();
|
|
4065
|
+
constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false }) {
|
|
4066
|
+
this.input = input;
|
|
4067
|
+
this.onWarning = onWarning;
|
|
4068
|
+
this.allowDuplicateKeys = allowDuplicateKeys;
|
|
4069
|
+
this.implicitTypes = schema.implicitTypes;
|
|
4070
|
+
this.typeMap = schema.typeMap;
|
|
4071
|
+
this.length = input.length;
|
|
4072
|
+
this.readIndent();
|
|
4073
|
+
}
|
|
4074
|
+
skipWhitespaces() {
|
|
4075
|
+
let ch = this.peek();
|
|
4076
|
+
while (isWhiteSpace(ch)) {
|
|
4077
|
+
ch = this.next();
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
skipComment() {
|
|
4081
|
+
let ch = this.peek();
|
|
4082
|
+
if (ch !== SHARP) return;
|
|
4083
|
+
ch = this.next();
|
|
4084
|
+
while (ch !== 0 && !isEOL(ch)) {
|
|
4085
|
+
ch = this.next();
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
readIndent() {
|
|
4089
|
+
let char = this.peek();
|
|
4090
|
+
while (char === SPACE) {
|
|
4091
|
+
this.lineIndent += 1;
|
|
4092
|
+
char = this.next();
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
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
|
+
#createError(message) {
|
|
4103
|
+
const mark = markToString(this.input, this.position, this.line, this.position - this.lineStart);
|
|
4104
|
+
return new SyntaxError(`${message} ${mark}`);
|
|
4105
|
+
}
|
|
4106
|
+
dispatchWarning(message) {
|
|
4107
|
+
const error = this.#createError(message);
|
|
4108
|
+
this.onWarning?.(error);
|
|
4109
|
+
}
|
|
4110
|
+
yamlDirectiveHandler(args) {
|
|
4111
|
+
if (args.length !== 1) {
|
|
4112
|
+
throw this.#createError("Cannot handle YAML directive: YAML directive accepts exactly one argument");
|
|
4113
|
+
}
|
|
4114
|
+
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
4115
|
+
if (match === null) {
|
|
4116
|
+
throw this.#createError("Cannot handle YAML directive: ill-formed argument");
|
|
4117
|
+
}
|
|
4118
|
+
const major = parseInt(match[1], 10);
|
|
4119
|
+
const minor = parseInt(match[2], 10);
|
|
4120
|
+
if (major !== 1) {
|
|
4121
|
+
throw this.#createError("Cannot handle YAML directive: unacceptable YAML version");
|
|
4122
|
+
}
|
|
4123
|
+
this.checkLineBreaks = minor < 2;
|
|
4124
|
+
if (minor !== 1 && minor !== 2) {
|
|
4125
|
+
this.dispatchWarning("Cannot handle YAML directive: unsupported YAML version");
|
|
4126
|
+
}
|
|
4127
|
+
return args[0] ?? null;
|
|
4128
|
+
}
|
|
4129
|
+
tagDirectiveHandler(args) {
|
|
4130
|
+
if (args.length !== 2) {
|
|
4131
|
+
throw this.#createError(`Cannot handle tag directive: directive accepts exactly two arguments, received ${args.length}`);
|
|
4132
|
+
}
|
|
4133
|
+
const handle = args[0];
|
|
4134
|
+
const prefix = args[1];
|
|
4135
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
4136
|
+
throw this.#createError(`Cannot handle tag directive: ill-formed handle (first argument) in "${handle}"`);
|
|
4137
|
+
}
|
|
4138
|
+
if (this.tagMap.has(handle)) {
|
|
4139
|
+
throw this.#createError(`Cannot handle tag directive: previously declared suffix for "${handle}" tag handle`);
|
|
4140
|
+
}
|
|
4141
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
4142
|
+
throw this.#createError("Cannot handle tag directive: ill-formed tag prefix (second argument) of the TAG directive");
|
|
4143
|
+
}
|
|
4144
|
+
this.tagMap.set(handle, prefix);
|
|
4145
|
+
}
|
|
4146
|
+
captureSegment(start, end, checkJson) {
|
|
4147
|
+
if (start < end) {
|
|
4148
|
+
const result = this.input.slice(start, end);
|
|
4149
|
+
if (checkJson) {
|
|
4150
|
+
for (let position = 0; position < result.length; position++) {
|
|
4151
|
+
const character = result.charCodeAt(position);
|
|
4152
|
+
if (!(character === 9 || 32 <= character && character <= 1114111)) {
|
|
4153
|
+
throw this.#createError(`Expected valid JSON character: received "${character}"`);
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
} else if (PATTERN_NON_PRINTABLE.test(result)) {
|
|
4157
|
+
throw this.#createError("Stream contains non-printable characters");
|
|
4158
|
+
}
|
|
4159
|
+
return result;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
readBlockSequence(tag, anchor, nodeIndent) {
|
|
4163
|
+
let detected = false;
|
|
4164
|
+
const result = [];
|
|
4165
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4166
|
+
let ch = this.peek();
|
|
4167
|
+
while (ch !== 0) {
|
|
4168
|
+
if (ch !== MINUS) {
|
|
4169
|
+
break;
|
|
4170
|
+
}
|
|
4171
|
+
const following = this.peek(1);
|
|
4172
|
+
if (!isWhiteSpaceOrEOL(following)) {
|
|
4173
|
+
break;
|
|
4174
|
+
}
|
|
4175
|
+
detected = true;
|
|
4176
|
+
this.position++;
|
|
4177
|
+
if (this.skipSeparationSpace(true, -1)) {
|
|
4178
|
+
if (this.lineIndent <= nodeIndent) {
|
|
4179
|
+
result.push(null);
|
|
4180
|
+
ch = this.peek();
|
|
4181
|
+
continue;
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
const line = this.line;
|
|
4185
|
+
const newState = this.composeNode({
|
|
4186
|
+
parentIndent: nodeIndent,
|
|
4187
|
+
nodeContext: CONTEXT_BLOCK_IN,
|
|
4188
|
+
allowToSeek: false,
|
|
4189
|
+
allowCompact: true
|
|
4190
|
+
});
|
|
4191
|
+
if (newState) result.push(newState.result);
|
|
4192
|
+
this.skipSeparationSpace(true, -1);
|
|
4193
|
+
ch = this.peek();
|
|
4194
|
+
if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
|
|
4195
|
+
throw this.#createError("Cannot read block sequence: bad indentation of a sequence entry");
|
|
4196
|
+
} else if (this.lineIndent < nodeIndent) {
|
|
4197
|
+
break;
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
if (detected) return {
|
|
4201
|
+
tag,
|
|
4202
|
+
anchor,
|
|
4203
|
+
kind: "sequence",
|
|
4204
|
+
result
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4207
|
+
mergeMappings(destination, source, overridableKeys) {
|
|
4208
|
+
if (!isObject(source)) {
|
|
4209
|
+
throw this.#createError("Cannot merge mappings: the provided source object is unacceptable");
|
|
4210
|
+
}
|
|
4211
|
+
for (const [key, value] of Object.entries(source)) {
|
|
4212
|
+
if (Object.hasOwn(destination, key)) continue;
|
|
4213
|
+
Object.defineProperty(destination, key, {
|
|
4214
|
+
value,
|
|
4215
|
+
writable: true,
|
|
4216
|
+
enumerable: true,
|
|
4217
|
+
configurable: true
|
|
4218
|
+
});
|
|
4219
|
+
overridableKeys.add(key);
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
|
4223
|
+
if (Array.isArray(keyNode)) {
|
|
4224
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
4225
|
+
for (let index = 0; index < keyNode.length; index++) {
|
|
4226
|
+
if (Array.isArray(keyNode[index])) {
|
|
4227
|
+
throw this.#createError("Cannot store mapping pair: nested arrays are not supported inside keys");
|
|
4228
|
+
}
|
|
4229
|
+
if (typeof keyNode === "object" && isPlainObject(keyNode[index])) {
|
|
4230
|
+
keyNode[index] = "[object Object]";
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
if (typeof keyNode === "object" && isPlainObject(keyNode)) {
|
|
4235
|
+
keyNode = "[object Object]";
|
|
4236
|
+
}
|
|
4237
|
+
keyNode = String(keyNode);
|
|
4238
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
4239
|
+
if (Array.isArray(valueNode)) {
|
|
4240
|
+
for (let index = 0; index < valueNode.length; index++) {
|
|
4241
|
+
this.mergeMappings(result, valueNode[index], overridableKeys);
|
|
4242
|
+
}
|
|
4243
|
+
} else {
|
|
4244
|
+
this.mergeMappings(result, valueNode, overridableKeys);
|
|
4245
|
+
}
|
|
4246
|
+
} else {
|
|
4247
|
+
if (!this.allowDuplicateKeys && !overridableKeys.has(keyNode) && Object.hasOwn(result, keyNode)) {
|
|
4248
|
+
this.line = startLine || this.line;
|
|
4249
|
+
this.position = startPos || this.position;
|
|
4250
|
+
throw this.#createError("Cannot store mapping pair: duplicated key");
|
|
4251
|
+
}
|
|
4252
|
+
Object.defineProperty(result, keyNode, {
|
|
4253
|
+
value: valueNode,
|
|
4254
|
+
writable: true,
|
|
4255
|
+
enumerable: true,
|
|
4256
|
+
configurable: true
|
|
4257
|
+
});
|
|
4258
|
+
overridableKeys.delete(keyNode);
|
|
4259
|
+
}
|
|
4260
|
+
return result;
|
|
4261
|
+
}
|
|
4262
|
+
readLineBreak() {
|
|
4263
|
+
const ch = this.peek();
|
|
4264
|
+
if (ch === LINE_FEED) {
|
|
4265
|
+
this.position++;
|
|
4266
|
+
} else if (ch === CARRIAGE_RETURN) {
|
|
4267
|
+
this.position++;
|
|
4268
|
+
if (this.peek() === LINE_FEED) {
|
|
4269
|
+
this.position++;
|
|
4270
|
+
}
|
|
4271
|
+
} else {
|
|
4272
|
+
throw this.#createError("Cannot read line: line break not found");
|
|
4273
|
+
}
|
|
4274
|
+
this.line += 1;
|
|
4275
|
+
this.lineStart = this.position;
|
|
4276
|
+
}
|
|
4277
|
+
skipSeparationSpace(allowComments, checkIndent) {
|
|
4278
|
+
let lineBreaks = 0;
|
|
4279
|
+
let ch = this.peek();
|
|
4280
|
+
while (ch !== 0) {
|
|
4281
|
+
this.skipWhitespaces();
|
|
4282
|
+
ch = this.peek();
|
|
4283
|
+
if (allowComments) {
|
|
4284
|
+
this.skipComment();
|
|
4285
|
+
ch = this.peek();
|
|
4286
|
+
}
|
|
4287
|
+
if (isEOL(ch)) {
|
|
4288
|
+
this.readLineBreak();
|
|
4289
|
+
ch = this.peek();
|
|
4290
|
+
lineBreaks++;
|
|
4291
|
+
this.lineIndent = 0;
|
|
4292
|
+
this.readIndent();
|
|
4293
|
+
ch = this.peek();
|
|
4294
|
+
} else {
|
|
4295
|
+
break;
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && this.lineIndent < checkIndent) {
|
|
4299
|
+
this.dispatchWarning("deficient indentation");
|
|
4300
|
+
}
|
|
4301
|
+
return lineBreaks;
|
|
4302
|
+
}
|
|
4303
|
+
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);
|
|
4307
|
+
if (ch === 0 || isWhiteSpaceOrEOL(ch)) {
|
|
4308
|
+
return true;
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
return false;
|
|
4312
|
+
}
|
|
4313
|
+
readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
|
|
4314
|
+
let ch = this.peek();
|
|
4315
|
+
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
|
+
return;
|
|
4317
|
+
}
|
|
4318
|
+
let following;
|
|
4319
|
+
if (ch === QUESTION || ch === MINUS) {
|
|
4320
|
+
following = this.peek(1);
|
|
4321
|
+
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4322
|
+
return;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
let result = "";
|
|
4326
|
+
let captureEnd = this.position;
|
|
4327
|
+
let captureStart = this.position;
|
|
4328
|
+
let hasPendingContent = false;
|
|
4329
|
+
let line = 0;
|
|
4330
|
+
while (ch !== 0) {
|
|
4331
|
+
if (ch === COLON) {
|
|
4332
|
+
following = this.peek(1);
|
|
4333
|
+
if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4334
|
+
break;
|
|
4335
|
+
}
|
|
4336
|
+
} else if (ch === SHARP) {
|
|
4337
|
+
const preceding = this.peek(-1);
|
|
4338
|
+
if (isWhiteSpaceOrEOL(preceding)) {
|
|
4339
|
+
break;
|
|
4340
|
+
}
|
|
4341
|
+
} else if (this.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4342
|
+
break;
|
|
4343
|
+
} else if (isEOL(ch)) {
|
|
4344
|
+
line = this.line;
|
|
4345
|
+
const lineStart = this.lineStart;
|
|
4346
|
+
const lineIndent = this.lineIndent;
|
|
4347
|
+
this.skipSeparationSpace(false, -1);
|
|
4348
|
+
if (this.lineIndent >= nodeIndent) {
|
|
4349
|
+
hasPendingContent = true;
|
|
4350
|
+
ch = this.peek();
|
|
4351
|
+
continue;
|
|
4352
|
+
} else {
|
|
4353
|
+
this.position = captureEnd;
|
|
4354
|
+
this.line = line;
|
|
4355
|
+
this.lineStart = lineStart;
|
|
4356
|
+
this.lineIndent = lineIndent;
|
|
4357
|
+
break;
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
if (hasPendingContent) {
|
|
4361
|
+
const segment2 = this.captureSegment(captureStart, captureEnd, false);
|
|
4362
|
+
if (segment2) result += segment2;
|
|
4363
|
+
result += writeFoldedLines(this.line - line);
|
|
4364
|
+
captureStart = captureEnd = this.position;
|
|
4365
|
+
hasPendingContent = false;
|
|
4366
|
+
}
|
|
4367
|
+
if (!isWhiteSpace(ch)) {
|
|
4368
|
+
captureEnd = this.position + 1;
|
|
4369
|
+
}
|
|
4370
|
+
ch = this.next();
|
|
4371
|
+
}
|
|
4372
|
+
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
4373
|
+
if (segment) result += segment;
|
|
4374
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4375
|
+
if (result) return {
|
|
4376
|
+
tag,
|
|
4377
|
+
anchor,
|
|
4378
|
+
kind: "scalar",
|
|
4379
|
+
result
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
readSingleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4383
|
+
let ch = this.peek();
|
|
4384
|
+
if (ch !== SINGLE_QUOTE) return;
|
|
4385
|
+
let result = "";
|
|
4386
|
+
this.position++;
|
|
4387
|
+
let captureStart = this.position;
|
|
4388
|
+
let captureEnd = this.position;
|
|
4389
|
+
ch = this.peek();
|
|
4390
|
+
while (ch !== 0) {
|
|
4391
|
+
if (ch === SINGLE_QUOTE) {
|
|
4392
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4393
|
+
if (segment) result += segment;
|
|
4394
|
+
ch = this.next();
|
|
4395
|
+
if (ch === SINGLE_QUOTE) {
|
|
4396
|
+
captureStart = this.position;
|
|
4397
|
+
this.position++;
|
|
4398
|
+
captureEnd = this.position;
|
|
4399
|
+
} else {
|
|
4400
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4401
|
+
return {
|
|
4402
|
+
tag,
|
|
4403
|
+
anchor,
|
|
4404
|
+
kind: "scalar",
|
|
4405
|
+
result
|
|
4406
|
+
};
|
|
4407
|
+
}
|
|
4408
|
+
} else if (isEOL(ch)) {
|
|
4409
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4410
|
+
if (segment) result += segment;
|
|
4411
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4412
|
+
captureStart = captureEnd = this.position;
|
|
4413
|
+
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4414
|
+
throw this.#createError("Unexpected end of the document within a single quoted scalar");
|
|
4415
|
+
} else {
|
|
4416
|
+
this.position++;
|
|
4417
|
+
captureEnd = this.position;
|
|
4418
|
+
}
|
|
4419
|
+
ch = this.peek();
|
|
4420
|
+
}
|
|
4421
|
+
throw this.#createError("Unexpected end of the stream within a single quoted scalar");
|
|
4422
|
+
}
|
|
4423
|
+
readDoubleQuotedScalar(tag, anchor, nodeIndent) {
|
|
4424
|
+
let ch = this.peek();
|
|
4425
|
+
if (ch !== DOUBLE_QUOTE) return;
|
|
4426
|
+
let result = "";
|
|
4427
|
+
this.position++;
|
|
4428
|
+
let captureEnd = this.position;
|
|
4429
|
+
let captureStart = this.position;
|
|
4430
|
+
let tmp;
|
|
4431
|
+
ch = this.peek();
|
|
4432
|
+
while (ch !== 0) {
|
|
4433
|
+
if (ch === DOUBLE_QUOTE) {
|
|
4434
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4435
|
+
if (segment) result += segment;
|
|
4436
|
+
this.position++;
|
|
4437
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4438
|
+
return {
|
|
4439
|
+
tag,
|
|
4440
|
+
anchor,
|
|
4441
|
+
kind: "scalar",
|
|
4442
|
+
result
|
|
4443
|
+
};
|
|
4444
|
+
}
|
|
4445
|
+
if (ch === BACKSLASH) {
|
|
4446
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
4447
|
+
if (segment) result += segment;
|
|
4448
|
+
ch = this.next();
|
|
4449
|
+
if (isEOL(ch)) {
|
|
4450
|
+
this.skipSeparationSpace(false, nodeIndent);
|
|
4451
|
+
} else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
|
|
4452
|
+
result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
|
|
4453
|
+
this.position++;
|
|
4454
|
+
} else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
|
|
4455
|
+
let hexLength = tmp;
|
|
4456
|
+
let hexResult = 0;
|
|
4457
|
+
for (; hexLength > 0; hexLength--) {
|
|
4458
|
+
ch = this.next();
|
|
4459
|
+
if ((tmp = hexCharCodeToNumber(ch)) >= 0) {
|
|
4460
|
+
hexResult = (hexResult << 4) + tmp;
|
|
4461
|
+
} else {
|
|
4462
|
+
throw this.#createError("Cannot read double quoted scalar: expected hexadecimal character");
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
result += codepointToChar(hexResult);
|
|
4466
|
+
this.position++;
|
|
4467
|
+
} else {
|
|
4468
|
+
throw this.#createError("Cannot read double quoted scalar: unknown escape sequence");
|
|
4469
|
+
}
|
|
4470
|
+
captureStart = captureEnd = this.position;
|
|
4471
|
+
} else if (isEOL(ch)) {
|
|
4472
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
4473
|
+
if (segment) result += segment;
|
|
4474
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
4475
|
+
captureStart = captureEnd = this.position;
|
|
4476
|
+
} else if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
4477
|
+
throw this.#createError("Unexpected end of the document within a double quoted scalar");
|
|
4478
|
+
} else {
|
|
4479
|
+
this.position++;
|
|
4480
|
+
captureEnd = this.position;
|
|
4481
|
+
}
|
|
4482
|
+
ch = this.peek();
|
|
4483
|
+
}
|
|
4484
|
+
throw this.#createError("Unexpected end of the stream within a double quoted scalar");
|
|
4485
|
+
}
|
|
4486
|
+
readFlowCollection(tag, anchor, nodeIndent) {
|
|
4487
|
+
let ch = this.peek();
|
|
4488
|
+
let terminator;
|
|
4489
|
+
let isMapping = true;
|
|
4490
|
+
let result = {};
|
|
4491
|
+
if (ch === LEFT_SQUARE_BRACKET) {
|
|
4492
|
+
terminator = RIGHT_SQUARE_BRACKET;
|
|
4493
|
+
isMapping = false;
|
|
4494
|
+
result = [];
|
|
4495
|
+
} else if (ch === LEFT_CURLY_BRACKET) {
|
|
4496
|
+
terminator = RIGHT_CURLY_BRACKET;
|
|
4497
|
+
} else {
|
|
4498
|
+
return;
|
|
4499
|
+
}
|
|
4500
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4501
|
+
ch = this.next();
|
|
4502
|
+
let readNext = true;
|
|
4503
|
+
let valueNode = null;
|
|
4504
|
+
let keyNode = null;
|
|
4505
|
+
let keyTag = null;
|
|
4506
|
+
let isExplicitPair = false;
|
|
4507
|
+
let isPair = false;
|
|
4508
|
+
let following = 0;
|
|
4509
|
+
let line = 0;
|
|
4510
|
+
const overridableKeys = /* @__PURE__ */ new Set();
|
|
4511
|
+
while (ch !== 0) {
|
|
4512
|
+
this.skipSeparationSpace(true, nodeIndent);
|
|
4513
|
+
ch = this.peek();
|
|
4514
|
+
if (ch === terminator) {
|
|
4515
|
+
this.position++;
|
|
4516
|
+
const kind = isMapping ? "mapping" : "sequence";
|
|
4517
|
+
return {
|
|
4518
|
+
tag,
|
|
4519
|
+
anchor,
|
|
4520
|
+
kind,
|
|
4521
|
+
result
|
|
4522
|
+
};
|
|
4523
|
+
}
|
|
4524
|
+
if (!readNext) {
|
|
4525
|
+
throw this.#createError("Cannot read flow collection: missing comma between flow collection entries");
|
|
4526
|
+
}
|
|
4527
|
+
keyTag = keyNode = valueNode = null;
|
|
4528
|
+
isPair = isExplicitPair = false;
|
|
4529
|
+
if (ch === QUESTION) {
|
|
4530
|
+
following = this.peek(1);
|
|
4531
|
+
if (isWhiteSpaceOrEOL(following)) {
|
|
4532
|
+
isPair = isExplicitPair = true;
|
|
4533
|
+
this.position++;
|
|
4534
|
+
this.skipSeparationSpace(true, nodeIndent);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
line = this.line;
|
|
4538
|
+
const newState = this.composeNode({
|
|
4539
|
+
parentIndent: nodeIndent,
|
|
4540
|
+
nodeContext: CONTEXT_FLOW_IN,
|
|
4541
|
+
allowToSeek: false,
|
|
4542
|
+
allowCompact: true
|
|
4543
|
+
});
|
|
4544
|
+
if (newState) {
|
|
4545
|
+
keyTag = newState.tag || null;
|
|
4546
|
+
keyNode = newState.result;
|
|
4547
|
+
}
|
|
4548
|
+
this.skipSeparationSpace(true, nodeIndent);
|
|
4549
|
+
ch = this.peek();
|
|
4550
|
+
if ((isExplicitPair || this.line === line) && ch === COLON) {
|
|
4551
|
+
isPair = true;
|
|
4552
|
+
ch = this.next();
|
|
4553
|
+
this.skipSeparationSpace(true, nodeIndent);
|
|
4554
|
+
const newState2 = this.composeNode({
|
|
4555
|
+
parentIndent: nodeIndent,
|
|
4556
|
+
nodeContext: CONTEXT_FLOW_IN,
|
|
4557
|
+
allowToSeek: false,
|
|
4558
|
+
allowCompact: true
|
|
4559
|
+
});
|
|
4560
|
+
if (newState2) valueNode = newState2.result;
|
|
4561
|
+
}
|
|
4562
|
+
if (isMapping) {
|
|
4563
|
+
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode);
|
|
4564
|
+
} else if (isPair) {
|
|
4565
|
+
result.push(this.storeMappingPair({}, overridableKeys, keyTag, keyNode, valueNode));
|
|
4566
|
+
} else {
|
|
4567
|
+
result.push(keyNode);
|
|
4568
|
+
}
|
|
4569
|
+
this.skipSeparationSpace(true, nodeIndent);
|
|
4570
|
+
ch = this.peek();
|
|
4571
|
+
if (ch === COMMA) {
|
|
4572
|
+
readNext = true;
|
|
4573
|
+
ch = this.next();
|
|
4574
|
+
} else {
|
|
4575
|
+
readNext = false;
|
|
4576
|
+
}
|
|
4577
|
+
}
|
|
4578
|
+
throw this.#createError("Cannot read flow collection: unexpected end of the stream within a flow collection");
|
|
4579
|
+
}
|
|
4580
|
+
// Handles block scaler styles: e.g. '|', '>', '|-' and '>-'.
|
|
4581
|
+
// https://yaml.org/spec/1.2.2/#81-block-scalar-styles
|
|
4582
|
+
readBlockScalar(tag, anchor, nodeIndent) {
|
|
4583
|
+
let chomping = CHOMPING_CLIP;
|
|
4584
|
+
let didReadContent = false;
|
|
4585
|
+
let detectedIndent = false;
|
|
4586
|
+
let textIndent = nodeIndent;
|
|
4587
|
+
let emptyLines = 0;
|
|
4588
|
+
let atMoreIndented = false;
|
|
4589
|
+
let ch = this.peek();
|
|
4590
|
+
let folding = false;
|
|
4591
|
+
if (ch === VERTICAL_LINE) {
|
|
4592
|
+
folding = false;
|
|
4593
|
+
} else if (ch === GREATER_THAN) {
|
|
4594
|
+
folding = true;
|
|
4595
|
+
} else {
|
|
4596
|
+
return;
|
|
4597
|
+
}
|
|
4598
|
+
let result = "";
|
|
4599
|
+
let tmp = 0;
|
|
4600
|
+
while (ch !== 0) {
|
|
4601
|
+
ch = this.next();
|
|
4602
|
+
if (ch === PLUS || ch === MINUS) {
|
|
4603
|
+
if (CHOMPING_CLIP === chomping) {
|
|
4604
|
+
chomping = ch === PLUS ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
4605
|
+
} else {
|
|
4606
|
+
throw this.#createError("Cannot read block: chomping mode identifier repeated");
|
|
4607
|
+
}
|
|
4608
|
+
} else if ((tmp = decimalCharCodeToNumber(ch)) >= 0) {
|
|
4609
|
+
if (tmp === 0) {
|
|
4610
|
+
throw this.#createError("Cannot read block: indentation width must be greater than 0");
|
|
4611
|
+
} else if (!detectedIndent) {
|
|
4612
|
+
textIndent = nodeIndent + tmp - 1;
|
|
4613
|
+
detectedIndent = true;
|
|
4614
|
+
} else {
|
|
4615
|
+
throw this.#createError("Cannot read block: indentation width identifier repeated");
|
|
4616
|
+
}
|
|
4617
|
+
} else {
|
|
4618
|
+
break;
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
if (isWhiteSpace(ch)) {
|
|
4622
|
+
this.skipWhitespaces();
|
|
4623
|
+
this.skipComment();
|
|
4624
|
+
ch = this.peek();
|
|
4625
|
+
}
|
|
4626
|
+
while (ch !== 0) {
|
|
4627
|
+
this.readLineBreak();
|
|
4628
|
+
this.lineIndent = 0;
|
|
4629
|
+
ch = this.peek();
|
|
4630
|
+
while ((!detectedIndent || this.lineIndent < textIndent) && ch === SPACE) {
|
|
4631
|
+
this.lineIndent++;
|
|
4632
|
+
ch = this.next();
|
|
4633
|
+
}
|
|
4634
|
+
if (!detectedIndent && this.lineIndent > textIndent) {
|
|
4635
|
+
textIndent = this.lineIndent;
|
|
4636
|
+
}
|
|
4637
|
+
if (isEOL(ch)) {
|
|
4638
|
+
emptyLines++;
|
|
4639
|
+
continue;
|
|
4640
|
+
}
|
|
4641
|
+
if (this.lineIndent < textIndent) {
|
|
4642
|
+
if (chomping === CHOMPING_KEEP) {
|
|
4643
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
4644
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
4645
|
+
if (didReadContent) {
|
|
4646
|
+
result += "\n";
|
|
4647
|
+
}
|
|
4648
|
+
}
|
|
4649
|
+
break;
|
|
4650
|
+
}
|
|
4651
|
+
if (folding) {
|
|
4652
|
+
if (isWhiteSpace(ch)) {
|
|
4653
|
+
atMoreIndented = true;
|
|
4654
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
4655
|
+
} else if (atMoreIndented) {
|
|
4656
|
+
atMoreIndented = false;
|
|
4657
|
+
result += "\n".repeat(emptyLines + 1);
|
|
4658
|
+
} else if (emptyLines === 0) {
|
|
4659
|
+
if (didReadContent) {
|
|
4660
|
+
result += " ";
|
|
4661
|
+
}
|
|
4662
|
+
} else {
|
|
4663
|
+
result += "\n".repeat(emptyLines);
|
|
4664
|
+
}
|
|
4665
|
+
} else {
|
|
4666
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
4667
|
+
}
|
|
4668
|
+
didReadContent = true;
|
|
4669
|
+
detectedIndent = true;
|
|
4670
|
+
emptyLines = 0;
|
|
4671
|
+
const captureStart = this.position;
|
|
4672
|
+
while (!isEOL(ch) && ch !== 0) {
|
|
4673
|
+
ch = this.next();
|
|
4674
|
+
}
|
|
4675
|
+
const segment = this.captureSegment(captureStart, this.position, false);
|
|
4676
|
+
if (segment) result += segment;
|
|
4677
|
+
}
|
|
4678
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4679
|
+
return {
|
|
4680
|
+
tag,
|
|
4681
|
+
anchor,
|
|
4682
|
+
kind: "scalar",
|
|
4683
|
+
result
|
|
4684
|
+
};
|
|
4685
|
+
}
|
|
4686
|
+
readBlockMapping(tag, anchor, nodeIndent, flowIndent) {
|
|
4687
|
+
const result = {};
|
|
4688
|
+
const overridableKeys = /* @__PURE__ */ new Set();
|
|
4689
|
+
let allowCompact = false;
|
|
4690
|
+
let line;
|
|
4691
|
+
let pos;
|
|
4692
|
+
let keyTag = null;
|
|
4693
|
+
let keyNode = null;
|
|
4694
|
+
let valueNode = null;
|
|
4695
|
+
let atExplicitKey = false;
|
|
4696
|
+
let detected = false;
|
|
4697
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4698
|
+
let ch = this.peek();
|
|
4699
|
+
while (ch !== 0) {
|
|
4700
|
+
const following = this.peek(1);
|
|
4701
|
+
line = this.line;
|
|
4702
|
+
pos = this.position;
|
|
4703
|
+
if ((ch === QUESTION || ch === COLON) && isWhiteSpaceOrEOL(following)) {
|
|
4704
|
+
if (ch === QUESTION) {
|
|
4705
|
+
if (atExplicitKey) {
|
|
4706
|
+
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
|
|
4707
|
+
keyTag = null;
|
|
4708
|
+
keyNode = null;
|
|
4709
|
+
valueNode = null;
|
|
4710
|
+
}
|
|
4711
|
+
detected = true;
|
|
4712
|
+
atExplicitKey = true;
|
|
4713
|
+
allowCompact = true;
|
|
4714
|
+
} else if (atExplicitKey) {
|
|
4715
|
+
atExplicitKey = false;
|
|
4716
|
+
allowCompact = true;
|
|
4717
|
+
} else {
|
|
4718
|
+
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
|
+
}
|
|
4720
|
+
this.position += 1;
|
|
4721
|
+
ch = following;
|
|
4722
|
+
} else {
|
|
4723
|
+
const newState = this.composeNode({
|
|
4724
|
+
parentIndent: flowIndent,
|
|
4725
|
+
nodeContext: CONTEXT_FLOW_OUT,
|
|
4726
|
+
allowToSeek: false,
|
|
4727
|
+
allowCompact: true
|
|
4728
|
+
});
|
|
4729
|
+
if (!newState) break;
|
|
4730
|
+
if (this.line === line) {
|
|
4731
|
+
ch = this.peek();
|
|
4732
|
+
this.skipWhitespaces();
|
|
4733
|
+
ch = this.peek();
|
|
4734
|
+
if (ch === COLON) {
|
|
4735
|
+
ch = this.next();
|
|
4736
|
+
if (!isWhiteSpaceOrEOL(ch)) {
|
|
4737
|
+
throw this.#createError("Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");
|
|
4738
|
+
}
|
|
4739
|
+
if (atExplicitKey) {
|
|
4740
|
+
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
|
|
4741
|
+
keyTag = null;
|
|
4742
|
+
keyNode = null;
|
|
4743
|
+
valueNode = null;
|
|
4744
|
+
}
|
|
4745
|
+
detected = true;
|
|
4746
|
+
atExplicitKey = false;
|
|
4747
|
+
allowCompact = false;
|
|
4748
|
+
keyTag = newState.tag;
|
|
4749
|
+
keyNode = newState.result;
|
|
4750
|
+
} else if (detected) {
|
|
4751
|
+
throw this.#createError("Cannot read an implicit mapping pair: missing colon");
|
|
4752
|
+
} else {
|
|
4753
|
+
const { kind, result: result2 } = newState;
|
|
4754
|
+
return {
|
|
4755
|
+
tag,
|
|
4756
|
+
anchor,
|
|
4757
|
+
kind,
|
|
4758
|
+
result: result2
|
|
4759
|
+
};
|
|
4760
|
+
}
|
|
4761
|
+
} else if (detected) {
|
|
4762
|
+
throw this.#createError("Cannot read a block mapping entry: a multiline key may not be an implicit key");
|
|
4763
|
+
} else {
|
|
4764
|
+
const { kind, result: result2 } = newState;
|
|
4765
|
+
return {
|
|
4766
|
+
tag,
|
|
4767
|
+
anchor,
|
|
4768
|
+
kind,
|
|
4769
|
+
result: result2
|
|
4770
|
+
};
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
if (this.line === line || this.lineIndent > nodeIndent) {
|
|
4774
|
+
const newState = this.composeNode({
|
|
4775
|
+
parentIndent: nodeIndent,
|
|
4776
|
+
nodeContext: CONTEXT_BLOCK_OUT,
|
|
4777
|
+
allowToSeek: true,
|
|
4778
|
+
allowCompact
|
|
4779
|
+
});
|
|
4780
|
+
if (newState) {
|
|
4781
|
+
if (atExplicitKey) {
|
|
4782
|
+
keyNode = newState.result;
|
|
4783
|
+
} else {
|
|
4784
|
+
valueNode = newState.result;
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
if (!atExplicitKey) {
|
|
4788
|
+
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, line, pos);
|
|
4789
|
+
keyTag = keyNode = valueNode = null;
|
|
4790
|
+
}
|
|
4791
|
+
this.skipSeparationSpace(true, -1);
|
|
4792
|
+
ch = this.peek();
|
|
4793
|
+
}
|
|
4794
|
+
if (this.lineIndent > nodeIndent && ch !== 0) {
|
|
4795
|
+
throw this.#createError("Cannot read block: bad indentation of a mapping entry");
|
|
4796
|
+
} else if (this.lineIndent < nodeIndent) {
|
|
4797
|
+
break;
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
if (atExplicitKey) {
|
|
4801
|
+
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
|
|
4802
|
+
}
|
|
4803
|
+
if (detected) return {
|
|
4804
|
+
tag,
|
|
4805
|
+
anchor,
|
|
4806
|
+
kind: "mapping",
|
|
4807
|
+
result
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
readTagProperty(tag) {
|
|
4811
|
+
let isVerbatim = false;
|
|
4812
|
+
let isNamed = false;
|
|
4813
|
+
let tagHandle = "";
|
|
4814
|
+
let tagName;
|
|
4815
|
+
let ch = this.peek();
|
|
4816
|
+
if (ch !== EXCLAMATION) return;
|
|
4817
|
+
if (tag !== null) {
|
|
4818
|
+
throw this.#createError("Cannot read tag property: duplication of a tag property");
|
|
4819
|
+
}
|
|
4820
|
+
ch = this.next();
|
|
4821
|
+
if (ch === SMALLER_THAN) {
|
|
4822
|
+
isVerbatim = true;
|
|
4823
|
+
ch = this.next();
|
|
4824
|
+
} else if (ch === EXCLAMATION) {
|
|
4825
|
+
isNamed = true;
|
|
4826
|
+
tagHandle = "!!";
|
|
4827
|
+
ch = this.next();
|
|
4828
|
+
} else {
|
|
4829
|
+
tagHandle = "!";
|
|
4830
|
+
}
|
|
4831
|
+
let position = this.position;
|
|
4832
|
+
if (isVerbatim) {
|
|
4833
|
+
do {
|
|
4834
|
+
ch = this.next();
|
|
4835
|
+
} while (ch !== 0 && ch !== GREATER_THAN);
|
|
4836
|
+
if (this.position < this.length) {
|
|
4837
|
+
tagName = this.input.slice(position, this.position);
|
|
4838
|
+
ch = this.next();
|
|
4839
|
+
} else {
|
|
4840
|
+
throw this.#createError("Cannot read tag property: unexpected end of stream");
|
|
4841
|
+
}
|
|
4842
|
+
} else {
|
|
4843
|
+
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
4844
|
+
if (ch === EXCLAMATION) {
|
|
4845
|
+
if (!isNamed) {
|
|
4846
|
+
tagHandle = this.input.slice(position - 1, this.position + 1);
|
|
4847
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
4848
|
+
throw this.#createError("Cannot read tag property: named tag handle contains invalid characters");
|
|
4849
|
+
}
|
|
4850
|
+
isNamed = true;
|
|
4851
|
+
position = this.position + 1;
|
|
4852
|
+
} else {
|
|
4853
|
+
throw this.#createError("Cannot read tag property: tag suffix cannot contain an exclamation mark");
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
ch = this.next();
|
|
4857
|
+
}
|
|
4858
|
+
tagName = this.input.slice(position, this.position);
|
|
4859
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
4860
|
+
throw this.#createError("Cannot read tag property: tag suffix cannot contain flow indicator characters");
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
4864
|
+
throw this.#createError(`Cannot read tag property: invalid characters in tag name "${tagName}"`);
|
|
4865
|
+
}
|
|
4866
|
+
if (isVerbatim) {
|
|
4867
|
+
return tagName;
|
|
4868
|
+
} else if (this.tagMap.has(tagHandle)) {
|
|
4869
|
+
return this.tagMap.get(tagHandle) + tagName;
|
|
4870
|
+
} else if (tagHandle === "!") {
|
|
4871
|
+
return `!${tagName}`;
|
|
4872
|
+
} else if (tagHandle === "!!") {
|
|
4873
|
+
return `tag:yaml.org,2002:${tagName}`;
|
|
4874
|
+
}
|
|
4875
|
+
throw this.#createError(`Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
4876
|
+
}
|
|
4877
|
+
readAnchorProperty(anchor) {
|
|
4878
|
+
let ch = this.peek();
|
|
4879
|
+
if (ch !== AMPERSAND) return;
|
|
4880
|
+
if (anchor !== null) {
|
|
4881
|
+
throw this.#createError("Cannot read anchor property: duplicate anchor property");
|
|
4882
|
+
}
|
|
4883
|
+
ch = this.next();
|
|
4884
|
+
const position = this.position;
|
|
4885
|
+
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4886
|
+
ch = this.next();
|
|
4887
|
+
}
|
|
4888
|
+
if (this.position === position) {
|
|
4889
|
+
throw this.#createError("Cannot read anchor property: name of an anchor node must contain at least one character");
|
|
4890
|
+
}
|
|
4891
|
+
return this.input.slice(position, this.position);
|
|
4892
|
+
}
|
|
4893
|
+
readAlias() {
|
|
4894
|
+
if (this.peek() !== ASTERISK) return;
|
|
4895
|
+
let ch = this.next();
|
|
4896
|
+
const position = this.position;
|
|
4897
|
+
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
4898
|
+
ch = this.next();
|
|
4899
|
+
}
|
|
4900
|
+
if (this.position === position) {
|
|
4901
|
+
throw this.#createError("Cannot read alias: alias name must contain at least one character");
|
|
4902
|
+
}
|
|
4903
|
+
const alias = this.input.slice(position, this.position);
|
|
4904
|
+
if (!this.anchorMap.has(alias)) {
|
|
4905
|
+
throw this.#createError(`Cannot read alias: unidentified alias "${alias}"`);
|
|
4906
|
+
}
|
|
4907
|
+
this.skipSeparationSpace(true, -1);
|
|
4908
|
+
return this.anchorMap.get(alias);
|
|
4909
|
+
}
|
|
4910
|
+
resolveTag(state) {
|
|
4911
|
+
switch (state.tag) {
|
|
4912
|
+
case null:
|
|
4913
|
+
case "!":
|
|
4914
|
+
return state;
|
|
4915
|
+
case "?": {
|
|
4916
|
+
for (const type2 of this.implicitTypes) {
|
|
4917
|
+
if (!type2.resolve(state.result)) continue;
|
|
4918
|
+
const result2 = type2.construct(state.result);
|
|
4919
|
+
state.result = result2;
|
|
4920
|
+
state.tag = type2.tag;
|
|
4921
|
+
const { anchor: anchor2 } = state;
|
|
4922
|
+
if (anchor2 !== null) this.anchorMap.set(anchor2, result2);
|
|
4923
|
+
return state;
|
|
4924
|
+
}
|
|
4925
|
+
return state;
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
const kind = state.kind ?? "fallback";
|
|
4929
|
+
const map2 = this.typeMap[kind];
|
|
4930
|
+
const type = map2.get(state.tag);
|
|
4931
|
+
if (!type) {
|
|
4932
|
+
throw this.#createError(`Cannot resolve unknown tag !<${state.tag}>`);
|
|
4933
|
+
}
|
|
4934
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
4935
|
+
throw this.#createError(`Unacceptable node kind for !<${state.tag}> tag: it should be "${type.kind}", not "${state.kind}"`);
|
|
4936
|
+
}
|
|
4937
|
+
if (!type.resolve(state.result)) {
|
|
4938
|
+
throw this.#createError(`Cannot resolve a node with !<${state.tag}> explicit tag`);
|
|
4939
|
+
}
|
|
4940
|
+
const result = type.construct(state.result);
|
|
4941
|
+
state.result = result;
|
|
4942
|
+
const { anchor } = state;
|
|
4943
|
+
if (anchor !== null) this.anchorMap.set(anchor, result);
|
|
4944
|
+
return state;
|
|
4945
|
+
}
|
|
4946
|
+
composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }) {
|
|
4947
|
+
let indentStatus = 1;
|
|
4948
|
+
let atNewLine = false;
|
|
4949
|
+
const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
4950
|
+
let allowBlockCollections = allowBlockScalars;
|
|
4951
|
+
const allowBlockStyles = allowBlockScalars;
|
|
4952
|
+
if (allowToSeek) {
|
|
4953
|
+
if (this.skipSeparationSpace(true, -1)) {
|
|
4954
|
+
atNewLine = true;
|
|
4955
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
let tag = null;
|
|
4959
|
+
let anchor = null;
|
|
4960
|
+
if (indentStatus === 1) {
|
|
4961
|
+
while (true) {
|
|
4962
|
+
const newTag = this.readTagProperty(tag);
|
|
4963
|
+
if (newTag) {
|
|
4964
|
+
tag = newTag;
|
|
4965
|
+
} else {
|
|
4966
|
+
const newAnchor = this.readAnchorProperty(anchor);
|
|
4967
|
+
if (!newAnchor) break;
|
|
4968
|
+
anchor = newAnchor;
|
|
4969
|
+
}
|
|
4970
|
+
if (this.skipSeparationSpace(true, -1)) {
|
|
4971
|
+
atNewLine = true;
|
|
4972
|
+
allowBlockCollections = allowBlockStyles;
|
|
4973
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
4974
|
+
} else {
|
|
4975
|
+
allowBlockCollections = false;
|
|
4976
|
+
}
|
|
4977
|
+
}
|
|
4978
|
+
}
|
|
4979
|
+
if (allowBlockCollections) {
|
|
4980
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
4981
|
+
}
|
|
4982
|
+
if (indentStatus === 1) {
|
|
4983
|
+
const cond = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext;
|
|
4984
|
+
const flowIndent = cond ? parentIndent : parentIndent + 1;
|
|
4985
|
+
if (allowBlockCollections) {
|
|
4986
|
+
const blockIndent = this.position - this.lineStart;
|
|
4987
|
+
const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
4988
|
+
if (blockSequenceState) return this.resolveTag(blockSequenceState);
|
|
4989
|
+
const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
|
|
4990
|
+
if (blockMappingState) return this.resolveTag(blockMappingState);
|
|
4991
|
+
}
|
|
4992
|
+
const flowCollectionState = this.readFlowCollection(tag, anchor, flowIndent);
|
|
4993
|
+
if (flowCollectionState) return this.resolveTag(flowCollectionState);
|
|
4994
|
+
if (allowBlockScalars) {
|
|
4995
|
+
const blockScalarState = this.readBlockScalar(tag, anchor, flowIndent);
|
|
4996
|
+
if (blockScalarState) return this.resolveTag(blockScalarState);
|
|
4997
|
+
}
|
|
4998
|
+
const singleQuoteState = this.readSingleQuotedScalar(tag, anchor, flowIndent);
|
|
4999
|
+
if (singleQuoteState) return this.resolveTag(singleQuoteState);
|
|
5000
|
+
const doubleQuoteState = this.readDoubleQuotedScalar(tag, anchor, flowIndent);
|
|
5001
|
+
if (doubleQuoteState) return this.resolveTag(doubleQuoteState);
|
|
5002
|
+
const alias = this.readAlias();
|
|
5003
|
+
if (alias) {
|
|
5004
|
+
if (tag !== null || anchor !== null) {
|
|
5005
|
+
throw this.#createError("Cannot compose node: alias node should not have any properties");
|
|
5006
|
+
}
|
|
5007
|
+
return this.resolveTag({
|
|
5008
|
+
tag,
|
|
5009
|
+
anchor,
|
|
5010
|
+
kind: null,
|
|
5011
|
+
result: alias
|
|
5012
|
+
});
|
|
5013
|
+
}
|
|
5014
|
+
const plainScalarState = this.readPlainScalar(tag, anchor, flowIndent, CONTEXT_FLOW_IN === nodeContext);
|
|
5015
|
+
if (plainScalarState) {
|
|
5016
|
+
plainScalarState.tag ??= "?";
|
|
5017
|
+
return this.resolveTag(plainScalarState);
|
|
5018
|
+
}
|
|
5019
|
+
} else if (indentStatus === 0 && CONTEXT_BLOCK_OUT === nodeContext && allowBlockCollections) {
|
|
5020
|
+
const blockIndent = this.position - this.lineStart;
|
|
5021
|
+
const newState2 = this.readBlockSequence(tag, anchor, blockIndent);
|
|
5022
|
+
if (newState2) return this.resolveTag(newState2);
|
|
5023
|
+
}
|
|
5024
|
+
const newState = this.resolveTag({
|
|
5025
|
+
tag,
|
|
5026
|
+
anchor,
|
|
5027
|
+
kind: null,
|
|
5028
|
+
result: null
|
|
5029
|
+
});
|
|
5030
|
+
if (newState.tag !== null || newState.anchor !== null) return newState;
|
|
5031
|
+
}
|
|
5032
|
+
readDirectives() {
|
|
5033
|
+
let hasDirectives = false;
|
|
5034
|
+
let version = null;
|
|
5035
|
+
let ch = this.peek();
|
|
5036
|
+
while (ch !== 0) {
|
|
5037
|
+
this.skipSeparationSpace(true, -1);
|
|
5038
|
+
ch = this.peek();
|
|
5039
|
+
if (this.lineIndent > 0 || ch !== PERCENT) {
|
|
5040
|
+
break;
|
|
5041
|
+
}
|
|
5042
|
+
hasDirectives = true;
|
|
5043
|
+
ch = this.next();
|
|
5044
|
+
let position = this.position;
|
|
5045
|
+
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5046
|
+
ch = this.next();
|
|
5047
|
+
}
|
|
5048
|
+
const directiveName = this.input.slice(position, this.position);
|
|
5049
|
+
const directiveArgs = [];
|
|
5050
|
+
if (directiveName.length < 1) {
|
|
5051
|
+
throw this.#createError("Cannot read document: directive name length must be greater than zero");
|
|
5052
|
+
}
|
|
5053
|
+
while (ch !== 0) {
|
|
5054
|
+
this.skipWhitespaces();
|
|
5055
|
+
this.skipComment();
|
|
5056
|
+
ch = this.peek();
|
|
5057
|
+
if (isEOL(ch)) break;
|
|
5058
|
+
position = this.position;
|
|
5059
|
+
while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
|
|
5060
|
+
ch = this.next();
|
|
5061
|
+
}
|
|
5062
|
+
directiveArgs.push(this.input.slice(position, this.position));
|
|
5063
|
+
}
|
|
5064
|
+
if (ch !== 0) this.readLineBreak();
|
|
5065
|
+
switch (directiveName) {
|
|
5066
|
+
case "YAML":
|
|
5067
|
+
if (version !== null) {
|
|
5068
|
+
throw this.#createError("Cannot handle YAML directive: duplication of %YAML directive");
|
|
5069
|
+
}
|
|
5070
|
+
version = this.yamlDirectiveHandler(directiveArgs);
|
|
5071
|
+
break;
|
|
5072
|
+
case "TAG":
|
|
5073
|
+
this.tagDirectiveHandler(directiveArgs);
|
|
5074
|
+
break;
|
|
5075
|
+
default:
|
|
5076
|
+
this.dispatchWarning(`unknown document directive "${directiveName}"`);
|
|
5077
|
+
break;
|
|
5078
|
+
}
|
|
5079
|
+
ch = this.peek();
|
|
5080
|
+
}
|
|
5081
|
+
return hasDirectives;
|
|
5082
|
+
}
|
|
5083
|
+
readDocument() {
|
|
5084
|
+
const documentStart = this.position;
|
|
5085
|
+
this.checkLineBreaks = false;
|
|
5086
|
+
this.tagMap = /* @__PURE__ */ new Map();
|
|
5087
|
+
this.anchorMap = /* @__PURE__ */ new Map();
|
|
5088
|
+
const hasDirectives = this.readDirectives();
|
|
5089
|
+
this.skipSeparationSpace(true, -1);
|
|
5090
|
+
let result = null;
|
|
5091
|
+
if (this.lineIndent === 0 && this.peek() === MINUS && this.peek(1) === MINUS && this.peek(2) === MINUS) {
|
|
5092
|
+
this.position += 3;
|
|
5093
|
+
this.skipSeparationSpace(true, -1);
|
|
5094
|
+
} else if (hasDirectives) {
|
|
5095
|
+
throw this.#createError("Cannot read document: directives end mark is expected");
|
|
5096
|
+
}
|
|
5097
|
+
const newState = this.composeNode({
|
|
5098
|
+
parentIndent: this.lineIndent - 1,
|
|
5099
|
+
nodeContext: CONTEXT_BLOCK_OUT,
|
|
5100
|
+
allowToSeek: false,
|
|
5101
|
+
allowCompact: true
|
|
5102
|
+
});
|
|
5103
|
+
if (newState) result = newState.result;
|
|
5104
|
+
this.skipSeparationSpace(true, -1);
|
|
5105
|
+
if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.input.slice(documentStart, this.position))) {
|
|
5106
|
+
this.dispatchWarning("non-ASCII line breaks are interpreted as content");
|
|
5107
|
+
}
|
|
5108
|
+
if (this.position === this.lineStart && this.testDocumentSeparator()) {
|
|
5109
|
+
if (this.peek() === DOT) {
|
|
5110
|
+
this.position += 3;
|
|
5111
|
+
this.skipSeparationSpace(true, -1);
|
|
5112
|
+
}
|
|
5113
|
+
} else if (this.position < this.length - 1) {
|
|
5114
|
+
throw this.#createError("Cannot read document: end of the stream or a document separator is expected");
|
|
5115
|
+
}
|
|
5116
|
+
return result;
|
|
5117
|
+
}
|
|
5118
|
+
*readDocuments() {
|
|
5119
|
+
while (this.position < this.length - 1) {
|
|
5120
|
+
yield this.readDocument();
|
|
5121
|
+
}
|
|
5122
|
+
}
|
|
5123
|
+
};
|
|
5124
|
+
|
|
5125
|
+
// __mcpc__cli_latest/node_modules/@jsr/std__yaml/parse.js
|
|
5126
|
+
function sanitizeInput(input) {
|
|
5127
|
+
input = String(input);
|
|
5128
|
+
if (input.length > 0) {
|
|
5129
|
+
if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
|
|
5130
|
+
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
5131
|
+
}
|
|
5132
|
+
input += "\0";
|
|
5133
|
+
return input;
|
|
5134
|
+
}
|
|
5135
|
+
function parse(content, options = {}) {
|
|
5136
|
+
content = sanitizeInput(content);
|
|
5137
|
+
const state = new LoaderState(content, {
|
|
5138
|
+
...options,
|
|
5139
|
+
schema: SCHEMA_MAP.get(options.schema)
|
|
5140
|
+
});
|
|
5141
|
+
const documentGenerator = state.readDocuments();
|
|
5142
|
+
const document = documentGenerator.next().value;
|
|
5143
|
+
if (!documentGenerator.next().done) {
|
|
5144
|
+
throw new SyntaxError("Found more than 1 document in the stream: expected a single document");
|
|
5145
|
+
}
|
|
5146
|
+
return document ?? null;
|
|
5147
|
+
}
|
|
5148
|
+
|
|
5149
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
3211
5150
|
import process3 from "node:process";
|
|
5151
|
+
function replaceEnvVars(str2) {
|
|
5152
|
+
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
5153
|
+
const value = process3.env[varName];
|
|
5154
|
+
if (value !== void 0) {
|
|
5155
|
+
return value;
|
|
5156
|
+
}
|
|
5157
|
+
return match;
|
|
5158
|
+
});
|
|
5159
|
+
}
|
|
5160
|
+
function replaceEnvVarsInObject(obj) {
|
|
5161
|
+
if (typeof obj === "string") {
|
|
5162
|
+
return replaceEnvVars(obj);
|
|
5163
|
+
}
|
|
5164
|
+
if (Array.isArray(obj)) {
|
|
5165
|
+
return obj.map((item) => replaceEnvVarsInObject(item));
|
|
5166
|
+
}
|
|
5167
|
+
if (obj && typeof obj === "object") {
|
|
5168
|
+
const result = {};
|
|
5169
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
5170
|
+
result[key] = replaceEnvVarsInObject(value);
|
|
5171
|
+
}
|
|
5172
|
+
return result;
|
|
5173
|
+
}
|
|
5174
|
+
return obj;
|
|
5175
|
+
}
|
|
5176
|
+
function parseMarkdownAgent(content) {
|
|
5177
|
+
const frontMatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/;
|
|
5178
|
+
const match = content.match(frontMatterRegex);
|
|
5179
|
+
if (!match) {
|
|
5180
|
+
throw new Error("Invalid Markdown agent file: missing YAML front matter. Expected format:\n---\nname: agent-name\n---\n\n# Description...");
|
|
5181
|
+
}
|
|
5182
|
+
const [, yamlContent, markdownContent] = match;
|
|
5183
|
+
let frontMatter;
|
|
5184
|
+
try {
|
|
5185
|
+
frontMatter = parse(yamlContent);
|
|
5186
|
+
} catch (error) {
|
|
5187
|
+
throw new Error(`Failed to parse YAML front matter: ${error}`);
|
|
5188
|
+
}
|
|
5189
|
+
if (!frontMatter.name) {
|
|
5190
|
+
throw new Error("Invalid Markdown agent file: 'name' is required in front matter");
|
|
5191
|
+
}
|
|
5192
|
+
return {
|
|
5193
|
+
frontMatter,
|
|
5194
|
+
body: markdownContent.trim()
|
|
5195
|
+
};
|
|
5196
|
+
}
|
|
5197
|
+
var OPTION_KEYS = [
|
|
5198
|
+
"mode",
|
|
5199
|
+
"maxSteps",
|
|
5200
|
+
"maxTokens",
|
|
5201
|
+
"tracingEnabled",
|
|
5202
|
+
"refs",
|
|
5203
|
+
"samplingConfig",
|
|
5204
|
+
"providerOptions",
|
|
5205
|
+
"acpSettings"
|
|
5206
|
+
];
|
|
5207
|
+
function markdownAgentToComposeDefinition(parsed) {
|
|
5208
|
+
const frontMatter = replaceEnvVarsInObject(parsed.frontMatter);
|
|
5209
|
+
const body = replaceEnvVars(parsed.body);
|
|
5210
|
+
const options = {};
|
|
5211
|
+
for (const key of OPTION_KEYS) {
|
|
5212
|
+
if (frontMatter[key] !== void 0) {
|
|
5213
|
+
options[key] = frontMatter[key];
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5216
|
+
const hasDescription = frontMatter.description !== void 0 && frontMatter.description !== "";
|
|
5217
|
+
return {
|
|
5218
|
+
name: frontMatter.name,
|
|
5219
|
+
description: hasDescription ? frontMatter.description : body,
|
|
5220
|
+
...hasDescription && body ? {
|
|
5221
|
+
manual: body
|
|
5222
|
+
} : {},
|
|
5223
|
+
deps: frontMatter.deps,
|
|
5224
|
+
plugins: frontMatter.plugins,
|
|
5225
|
+
...Object.keys(options).length > 0 ? {
|
|
5226
|
+
options
|
|
5227
|
+
} : {}
|
|
5228
|
+
};
|
|
5229
|
+
}
|
|
5230
|
+
async function loadMarkdownAgentFile(filePath) {
|
|
5231
|
+
const content = await readFile2(filePath, "utf-8");
|
|
5232
|
+
const parsed = parseMarkdownAgent(content);
|
|
5233
|
+
return markdownAgentToComposeDefinition(parsed);
|
|
5234
|
+
}
|
|
5235
|
+
|
|
5236
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/mod.js
|
|
5237
|
+
function markdownLoaderPlugin() {
|
|
5238
|
+
return {
|
|
5239
|
+
name: "markdown-loader",
|
|
5240
|
+
version: "1.0.0",
|
|
5241
|
+
enforce: "pre",
|
|
5242
|
+
configureServer: (server) => {
|
|
5243
|
+
server.registerFileLoader(".md", loadMarkdownAgentFile);
|
|
5244
|
+
server.registerFileLoader(".markdown", loadMarkdownAgentFile);
|
|
5245
|
+
}
|
|
5246
|
+
};
|
|
5247
|
+
}
|
|
5248
|
+
var defaultPlugin = markdownLoaderPlugin();
|
|
5249
|
+
|
|
5250
|
+
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
5251
|
+
import { resolve as resolve3 } from "node:path";
|
|
5252
|
+
import process4 from "node:process";
|
|
3212
5253
|
var DEFAULT_SKILLS_PATHS = [
|
|
3213
5254
|
".claude/skills"
|
|
3214
5255
|
];
|
|
3215
5256
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
3216
5257
|
function getGlobalPlugins(skillsPaths) {
|
|
3217
|
-
const resolvedPaths = skillsPaths.map((p2) => resolve3(
|
|
5258
|
+
const resolvedPaths = skillsPaths.map((p2) => resolve3(process4.cwd(), p2));
|
|
3218
5259
|
return [
|
|
3219
5260
|
markdownLoaderPlugin(),
|
|
3220
5261
|
createSkillsPlugin({
|
|
@@ -3271,7 +5312,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
3271
5312
|
try {
|
|
3272
5313
|
let existingConfig = null;
|
|
3273
5314
|
try {
|
|
3274
|
-
const content = await
|
|
5315
|
+
const content = await readFile3(configPath, "utf-8");
|
|
3275
5316
|
existingConfig = JSON.parse(content);
|
|
3276
5317
|
} catch {
|
|
3277
5318
|
}
|
|
@@ -3308,7 +5349,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
3308
5349
|
async function createWrapConfig(args) {
|
|
3309
5350
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
3310
5351
|
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'");
|
|
3311
|
-
|
|
5352
|
+
process5.exit(1);
|
|
3312
5353
|
}
|
|
3313
5354
|
const mcpServers = {};
|
|
3314
5355
|
const serverNames = [];
|
|
@@ -3431,7 +5472,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
3431
5472
|
};
|
|
3432
5473
|
}
|
|
3433
5474
|
function parseCLIArgs() {
|
|
3434
|
-
const args = parseArgs(
|
|
5475
|
+
const args = parseArgs(process5.argv.slice(2), {
|
|
3435
5476
|
boolean: [
|
|
3436
5477
|
"help",
|
|
3437
5478
|
"version",
|
|
@@ -3520,15 +5561,15 @@ async function loadConfig() {
|
|
|
3520
5561
|
const args = parseCLIArgs();
|
|
3521
5562
|
if (args.version) {
|
|
3522
5563
|
printVersion();
|
|
3523
|
-
|
|
5564
|
+
process5.exit(0);
|
|
3524
5565
|
}
|
|
3525
5566
|
if (args.help) {
|
|
3526
5567
|
printHelp();
|
|
3527
|
-
|
|
5568
|
+
process5.exit(0);
|
|
3528
5569
|
}
|
|
3529
5570
|
if (args.cwd) {
|
|
3530
|
-
const targetCwd = resolve4(
|
|
3531
|
-
|
|
5571
|
+
const targetCwd = resolve4(process5.cwd(), args.cwd);
|
|
5572
|
+
process5.chdir(targetCwd);
|
|
3532
5573
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
3533
5574
|
}
|
|
3534
5575
|
const mergeSkills = (config) => {
|
|
@@ -3540,7 +5581,7 @@ async function loadConfig() {
|
|
|
3540
5581
|
...args,
|
|
3541
5582
|
saveConfig: true
|
|
3542
5583
|
});
|
|
3543
|
-
|
|
5584
|
+
process5.exit(0);
|
|
3544
5585
|
}
|
|
3545
5586
|
if (args.wrap) {
|
|
3546
5587
|
return mergeSkills(await createWrapConfig({
|
|
@@ -3557,16 +5598,16 @@ async function loadConfig() {
|
|
|
3557
5598
|
throw error;
|
|
3558
5599
|
}
|
|
3559
5600
|
}
|
|
3560
|
-
if (
|
|
5601
|
+
if (process5.env.MCPC_CONFIG) {
|
|
3561
5602
|
try {
|
|
3562
|
-
const parsed = JSON.parse(
|
|
5603
|
+
const parsed = JSON.parse(process5.env.MCPC_CONFIG);
|
|
3563
5604
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
3564
5605
|
} catch (error) {
|
|
3565
5606
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
3566
5607
|
throw error;
|
|
3567
5608
|
}
|
|
3568
5609
|
}
|
|
3569
|
-
const configUrl = args.configUrl ||
|
|
5610
|
+
const configUrl = args.configUrl || process5.env.MCPC_CONFIG_URL;
|
|
3570
5611
|
if (configUrl) {
|
|
3571
5612
|
try {
|
|
3572
5613
|
const headers = {
|
|
@@ -3587,7 +5628,7 @@ async function loadConfig() {
|
|
|
3587
5628
|
throw error;
|
|
3588
5629
|
}
|
|
3589
5630
|
}
|
|
3590
|
-
const configFile = args.configFile ||
|
|
5631
|
+
const configFile = args.configFile || process5.env.MCPC_CONFIG_FILE;
|
|
3591
5632
|
if (configFile) {
|
|
3592
5633
|
try {
|
|
3593
5634
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -3612,7 +5653,7 @@ async function loadConfig() {
|
|
|
3612
5653
|
throw error;
|
|
3613
5654
|
}
|
|
3614
5655
|
}
|
|
3615
|
-
const defaultJsonConfigPath = resolve4(
|
|
5656
|
+
const defaultJsonConfigPath = resolve4(process5.cwd(), "mcpc.config.json");
|
|
3616
5657
|
try {
|
|
3617
5658
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
3618
5659
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -3625,16 +5666,16 @@ async function loadConfig() {
|
|
|
3625
5666
|
}
|
|
3626
5667
|
}
|
|
3627
5668
|
}
|
|
3628
|
-
function
|
|
3629
|
-
return
|
|
3630
|
-
return
|
|
5669
|
+
function replaceEnvVars2(str2) {
|
|
5670
|
+
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
5671
|
+
return process5.env[varName] || "";
|
|
3631
5672
|
});
|
|
3632
5673
|
}
|
|
3633
|
-
function
|
|
5674
|
+
function isMarkdownFile2(path) {
|
|
3634
5675
|
return path.endsWith(".md") || path.endsWith(".markdown");
|
|
3635
5676
|
}
|
|
3636
5677
|
async function loadConfigFromFile(filePath) {
|
|
3637
|
-
if (
|
|
5678
|
+
if (isMarkdownFile2(filePath)) {
|
|
3638
5679
|
return {
|
|
3639
5680
|
name: "mcpc-server",
|
|
3640
5681
|
version: "0.1.0",
|
|
@@ -3643,13 +5684,13 @@ async function loadConfigFromFile(filePath) {
|
|
|
3643
5684
|
]
|
|
3644
5685
|
};
|
|
3645
5686
|
}
|
|
3646
|
-
const content = await
|
|
5687
|
+
const content = await readFile3(filePath, "utf-8");
|
|
3647
5688
|
const parsed = JSON.parse(content);
|
|
3648
5689
|
return normalizeConfig(parsed);
|
|
3649
5690
|
}
|
|
3650
5691
|
function replaceEnvVarsInConfig(obj) {
|
|
3651
5692
|
if (typeof obj === "string") {
|
|
3652
|
-
return
|
|
5693
|
+
return replaceEnvVars2(obj);
|
|
3653
5694
|
}
|
|
3654
5695
|
if (Array.isArray(obj)) {
|
|
3655
5696
|
return obj.map((item) => replaceEnvVarsInConfig(item));
|
|
@@ -4735,7 +6776,7 @@ var Protocol = class {
|
|
|
4735
6776
|
};
|
|
4736
6777
|
}
|
|
4737
6778
|
};
|
|
4738
|
-
function
|
|
6779
|
+
function isPlainObject2(value) {
|
|
4739
6780
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4740
6781
|
}
|
|
4741
6782
|
function mergeCapabilities(base, additional) {
|
|
@@ -4746,7 +6787,7 @@ function mergeCapabilities(base, additional) {
|
|
|
4746
6787
|
if (addValue === void 0)
|
|
4747
6788
|
continue;
|
|
4748
6789
|
const baseValue = result[k];
|
|
4749
|
-
if (
|
|
6790
|
+
if (isPlainObject2(baseValue) && isPlainObject2(addValue)) {
|
|
4750
6791
|
result[k] = { ...baseValue, ...addValue };
|
|
4751
6792
|
} else {
|
|
4752
6793
|
result[k] = addValue;
|
|
@@ -6044,9 +8085,9 @@ var Client = class extends Protocol {
|
|
|
6044
8085
|
|
|
6045
8086
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
6046
8087
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
6047
|
-
import
|
|
8088
|
+
import process6 from "node:process";
|
|
6048
8089
|
import { PassThrough } from "node:stream";
|
|
6049
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
8090
|
+
var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
|
|
6050
8091
|
"APPDATA",
|
|
6051
8092
|
"HOMEDRIVE",
|
|
6052
8093
|
"HOMEPATH",
|
|
@@ -6066,7 +8107,7 @@ var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
|
|
|
6066
8107
|
function getDefaultEnvironment() {
|
|
6067
8108
|
const env = {};
|
|
6068
8109
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
6069
|
-
const value =
|
|
8110
|
+
const value = process6.env[key];
|
|
6070
8111
|
if (value === void 0) {
|
|
6071
8112
|
continue;
|
|
6072
8113
|
}
|
|
@@ -6102,7 +8143,7 @@ var StdioClientTransport = class {
|
|
|
6102
8143
|
},
|
|
6103
8144
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
6104
8145
|
shell: false,
|
|
6105
|
-
windowsHide:
|
|
8146
|
+
windowsHide: process6.platform === "win32" && isElectron(),
|
|
6106
8147
|
cwd: this._serverParams.cwd
|
|
6107
8148
|
});
|
|
6108
8149
|
this._process.on("error", (error) => {
|
|
@@ -6210,7 +8251,7 @@ var StdioClientTransport = class {
|
|
|
6210
8251
|
}
|
|
6211
8252
|
};
|
|
6212
8253
|
function isElectron() {
|
|
6213
|
-
return "type" in
|
|
8254
|
+
return "type" in process6;
|
|
6214
8255
|
}
|
|
6215
8256
|
|
|
6216
8257
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -8091,8 +10132,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
8091
10132
|
};
|
|
8092
10133
|
|
|
8093
10134
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
8094
|
-
import
|
|
8095
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
10135
|
+
import process7 from "node:process";
|
|
10136
|
+
var GEMINI_PREFERRED_FORMAT = process7.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
8096
10137
|
|
|
8097
10138
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
8098
10139
|
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
@@ -8165,7 +10206,7 @@ var cleanToolSchema = (schema) => {
|
|
|
8165
10206
|
|
|
8166
10207
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
8167
10208
|
import { cwd } from "node:process";
|
|
8168
|
-
import
|
|
10209
|
+
import process8 from "node:process";
|
|
8169
10210
|
import { createHash } from "node:crypto";
|
|
8170
10211
|
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
8171
10212
|
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
@@ -8218,7 +10259,7 @@ function createTransport(def) {
|
|
|
8218
10259
|
command: defAny.command,
|
|
8219
10260
|
args: defAny.args,
|
|
8220
10261
|
env: {
|
|
8221
|
-
...
|
|
10262
|
+
...process8.env,
|
|
8222
10263
|
...defAny.env ?? {}
|
|
8223
10264
|
},
|
|
8224
10265
|
cwd: cwd()
|
|
@@ -8286,11 +10327,11 @@ var cleanupAllPooledClients = async () => {
|
|
|
8286
10327
|
}
|
|
8287
10328
|
}));
|
|
8288
10329
|
};
|
|
8289
|
-
|
|
10330
|
+
process8.once?.("exit", () => {
|
|
8290
10331
|
cleanupAllPooledClients();
|
|
8291
10332
|
});
|
|
8292
|
-
|
|
8293
|
-
cleanupAllPooledClients().finally(() =>
|
|
10333
|
+
process8.once?.("SIGINT", () => {
|
|
10334
|
+
cleanupAllPooledClients().finally(() => process8.exit(0));
|
|
8294
10335
|
});
|
|
8295
10336
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
8296
10337
|
const allTools = {};
|
|
@@ -8912,7 +10953,7 @@ function endSpan(span, error) {
|
|
|
8912
10953
|
}
|
|
8913
10954
|
|
|
8914
10955
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
8915
|
-
import
|
|
10956
|
+
import process9 from "node:process";
|
|
8916
10957
|
var AgenticExecutor = class {
|
|
8917
10958
|
name;
|
|
8918
10959
|
allToolNames;
|
|
@@ -8932,13 +10973,13 @@ var AgenticExecutor = class {
|
|
|
8932
10973
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
8933
10974
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
8934
10975
|
try {
|
|
8935
|
-
this.tracingEnabled =
|
|
10976
|
+
this.tracingEnabled = process9.env.MCPC_TRACING_ENABLED === "true";
|
|
8936
10977
|
if (this.tracingEnabled) {
|
|
8937
10978
|
initializeTracing({
|
|
8938
10979
|
enabled: true,
|
|
8939
10980
|
serviceName: `mcpc-agentic-${name}`,
|
|
8940
|
-
exportTo:
|
|
8941
|
-
otlpEndpoint:
|
|
10981
|
+
exportTo: process9.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
10982
|
+
otlpEndpoint: process9.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
8942
10983
|
});
|
|
8943
10984
|
}
|
|
8944
10985
|
} catch {
|
|
@@ -10263,7 +12304,7 @@ async function loadPlugin(pluginPath, options = {
|
|
|
10263
12304
|
const importPath = typeof resolveFn === "function" ? resolveFn(rawPath) : new URL(rawPath, import.meta.url).href;
|
|
10264
12305
|
const pluginModule = await import(importPath);
|
|
10265
12306
|
const pluginFactory = pluginModule.createPlugin;
|
|
10266
|
-
const
|
|
12307
|
+
const defaultPlugin2 = pluginModule.default;
|
|
10267
12308
|
let plugin;
|
|
10268
12309
|
if (Object.keys(params).length > 0) {
|
|
10269
12310
|
if (typeof pluginFactory !== "function") {
|
|
@@ -10272,8 +12313,8 @@ async function loadPlugin(pluginPath, options = {
|
|
|
10272
12313
|
const typedParams = parseQueryParams(params);
|
|
10273
12314
|
plugin = pluginFactory(typedParams);
|
|
10274
12315
|
} else {
|
|
10275
|
-
if (
|
|
10276
|
-
plugin =
|
|
12316
|
+
if (defaultPlugin2) {
|
|
12317
|
+
plugin = defaultPlugin2;
|
|
10277
12318
|
} else if (typeof pluginFactory === "function") {
|
|
10278
12319
|
plugin = pluginFactory();
|
|
10279
12320
|
} else {
|
|
@@ -10974,6 +13015,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
10974
13015
|
pluginManager;
|
|
10975
13016
|
toolManager;
|
|
10976
13017
|
logger = createLogger("mcpc.compose");
|
|
13018
|
+
fileLoaders = /* @__PURE__ */ new Map();
|
|
10977
13019
|
// Legacy property for backward compatibility
|
|
10978
13020
|
get toolNameMapping() {
|
|
10979
13021
|
return this.toolManager.getToolNameMapping();
|
|
@@ -10992,6 +13034,58 @@ var ComposableMCPServer = class extends Server {
|
|
|
10992
13034
|
this.pluginManager = new PluginManager(this);
|
|
10993
13035
|
this.toolManager = new ToolManager();
|
|
10994
13036
|
}
|
|
13037
|
+
/**
|
|
13038
|
+
* Register a file loader for a specific extension.
|
|
13039
|
+
* Plugins can use this to add support for different file formats.
|
|
13040
|
+
*
|
|
13041
|
+
* @param extension - File extension including the dot (e.g., ".md", ".yaml")
|
|
13042
|
+
* @param loader - Function that loads a file and returns a ComposeDefinition
|
|
13043
|
+
*
|
|
13044
|
+
* @example
|
|
13045
|
+
* ```typescript
|
|
13046
|
+
* // In a plugin's configureServer hook:
|
|
13047
|
+
* configureServer: (server) => {
|
|
13048
|
+
* server.registerFileLoader(".md", loadMarkdownAgentFile);
|
|
13049
|
+
* server.registerFileLoader(".yaml", loadYamlAgentFile);
|
|
13050
|
+
* }
|
|
13051
|
+
* ```
|
|
13052
|
+
*/
|
|
13053
|
+
registerFileLoader(extension, loader) {
|
|
13054
|
+
this.fileLoaders.set(extension.toLowerCase(), loader);
|
|
13055
|
+
}
|
|
13056
|
+
/**
|
|
13057
|
+
* Get the file loader for a specific extension.
|
|
13058
|
+
*/
|
|
13059
|
+
getFileLoader(extension) {
|
|
13060
|
+
return this.fileLoaders.get(extension.toLowerCase());
|
|
13061
|
+
}
|
|
13062
|
+
/**
|
|
13063
|
+
* Check if a file extension has a registered loader.
|
|
13064
|
+
*/
|
|
13065
|
+
hasFileLoader(extension) {
|
|
13066
|
+
return this.fileLoaders.has(extension.toLowerCase());
|
|
13067
|
+
}
|
|
13068
|
+
/**
|
|
13069
|
+
* Get all registered file extensions.
|
|
13070
|
+
*/
|
|
13071
|
+
getRegisteredExtensions() {
|
|
13072
|
+
return Array.from(this.fileLoaders.keys());
|
|
13073
|
+
}
|
|
13074
|
+
/**
|
|
13075
|
+
* Resolve a file path to a ComposeDefinition using registered loaders.
|
|
13076
|
+
* @internal
|
|
13077
|
+
*/
|
|
13078
|
+
async resolveFilePath(filePath) {
|
|
13079
|
+
const lastDot = filePath.lastIndexOf(".");
|
|
13080
|
+
const extension = lastDot === -1 ? "" : filePath.slice(lastDot).toLowerCase();
|
|
13081
|
+
const loader = this.fileLoaders.get(extension);
|
|
13082
|
+
if (!loader) {
|
|
13083
|
+
const supportedExtensions = this.getRegisteredExtensions().join(", ");
|
|
13084
|
+
const hint = supportedExtensions ? ` Supported extensions: ${supportedExtensions}.` : ' No file loaders registered. Use a loader plugin (e.g., markdownLoaderPlugin from "@mcpc/plugin-markdown-loader").';
|
|
13085
|
+
throw new Error(`Cannot load file "${filePath}": No loader registered for "${extension}" extension.${hint}`);
|
|
13086
|
+
}
|
|
13087
|
+
return await loader(filePath);
|
|
13088
|
+
}
|
|
10995
13089
|
/**
|
|
10996
13090
|
* Initialize built-in plugins - called during setup
|
|
10997
13091
|
*/
|
|
@@ -11536,32 +13630,16 @@ var ComposableMCPServer = class extends Server {
|
|
|
11536
13630
|
};
|
|
11537
13631
|
|
|
11538
13632
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
11539
|
-
import
|
|
11540
|
-
var isSCF = () => Boolean(
|
|
13633
|
+
import process10 from "node:process";
|
|
13634
|
+
var isSCF = () => Boolean(process10.env.SCF_RUNTIME || process10.env.PROD_SCF);
|
|
11541
13635
|
if (isSCF()) {
|
|
11542
13636
|
console.log({
|
|
11543
13637
|
isSCF: isSCF(),
|
|
11544
|
-
SCF_RUNTIME:
|
|
13638
|
+
SCF_RUNTIME: process10.env.SCF_RUNTIME
|
|
11545
13639
|
});
|
|
11546
13640
|
}
|
|
11547
13641
|
|
|
11548
13642
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/set-up-mcp-compose.js
|
|
11549
|
-
var markdownAgentLoader = null;
|
|
11550
|
-
function isMarkdownFile2(path) {
|
|
11551
|
-
return path.endsWith(".md") || path.endsWith(".markdown");
|
|
11552
|
-
}
|
|
11553
|
-
async function resolveComposeInput(input) {
|
|
11554
|
-
if (typeof input !== "string") {
|
|
11555
|
-
return input;
|
|
11556
|
-
}
|
|
11557
|
-
if (!isMarkdownFile2(input)) {
|
|
11558
|
-
throw new Error(`Invalid compose input: "${input}". Expected a Markdown file path (.md) or a ComposeDefinition object.`);
|
|
11559
|
-
}
|
|
11560
|
-
if (!markdownAgentLoader) {
|
|
11561
|
-
throw new Error(`Cannot load Markdown agent file "${input}": Markdown loader not available. Use markdownLoaderPlugin() from "@mcpc/plugin-markdown-loader", or use inline ComposeDefinition objects.`);
|
|
11562
|
-
}
|
|
11563
|
-
return await markdownAgentLoader(input);
|
|
11564
|
-
}
|
|
11565
13643
|
function parseMcpcConfigs(conf) {
|
|
11566
13644
|
return conf ?? [];
|
|
11567
13645
|
}
|
|
@@ -11579,7 +13657,13 @@ async function mcpc(serverConf, composeConf, optionsOrSetup) {
|
|
|
11579
13657
|
}
|
|
11580
13658
|
}
|
|
11581
13659
|
}
|
|
11582
|
-
const
|
|
13660
|
+
const resolveInput = (input) => {
|
|
13661
|
+
if (typeof input !== "string") {
|
|
13662
|
+
return Promise.resolve(input);
|
|
13663
|
+
}
|
|
13664
|
+
return server.resolveFilePath(input);
|
|
13665
|
+
};
|
|
13666
|
+
const resolvedConfigs = composeConf ? await Promise.all(composeConf.map(resolveInput)) : [];
|
|
11583
13667
|
const parsed = parseMcpcConfigs(resolvedConfigs);
|
|
11584
13668
|
await server.initBuiltInPlugins();
|
|
11585
13669
|
for (const mcpcConfig of parsed) {
|