@d5render/cli 0.1.22 → 0.1.24

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