@d5render/cli 0.1.33 → 0.1.34
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/copilot.js +218 -231
- package/bin/d5cli +2 -2
- package/package.json +1 -1
package/bin/copilot.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import process$1, { argv
|
|
1
|
+
import process$1, { argv } from "node:process";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
|
-
import "node:child_process";
|
|
4
|
-
import "node:fs";
|
|
5
3
|
import { fileURLToPath } from "node:url";
|
|
6
4
|
|
|
7
5
|
//#region rolldown:runtime
|
|
@@ -3582,7 +3580,7 @@ const pipelineType = ZodPipeline.create;
|
|
|
3582
3580
|
//#region node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js
|
|
3583
3581
|
/** A special constant with type `never` */
|
|
3584
3582
|
const NEVER = Object.freeze({ status: "aborted" });
|
|
3585
|
-
function $constructor(name$
|
|
3583
|
+
function $constructor(name$1, initializer$2, params) {
|
|
3586
3584
|
function init(inst, def) {
|
|
3587
3585
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
3588
3586
|
value: {
|
|
@@ -3592,8 +3590,8 @@ function $constructor(name$2, initializer$2, params) {
|
|
|
3592
3590
|
},
|
|
3593
3591
|
enumerable: false
|
|
3594
3592
|
});
|
|
3595
|
-
if (inst._zod.traits.has(name$
|
|
3596
|
-
inst._zod.traits.add(name$
|
|
3593
|
+
if (inst._zod.traits.has(name$1)) return;
|
|
3594
|
+
inst._zod.traits.add(name$1);
|
|
3597
3595
|
initializer$2(inst, def);
|
|
3598
3596
|
const proto = _.prototype;
|
|
3599
3597
|
const keys = Object.keys(proto);
|
|
@@ -3604,7 +3602,7 @@ function $constructor(name$2, initializer$2, params) {
|
|
|
3604
3602
|
}
|
|
3605
3603
|
const Parent = params?.Parent ?? Object;
|
|
3606
3604
|
class Definition extends Parent {}
|
|
3607
|
-
Object.defineProperty(Definition, "name", { value: name$
|
|
3605
|
+
Object.defineProperty(Definition, "name", { value: name$1 });
|
|
3608
3606
|
function _(def) {
|
|
3609
3607
|
var _a$1;
|
|
3610
3608
|
const inst = params?.Parent ? new Definition() : this;
|
|
@@ -3616,9 +3614,9 @@ function $constructor(name$2, initializer$2, params) {
|
|
|
3616
3614
|
Object.defineProperty(_, "init", { value: init });
|
|
3617
3615
|
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
3618
3616
|
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
3619
|
-
return inst?._zod?.traits?.has(name$
|
|
3617
|
+
return inst?._zod?.traits?.has(name$1);
|
|
3620
3618
|
} });
|
|
3621
|
-
Object.defineProperty(_, "name", { value: name$
|
|
3619
|
+
Object.defineProperty(_, "name", { value: name$1 });
|
|
3622
3620
|
return _;
|
|
3623
3621
|
}
|
|
3624
3622
|
var $ZodAsyncError = class extends Error {
|
|
@@ -3627,8 +3625,8 @@ var $ZodAsyncError = class extends Error {
|
|
|
3627
3625
|
}
|
|
3628
3626
|
};
|
|
3629
3627
|
var $ZodEncodeError = class extends Error {
|
|
3630
|
-
constructor(name$
|
|
3631
|
-
super(`Encountered unidirectional transform during encode: ${name$
|
|
3628
|
+
constructor(name$1) {
|
|
3629
|
+
super(`Encountered unidirectional transform during encode: ${name$1}`);
|
|
3632
3630
|
this.name = "ZodEncodeError";
|
|
3633
3631
|
}
|
|
3634
3632
|
};
|
|
@@ -9315,12 +9313,12 @@ const getRefs = (options) => {
|
|
|
9315
9313
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
9316
9314
|
currentPath,
|
|
9317
9315
|
propertyPath: void 0,
|
|
9318
|
-
seen: new Map(Object.entries(_options.definitions).map(([name$
|
|
9316
|
+
seen: new Map(Object.entries(_options.definitions).map(([name$1, def]) => [def._def, {
|
|
9319
9317
|
def: def._def,
|
|
9320
9318
|
path: [
|
|
9321
9319
|
..._options.basePath,
|
|
9322
9320
|
_options.definitionPath,
|
|
9323
|
-
name$
|
|
9321
|
+
name$1
|
|
9324
9322
|
],
|
|
9325
9323
|
jsonSchema: void 0
|
|
9326
9324
|
}]))
|
|
@@ -10308,24 +10306,24 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
10308
10306
|
//#region node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.5/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
10309
10307
|
const zodToJsonSchema = (schema, options) => {
|
|
10310
10308
|
const refs = getRefs(options);
|
|
10311
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name$
|
|
10309
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name$2, schema$1]) => ({
|
|
10312
10310
|
...acc,
|
|
10313
|
-
[name$
|
|
10311
|
+
[name$2]: parseDef(schema$1._def, {
|
|
10314
10312
|
...refs,
|
|
10315
10313
|
currentPath: [
|
|
10316
10314
|
...refs.basePath,
|
|
10317
10315
|
refs.definitionPath,
|
|
10318
|
-
name$
|
|
10316
|
+
name$2
|
|
10319
10317
|
]
|
|
10320
10318
|
}, true) ?? parseAnyDef(refs)
|
|
10321
10319
|
}), {}) : void 0;
|
|
10322
|
-
const name$
|
|
10323
|
-
const main = parseDef(schema._def, name$
|
|
10320
|
+
const name$1 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
10321
|
+
const main = parseDef(schema._def, name$1 === void 0 ? refs : {
|
|
10324
10322
|
...refs,
|
|
10325
10323
|
currentPath: [
|
|
10326
10324
|
...refs.basePath,
|
|
10327
10325
|
refs.definitionPath,
|
|
10328
|
-
name$
|
|
10326
|
+
name$1
|
|
10329
10327
|
]
|
|
10330
10328
|
}, false) ?? parseAnyDef(refs);
|
|
10331
10329
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
@@ -10348,18 +10346,18 @@ const zodToJsonSchema = (schema, options) => {
|
|
|
10348
10346
|
].join("/") }
|
|
10349
10347
|
};
|
|
10350
10348
|
}
|
|
10351
|
-
const combined = name$
|
|
10349
|
+
const combined = name$1 === void 0 ? definitions ? {
|
|
10352
10350
|
...main,
|
|
10353
10351
|
[refs.definitionPath]: definitions
|
|
10354
10352
|
} : main : {
|
|
10355
10353
|
$ref: [
|
|
10356
10354
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
10357
10355
|
refs.definitionPath,
|
|
10358
|
-
name$
|
|
10356
|
+
name$1
|
|
10359
10357
|
].join("/"),
|
|
10360
10358
|
[refs.definitionPath]: {
|
|
10361
10359
|
...definitions,
|
|
10362
|
-
[name$
|
|
10360
|
+
[name$1]: main
|
|
10363
10361
|
}
|
|
10364
10362
|
};
|
|
10365
10363
|
if (refs.target === "jsonSchema7") combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -11388,9 +11386,9 @@ var require_scope = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11388
11386
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
|
11389
11387
|
const code_1 = require_code$1();
|
|
11390
11388
|
var ValueError = class extends Error {
|
|
11391
|
-
constructor(name$
|
|
11392
|
-
super(`CodeGen: "code" for ${name$
|
|
11393
|
-
this.value = name$
|
|
11389
|
+
constructor(name$1) {
|
|
11390
|
+
super(`CodeGen: "code" for ${name$1} not defined`);
|
|
11391
|
+
this.value = name$1.value;
|
|
11394
11392
|
}
|
|
11395
11393
|
};
|
|
11396
11394
|
var UsedValueState;
|
|
@@ -11460,23 +11458,23 @@ var require_scope = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11460
11458
|
value(nameOrPrefix, value) {
|
|
11461
11459
|
var _a$1;
|
|
11462
11460
|
if (value.ref === void 0) throw new Error("CodeGen: ref must be passed in value");
|
|
11463
|
-
const name$
|
|
11464
|
-
const { prefix } = name$
|
|
11461
|
+
const name$1 = this.toName(nameOrPrefix);
|
|
11462
|
+
const { prefix } = name$1;
|
|
11465
11463
|
const valueKey = (_a$1 = value.key) !== null && _a$1 !== void 0 ? _a$1 : value.ref;
|
|
11466
11464
|
let vs = this._values[prefix];
|
|
11467
11465
|
if (vs) {
|
|
11468
11466
|
const _name = vs.get(valueKey);
|
|
11469
11467
|
if (_name) return _name;
|
|
11470
11468
|
} else vs = this._values[prefix] = /* @__PURE__ */ new Map();
|
|
11471
|
-
vs.set(valueKey, name$
|
|
11469
|
+
vs.set(valueKey, name$1);
|
|
11472
11470
|
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
|
11473
11471
|
const itemIndex = s.length;
|
|
11474
11472
|
s[itemIndex] = value.ref;
|
|
11475
|
-
name$
|
|
11473
|
+
name$1.setValue(value, {
|
|
11476
11474
|
property: prefix,
|
|
11477
11475
|
itemIndex
|
|
11478
11476
|
});
|
|
11479
|
-
return name$
|
|
11477
|
+
return name$1;
|
|
11480
11478
|
}
|
|
11481
11479
|
getValue(prefix, keyOrRef) {
|
|
11482
11480
|
const vs = this._values[prefix];
|
|
@@ -11484,15 +11482,15 @@ var require_scope = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11484
11482
|
return vs.get(keyOrRef);
|
|
11485
11483
|
}
|
|
11486
11484
|
scopeRefs(scopeName, values = this._values) {
|
|
11487
|
-
return this._reduceValues(values, (name$
|
|
11488
|
-
if (name$
|
|
11489
|
-
return (0, code_1._)`${scopeName}${name$
|
|
11485
|
+
return this._reduceValues(values, (name$1) => {
|
|
11486
|
+
if (name$1.scopePath === void 0) throw new Error(`CodeGen: name "${name$1}" has no value`);
|
|
11487
|
+
return (0, code_1._)`${scopeName}${name$1.scopePath}`;
|
|
11490
11488
|
});
|
|
11491
11489
|
}
|
|
11492
11490
|
scopeCode(values = this._values, usedValues, getCode) {
|
|
11493
|
-
return this._reduceValues(values, (name$
|
|
11494
|
-
if (name$
|
|
11495
|
-
return name$
|
|
11491
|
+
return this._reduceValues(values, (name$1) => {
|
|
11492
|
+
if (name$1.value === void 0) throw new Error(`CodeGen: name "${name$1}" has no value`);
|
|
11493
|
+
return name$1.value.code;
|
|
11496
11494
|
}, usedValues, getCode);
|
|
11497
11495
|
}
|
|
11498
11496
|
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
|
@@ -11501,16 +11499,16 @@ var require_scope = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11501
11499
|
const vs = values[prefix];
|
|
11502
11500
|
if (!vs) continue;
|
|
11503
11501
|
const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
|
|
11504
|
-
vs.forEach((name$
|
|
11505
|
-
if (nameSet.has(name$
|
|
11506
|
-
nameSet.set(name$
|
|
11507
|
-
let c = valueCode(name$
|
|
11502
|
+
vs.forEach((name$1) => {
|
|
11503
|
+
if (nameSet.has(name$1)) return;
|
|
11504
|
+
nameSet.set(name$1, UsedValueState.Started);
|
|
11505
|
+
let c = valueCode(name$1);
|
|
11508
11506
|
if (c) {
|
|
11509
11507
|
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
|
11510
|
-
code$1 = (0, code_1._)`${code$1}${def} ${name$
|
|
11511
|
-
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name$
|
|
11512
|
-
else throw new ValueError(name$
|
|
11513
|
-
nameSet.set(name$
|
|
11508
|
+
code$1 = (0, code_1._)`${code$1}${def} ${name$1} = ${c};${this.opts._n}`;
|
|
11509
|
+
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name$1)) code$1 = (0, code_1._)`${code$1}${c}${this.opts._n}`;
|
|
11510
|
+
else throw new ValueError(name$1);
|
|
11511
|
+
nameSet.set(name$1, UsedValueState.Completed);
|
|
11514
11512
|
});
|
|
11515
11513
|
}
|
|
11516
11514
|
return code$1;
|
|
@@ -11621,10 +11619,10 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11621
11619
|
}
|
|
11622
11620
|
};
|
|
11623
11621
|
var Def = class extends Node {
|
|
11624
|
-
constructor(varKind, name$
|
|
11622
|
+
constructor(varKind, name$1, rhs) {
|
|
11625
11623
|
super();
|
|
11626
11624
|
this.varKind = varKind;
|
|
11627
|
-
this.name = name$
|
|
11625
|
+
this.name = name$1;
|
|
11628
11626
|
this.rhs = rhs;
|
|
11629
11627
|
}
|
|
11630
11628
|
render({ es5, _n }) {
|
|
@@ -11824,28 +11822,28 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11824
11822
|
}
|
|
11825
11823
|
};
|
|
11826
11824
|
var ForRange = class extends For {
|
|
11827
|
-
constructor(varKind, name$
|
|
11825
|
+
constructor(varKind, name$1, from, to) {
|
|
11828
11826
|
super();
|
|
11829
11827
|
this.varKind = varKind;
|
|
11830
|
-
this.name = name$
|
|
11828
|
+
this.name = name$1;
|
|
11831
11829
|
this.from = from;
|
|
11832
11830
|
this.to = to;
|
|
11833
11831
|
}
|
|
11834
11832
|
render(opts) {
|
|
11835
11833
|
const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
|
|
11836
|
-
const { name: name$
|
|
11837
|
-
return `for(${varKind} ${name$
|
|
11834
|
+
const { name: name$1, from, to } = this;
|
|
11835
|
+
return `for(${varKind} ${name$1}=${from}; ${name$1}<${to}; ${name$1}++)` + super.render(opts);
|
|
11838
11836
|
}
|
|
11839
11837
|
get names() {
|
|
11840
11838
|
return addExprNames(addExprNames(super.names, this.from), this.to);
|
|
11841
11839
|
}
|
|
11842
11840
|
};
|
|
11843
11841
|
var ForIter = class extends For {
|
|
11844
|
-
constructor(loop, varKind, name$
|
|
11842
|
+
constructor(loop, varKind, name$1, iterable) {
|
|
11845
11843
|
super();
|
|
11846
11844
|
this.loop = loop;
|
|
11847
11845
|
this.varKind = varKind;
|
|
11848
|
-
this.name = name$
|
|
11846
|
+
this.name = name$1;
|
|
11849
11847
|
this.iterable = iterable;
|
|
11850
11848
|
}
|
|
11851
11849
|
render(opts) {
|
|
@@ -11861,9 +11859,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11861
11859
|
}
|
|
11862
11860
|
};
|
|
11863
11861
|
var Func = class extends BlockNode {
|
|
11864
|
-
constructor(name$
|
|
11862
|
+
constructor(name$1, args, async) {
|
|
11865
11863
|
super();
|
|
11866
|
-
this.name = name$
|
|
11864
|
+
this.name = name$1;
|
|
11867
11865
|
this.args = args;
|
|
11868
11866
|
this.async = async;
|
|
11869
11867
|
}
|
|
@@ -11945,9 +11943,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11945
11943
|
return this._extScope.name(prefix);
|
|
11946
11944
|
}
|
|
11947
11945
|
scopeValue(prefixOrName, value) {
|
|
11948
|
-
const name$
|
|
11949
|
-
(this._values[name$
|
|
11950
|
-
return name$
|
|
11946
|
+
const name$1 = this._extScope.value(prefixOrName, value);
|
|
11947
|
+
(this._values[name$1.prefix] || (this._values[name$1.prefix] = /* @__PURE__ */ new Set())).add(name$1);
|
|
11948
|
+
return name$1;
|
|
11951
11949
|
}
|
|
11952
11950
|
getScopeValue(prefix, keyOrRef) {
|
|
11953
11951
|
return this._extScope.getValue(prefix, keyOrRef);
|
|
@@ -11959,10 +11957,10 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11959
11957
|
return this._extScope.scopeCode(this._values);
|
|
11960
11958
|
}
|
|
11961
11959
|
_def(varKind, nameOrPrefix, rhs, constant) {
|
|
11962
|
-
const name$
|
|
11963
|
-
if (rhs !== void 0 && constant) this._constants[name$
|
|
11964
|
-
this._leafNode(new Def(varKind, name$
|
|
11965
|
-
return name$
|
|
11960
|
+
const name$1 = this._scope.toName(nameOrPrefix);
|
|
11961
|
+
if (rhs !== void 0 && constant) this._constants[name$1.str] = rhs;
|
|
11962
|
+
this._leafNode(new Def(varKind, name$1, rhs));
|
|
11963
|
+
return name$1;
|
|
11966
11964
|
}
|
|
11967
11965
|
const(nameOrPrefix, rhs, _constant) {
|
|
11968
11966
|
return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
|
|
@@ -12022,24 +12020,24 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12022
12020
|
return this._for(new ForLoop(iteration), forBody);
|
|
12023
12021
|
}
|
|
12024
12022
|
forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
|
|
12025
|
-
const name$
|
|
12026
|
-
return this._for(new ForRange(varKind, name$
|
|
12023
|
+
const name$1 = this._scope.toName(nameOrPrefix);
|
|
12024
|
+
return this._for(new ForRange(varKind, name$1, from, to), () => forBody(name$1));
|
|
12027
12025
|
}
|
|
12028
12026
|
forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
|
|
12029
|
-
const name$
|
|
12027
|
+
const name$1 = this._scope.toName(nameOrPrefix);
|
|
12030
12028
|
if (this.opts.es5) {
|
|
12031
12029
|
const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
|
|
12032
12030
|
return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
|
|
12033
|
-
this.var(name$
|
|
12034
|
-
forBody(name$
|
|
12031
|
+
this.var(name$1, (0, code_1._)`${arr}[${i}]`);
|
|
12032
|
+
forBody(name$1);
|
|
12035
12033
|
});
|
|
12036
12034
|
}
|
|
12037
|
-
return this._for(new ForIter("of", varKind, name$
|
|
12035
|
+
return this._for(new ForIter("of", varKind, name$1, iterable), () => forBody(name$1));
|
|
12038
12036
|
}
|
|
12039
12037
|
forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
|
|
12040
12038
|
if (this.opts.ownProperties) return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
|
|
12041
|
-
const name$
|
|
12042
|
-
return this._for(new ForIter("in", varKind, name$
|
|
12039
|
+
const name$1 = this._scope.toName(nameOrPrefix);
|
|
12040
|
+
return this._for(new ForIter("in", varKind, name$1, obj), () => forBody(name$1));
|
|
12043
12041
|
}
|
|
12044
12042
|
endFor() {
|
|
12045
12043
|
return this._endBlockNode(For);
|
|
@@ -12089,8 +12087,8 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12089
12087
|
this._nodes.length = len;
|
|
12090
12088
|
return this;
|
|
12091
12089
|
}
|
|
12092
|
-
func(name$
|
|
12093
|
-
this._blockNode(new Func(name$
|
|
12090
|
+
func(name$1, args = code_1.nil, async, funcBody) {
|
|
12091
|
+
this._blockNode(new Func(name$1, args, async));
|
|
12094
12092
|
if (funcBody) this.code(funcBody).endFunc();
|
|
12095
12093
|
return this;
|
|
12096
12094
|
}
|
|
@@ -13765,19 +13763,19 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13765
13763
|
const util_1 = require_util();
|
|
13766
13764
|
const validate_1 = require_validate();
|
|
13767
13765
|
var SchemaEnv = class {
|
|
13768
|
-
constructor(env
|
|
13766
|
+
constructor(env) {
|
|
13769
13767
|
var _a$1;
|
|
13770
13768
|
this.refs = {};
|
|
13771
13769
|
this.dynamicAnchors = {};
|
|
13772
13770
|
let schema;
|
|
13773
|
-
if (typeof env
|
|
13774
|
-
this.schema = env
|
|
13775
|
-
this.schemaId = env
|
|
13776
|
-
this.root = env
|
|
13777
|
-
this.baseId = (_a$1 = env
|
|
13778
|
-
this.schemaPath = env
|
|
13779
|
-
this.localRefs = env
|
|
13780
|
-
this.meta = env
|
|
13771
|
+
if (typeof env.schema == "object") schema = env.schema;
|
|
13772
|
+
this.schema = env.schema;
|
|
13773
|
+
this.schemaId = env.schemaId;
|
|
13774
|
+
this.root = env.root || this;
|
|
13775
|
+
this.baseId = (_a$1 = env.baseId) !== null && _a$1 !== void 0 ? _a$1 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
13776
|
+
this.schemaPath = env.schemaPath;
|
|
13777
|
+
this.localRefs = env.localRefs;
|
|
13778
|
+
this.meta = env.meta;
|
|
13781
13779
|
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
|
13782
13780
|
this.refs = {};
|
|
13783
13781
|
}
|
|
@@ -13952,19 +13950,19 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13952
13950
|
const schId = typeof schema === "object" && schema[this.opts.schemaId];
|
|
13953
13951
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
13954
13952
|
}
|
|
13955
|
-
let env
|
|
13953
|
+
let env;
|
|
13956
13954
|
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
|
13957
13955
|
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
|
13958
|
-
env
|
|
13956
|
+
env = resolveSchema.call(this, root, $ref);
|
|
13959
13957
|
}
|
|
13960
13958
|
const { schemaId } = this.opts;
|
|
13961
|
-
env
|
|
13959
|
+
env = env || new SchemaEnv({
|
|
13962
13960
|
schema,
|
|
13963
13961
|
schemaId,
|
|
13964
13962
|
root,
|
|
13965
13963
|
baseId
|
|
13966
13964
|
});
|
|
13967
|
-
if (env
|
|
13965
|
+
if (env.schema !== env.root.schema) return env;
|
|
13968
13966
|
}
|
|
13969
13967
|
}));
|
|
13970
13968
|
|
|
@@ -14282,8 +14280,8 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14282
14280
|
* @param {string} name
|
|
14283
14281
|
* @returns {name is SchemeName}
|
|
14284
14282
|
*/
|
|
14285
|
-
function isValidSchemeName(name$
|
|
14286
|
-
return supportedSchemeNames.indexOf(name$
|
|
14283
|
+
function isValidSchemeName(name$1) {
|
|
14284
|
+
return supportedSchemeNames.indexOf(name$1) !== -1;
|
|
14287
14285
|
}
|
|
14288
14286
|
/**
|
|
14289
14287
|
* @callback SchemeFn
|
|
@@ -15068,9 +15066,9 @@ var require_core$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15068
15066
|
}
|
|
15069
15067
|
return this;
|
|
15070
15068
|
}
|
|
15071
|
-
addFormat(name$
|
|
15069
|
+
addFormat(name$1, format) {
|
|
15072
15070
|
if (typeof format == "string") format = new RegExp(format);
|
|
15073
|
-
this.formats[name$
|
|
15071
|
+
this.formats[name$1] = format;
|
|
15074
15072
|
return this;
|
|
15075
15073
|
}
|
|
15076
15074
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
@@ -15171,9 +15169,9 @@ var require_core$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15171
15169
|
else for (const key in optsSchemas) this.addSchema(optsSchemas[key], key);
|
|
15172
15170
|
}
|
|
15173
15171
|
function addInitialFormats() {
|
|
15174
|
-
for (const name$
|
|
15175
|
-
const format = this.opts.formats[name$
|
|
15176
|
-
if (format) this.addFormat(name$
|
|
15172
|
+
for (const name$1 in this.opts.formats) {
|
|
15173
|
+
const format = this.opts.formats[name$1];
|
|
15174
|
+
if (format) this.addFormat(name$1, format);
|
|
15177
15175
|
}
|
|
15178
15176
|
}
|
|
15179
15177
|
function addInitialKeywords(defs) {
|
|
@@ -15291,15 +15289,15 @@ var require_ref = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15291
15289
|
schemaType: "string",
|
|
15292
15290
|
code(cxt) {
|
|
15293
15291
|
const { gen, schema: $ref, it } = cxt;
|
|
15294
|
-
const { baseId, schemaEnv: env
|
|
15295
|
-
const { root } = env
|
|
15292
|
+
const { baseId, schemaEnv: env, validateName, opts, self } = it;
|
|
15293
|
+
const { root } = env;
|
|
15296
15294
|
if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef();
|
|
15297
15295
|
const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
|
|
15298
15296
|
if (schOrEnv === void 0) throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
|
|
15299
15297
|
if (schOrEnv instanceof compile_1.SchemaEnv) return callValidate(schOrEnv);
|
|
15300
15298
|
return inlineRefSchema(schOrEnv);
|
|
15301
15299
|
function callRootRef() {
|
|
15302
|
-
if (env
|
|
15300
|
+
if (env === root) return callRef(cxt, validateName, env, env.$async);
|
|
15303
15301
|
const rootName = gen.scopeValue("root", { ref: root });
|
|
15304
15302
|
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
|
|
15305
15303
|
}
|
|
@@ -15331,12 +15329,12 @@ var require_ref = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15331
15329
|
exports.getValidate = getValidate;
|
|
15332
15330
|
function callRef(cxt, v, sch, $async) {
|
|
15333
15331
|
const { gen, it } = cxt;
|
|
15334
|
-
const { allErrors, schemaEnv: env
|
|
15332
|
+
const { allErrors, schemaEnv: env, opts } = it;
|
|
15335
15333
|
const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
|
|
15336
15334
|
if ($async) callAsyncRef();
|
|
15337
15335
|
else callSyncRef();
|
|
15338
15336
|
function callAsyncRef() {
|
|
15339
|
-
if (!env
|
|
15337
|
+
if (!env.$async) throw new Error("async schema referenced by sync schema");
|
|
15340
15338
|
const valid = gen.let("valid");
|
|
15341
15339
|
gen.try(() => {
|
|
15342
15340
|
gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);
|
|
@@ -17395,9 +17393,9 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
17395
17393
|
if (opts.keywords) (0, limit_1.default)(ajv);
|
|
17396
17394
|
return ajv;
|
|
17397
17395
|
};
|
|
17398
|
-
formatsPlugin.get = (name$
|
|
17399
|
-
const f = (mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats)[name$
|
|
17400
|
-
if (!f) throw new Error(`Unknown format "${name$
|
|
17396
|
+
formatsPlugin.get = (name$1, mode = "full") => {
|
|
17397
|
+
const f = (mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats)[name$1];
|
|
17398
|
+
if (!f) throw new Error(`Unknown format "${name$1}"`);
|
|
17401
17399
|
return f;
|
|
17402
17400
|
};
|
|
17403
17401
|
function addFormats(ajv, list, fs, exportName) {
|
|
@@ -18013,22 +18011,22 @@ const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
|
18013
18011
|
* @param name - The tool name to validate
|
|
18014
18012
|
* @returns An object containing validation result and any warnings
|
|
18015
18013
|
*/
|
|
18016
|
-
function validateToolName(name$
|
|
18014
|
+
function validateToolName(name$1) {
|
|
18017
18015
|
const warnings = [];
|
|
18018
|
-
if (name$
|
|
18016
|
+
if (name$1.length === 0) return {
|
|
18019
18017
|
isValid: false,
|
|
18020
18018
|
warnings: ["Tool name cannot be empty"]
|
|
18021
18019
|
};
|
|
18022
|
-
if (name$
|
|
18020
|
+
if (name$1.length > 128) return {
|
|
18023
18021
|
isValid: false,
|
|
18024
|
-
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name$
|
|
18022
|
+
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name$1.length})`]
|
|
18025
18023
|
};
|
|
18026
|
-
if (name$
|
|
18027
|
-
if (name$
|
|
18028
|
-
if (name$
|
|
18029
|
-
if (name$
|
|
18030
|
-
if (!TOOL_NAME_REGEX.test(name$
|
|
18031
|
-
const invalidChars = name$
|
|
18024
|
+
if (name$1.includes(" ")) warnings.push("Tool name contains spaces, which may cause parsing issues");
|
|
18025
|
+
if (name$1.includes(",")) warnings.push("Tool name contains commas, which may cause parsing issues");
|
|
18026
|
+
if (name$1.startsWith("-") || name$1.endsWith("-")) warnings.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");
|
|
18027
|
+
if (name$1.startsWith(".") || name$1.endsWith(".")) warnings.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");
|
|
18028
|
+
if (!TOOL_NAME_REGEX.test(name$1)) {
|
|
18029
|
+
const invalidChars = name$1.split("").filter((char) => !/[A-Za-z0-9._-]/.test(char)).filter((char, index, arr) => arr.indexOf(char) === index);
|
|
18032
18030
|
warnings.push(`Tool name contains invalid characters: ${invalidChars.map((c) => `"${c}"`).join(", ")}`, "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)");
|
|
18033
18031
|
return {
|
|
18034
18032
|
isValid: false,
|
|
@@ -18045,9 +18043,9 @@ function validateToolName(name$2) {
|
|
|
18045
18043
|
* @param name - The tool name that triggered the warnings
|
|
18046
18044
|
* @param warnings - Array of warning messages
|
|
18047
18045
|
*/
|
|
18048
|
-
function issueToolNameWarning(name$
|
|
18046
|
+
function issueToolNameWarning(name$1, warnings) {
|
|
18049
18047
|
if (warnings.length > 0) {
|
|
18050
|
-
console.warn(`Tool name validation warning for "${name$
|
|
18048
|
+
console.warn(`Tool name validation warning for "${name$1}":`);
|
|
18051
18049
|
for (const warning of warnings) console.warn(` - ${warning}`);
|
|
18052
18050
|
console.warn("Tool registration will proceed, but this may cause compatibility issues.");
|
|
18053
18051
|
console.warn("Consider updating the tool name to conform to the MCP tool naming standard.");
|
|
@@ -18059,9 +18057,9 @@ function issueToolNameWarning(name$2, warnings) {
|
|
|
18059
18057
|
* @param name - The tool name to validate
|
|
18060
18058
|
* @returns true if the name is valid, false otherwise
|
|
18061
18059
|
*/
|
|
18062
|
-
function validateAndWarnToolName(name$
|
|
18063
|
-
const result = validateToolName(name$
|
|
18064
|
-
issueToolNameWarning(name$
|
|
18060
|
+
function validateAndWarnToolName(name$1) {
|
|
18061
|
+
const result = validateToolName(name$1);
|
|
18062
|
+
issueToolNameWarning(name$1, result.warnings);
|
|
18065
18063
|
return result.isValid;
|
|
18066
18064
|
}
|
|
18067
18065
|
|
|
@@ -18087,13 +18085,13 @@ var ExperimentalMcpServerTasks = class {
|
|
|
18087
18085
|
constructor(_mcpServer) {
|
|
18088
18086
|
this._mcpServer = _mcpServer;
|
|
18089
18087
|
}
|
|
18090
|
-
registerToolTask(name$
|
|
18088
|
+
registerToolTask(name$1, config$1, handler) {
|
|
18091
18089
|
const execution = {
|
|
18092
18090
|
taskSupport: "required",
|
|
18093
18091
|
...config$1.execution
|
|
18094
18092
|
};
|
|
18095
|
-
if (execution.taskSupport === "forbidden") throw new Error(`Cannot register task-based tool '${name$
|
|
18096
|
-
return this._mcpServer._createRegisteredTool(name$
|
|
18093
|
+
if (execution.taskSupport === "forbidden") throw new Error(`Cannot register task-based tool '${name$1}' with taskSupport 'forbidden'. Use registerTool() instead.`);
|
|
18094
|
+
return this._mcpServer._createRegisteredTool(name$1, config$1.title, config$1.description, config$1.inputSchema, config$1.outputSchema, config$1.annotations, execution, config$1._meta, handler);
|
|
18097
18095
|
}
|
|
18098
18096
|
};
|
|
18099
18097
|
|
|
@@ -18146,9 +18144,9 @@ var McpServer = class {
|
|
|
18146
18144
|
this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema));
|
|
18147
18145
|
this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema));
|
|
18148
18146
|
this.server.registerCapabilities({ tools: { listChanged: true } });
|
|
18149
|
-
this.server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name$
|
|
18147
|
+
this.server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name$1, tool]) => {
|
|
18150
18148
|
const toolDefinition = {
|
|
18151
|
-
name: name$
|
|
18149
|
+
name: name$1,
|
|
18152
18150
|
title: tool.title,
|
|
18153
18151
|
description: tool.description,
|
|
18154
18152
|
inputSchema: (() => {
|
|
@@ -18349,8 +18347,8 @@ var McpServer = class {
|
|
|
18349
18347
|
return { resources: [...resources, ...templateResources] };
|
|
18350
18348
|
});
|
|
18351
18349
|
this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
|
|
18352
|
-
return { resourceTemplates: Object.entries(this._registeredResourceTemplates).map(([name$
|
|
18353
|
-
name: name$
|
|
18350
|
+
return { resourceTemplates: Object.entries(this._registeredResourceTemplates).map(([name$1, template]) => ({
|
|
18351
|
+
name: name$1,
|
|
18354
18352
|
uriTemplate: template.resourceTemplate.uriTemplate.toString(),
|
|
18355
18353
|
...template.metadata
|
|
18356
18354
|
})) };
|
|
@@ -18375,9 +18373,9 @@ var McpServer = class {
|
|
|
18375
18373
|
this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema));
|
|
18376
18374
|
this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema));
|
|
18377
18375
|
this.server.registerCapabilities({ prompts: { listChanged: true } });
|
|
18378
|
-
this.server.setRequestHandler(ListPromptsRequestSchema, () => ({ prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name$
|
|
18376
|
+
this.server.setRequestHandler(ListPromptsRequestSchema, () => ({ prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name$1, prompt]) => {
|
|
18379
18377
|
return {
|
|
18380
|
-
name: name$
|
|
18378
|
+
name: name$1,
|
|
18381
18379
|
title: prompt.title,
|
|
18382
18380
|
description: prompt.description,
|
|
18383
18381
|
arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : void 0
|
|
@@ -18403,42 +18401,42 @@ var McpServer = class {
|
|
|
18403
18401
|
});
|
|
18404
18402
|
this._promptHandlersInitialized = true;
|
|
18405
18403
|
}
|
|
18406
|
-
resource(name$
|
|
18404
|
+
resource(name$1, uriOrTemplate, ...rest) {
|
|
18407
18405
|
let metadata;
|
|
18408
18406
|
if (typeof rest[0] === "object") metadata = rest.shift();
|
|
18409
18407
|
const readCallback = rest[0];
|
|
18410
18408
|
if (typeof uriOrTemplate === "string") {
|
|
18411
18409
|
if (this._registeredResources[uriOrTemplate]) throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
18412
|
-
const registeredResource = this._createRegisteredResource(name$
|
|
18410
|
+
const registeredResource = this._createRegisteredResource(name$1, void 0, uriOrTemplate, metadata, readCallback);
|
|
18413
18411
|
this.setResourceRequestHandlers();
|
|
18414
18412
|
this.sendResourceListChanged();
|
|
18415
18413
|
return registeredResource;
|
|
18416
18414
|
} else {
|
|
18417
|
-
if (this._registeredResourceTemplates[name$
|
|
18418
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$
|
|
18415
|
+
if (this._registeredResourceTemplates[name$1]) throw new Error(`Resource template ${name$1} is already registered`);
|
|
18416
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$1, void 0, uriOrTemplate, metadata, readCallback);
|
|
18419
18417
|
this.setResourceRequestHandlers();
|
|
18420
18418
|
this.sendResourceListChanged();
|
|
18421
18419
|
return registeredResourceTemplate;
|
|
18422
18420
|
}
|
|
18423
18421
|
}
|
|
18424
|
-
registerResource(name$
|
|
18422
|
+
registerResource(name$1, uriOrTemplate, config$1, readCallback) {
|
|
18425
18423
|
if (typeof uriOrTemplate === "string") {
|
|
18426
18424
|
if (this._registeredResources[uriOrTemplate]) throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
18427
|
-
const registeredResource = this._createRegisteredResource(name$
|
|
18425
|
+
const registeredResource = this._createRegisteredResource(name$1, config$1.title, uriOrTemplate, config$1, readCallback);
|
|
18428
18426
|
this.setResourceRequestHandlers();
|
|
18429
18427
|
this.sendResourceListChanged();
|
|
18430
18428
|
return registeredResource;
|
|
18431
18429
|
} else {
|
|
18432
|
-
if (this._registeredResourceTemplates[name$
|
|
18433
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$
|
|
18430
|
+
if (this._registeredResourceTemplates[name$1]) throw new Error(`Resource template ${name$1} is already registered`);
|
|
18431
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$1, config$1.title, uriOrTemplate, config$1, readCallback);
|
|
18434
18432
|
this.setResourceRequestHandlers();
|
|
18435
18433
|
this.sendResourceListChanged();
|
|
18436
18434
|
return registeredResourceTemplate;
|
|
18437
18435
|
}
|
|
18438
18436
|
}
|
|
18439
|
-
_createRegisteredResource(name$
|
|
18437
|
+
_createRegisteredResource(name$1, title, uri, metadata, readCallback) {
|
|
18440
18438
|
const registeredResource = {
|
|
18441
|
-
name: name$
|
|
18439
|
+
name: name$1,
|
|
18442
18440
|
title,
|
|
18443
18441
|
metadata,
|
|
18444
18442
|
readCallback,
|
|
@@ -18462,7 +18460,7 @@ var McpServer = class {
|
|
|
18462
18460
|
this._registeredResources[uri] = registeredResource;
|
|
18463
18461
|
return registeredResource;
|
|
18464
18462
|
}
|
|
18465
|
-
_createRegisteredResourceTemplate(name$
|
|
18463
|
+
_createRegisteredResourceTemplate(name$1, title, template, metadata, readCallback) {
|
|
18466
18464
|
const registeredResourceTemplate = {
|
|
18467
18465
|
resourceTemplate: template,
|
|
18468
18466
|
title,
|
|
@@ -18473,8 +18471,8 @@ var McpServer = class {
|
|
|
18473
18471
|
enable: () => registeredResourceTemplate.update({ enabled: true }),
|
|
18474
18472
|
remove: () => registeredResourceTemplate.update({ name: null }),
|
|
18475
18473
|
update: (updates) => {
|
|
18476
|
-
if (typeof updates.name !== "undefined" && updates.name !== name$
|
|
18477
|
-
delete this._registeredResourceTemplates[name$
|
|
18474
|
+
if (typeof updates.name !== "undefined" && updates.name !== name$1) {
|
|
18475
|
+
delete this._registeredResourceTemplates[name$1];
|
|
18478
18476
|
if (updates.name) this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
|
|
18479
18477
|
}
|
|
18480
18478
|
if (typeof updates.title !== "undefined") registeredResourceTemplate.title = updates.title;
|
|
@@ -18485,12 +18483,12 @@ var McpServer = class {
|
|
|
18485
18483
|
this.sendResourceListChanged();
|
|
18486
18484
|
}
|
|
18487
18485
|
};
|
|
18488
|
-
this._registeredResourceTemplates[name$
|
|
18486
|
+
this._registeredResourceTemplates[name$1] = registeredResourceTemplate;
|
|
18489
18487
|
const variableNames = template.uriTemplate.variableNames;
|
|
18490
18488
|
if (Array.isArray(variableNames) && variableNames.some((v) => !!template.completeCallback(v))) this.setCompletionRequestHandler();
|
|
18491
18489
|
return registeredResourceTemplate;
|
|
18492
18490
|
}
|
|
18493
|
-
_createRegisteredPrompt(name$
|
|
18491
|
+
_createRegisteredPrompt(name$1, title, description, argsSchema, callback) {
|
|
18494
18492
|
const registeredPrompt = {
|
|
18495
18493
|
title,
|
|
18496
18494
|
description,
|
|
@@ -18501,8 +18499,8 @@ var McpServer = class {
|
|
|
18501
18499
|
enable: () => registeredPrompt.update({ enabled: true }),
|
|
18502
18500
|
remove: () => registeredPrompt.update({ name: null }),
|
|
18503
18501
|
update: (updates) => {
|
|
18504
|
-
if (typeof updates.name !== "undefined" && updates.name !== name$
|
|
18505
|
-
delete this._registeredPrompts[name$
|
|
18502
|
+
if (typeof updates.name !== "undefined" && updates.name !== name$1) {
|
|
18503
|
+
delete this._registeredPrompts[name$1];
|
|
18506
18504
|
if (updates.name) this._registeredPrompts[updates.name] = registeredPrompt;
|
|
18507
18505
|
}
|
|
18508
18506
|
if (typeof updates.title !== "undefined") registeredPrompt.title = updates.title;
|
|
@@ -18513,7 +18511,7 @@ var McpServer = class {
|
|
|
18513
18511
|
this.sendPromptListChanged();
|
|
18514
18512
|
}
|
|
18515
18513
|
};
|
|
18516
|
-
this._registeredPrompts[name$
|
|
18514
|
+
this._registeredPrompts[name$1] = registeredPrompt;
|
|
18517
18515
|
if (argsSchema) {
|
|
18518
18516
|
if (Object.values(argsSchema).some((field) => {
|
|
18519
18517
|
return isCompletable(field instanceof ZodOptional ? field._def?.innerType : field);
|
|
@@ -18521,8 +18519,8 @@ var McpServer = class {
|
|
|
18521
18519
|
}
|
|
18522
18520
|
return registeredPrompt;
|
|
18523
18521
|
}
|
|
18524
|
-
_createRegisteredTool(name$
|
|
18525
|
-
validateAndWarnToolName(name$
|
|
18522
|
+
_createRegisteredTool(name$1, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {
|
|
18523
|
+
validateAndWarnToolName(name$1);
|
|
18526
18524
|
const registeredTool = {
|
|
18527
18525
|
title,
|
|
18528
18526
|
description,
|
|
@@ -18537,9 +18535,9 @@ var McpServer = class {
|
|
|
18537
18535
|
enable: () => registeredTool.update({ enabled: true }),
|
|
18538
18536
|
remove: () => registeredTool.update({ name: null }),
|
|
18539
18537
|
update: (updates) => {
|
|
18540
|
-
if (typeof updates.name !== "undefined" && updates.name !== name$
|
|
18538
|
+
if (typeof updates.name !== "undefined" && updates.name !== name$1) {
|
|
18541
18539
|
if (typeof updates.name === "string") validateAndWarnToolName(updates.name);
|
|
18542
|
-
delete this._registeredTools[name$
|
|
18540
|
+
delete this._registeredTools[name$1];
|
|
18543
18541
|
if (updates.name) this._registeredTools[updates.name] = registeredTool;
|
|
18544
18542
|
}
|
|
18545
18543
|
if (typeof updates.title !== "undefined") registeredTool.title = updates.title;
|
|
@@ -18553,7 +18551,7 @@ var McpServer = class {
|
|
|
18553
18551
|
this.sendToolListChanged();
|
|
18554
18552
|
}
|
|
18555
18553
|
};
|
|
18556
|
-
this._registeredTools[name$
|
|
18554
|
+
this._registeredTools[name$1] = registeredTool;
|
|
18557
18555
|
this.setToolRequestHandlers();
|
|
18558
18556
|
this.sendToolListChanged();
|
|
18559
18557
|
return registeredTool;
|
|
@@ -18561,8 +18559,8 @@ var McpServer = class {
|
|
|
18561
18559
|
/**
|
|
18562
18560
|
* tool() implementation. Parses arguments passed to overrides defined above.
|
|
18563
18561
|
*/
|
|
18564
|
-
tool(name$
|
|
18565
|
-
if (this._registeredTools[name$
|
|
18562
|
+
tool(name$1, ...rest) {
|
|
18563
|
+
if (this._registeredTools[name$1]) throw new Error(`Tool ${name$1} is already registered`);
|
|
18566
18564
|
let description;
|
|
18567
18565
|
let inputSchema;
|
|
18568
18566
|
let outputSchema;
|
|
@@ -18576,24 +18574,24 @@ var McpServer = class {
|
|
|
18576
18574
|
} else if (typeof firstArg === "object" && firstArg !== null) annotations = rest.shift();
|
|
18577
18575
|
}
|
|
18578
18576
|
const callback = rest[0];
|
|
18579
|
-
return this._createRegisteredTool(name$
|
|
18577
|
+
return this._createRegisteredTool(name$1, void 0, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
|
|
18580
18578
|
}
|
|
18581
18579
|
/**
|
|
18582
18580
|
* Registers a tool with a config object and callback.
|
|
18583
18581
|
*/
|
|
18584
|
-
registerTool(name$
|
|
18585
|
-
if (this._registeredTools[name$
|
|
18582
|
+
registerTool(name$1, config$1, cb) {
|
|
18583
|
+
if (this._registeredTools[name$1]) throw new Error(`Tool ${name$1} is already registered`);
|
|
18586
18584
|
const { title, description, inputSchema, outputSchema, annotations, _meta } = config$1;
|
|
18587
|
-
return this._createRegisteredTool(name$
|
|
18585
|
+
return this._createRegisteredTool(name$1, title, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb);
|
|
18588
18586
|
}
|
|
18589
|
-
prompt(name$
|
|
18590
|
-
if (this._registeredPrompts[name$
|
|
18587
|
+
prompt(name$1, ...rest) {
|
|
18588
|
+
if (this._registeredPrompts[name$1]) throw new Error(`Prompt ${name$1} is already registered`);
|
|
18591
18589
|
let description;
|
|
18592
18590
|
if (typeof rest[0] === "string") description = rest.shift();
|
|
18593
18591
|
let argsSchema;
|
|
18594
18592
|
if (rest.length > 1) argsSchema = rest.shift();
|
|
18595
18593
|
const cb = rest[0];
|
|
18596
|
-
const registeredPrompt = this._createRegisteredPrompt(name$
|
|
18594
|
+
const registeredPrompt = this._createRegisteredPrompt(name$1, void 0, description, argsSchema, cb);
|
|
18597
18595
|
this.setPromptRequestHandlers();
|
|
18598
18596
|
this.sendPromptListChanged();
|
|
18599
18597
|
return registeredPrompt;
|
|
@@ -18601,10 +18599,10 @@ var McpServer = class {
|
|
|
18601
18599
|
/**
|
|
18602
18600
|
* Registers a prompt with a config object and callback.
|
|
18603
18601
|
*/
|
|
18604
|
-
registerPrompt(name$
|
|
18605
|
-
if (this._registeredPrompts[name$
|
|
18602
|
+
registerPrompt(name$1, config$1, cb) {
|
|
18603
|
+
if (this._registeredPrompts[name$1]) throw new Error(`Prompt ${name$1} is already registered`);
|
|
18606
18604
|
const { title, description, argsSchema } = config$1;
|
|
18607
|
-
const registeredPrompt = this._createRegisteredPrompt(name$
|
|
18605
|
+
const registeredPrompt = this._createRegisteredPrompt(name$1, title, description, argsSchema, cb);
|
|
18608
18606
|
this.setPromptRequestHandlers();
|
|
18609
18607
|
this.sendPromptListChanged();
|
|
18610
18608
|
return registeredPrompt;
|
|
@@ -18693,9 +18691,9 @@ function getZodSchemaObject(schema) {
|
|
|
18693
18691
|
function promptArgumentsFromSchema(schema) {
|
|
18694
18692
|
const shape = getObjectShape(schema);
|
|
18695
18693
|
if (!shape) return [];
|
|
18696
|
-
return Object.entries(shape).map(([name$
|
|
18694
|
+
return Object.entries(shape).map(([name$1, field]) => {
|
|
18697
18695
|
return {
|
|
18698
|
-
name: name$
|
|
18696
|
+
name: name$1,
|
|
18699
18697
|
description: getSchemaDescription(field),
|
|
18700
18698
|
required: !isSchemaOptional(field)
|
|
18701
18699
|
};
|
|
@@ -18803,77 +18801,6 @@ var StdioServerTransport = class {
|
|
|
18803
18801
|
}
|
|
18804
18802
|
};
|
|
18805
18803
|
|
|
18806
|
-
//#endregion
|
|
18807
|
-
//#region package.json
|
|
18808
|
-
var name$1 = "@d5render/cli";
|
|
18809
|
-
|
|
18810
|
-
//#endregion
|
|
18811
|
-
//#region packages/gitlab/url.ts
|
|
18812
|
-
function buildHeaders() {
|
|
18813
|
-
const headers = new Headers();
|
|
18814
|
-
headers.set("Content-Type", "application/json");
|
|
18815
|
-
const { GITLAB_TOKEN = "" } = envUsed;
|
|
18816
|
-
if (GITLAB_TOKEN.startsWith("glpat-")) headers.set("PRIVATE-TOKEN", GITLAB_TOKEN);
|
|
18817
|
-
else headers.set("Authorization", `Bearer ${GITLAB_TOKEN}`);
|
|
18818
|
-
return headers;
|
|
18819
|
-
}
|
|
18820
|
-
const pipelineMerge = () => {
|
|
18821
|
-
const { CI_MERGE_REQUEST_IID, CI_PROJECT_ID, CI_SERVER_URL } = envUsed;
|
|
18822
|
-
if (CI_MERGE_REQUEST_IID && CI_PROJECT_ID && CI_SERVER_URL) return `${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}`;
|
|
18823
|
-
};
|
|
18824
|
-
const visitCommit = () => {
|
|
18825
|
-
const { CI_PROJECT_PATH, CI_SERVER_URL } = envUsed;
|
|
18826
|
-
if (CI_PROJECT_PATH && CI_SERVER_URL) return `${CI_SERVER_URL}/${CI_PROJECT_PATH}/-/commit`;
|
|
18827
|
-
};
|
|
18828
|
-
function visitPipeline(mid) {
|
|
18829
|
-
const { CI_SERVER_URL, CI_PROJECT_PATH, CI_MERGE_REQUEST_IID = mid, CI_COMMIT_SHA } = envUsed;
|
|
18830
|
-
if (!CI_SERVER_URL || !CI_PROJECT_PATH) return {};
|
|
18831
|
-
if (CI_MERGE_REQUEST_IID) return {
|
|
18832
|
-
url: `${CI_SERVER_URL}/${CI_PROJECT_PATH}/-/merge_requests/${CI_MERGE_REQUEST_IID}`,
|
|
18833
|
-
type: "merge_request"
|
|
18834
|
-
};
|
|
18835
|
-
if (CI_COMMIT_SHA) return {
|
|
18836
|
-
url: `${visitCommit()}/${CI_COMMIT_SHA}`,
|
|
18837
|
-
type: "commit"
|
|
18838
|
-
};
|
|
18839
|
-
return {};
|
|
18840
|
-
}
|
|
18841
|
-
const commits = () => {
|
|
18842
|
-
const { CI_PROJECT_ID, CI_SERVER_URL } = envUsed;
|
|
18843
|
-
if (CI_PROJECT_ID && CI_SERVER_URL) return `${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/repository/commits`;
|
|
18844
|
-
};
|
|
18845
|
-
|
|
18846
|
-
//#endregion
|
|
18847
|
-
//#region packages/message/sendding.ts
|
|
18848
|
-
async function sendding(title, text) {
|
|
18849
|
-
if (!envUsed.DINGTALK_WEBHOOK) throw new Error("non DINGTALK_WEBHOOK");
|
|
18850
|
-
let res = new Response();
|
|
18851
|
-
for (const url of envUsed.DINGTALK_WEBHOOK.split(",")) res = await fetch(url, {
|
|
18852
|
-
method: "POST",
|
|
18853
|
-
headers: { "Content-Type": "application/json" },
|
|
18854
|
-
body: JSON.stringify({
|
|
18855
|
-
msgtype: "markdown",
|
|
18856
|
-
markdown: {
|
|
18857
|
-
title,
|
|
18858
|
-
text
|
|
18859
|
-
},
|
|
18860
|
-
at: {
|
|
18861
|
-
atMobiles: ["17856104313"],
|
|
18862
|
-
isAtAll: false
|
|
18863
|
-
}
|
|
18864
|
-
})
|
|
18865
|
-
});
|
|
18866
|
-
return res;
|
|
18867
|
-
}
|
|
18868
|
-
|
|
18869
|
-
//#endregion
|
|
18870
|
-
//#region copilot/bin/utils.ts
|
|
18871
|
-
const NAME = name$1.replaceAll("/", "_");
|
|
18872
|
-
const RUNTIME_CWD = join(dirname(fileURLToPath(import.meta.url)), "../");
|
|
18873
|
-
const HOME = env.USERPROFILE ?? env.HOME ?? env.HOMEPATH;
|
|
18874
|
-
if (!HOME) throw new Error("cannot find `USERPROFILE` directory");
|
|
18875
|
-
const TEMP = env.CI_PROJECT_DIR + "." + NAME;
|
|
18876
|
-
|
|
18877
18804
|
//#endregion
|
|
18878
18805
|
//#region copilot/server/config.ts
|
|
18879
18806
|
const name = "d5_mcp_review_builtin";
|
|
@@ -18881,6 +18808,7 @@ const report = "report";
|
|
|
18881
18808
|
const getHash = "hash";
|
|
18882
18809
|
const noMandatory = "dont't call under non-mandatory conditions";
|
|
18883
18810
|
const file = "bin/copilot.js";
|
|
18811
|
+
const RUNTIME_CWD = join(dirname(fileURLToPath(import.meta.url)), "../");
|
|
18884
18812
|
const serveFile = join(RUNTIME_CWD, file);
|
|
18885
18813
|
const envJson = buildEnv();
|
|
18886
18814
|
const envUsed = {
|
|
@@ -18927,6 +18855,42 @@ function buildEnv() {
|
|
|
18927
18855
|
return envJson$1;
|
|
18928
18856
|
}
|
|
18929
18857
|
|
|
18858
|
+
//#endregion
|
|
18859
|
+
//#region packages/gitlab/url.ts
|
|
18860
|
+
function buildHeaders() {
|
|
18861
|
+
const headers = new Headers();
|
|
18862
|
+
headers.set("Content-Type", "application/json");
|
|
18863
|
+
const { GITLAB_TOKEN = "" } = envUsed;
|
|
18864
|
+
if (GITLAB_TOKEN.startsWith("glpat-")) headers.set("PRIVATE-TOKEN", GITLAB_TOKEN);
|
|
18865
|
+
else headers.set("Authorization", `Bearer ${GITLAB_TOKEN}`);
|
|
18866
|
+
return headers;
|
|
18867
|
+
}
|
|
18868
|
+
const pipelineMerge = () => {
|
|
18869
|
+
const { CI_MERGE_REQUEST_IID, CI_PROJECT_ID, CI_SERVER_URL } = envUsed;
|
|
18870
|
+
if (CI_MERGE_REQUEST_IID && CI_PROJECT_ID && CI_SERVER_URL) return `${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}`;
|
|
18871
|
+
};
|
|
18872
|
+
const visitCommit = () => {
|
|
18873
|
+
const { CI_PROJECT_PATH, CI_SERVER_URL } = envUsed;
|
|
18874
|
+
if (CI_PROJECT_PATH && CI_SERVER_URL) return `${CI_SERVER_URL}/${CI_PROJECT_PATH}/-/commit`;
|
|
18875
|
+
};
|
|
18876
|
+
function visitPipeline(mid) {
|
|
18877
|
+
const { CI_SERVER_URL, CI_PROJECT_PATH, CI_MERGE_REQUEST_IID = mid, CI_COMMIT_SHA } = envUsed;
|
|
18878
|
+
if (!CI_SERVER_URL || !CI_PROJECT_PATH) return {};
|
|
18879
|
+
if (CI_MERGE_REQUEST_IID) return {
|
|
18880
|
+
url: `${CI_SERVER_URL}/${CI_PROJECT_PATH}/-/merge_requests/${CI_MERGE_REQUEST_IID}`,
|
|
18881
|
+
type: "merge_request"
|
|
18882
|
+
};
|
|
18883
|
+
if (CI_COMMIT_SHA) return {
|
|
18884
|
+
url: `${visitCommit()}/${CI_COMMIT_SHA}`,
|
|
18885
|
+
type: "commit"
|
|
18886
|
+
};
|
|
18887
|
+
return {};
|
|
18888
|
+
}
|
|
18889
|
+
const commits = () => {
|
|
18890
|
+
const { CI_PROJECT_ID, CI_SERVER_URL } = envUsed;
|
|
18891
|
+
if (CI_PROJECT_ID && CI_SERVER_URL) return `${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/repository/commits`;
|
|
18892
|
+
};
|
|
18893
|
+
|
|
18930
18894
|
//#endregion
|
|
18931
18895
|
//#region packages/gitlab/commit.ts
|
|
18932
18896
|
const getCommits = () => {
|
|
@@ -19101,6 +19065,29 @@ const reportSchema = {
|
|
|
19101
19065
|
})).optional().describe("After gaining a comprehensive understanding of the files involved in the commits, propose suggestions for code corrections beyond the diff.")
|
|
19102
19066
|
};
|
|
19103
19067
|
|
|
19068
|
+
//#endregion
|
|
19069
|
+
//#region packages/message/sendding.ts
|
|
19070
|
+
async function sendding(title, text) {
|
|
19071
|
+
if (!envUsed.DINGTALK_WEBHOOK) throw new Error("non DINGTALK_WEBHOOK");
|
|
19072
|
+
let res = new Response();
|
|
19073
|
+
for (const url of envUsed.DINGTALK_WEBHOOK.split(",")) res = await fetch(url, {
|
|
19074
|
+
method: "POST",
|
|
19075
|
+
headers: { "Content-Type": "application/json" },
|
|
19076
|
+
body: JSON.stringify({
|
|
19077
|
+
msgtype: "markdown",
|
|
19078
|
+
markdown: {
|
|
19079
|
+
title,
|
|
19080
|
+
text
|
|
19081
|
+
},
|
|
19082
|
+
at: {
|
|
19083
|
+
atMobiles: ["17856104313"],
|
|
19084
|
+
isAtAll: false
|
|
19085
|
+
}
|
|
19086
|
+
})
|
|
19087
|
+
});
|
|
19088
|
+
return res;
|
|
19089
|
+
}
|
|
19090
|
+
|
|
19104
19091
|
//#endregion
|
|
19105
19092
|
//#region packages/message/report.ts
|
|
19106
19093
|
const lastComment = { value: {} };
|
package/bin/d5cli
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name$1 = "@d5render/cli";
|
|
10
|
-
var version = "0.1.
|
|
10
|
+
var version = "0.1.34";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region copilot/server/config.ts
|
|
@@ -15,6 +15,7 @@ const name = "d5_mcp_review_builtin";
|
|
|
15
15
|
const report = "report";
|
|
16
16
|
const getHash = "hash";
|
|
17
17
|
const file = "bin/copilot.js";
|
|
18
|
+
const RUNTIME_CWD = join(dirname(fileURLToPath(import.meta.url)), "../");
|
|
18
19
|
const serveFile = join(RUNTIME_CWD, file);
|
|
19
20
|
const envJson = buildEnv();
|
|
20
21
|
const envUsed = {
|
|
@@ -120,7 +121,6 @@ async function sendding(title, text) {
|
|
|
120
121
|
//#region copilot/bin/utils.ts
|
|
121
122
|
const NAME = name$1.replaceAll("/", "_");
|
|
122
123
|
const VERSION = version;
|
|
123
|
-
const RUNTIME_CWD = join(dirname(fileURLToPath(import.meta.url)), "../");
|
|
124
124
|
const HOME = env.USERPROFILE ?? env.HOME ?? env.HOMEPATH;
|
|
125
125
|
if (!HOME) throw new Error("cannot find `USERPROFILE` directory");
|
|
126
126
|
const TEMP = env.CI_PROJECT_DIR + "." + NAME;
|