@dedenlabs/claude-code-router-cli 2.0.8-beta.7 → 2.0.8-beta.8

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.
Files changed (2) hide show
  1. package/dist/cli.js +213 -199
  2. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -2094,11 +2094,11 @@ var require_commonjs3 = __commonJS({
2094
2094
  return (f) => f.length === len && f !== "." && f !== "..";
2095
2095
  };
2096
2096
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
2097
- var path8 = {
2097
+ var path9 = {
2098
2098
  win32: { sep: "\\" },
2099
2099
  posix: { sep: "/" }
2100
2100
  };
2101
- exports2.sep = defaultPlatform === "win32" ? path8.win32.sep : path8.posix.sep;
2101
+ exports2.sep = defaultPlatform === "win32" ? path9.win32.sep : path9.posix.sep;
2102
2102
  exports2.minimatch.sep = exports2.sep;
2103
2103
  exports2.GLOBSTAR = Symbol("globstar **");
2104
2104
  exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
@@ -5415,12 +5415,12 @@ var require_commonjs6 = __commonJS({
5415
5415
  /**
5416
5416
  * Get the Path object referenced by the string path, resolved from this Path
5417
5417
  */
5418
- resolve(path8) {
5419
- if (!path8) {
5418
+ resolve(path9) {
5419
+ if (!path9) {
5420
5420
  return this;
5421
5421
  }
5422
- const rootPath = this.getRootString(path8);
5423
- const dir = path8.substring(rootPath.length);
5422
+ const rootPath = this.getRootString(path9);
5423
+ const dir = path9.substring(rootPath.length);
5424
5424
  const dirParts = dir.split(this.splitSep);
5425
5425
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
5426
5426
  return result;
@@ -6173,8 +6173,8 @@ var require_commonjs6 = __commonJS({
6173
6173
  /**
6174
6174
  * @internal
6175
6175
  */
6176
- getRootString(path8) {
6177
- return node_path_1.win32.parse(path8).root;
6176
+ getRootString(path9) {
6177
+ return node_path_1.win32.parse(path9).root;
6178
6178
  }
6179
6179
  /**
6180
6180
  * @internal
@@ -6221,8 +6221,8 @@ var require_commonjs6 = __commonJS({
6221
6221
  /**
6222
6222
  * @internal
6223
6223
  */
6224
- getRootString(path8) {
6225
- return path8.startsWith("/") ? "/" : "";
6224
+ getRootString(path9) {
6225
+ return path9.startsWith("/") ? "/" : "";
6226
6226
  }
6227
6227
  /**
6228
6228
  * @internal
@@ -6312,11 +6312,11 @@ var require_commonjs6 = __commonJS({
6312
6312
  /**
6313
6313
  * Get the depth of a provided path, string, or the cwd
6314
6314
  */
6315
- depth(path8 = this.cwd) {
6316
- if (typeof path8 === "string") {
6317
- path8 = this.cwd.resolve(path8);
6315
+ depth(path9 = this.cwd) {
6316
+ if (typeof path9 === "string") {
6317
+ path9 = this.cwd.resolve(path9);
6318
6318
  }
6319
- return path8.depth();
6319
+ return path9.depth();
6320
6320
  }
6321
6321
  /**
6322
6322
  * Return the cache of child entries. Exposed so subclasses can create
@@ -6803,9 +6803,9 @@ var require_commonjs6 = __commonJS({
6803
6803
  process4();
6804
6804
  return results;
6805
6805
  }
6806
- chdir(path8 = this.cwd) {
6806
+ chdir(path9 = this.cwd) {
6807
6807
  const oldCwd = this.cwd;
6808
- this.cwd = typeof path8 === "string" ? this.cwd.resolve(path8) : path8;
6808
+ this.cwd = typeof path9 === "string" ? this.cwd.resolve(path9) : path9;
6809
6809
  this.cwd[setAsCwd](oldCwd);
6810
6810
  }
6811
6811
  };
@@ -7193,8 +7193,8 @@ var require_processor = __commonJS({
7193
7193
  }
7194
7194
  // match, absolute, ifdir
7195
7195
  entries() {
7196
- return [...this.store.entries()].map(([path8, n]) => [
7197
- path8,
7196
+ return [...this.store.entries()].map(([path9, n]) => [
7197
+ path9,
7198
7198
  !!(n & 2),
7199
7199
  !!(n & 1)
7200
7200
  ]);
@@ -7412,9 +7412,9 @@ var require_walker = __commonJS({
7412
7412
  signal;
7413
7413
  maxDepth;
7414
7414
  includeChildMatches;
7415
- constructor(patterns, path8, opts) {
7415
+ constructor(patterns, path9, opts) {
7416
7416
  this.patterns = patterns;
7417
- this.path = path8;
7417
+ this.path = path9;
7418
7418
  this.opts = opts;
7419
7419
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
7420
7420
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -7433,11 +7433,11 @@ var require_walker = __commonJS({
7433
7433
  });
7434
7434
  }
7435
7435
  }
7436
- #ignored(path8) {
7437
- return this.seen.has(path8) || !!this.#ignore?.ignored?.(path8);
7436
+ #ignored(path9) {
7437
+ return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
7438
7438
  }
7439
- #childrenIgnored(path8) {
7440
- return !!this.#ignore?.childrenIgnored?.(path8);
7439
+ #childrenIgnored(path9) {
7440
+ return !!this.#ignore?.childrenIgnored?.(path9);
7441
7441
  }
7442
7442
  // backpressure mechanism
7443
7443
  pause() {
@@ -7653,8 +7653,8 @@ var require_walker = __commonJS({
7653
7653
  exports2.GlobUtil = GlobUtil;
7654
7654
  var GlobWalker = class extends GlobUtil {
7655
7655
  matches = /* @__PURE__ */ new Set();
7656
- constructor(patterns, path8, opts) {
7657
- super(patterns, path8, opts);
7656
+ constructor(patterns, path9, opts) {
7657
+ super(patterns, path9, opts);
7658
7658
  }
7659
7659
  matchEmit(e) {
7660
7660
  this.matches.add(e);
@@ -7692,8 +7692,8 @@ var require_walker = __commonJS({
7692
7692
  exports2.GlobWalker = GlobWalker;
7693
7693
  var GlobStream = class extends GlobUtil {
7694
7694
  results;
7695
- constructor(patterns, path8, opts) {
7696
- super(patterns, path8, opts);
7695
+ constructor(patterns, path9, opts) {
7696
+ super(patterns, path9, opts);
7697
7697
  this.results = new minipass_1.Minipass({
7698
7698
  signal: this.signal,
7699
7699
  objectMode: true
@@ -8185,11 +8185,11 @@ var require_Mime = __commonJS({
8185
8185
  }
8186
8186
  }
8187
8187
  };
8188
- Mime.prototype.getType = function(path8) {
8189
- path8 = String(path8);
8190
- let last = path8.replace(/^.*[/\\]/, "").toLowerCase();
8188
+ Mime.prototype.getType = function(path9) {
8189
+ path9 = String(path9);
8190
+ let last = path9.replace(/^.*[/\\]/, "").toLowerCase();
8191
8191
  let ext = last.replace(/^.*\./, "").toLowerCase();
8192
- let hasPath = last.length < path8.length;
8192
+ let hasPath = last.length < path9.length;
8193
8193
  let hasDot = ext.length < last.length - 1;
8194
8194
  return (hasDot || !hasPath) && this._types[ext] || null;
8195
8195
  };
@@ -9675,7 +9675,7 @@ var require_send = __commonJS({
9675
9675
  "node_modules/@fastify/send/lib/send.js"(exports2, module2) {
9676
9676
  "use strict";
9677
9677
  var fs7 = require("node:fs");
9678
- var path8 = require("node:path");
9678
+ var path9 = require("node:path");
9679
9679
  var stream = require("node:stream");
9680
9680
  var debug = require("node:util").debuglog("send");
9681
9681
  var decode = require_fast_decode_uri_component();
@@ -9691,11 +9691,11 @@ var require_send = __commonJS({
9691
9691
  var { parseBytesRange } = require_parseBytesRange();
9692
9692
  var { parseTokenList } = require_parseTokenList();
9693
9693
  var { createHttpError } = require_createHttpError();
9694
- var extname = path8.extname;
9695
- var join9 = path8.join;
9696
- var normalize = path8.normalize;
9697
- var resolve = path8.resolve;
9698
- var sep2 = path8.sep;
9694
+ var extname = path9.extname;
9695
+ var join9 = path9.join;
9696
+ var normalize = path9.normalize;
9697
+ var resolve = path9.resolve;
9698
+ var sep2 = path9.sep;
9699
9699
  var Readable = stream.Readable;
9700
9700
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
9701
9701
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
@@ -9762,36 +9762,36 @@ var require_send = __commonJS({
9762
9762
  };
9763
9763
  }
9764
9764
  function normalizePath(_path, root) {
9765
- let path9 = decode(_path);
9766
- if (path9 == null) {
9765
+ let path10 = decode(_path);
9766
+ if (path10 == null) {
9767
9767
  return { statusCode: 400 };
9768
9768
  }
9769
- if (~path9.indexOf("\0")) {
9769
+ if (~path10.indexOf("\0")) {
9770
9770
  return { statusCode: 400 };
9771
9771
  }
9772
9772
  let parts;
9773
9773
  if (root !== null) {
9774
- if (path9) {
9775
- path9 = normalize("." + sep2 + path9);
9774
+ if (path10) {
9775
+ path10 = normalize("." + sep2 + path10);
9776
9776
  }
9777
- if (UP_PATH_REGEXP.test(path9)) {
9778
- debug('malicious path "%s"', path9);
9777
+ if (UP_PATH_REGEXP.test(path10)) {
9778
+ debug('malicious path "%s"', path10);
9779
9779
  return { statusCode: 403 };
9780
9780
  }
9781
- parts = path9.split(sep2);
9782
- path9 = normalize(join9(root, path9));
9781
+ parts = path10.split(sep2);
9782
+ path10 = normalize(join9(root, path10));
9783
9783
  } else {
9784
- if (UP_PATH_REGEXP.test(path9)) {
9785
- debug('malicious path "%s"', path9);
9784
+ if (UP_PATH_REGEXP.test(path10)) {
9785
+ debug('malicious path "%s"', path10);
9786
9786
  return { statusCode: 403 };
9787
9787
  }
9788
- parts = normalize(path9).split(sep2);
9789
- path9 = resolve(path9);
9788
+ parts = normalize(path10).split(sep2);
9789
+ path10 = resolve(path10);
9790
9790
  }
9791
- return { path: path9, parts };
9791
+ return { path: path10, parts };
9792
9792
  }
9793
- function hasTrailingSlash(path9) {
9794
- return path9[path9.length - 1] === "/";
9793
+ function hasTrailingSlash(path10) {
9794
+ return path10[path10.length - 1] === "/";
9795
9795
  }
9796
9796
  function isConditionalGET(request) {
9797
9797
  return request.headers["if-match"] || request.headers["if-unmodified-since"] || request.headers["if-none-match"] || request.headers["if-modified-since"];
@@ -9881,9 +9881,9 @@ var require_send = __commonJS({
9881
9881
  lastModified <= ifRangeTimestamp
9882
9882
  );
9883
9883
  }
9884
- function tryStat(path9) {
9884
+ function tryStat(path10) {
9885
9885
  return new Promise((resolve2) => {
9886
- fs7.stat(path9, function onstat(error, stat3) {
9886
+ fs7.stat(path10, function onstat(error, stat3) {
9887
9887
  resolve2({ error, stat: stat3 });
9888
9888
  });
9889
9889
  });
@@ -9919,7 +9919,7 @@ var require_send = __commonJS({
9919
9919
  return sendError(500, err);
9920
9920
  }
9921
9921
  }
9922
- function sendNotModified(headers, path9, stat3) {
9922
+ function sendNotModified(headers, path10, stat3) {
9923
9923
  debug("not modified");
9924
9924
  delete headers["Content-Encoding"];
9925
9925
  delete headers["Content-Language"];
@@ -9932,15 +9932,15 @@ var require_send = __commonJS({
9932
9932
  stream: Readable.from(""),
9933
9933
  // metadata
9934
9934
  type: "file",
9935
- metadata: { path: path9, stat: stat3 }
9935
+ metadata: { path: path10, stat: stat3 }
9936
9936
  };
9937
9937
  }
9938
- function sendFileDirectly(request, path9, stat3, options) {
9938
+ function sendFileDirectly(request, path10, stat3, options) {
9939
9939
  let len = stat3.size;
9940
9940
  let offset = options.start ?? 0;
9941
9941
  let statusCode = 200;
9942
9942
  const headers = {};
9943
- debug('send "%s"', path9);
9943
+ debug('send "%s"', path10);
9944
9944
  if (options.acceptRanges) {
9945
9945
  debug("accept ranges");
9946
9946
  headers["Accept-Ranges"] = "bytes";
@@ -9964,7 +9964,7 @@ var require_send = __commonJS({
9964
9964
  headers.ETag = etag;
9965
9965
  }
9966
9966
  if (options.contentType) {
9967
- let type = mime.getType(path9) || mime.default_type;
9967
+ let type = mime.getType(path10) || mime.default_type;
9968
9968
  debug("content-type %s", type);
9969
9969
  if (type && isUtf8MimeType(type)) {
9970
9970
  type += "; charset=utf-8";
@@ -9978,7 +9978,7 @@ var require_send = __commonJS({
9978
9978
  return sendError(412);
9979
9979
  }
9980
9980
  if (isNotModifiedFailure(request, headers)) {
9981
- return sendNotModified(headers, path9, stat3);
9981
+ return sendNotModified(headers, path10, stat3);
9982
9982
  }
9983
9983
  }
9984
9984
  len = Math.max(0, len - offset);
@@ -10020,10 +10020,10 @@ var require_send = __commonJS({
10020
10020
  stream: Readable.from(""),
10021
10021
  // metadata
10022
10022
  type: "file",
10023
- metadata: { path: path9, stat: stat3 }
10023
+ metadata: { path: path10, stat: stat3 }
10024
10024
  };
10025
10025
  }
10026
- const stream2 = fs7.createReadStream(path9, {
10026
+ const stream2 = fs7.createReadStream(path10, {
10027
10027
  highWaterMark: options.highWaterMark,
10028
10028
  start: offset,
10029
10029
  end: Math.max(offset, offset + len - 1)
@@ -10034,10 +10034,10 @@ var require_send = __commonJS({
10034
10034
  stream: stream2,
10035
10035
  // metadata
10036
10036
  type: "file",
10037
- metadata: { path: path9, stat: stat3 }
10037
+ metadata: { path: path10, stat: stat3 }
10038
10038
  };
10039
10039
  }
10040
- function sendRedirect(path9, options) {
10040
+ function sendRedirect(path10, options) {
10041
10041
  if (hasTrailingSlash(options.path)) {
10042
10042
  return sendError(403);
10043
10043
  }
@@ -10055,14 +10055,14 @@ var require_send = __commonJS({
10055
10055
  stream: Readable.from(doc[0]),
10056
10056
  // metadata
10057
10057
  type: "directory",
10058
- metadata: { requestPath: options.path, path: path9 }
10058
+ metadata: { requestPath: options.path, path: path10 }
10059
10059
  };
10060
10060
  }
10061
- async function sendIndex(request, path9, options) {
10061
+ async function sendIndex(request, path10, options) {
10062
10062
  let err;
10063
10063
  for (let i = 0; i < options.index.length; i++) {
10064
10064
  const index = options.index[i];
10065
- const p = join9(path9, index);
10065
+ const p = join9(path10, index);
10066
10066
  const { error, stat: stat3 } = await tryStat(p);
10067
10067
  if (error) {
10068
10068
  err = error;
@@ -10076,13 +10076,13 @@ var require_send = __commonJS({
10076
10076
  }
10077
10077
  return sendError(404);
10078
10078
  }
10079
- async function sendFile(request, path9, options) {
10080
- const { error, stat: stat3 } = await tryStat(path9);
10081
- if (error && error.code === "ENOENT" && !extname(path9) && path9[path9.length - 1] !== sep2) {
10079
+ async function sendFile(request, path10, options) {
10080
+ const { error, stat: stat3 } = await tryStat(path10);
10081
+ if (error && error.code === "ENOENT" && !extname(path10) && path10[path10.length - 1] !== sep2) {
10082
10082
  let err = error;
10083
10083
  for (let i = 0; i < options.extensions.length; i++) {
10084
10084
  const extension = options.extensions[i];
10085
- const p = path9 + "." + extension;
10085
+ const p = path10 + "." + extension;
10086
10086
  const { error: error2, stat: stat4 } = await tryStat(p);
10087
10087
  if (error2) {
10088
10088
  err = error2;
@@ -10100,14 +10100,14 @@ var require_send = __commonJS({
10100
10100
  return sendError(404);
10101
10101
  }
10102
10102
  if (error) return sendStatError(error);
10103
- if (stat3.isDirectory()) return sendRedirect(path9, options);
10104
- return sendFileDirectly(request, path9, stat3, options);
10103
+ if (stat3.isDirectory()) return sendRedirect(path10, options);
10104
+ return sendFileDirectly(request, path10, stat3, options);
10105
10105
  }
10106
10106
  async function send(request, _path, options) {
10107
10107
  const opts = normalizeOptions(options);
10108
10108
  opts.path = _path;
10109
10109
  const parsed = normalizePath(_path, opts.root);
10110
- const { path: path9, parts } = parsed;
10110
+ const { path: path10, parts } = parsed;
10111
10111
  if (parsed.statusCode !== void 0) {
10112
10112
  return sendError(parsed.statusCode);
10113
10113
  }
@@ -10117,23 +10117,23 @@ var require_send = __commonJS({
10117
10117
  /* c8 ignore start */
10118
10118
  /* unreachable, because NODE_DEBUG can not be set after process is running */
10119
10119
  case 0:
10120
- debug('allow dotfile "%s"', path9);
10120
+ debug('allow dotfile "%s"', path10);
10121
10121
  break;
10122
10122
  /* c8 ignore stop */
10123
10123
  case 2:
10124
- debug('deny dotfile "%s"', path9);
10124
+ debug('deny dotfile "%s"', path10);
10125
10125
  return sendError(403);
10126
10126
  case 1:
10127
10127
  // 'ignore'
10128
10128
  default:
10129
- debug('ignore dotfile "%s"', path9);
10129
+ debug('ignore dotfile "%s"', path10);
10130
10130
  return sendError(404);
10131
10131
  }
10132
10132
  }
10133
10133
  if (opts.index.length && hasTrailingSlash(_path)) {
10134
- return sendIndex(request, path9, opts);
10134
+ return sendIndex(request, path10, opts);
10135
10135
  }
10136
- return sendFile(request, path9, opts);
10136
+ return sendFile(request, path10, opts);
10137
10137
  }
10138
10138
  module2.exports.send = send;
10139
10139
  }
@@ -10835,16 +10835,16 @@ var require_dirList = __commonJS({
10835
10835
  "node_modules/@fastify/static/lib/dirList.js"(exports2, module2) {
10836
10836
  "use strict";
10837
10837
  var os2 = require("node:os");
10838
- var path8 = require("node:path");
10838
+ var path9 = require("node:path");
10839
10839
  var fs7 = require("node:fs/promises");
10840
10840
  var fastq = require_queue();
10841
10841
  var fastqConcurrency = Math.max(1, os2.cpus().length - 1);
10842
10842
  var dirList = {
10843
10843
  _getExtendedInfo: async function(dir, info) {
10844
- const depth = dir.split(path8.sep).length;
10844
+ const depth = dir.split(path9.sep).length;
10845
10845
  const files = await fs7.readdir(dir);
10846
10846
  const worker = async (filename) => {
10847
- const filePath = path8.join(dir, filename);
10847
+ const filePath = path9.join(dir, filename);
10848
10848
  let stats;
10849
10849
  try {
10850
10850
  stats = await fs7.stat(filePath);
@@ -10853,12 +10853,12 @@ var require_dirList = __commonJS({
10853
10853
  }
10854
10854
  if (stats.isDirectory()) {
10855
10855
  info.totalFolderCount++;
10856
- filePath.split(path8.sep).length === depth + 1 && info.folderCount++;
10856
+ filePath.split(path9.sep).length === depth + 1 && info.folderCount++;
10857
10857
  await dirList._getExtendedInfo(filePath, info);
10858
10858
  } else {
10859
10859
  info.totalSize += stats.size;
10860
10860
  info.totalFileCount++;
10861
- filePath.split(path8.sep).length === depth + 1 && info.fileCount++;
10861
+ filePath.split(path9.sep).length === depth + 1 && info.fileCount++;
10862
10862
  info.lastModified = Math.max(info.lastModified, stats.mtimeMs);
10863
10863
  }
10864
10864
  };
@@ -10901,14 +10901,14 @@ var require_dirList = __commonJS({
10901
10901
  const worker = async (filename) => {
10902
10902
  let stats;
10903
10903
  try {
10904
- stats = await fs7.stat(path8.join(dir, filename));
10904
+ stats = await fs7.stat(path9.join(dir, filename));
10905
10905
  } catch {
10906
10906
  return;
10907
10907
  }
10908
10908
  const entry = { name: filename, stats };
10909
10909
  if (stats.isDirectory()) {
10910
10910
  if (options.extendedFolderInfo) {
10911
- entry.extendedInfo = await dirList.getExtendedInfo(path8.join(dir, filename));
10911
+ entry.extendedInfo = await dirList.getExtendedInfo(path9.join(dir, filename));
10912
10912
  }
10913
10913
  entries.dirs.push(entry);
10914
10914
  } else {
@@ -10964,11 +10964,11 @@ var require_dirList = __commonJS({
10964
10964
  * @return {ListFile}
10965
10965
  */
10966
10966
  htmlInfo: function(entry, route, prefix, options) {
10967
- if (options.names?.includes(path8.basename(route))) {
10968
- route = path8.normalize(path8.join(route, ".."));
10967
+ if (options.names?.includes(path9.basename(route))) {
10968
+ route = path9.normalize(path9.join(route, ".."));
10969
10969
  }
10970
10970
  return {
10971
- href: encodeURI(path8.join(prefix, route, entry.name).replace(/\\/gu, "/")),
10971
+ href: encodeURI(path9.join(prefix, route, entry.name).replace(/\\/gu, "/")),
10972
10972
  name: entry.name,
10973
10973
  stats: entry.stats,
10974
10974
  extendedInfo: entry.extendedInfo
@@ -10981,7 +10981,7 @@ var require_dirList = __commonJS({
10981
10981
  * @return {boolean}
10982
10982
  */
10983
10983
  handle: function(route, options) {
10984
- return options.names?.includes(path8.basename(route)) || // match trailing slash
10984
+ return options.names?.includes(path9.basename(route)) || // match trailing slash
10985
10985
  ((options.names?.includes("/") && route[route.length - 1] === "/") ?? false);
10986
10986
  },
10987
10987
  /**
@@ -10991,7 +10991,7 @@ var require_dirList = __commonJS({
10991
10991
  */
10992
10992
  path: function(root, route) {
10993
10993
  const _route = route[route.length - 1] === "/" ? route + "none" : route;
10994
- return path8.dirname(path8.join(root, _route));
10994
+ return path9.dirname(path9.join(root, _route));
10995
10995
  },
10996
10996
  /**
10997
10997
  * validate options
@@ -11026,7 +11026,7 @@ var require_dirList = __commonJS({
11026
11026
  var require_static = __commonJS({
11027
11027
  "node_modules/@fastify/static/index.js"(exports2, module2) {
11028
11028
  "use strict";
11029
- var path8 = require("node:path");
11029
+ var path9 = require("node:path");
11030
11030
  var { fileURLToPath } = require("node:url");
11031
11031
  var { statSync: statSync2 } = require("node:fs");
11032
11032
  var { glob } = require_commonjs7();
@@ -11137,7 +11137,7 @@ var require_static = __commonJS({
11137
11137
  const routes = /* @__PURE__ */ new Set();
11138
11138
  const roots = Array.isArray(sendOptions.root) ? sendOptions.root : [sendOptions.root];
11139
11139
  for (let rootPath of roots) {
11140
- rootPath = rootPath.split(path8.win32.sep).join(path8.posix.sep);
11140
+ rootPath = rootPath.split(path9.win32.sep).join(path9.posix.sep);
11141
11141
  !rootPath.endsWith("/") && (rootPath += "/");
11142
11142
  const files = await glob("**/**", {
11143
11143
  cwd: rootPath,
@@ -11148,16 +11148,16 @@ var require_static = __commonJS({
11148
11148
  ignore: opts.globIgnore
11149
11149
  });
11150
11150
  for (let file of files) {
11151
- file = file.split(path8.win32.sep).join(path8.posix.sep);
11151
+ file = file.split(path9.win32.sep).join(path9.posix.sep);
11152
11152
  const route = prefix + file;
11153
11153
  if (routes.has(route)) {
11154
11154
  continue;
11155
11155
  }
11156
11156
  routes.add(route);
11157
11157
  setUpHeadAndGet(routeOpts, route, `/${file}`, rootPath);
11158
- const key = path8.posix.basename(route);
11158
+ const key = path9.posix.basename(route);
11159
11159
  if (indexes.has(key) && !indexDirs.has(key)) {
11160
- indexDirs.set(path8.posix.dirname(route), rootPath);
11160
+ indexDirs.set(path9.posix.dirname(route), rootPath);
11161
11161
  }
11162
11162
  }
11163
11163
  }
@@ -11181,7 +11181,7 @@ var require_static = __commonJS({
11181
11181
  } else {
11182
11182
  options.root = rootPath;
11183
11183
  }
11184
- } else if (path8.isAbsolute(pathname) === false) {
11184
+ } else if (path9.isAbsolute(pathname) === false) {
11185
11185
  return reply.callNotFound();
11186
11186
  }
11187
11187
  if (allowedPath && !allowedPath(pathname, options.root, request)) {
@@ -11213,11 +11213,11 @@ var require_static = __commonJS({
11213
11213
  } = await send(request.raw, encodeURI(pathnameForSend), options);
11214
11214
  switch (type) {
11215
11215
  case "directory": {
11216
- const path9 = metadata.path;
11216
+ const path10 = metadata.path;
11217
11217
  if (opts.list) {
11218
11218
  await dirList.send({
11219
11219
  reply,
11220
- dir: path9,
11220
+ dir: path10,
11221
11221
  options: opts.list,
11222
11222
  route: pathname,
11223
11223
  prefix,
@@ -11374,7 +11374,7 @@ var require_static = __commonJS({
11374
11374
  '"root" option array contains one or more duplicate paths'
11375
11375
  );
11376
11376
  }
11377
- rootPath.map((path9) => checkPath(fastify, path9));
11377
+ rootPath.map((path10) => checkPath(fastify, path10));
11378
11378
  return;
11379
11379
  }
11380
11380
  if (typeof rootPath === "string") {
@@ -11386,7 +11386,7 @@ var require_static = __commonJS({
11386
11386
  if (typeof rootPath !== "string") {
11387
11387
  throw new TypeError('"root" option must be a string');
11388
11388
  }
11389
- if (path8.isAbsolute(rootPath) === false) {
11389
+ if (path9.isAbsolute(rootPath) === false) {
11390
11390
  throw new Error('"root" option must be an absolute path');
11391
11391
  }
11392
11392
  let pathStat;
@@ -11403,8 +11403,8 @@ var require_static = __commonJS({
11403
11403
  throw new Error('"root" option must point to a directory');
11404
11404
  }
11405
11405
  }
11406
- function getContentType(path9) {
11407
- const type = send.mime.getType(path9) || send.mime.default_type;
11406
+ function getContentType(path10) {
11407
+ const type = send.mime.getType(path10) || send.mime.default_type;
11408
11408
  if (!send.isUtf8MimeType(type)) {
11409
11409
  return type;
11410
11410
  }
@@ -11413,7 +11413,7 @@ var require_static = __commonJS({
11413
11413
  function findIndexFile(pathname, root, indexFiles = ["index.html"]) {
11414
11414
  if (Array.isArray(indexFiles)) {
11415
11415
  return indexFiles.find((filename) => {
11416
- const p = path8.join(root, pathname, filename);
11416
+ const p = path9.join(root, pathname, filename);
11417
11417
  try {
11418
11418
  const stats = statSync2(p);
11419
11419
  return !stats.isDirectory();
@@ -11879,13 +11879,13 @@ var require_tiktoken = __commonJS({
11879
11879
  var wasm = require_tiktoken_bg();
11880
11880
  var imports = {};
11881
11881
  imports["./tiktoken_bg.js"] = wasm;
11882
- var path8 = require("path");
11882
+ var path9 = require("path");
11883
11883
  var fs7 = require("fs");
11884
- var candidates = __dirname.split(path8.sep).reduce((memo, _, index, array) => {
11885
- const prefix = array.slice(0, index + 1).join(path8.sep) + path8.sep;
11886
- if (!prefix.includes("node_modules" + path8.sep)) {
11884
+ var candidates = __dirname.split(path9.sep).reduce((memo, _, index, array) => {
11885
+ const prefix = array.slice(0, index + 1).join(path9.sep) + path9.sep;
11886
+ if (!prefix.includes("node_modules" + path9.sep)) {
11887
11887
  memo.unshift(
11888
- path8.join(
11888
+ path9.join(
11889
11889
  prefix,
11890
11890
  "node_modules",
11891
11891
  "tiktoken",
@@ -11896,7 +11896,7 @@ var require_tiktoken = __commonJS({
11896
11896
  }
11897
11897
  return memo;
11898
11898
  }, []);
11899
- candidates.unshift(path8.join(__dirname, "./tiktoken_bg.wasm"));
11899
+ candidates.unshift(path9.join(__dirname, "./tiktoken_bg.wasm"));
11900
11900
  var bytes = null;
11901
11901
  for (const candidate of candidates) {
11902
11902
  try {
@@ -11921,7 +11921,7 @@ var require_package = __commonJS({
11921
11921
  "package.json"(exports2, module2) {
11922
11922
  module2.exports = {
11923
11923
  name: "@dedenlabs/claude-code-router-cli",
11924
- version: "2.0.8-beta.7",
11924
+ version: "2.0.8-beta.8",
11925
11925
  description: "\u57FA\u4E8E@musistudio/claude-code-router\u7684\u589E\u5F3A\u7248CLI\u8DEF\u7531\u5DE5\u5177 - \u652F\u6301\u7EDF\u4E00\u8DEF\u7531\u5F15\u64CE\u3001\u5916\u90E8\u89C4\u5219\u52A0\u8F7D\u3001\u667A\u80FD\u65E5\u5FD7\u7CFB\u7EDF\u3001\u81EA\u52A8\u914D\u7F6E\u8FC1\u79FB\u548CGLM\u601D\u8003\u6A21\u5F0F",
11926
11926
  bin: {
11927
11927
  ccr: "dist/cli.js"
@@ -11998,6 +11998,7 @@ var require_package = __commonJS({
11998
11998
  },
11999
11999
  files: [
12000
12000
  "dist/",
12001
+ "packages/core/dist/",
12001
12002
  "examples/",
12002
12003
  "LICENSE",
12003
12004
  "README.md",
@@ -12473,11 +12474,11 @@ var require_find_pid = __commonJS({
12473
12474
  var fs7 = __importStar(require("fs"));
12474
12475
  var utils_1 = __importDefault(require_utils());
12475
12476
  var logger_1 = __importDefault(require_logger());
12476
- var ensureDir2 = (path8) => new Promise((resolve, reject) => {
12477
- if (fs7.existsSync(path8)) {
12477
+ var ensureDir2 = (path9) => new Promise((resolve, reject) => {
12478
+ if (fs7.existsSync(path9)) {
12478
12479
  resolve();
12479
12480
  } else {
12480
- fs7.mkdir(path8, (err) => {
12481
+ fs7.mkdir(path9, (err) => {
12481
12482
  err ? reject(err) : resolve();
12482
12483
  });
12483
12484
  }
@@ -12676,7 +12677,7 @@ var require_find_process = __commonJS({
12676
12677
  return mod && mod.__esModule ? mod : { "default": mod };
12677
12678
  };
12678
12679
  Object.defineProperty(exports2, "__esModule", { value: true });
12679
- var path8 = __importStar(require("path"));
12680
+ var path9 = __importStar(require("path"));
12680
12681
  var utils_1 = __importDefault(require_utils());
12681
12682
  function matchName(text, name) {
12682
12683
  if (!name) {
@@ -12688,7 +12689,7 @@ var require_find_process = __commonJS({
12688
12689
  return false;
12689
12690
  }
12690
12691
  function fetchBin(cmd) {
12691
- const pieces = cmd.split(path8.sep);
12692
+ const pieces = cmd.split(path9.sep);
12692
12693
  const last = pieces[pieces.length - 1];
12693
12694
  if (last) {
12694
12695
  pieces[pieces.length - 1] = last.split(" ")[0];
@@ -12705,16 +12706,16 @@ var require_find_process = __commonJS({
12705
12706
  }
12706
12707
  fixed.push(part);
12707
12708
  }
12708
- return fixed.join(path8.sep);
12709
+ return fixed.join(path9.sep);
12709
12710
  }
12710
12711
  function fetchName(fullpath) {
12711
12712
  if (process.platform === "darwin") {
12712
12713
  const idx = fullpath.indexOf(".app/");
12713
12714
  if (idx >= 0) {
12714
- return path8.basename(fullpath.substring(0, idx));
12715
+ return path9.basename(fullpath.substring(0, idx));
12715
12716
  }
12716
12717
  }
12717
- return path8.basename(fullpath);
12718
+ return path9.basename(fullpath);
12718
12719
  }
12719
12720
  var finders = {
12720
12721
  darwin(cond) {
@@ -14047,14 +14048,14 @@ var require_util2 = __commonJS({
14047
14048
  }
14048
14049
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
14049
14050
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
14050
- let path8 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
14051
+ let path9 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
14051
14052
  if (origin[origin.length - 1] === "/") {
14052
14053
  origin = origin.slice(0, origin.length - 1);
14053
14054
  }
14054
- if (path8 && path8[0] !== "/") {
14055
- path8 = `/${path8}`;
14055
+ if (path9 && path9[0] !== "/") {
14056
+ path9 = `/${path9}`;
14056
14057
  }
14057
- return new URL(`${origin}${path8}`);
14058
+ return new URL(`${origin}${path9}`);
14058
14059
  }
14059
14060
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
14060
14061
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -14874,9 +14875,9 @@ var require_diagnostics = __commonJS({
14874
14875
  "undici:client:sendHeaders",
14875
14876
  (evt) => {
14876
14877
  const {
14877
- request: { method, path: path8, origin }
14878
+ request: { method, path: path9, origin }
14878
14879
  } = evt;
14879
- debugLog("sending request to %s %s%s", method, origin, path8);
14880
+ debugLog("sending request to %s %s%s", method, origin, path9);
14880
14881
  }
14881
14882
  );
14882
14883
  }
@@ -14894,14 +14895,14 @@ var require_diagnostics = __commonJS({
14894
14895
  "undici:request:headers",
14895
14896
  (evt) => {
14896
14897
  const {
14897
- request: { method, path: path8, origin },
14898
+ request: { method, path: path9, origin },
14898
14899
  response: { statusCode }
14899
14900
  } = evt;
14900
14901
  debugLog(
14901
14902
  "received response to %s %s%s - HTTP %d",
14902
14903
  method,
14903
14904
  origin,
14904
- path8,
14905
+ path9,
14905
14906
  statusCode
14906
14907
  );
14907
14908
  }
@@ -14910,23 +14911,23 @@ var require_diagnostics = __commonJS({
14910
14911
  "undici:request:trailers",
14911
14912
  (evt) => {
14912
14913
  const {
14913
- request: { method, path: path8, origin }
14914
+ request: { method, path: path9, origin }
14914
14915
  } = evt;
14915
- debugLog("trailers received from %s %s%s", method, origin, path8);
14916
+ debugLog("trailers received from %s %s%s", method, origin, path9);
14916
14917
  }
14917
14918
  );
14918
14919
  diagnosticsChannel.subscribe(
14919
14920
  "undici:request:error",
14920
14921
  (evt) => {
14921
14922
  const {
14922
- request: { method, path: path8, origin },
14923
+ request: { method, path: path9, origin },
14923
14924
  error
14924
14925
  } = evt;
14925
14926
  debugLog(
14926
14927
  "request to %s %s%s errored - %s",
14927
14928
  method,
14928
14929
  origin,
14929
- path8,
14930
+ path9,
14930
14931
  error.message
14931
14932
  );
14932
14933
  }
@@ -15026,7 +15027,7 @@ var require_request = __commonJS({
15026
15027
  var kHandler = Symbol("handler");
15027
15028
  var Request = class {
15028
15029
  constructor(origin, {
15029
- path: path8,
15030
+ path: path9,
15030
15031
  method,
15031
15032
  body,
15032
15033
  headers,
@@ -15042,11 +15043,11 @@ var require_request = __commonJS({
15042
15043
  throwOnError,
15043
15044
  maxRedirections
15044
15045
  }, handler) {
15045
- if (typeof path8 !== "string") {
15046
+ if (typeof path9 !== "string") {
15046
15047
  throw new InvalidArgumentError("path must be a string");
15047
- } else if (path8[0] !== "/" && !(path8.startsWith("http://") || path8.startsWith("https://")) && method !== "CONNECT") {
15048
+ } else if (path9[0] !== "/" && !(path9.startsWith("http://") || path9.startsWith("https://")) && method !== "CONNECT") {
15048
15049
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
15049
- } else if (invalidPathRegex.test(path8)) {
15050
+ } else if (invalidPathRegex.test(path9)) {
15050
15051
  throw new InvalidArgumentError("invalid request path");
15051
15052
  }
15052
15053
  if (typeof method !== "string") {
@@ -15114,7 +15115,7 @@ var require_request = __commonJS({
15114
15115
  this.completed = false;
15115
15116
  this.aborted = false;
15116
15117
  this.upgrade = upgrade || null;
15117
- this.path = query ? serializePathWithQuery(path8, query) : path8;
15118
+ this.path = query ? serializePathWithQuery(path9, query) : path9;
15118
15119
  this.origin = origin;
15119
15120
  this.protocol = getProtocolFromUrlString(origin);
15120
15121
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -20106,7 +20107,7 @@ var require_client_h1 = __commonJS({
20106
20107
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
20107
20108
  }
20108
20109
  function writeH1(client, request) {
20109
- const { method, path: path8, host, upgrade, blocking, reset } = request;
20110
+ const { method, path: path9, host, upgrade, blocking, reset } = request;
20110
20111
  let { body, headers, contentLength } = request;
20111
20112
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
20112
20113
  if (util.isFormDataLike(body)) {
@@ -20172,7 +20173,7 @@ var require_client_h1 = __commonJS({
20172
20173
  if (blocking) {
20173
20174
  socket[kBlocking] = true;
20174
20175
  }
20175
- let header = `${method} ${path8} HTTP/1.1\r
20176
+ let header = `${method} ${path9} HTTP/1.1\r
20176
20177
  `;
20177
20178
  if (typeof host === "string") {
20178
20179
  header += `host: ${host}\r
@@ -20778,7 +20779,7 @@ var require_client_h2 = __commonJS({
20778
20779
  function writeH2(client, request) {
20779
20780
  const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
20780
20781
  const session = client[kHTTP2Session];
20781
- const { method, path: path8, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
20782
+ const { method, path: path9, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
20782
20783
  let { body } = request;
20783
20784
  if (upgrade != null && upgrade !== "websocket") {
20784
20785
  util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -20846,7 +20847,7 @@ var require_client_h2 = __commonJS({
20846
20847
  }
20847
20848
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
20848
20849
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
20849
- headers[HTTP2_HEADER_PATH] = path8;
20850
+ headers[HTTP2_HEADER_PATH] = path9;
20850
20851
  if (protocol === "ws:" || protocol === "wss:") {
20851
20852
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
20852
20853
  } else {
@@ -20887,7 +20888,7 @@ var require_client_h2 = __commonJS({
20887
20888
  stream.setTimeout(requestTimeout);
20888
20889
  return true;
20889
20890
  }
20890
- headers[HTTP2_HEADER_PATH] = path8;
20891
+ headers[HTTP2_HEADER_PATH] = path9;
20891
20892
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
20892
20893
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
20893
20894
  if (body && typeof body.read === "function") {
@@ -22487,10 +22488,10 @@ var require_proxy_agent = __commonJS({
22487
22488
  };
22488
22489
  const {
22489
22490
  origin,
22490
- path: path8 = "/",
22491
+ path: path9 = "/",
22491
22492
  headers = {}
22492
22493
  } = opts;
22493
- opts.path = origin + path8;
22494
+ opts.path = origin + path9;
22494
22495
  if (!("host" in headers) && !("Host" in headers)) {
22495
22496
  const { host } = new URL(origin);
22496
22497
  headers.host = host;
@@ -24532,20 +24533,20 @@ var require_mock_utils = __commonJS({
24532
24533
  }
24533
24534
  return normalizedQp;
24534
24535
  }
24535
- function safeUrl(path8) {
24536
- if (typeof path8 !== "string") {
24537
- return path8;
24536
+ function safeUrl(path9) {
24537
+ if (typeof path9 !== "string") {
24538
+ return path9;
24538
24539
  }
24539
- const pathSegments = path8.split("?", 3);
24540
+ const pathSegments = path9.split("?", 3);
24540
24541
  if (pathSegments.length !== 2) {
24541
- return path8;
24542
+ return path9;
24542
24543
  }
24543
24544
  const qp = new URLSearchParams(pathSegments.pop());
24544
24545
  qp.sort();
24545
24546
  return [...pathSegments, qp.toString()].join("?");
24546
24547
  }
24547
- function matchKey(mockDispatch2, { path: path8, method, body, headers }) {
24548
- const pathMatch = matchValue(mockDispatch2.path, path8);
24548
+ function matchKey(mockDispatch2, { path: path9, method, body, headers }) {
24549
+ const pathMatch = matchValue(mockDispatch2.path, path9);
24549
24550
  const methodMatch = matchValue(mockDispatch2.method, method);
24550
24551
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
24551
24552
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -24570,8 +24571,8 @@ var require_mock_utils = __commonJS({
24570
24571
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
24571
24572
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
24572
24573
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
24573
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path8, ignoreTrailingSlash }) => {
24574
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path8)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path8), resolvedPath);
24574
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path9, ignoreTrailingSlash }) => {
24575
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path9)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path9), resolvedPath);
24575
24576
  });
24576
24577
  if (matchedMockDispatches.length === 0) {
24577
24578
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -24609,19 +24610,19 @@ var require_mock_utils = __commonJS({
24609
24610
  mockDispatches.splice(index, 1);
24610
24611
  }
24611
24612
  }
24612
- function removeTrailingSlash(path8) {
24613
- while (path8.endsWith("/")) {
24614
- path8 = path8.slice(0, -1);
24613
+ function removeTrailingSlash(path9) {
24614
+ while (path9.endsWith("/")) {
24615
+ path9 = path9.slice(0, -1);
24615
24616
  }
24616
- if (path8.length === 0) {
24617
- path8 = "/";
24617
+ if (path9.length === 0) {
24618
+ path9 = "/";
24618
24619
  }
24619
- return path8;
24620
+ return path9;
24620
24621
  }
24621
24622
  function buildKey(opts) {
24622
- const { path: path8, method, body, headers, query } = opts;
24623
+ const { path: path9, method, body, headers, query } = opts;
24623
24624
  return {
24624
- path: path8,
24625
+ path: path9,
24625
24626
  method,
24626
24627
  body,
24627
24628
  headers,
@@ -25278,10 +25279,10 @@ var require_pending_interceptors_formatter = __commonJS({
25278
25279
  }
25279
25280
  format(pendingInterceptors) {
25280
25281
  const withPrettyHeaders = pendingInterceptors.map(
25281
- ({ method, path: path8, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
25282
+ ({ method, path: path9, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
25282
25283
  Method: method,
25283
25284
  Origin: origin,
25284
- Path: path8,
25285
+ Path: path9,
25285
25286
  "Status code": statusCode,
25286
25287
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
25287
25288
  Invocations: timesInvoked,
@@ -25361,9 +25362,9 @@ var require_mock_agent = __commonJS({
25361
25362
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
25362
25363
  const dispatchOpts = { ...opts };
25363
25364
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
25364
- const [path8, searchParams] = dispatchOpts.path.split("?");
25365
+ const [path9, searchParams] = dispatchOpts.path.split("?");
25365
25366
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
25366
- dispatchOpts.path = `${path8}?${normalizedSearchParams}`;
25367
+ dispatchOpts.path = `${path9}?${normalizedSearchParams}`;
25367
25368
  }
25368
25369
  return this[kAgent].dispatch(dispatchOpts, handler);
25369
25370
  }
@@ -25764,12 +25765,12 @@ var require_snapshot_recorder = __commonJS({
25764
25765
  * @return {Promise<void>} - Resolves when snapshots are loaded
25765
25766
  */
25766
25767
  async loadSnapshots(filePath) {
25767
- const path8 = filePath || this.#snapshotPath;
25768
- if (!path8) {
25768
+ const path9 = filePath || this.#snapshotPath;
25769
+ if (!path9) {
25769
25770
  throw new InvalidArgumentError("Snapshot path is required");
25770
25771
  }
25771
25772
  try {
25772
- const data = await readFile4(resolve(path8), "utf8");
25773
+ const data = await readFile4(resolve(path9), "utf8");
25773
25774
  const parsed = JSON.parse(data);
25774
25775
  if (Array.isArray(parsed)) {
25775
25776
  this.#snapshots.clear();
@@ -25783,7 +25784,7 @@ var require_snapshot_recorder = __commonJS({
25783
25784
  if (error.code === "ENOENT") {
25784
25785
  this.#snapshots.clear();
25785
25786
  } else {
25786
- throw new UndiciError(`Failed to load snapshots from ${path8}`, { cause: error });
25787
+ throw new UndiciError(`Failed to load snapshots from ${path9}`, { cause: error });
25787
25788
  }
25788
25789
  }
25789
25790
  }
@@ -25794,11 +25795,11 @@ var require_snapshot_recorder = __commonJS({
25794
25795
  * @returns {Promise<void>} - Resolves when snapshots are saved
25795
25796
  */
25796
25797
  async saveSnapshots(filePath) {
25797
- const path8 = filePath || this.#snapshotPath;
25798
- if (!path8) {
25798
+ const path9 = filePath || this.#snapshotPath;
25799
+ if (!path9) {
25799
25800
  throw new InvalidArgumentError("Snapshot path is required");
25800
25801
  }
25801
- const resolvedPath = resolve(path8);
25802
+ const resolvedPath = resolve(path9);
25802
25803
  await mkdir2(dirname(resolvedPath), { recursive: true });
25803
25804
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
25804
25805
  hash,
@@ -26423,15 +26424,15 @@ var require_redirect_handler = __commonJS({
26423
26424
  return;
26424
26425
  }
26425
26426
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
26426
- const path8 = search ? `${pathname}${search}` : pathname;
26427
- const redirectUrlString = `${origin}${path8}`;
26427
+ const path9 = search ? `${pathname}${search}` : pathname;
26428
+ const redirectUrlString = `${origin}${path9}`;
26428
26429
  for (const historyUrl of this.history) {
26429
26430
  if (historyUrl.toString() === redirectUrlString) {
26430
26431
  throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
26431
26432
  }
26432
26433
  }
26433
26434
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
26434
- this.opts.path = path8;
26435
+ this.opts.path = path9;
26435
26436
  this.opts.origin = origin;
26436
26437
  this.opts.query = null;
26437
26438
  }
@@ -33197,9 +33198,9 @@ var require_util5 = __commonJS({
33197
33198
  }
33198
33199
  }
33199
33200
  }
33200
- function validateCookiePath(path8) {
33201
- for (let i = 0; i < path8.length; ++i) {
33202
- const code = path8.charCodeAt(i);
33201
+ function validateCookiePath(path9) {
33202
+ for (let i = 0; i < path9.length; ++i) {
33203
+ const code = path9.charCodeAt(i);
33203
33204
  if (code < 32 || // exclude CTLs (0-31)
33204
33205
  code === 127 || // DEL
33205
33206
  code === 59) {
@@ -36309,11 +36310,11 @@ var require_undici = __commonJS({
36309
36310
  if (typeof opts.path !== "string") {
36310
36311
  throw new InvalidArgumentError("invalid opts.path");
36311
36312
  }
36312
- let path8 = opts.path;
36313
+ let path9 = opts.path;
36313
36314
  if (!opts.path.startsWith("/")) {
36314
- path8 = `/${path8}`;
36315
+ path9 = `/${path9}`;
36315
36316
  }
36316
- url = new URL(util.parseOrigin(url).origin + path8);
36317
+ url = new URL(util.parseOrigin(url).origin + path9);
36317
36318
  } else {
36318
36319
  if (!opts) {
36319
36320
  opts = typeof url === "object" ? url : {};
@@ -37945,15 +37946,15 @@ var require_route = __commonJS({
37945
37946
  };
37946
37947
  }
37947
37948
  function wrapConversion(toModel, graph) {
37948
- const path8 = [graph[toModel].parent, toModel];
37949
+ const path9 = [graph[toModel].parent, toModel];
37949
37950
  let fn = conversions[graph[toModel].parent][toModel];
37950
37951
  let cur = graph[toModel].parent;
37951
37952
  while (graph[cur].parent) {
37952
- path8.unshift(graph[cur].parent);
37953
+ path9.unshift(graph[cur].parent);
37953
37954
  fn = link(conversions[graph[cur].parent][cur], fn);
37954
37955
  cur = graph[cur].parent;
37955
37956
  }
37956
- fn.conversion = path8;
37957
+ fn.conversion = path9;
37957
37958
  return fn;
37958
37959
  }
37959
37960
  module2.exports = function(fromModel) {
@@ -42024,11 +42025,24 @@ function normalizeConfig(config) {
42024
42025
 
42025
42026
  // src/server.ts
42026
42027
  var Server;
42028
+ var path5 = require("path");
42029
+ var isNpmGlobal = __dirname.includes("node_modules");
42030
+ var corePath;
42031
+ if (isNpmGlobal) {
42032
+ corePath = path5.resolve(__dirname, "..", "packages", "core", "dist", "cjs", "server.cjs");
42033
+ } else {
42034
+ corePath = path5.resolve(__dirname, "..", "packages", "core", "dist", "cjs", "server.cjs");
42035
+ }
42027
42036
  try {
42028
- Server = require("@musistudio/llms").default || require("@musistudio/llms");
42037
+ const coreModule = require(corePath);
42038
+ Server = coreModule.default || coreModule;
42029
42039
  } catch (e) {
42030
- console.error("Failed to load @musistudio/llms:", e.message);
42031
- process.exit(1);
42040
+ try {
42041
+ Server = require("@musistudio/llms").default || require("@musistudio/llms");
42042
+ } catch (e2) {
42043
+ console.error("Failed to load @musistudio/llms:", e2.message);
42044
+ process.exit(1);
42045
+ }
42032
42046
  }
42033
42047
  var createServer = (config) => {
42034
42048
  const server = new Server(config);
@@ -42356,11 +42370,11 @@ var RotatingFileStream = class extends import_stream.Writable {
42356
42370
  timeout;
42357
42371
  timeoutPromise;
42358
42372
  constructor(generator, options) {
42359
- const { encoding, history, maxFiles, maxSize, path: path8 } = options;
42373
+ const { encoding, history, maxFiles, maxSize, path: path9 } = options;
42360
42374
  super({ decodeStrings: true, defaultEncoding: encoding });
42361
42375
  this.createGzip = import_zlib.createGzip;
42362
42376
  this.exec = import_child_process3.exec;
42363
- this.filename = path8 + generator(null);
42377
+ this.filename = path9 + generator(null);
42364
42378
  this.fsCreateReadStream = import_fs3.createReadStream;
42365
42379
  this.fsCreateWriteStream = import_fs3.createWriteStream;
42366
42380
  this.fsOpen = import_promises5.open;
@@ -42372,7 +42386,7 @@ var RotatingFileStream = class extends import_stream.Writable {
42372
42386
  this.options = options;
42373
42387
  this.stdout = process.stdout;
42374
42388
  if (maxFiles || maxSize)
42375
- options.history = path8 + (history ? history : this.generator(null) + ".txt");
42389
+ options.history = path9 + (history ? history : this.generator(null) + ".txt");
42376
42390
  this.on("close", () => this.finished ? null : this.emit("finish"));
42377
42391
  this.on("finish", () => this.finished = this.clear());
42378
42392
  (async () => {
@@ -42500,9 +42514,9 @@ var RotatingFileStream = class extends import_stream.Writable {
42500
42514
  return this.move();
42501
42515
  }
42502
42516
  async findName() {
42503
- const { interval, path: path8, intervalBoundary } = this.options;
42517
+ const { interval, path: path9, intervalBoundary } = this.options;
42504
42518
  for (let index = 1; index < 1e3; ++index) {
42505
- const filename = path8 + this.generator(interval && intervalBoundary ? new Date(this.prev) : this.rotation, index);
42519
+ const filename = path9 + this.generator(interval && intervalBoundary ? new Date(this.prev) : this.rotation, index);
42506
42520
  if (!await exists(filename))
42507
42521
  return filename;
42508
42522
  }
@@ -42532,11 +42546,11 @@ var RotatingFileStream = class extends import_stream.Writable {
42532
42546
  return this.unlink(filename);
42533
42547
  }
42534
42548
  async classical() {
42535
- const { compress, path: path8, rotate: rotate2 } = this.options;
42549
+ const { compress, path: path9, rotate: rotate2 } = this.options;
42536
42550
  let rotatedName = "";
42537
42551
  for (let count = rotate2; count > 0; --count) {
42538
- const currName = path8 + this.generator(count);
42539
- const prevName = count === 1 ? this.filename : path8 + this.generator(count - 1);
42552
+ const currName = path9 + this.generator(count);
42553
+ const prevName = count === 1 ? this.filename : path9 + this.generator(count - 1);
42540
42554
  if (!await exists(prevName))
42541
42555
  continue;
42542
42556
  if (!rotatedName)
@@ -44453,7 +44467,7 @@ async function renderPowerlineStyle(theme, variables) {
44453
44467
 
44454
44468
  // src/utils/modelSelector.ts
44455
44469
  var fs5 = __toESM(require("fs"));
44456
- var path7 = __toESM(require("path"));
44470
+ var path8 = __toESM(require("path"));
44457
44471
 
44458
44472
  // node_modules/@inquirer/core/dist/esm/lib/key.mjs
44459
44473
  var isUpKey = (key) => (
@@ -45819,11 +45833,11 @@ var AVAILABLE_TRANSFORMERS = [
45819
45833
  "rovo-cli"
45820
45834
  ];
45821
45835
  function getConfigPath() {
45822
- const configDir = path7.join(
45836
+ const configDir = path8.join(
45823
45837
  process.env.HOME || process.env.USERPROFILE || "",
45824
45838
  ".claude-code-router"
45825
45839
  );
45826
- const configPath = path7.join(configDir, "config.json");
45840
+ const configPath = path8.join(configDir, "config.json");
45827
45841
  if (!fs5.existsSync(configPath)) {
45828
45842
  throw new Error(`config.json not found at ${configPath}`);
45829
45843
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedenlabs/claude-code-router-cli",
3
- "version": "2.0.8-beta.7",
3
+ "version": "2.0.8-beta.8",
4
4
  "description": "基于@musistudio/claude-code-router的增强版CLI路由工具 - 支持统一路由引擎、外部规则加载、智能日志系统、自动配置迁移和GLM思考模式",
5
5
  "bin": {
6
6
  "ccr": "dist/cli.js"
@@ -77,6 +77,7 @@
77
77
  },
78
78
  "files": [
79
79
  "dist/",
80
+ "packages/core/dist/",
80
81
  "examples/",
81
82
  "LICENSE",
82
83
  "README.md",