@dedenlabs/claude-code-router-cli 2.0.8-beta.6 → 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.
- package/dist/cli.js +214 -199
- package/package.json +3 -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
|
|
2097
|
+
var path9 = {
|
|
2098
2098
|
win32: { sep: "\\" },
|
|
2099
2099
|
posix: { sep: "/" }
|
|
2100
2100
|
};
|
|
2101
|
-
exports2.sep = defaultPlatform === "win32" ?
|
|
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(
|
|
5419
|
-
if (!
|
|
5418
|
+
resolve(path9) {
|
|
5419
|
+
if (!path9) {
|
|
5420
5420
|
return this;
|
|
5421
5421
|
}
|
|
5422
|
-
const rootPath = this.getRootString(
|
|
5423
|
-
const dir =
|
|
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(
|
|
6177
|
-
return node_path_1.win32.parse(
|
|
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(
|
|
6225
|
-
return
|
|
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(
|
|
6316
|
-
if (typeof
|
|
6317
|
-
|
|
6315
|
+
depth(path9 = this.cwd) {
|
|
6316
|
+
if (typeof path9 === "string") {
|
|
6317
|
+
path9 = this.cwd.resolve(path9);
|
|
6318
6318
|
}
|
|
6319
|
-
return
|
|
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(
|
|
6806
|
+
chdir(path9 = this.cwd) {
|
|
6807
6807
|
const oldCwd = this.cwd;
|
|
6808
|
-
this.cwd = typeof
|
|
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(([
|
|
7197
|
-
|
|
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,
|
|
7415
|
+
constructor(patterns, path9, opts) {
|
|
7416
7416
|
this.patterns = patterns;
|
|
7417
|
-
this.path =
|
|
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(
|
|
7437
|
-
return this.seen.has(
|
|
7436
|
+
#ignored(path9) {
|
|
7437
|
+
return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
|
|
7438
7438
|
}
|
|
7439
|
-
#childrenIgnored(
|
|
7440
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
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,
|
|
7657
|
-
super(patterns,
|
|
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,
|
|
7696
|
-
super(patterns,
|
|
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(
|
|
8189
|
-
|
|
8190
|
-
let last =
|
|
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 <
|
|
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
|
|
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 =
|
|
9695
|
-
var join9 =
|
|
9696
|
-
var normalize =
|
|
9697
|
-
var resolve =
|
|
9698
|
-
var sep2 =
|
|
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
|
|
9766
|
-
if (
|
|
9765
|
+
let path10 = decode(_path);
|
|
9766
|
+
if (path10 == null) {
|
|
9767
9767
|
return { statusCode: 400 };
|
|
9768
9768
|
}
|
|
9769
|
-
if (~
|
|
9769
|
+
if (~path10.indexOf("\0")) {
|
|
9770
9770
|
return { statusCode: 400 };
|
|
9771
9771
|
}
|
|
9772
9772
|
let parts;
|
|
9773
9773
|
if (root !== null) {
|
|
9774
|
-
if (
|
|
9775
|
-
|
|
9774
|
+
if (path10) {
|
|
9775
|
+
path10 = normalize("." + sep2 + path10);
|
|
9776
9776
|
}
|
|
9777
|
-
if (UP_PATH_REGEXP.test(
|
|
9778
|
-
debug('malicious path "%s"',
|
|
9777
|
+
if (UP_PATH_REGEXP.test(path10)) {
|
|
9778
|
+
debug('malicious path "%s"', path10);
|
|
9779
9779
|
return { statusCode: 403 };
|
|
9780
9780
|
}
|
|
9781
|
-
parts =
|
|
9782
|
-
|
|
9781
|
+
parts = path10.split(sep2);
|
|
9782
|
+
path10 = normalize(join9(root, path10));
|
|
9783
9783
|
} else {
|
|
9784
|
-
if (UP_PATH_REGEXP.test(
|
|
9785
|
-
debug('malicious path "%s"',
|
|
9784
|
+
if (UP_PATH_REGEXP.test(path10)) {
|
|
9785
|
+
debug('malicious path "%s"', path10);
|
|
9786
9786
|
return { statusCode: 403 };
|
|
9787
9787
|
}
|
|
9788
|
-
parts = normalize(
|
|
9789
|
-
|
|
9788
|
+
parts = normalize(path10).split(sep2);
|
|
9789
|
+
path10 = resolve(path10);
|
|
9790
9790
|
}
|
|
9791
|
-
return { path:
|
|
9791
|
+
return { path: path10, parts };
|
|
9792
9792
|
}
|
|
9793
|
-
function hasTrailingSlash(
|
|
9794
|
-
return
|
|
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(
|
|
9884
|
+
function tryStat(path10) {
|
|
9885
9885
|
return new Promise((resolve2) => {
|
|
9886
|
-
fs7.stat(
|
|
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,
|
|
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:
|
|
9935
|
+
metadata: { path: path10, stat: stat3 }
|
|
9936
9936
|
};
|
|
9937
9937
|
}
|
|
9938
|
-
function sendFileDirectly(request,
|
|
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"',
|
|
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(
|
|
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,
|
|
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:
|
|
10023
|
+
metadata: { path: path10, stat: stat3 }
|
|
10024
10024
|
};
|
|
10025
10025
|
}
|
|
10026
|
-
const stream2 = fs7.createReadStream(
|
|
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:
|
|
10037
|
+
metadata: { path: path10, stat: stat3 }
|
|
10038
10038
|
};
|
|
10039
10039
|
}
|
|
10040
|
-
function sendRedirect(
|
|
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:
|
|
10058
|
+
metadata: { requestPath: options.path, path: path10 }
|
|
10059
10059
|
};
|
|
10060
10060
|
}
|
|
10061
|
-
async function sendIndex(request,
|
|
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(
|
|
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,
|
|
10080
|
-
const { error, stat: stat3 } = await tryStat(
|
|
10081
|
-
if (error && error.code === "ENOENT" && !extname(
|
|
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 =
|
|
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(
|
|
10104
|
-
return sendFileDirectly(request,
|
|
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:
|
|
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"',
|
|
10120
|
+
debug('allow dotfile "%s"', path10);
|
|
10121
10121
|
break;
|
|
10122
10122
|
/* c8 ignore stop */
|
|
10123
10123
|
case 2:
|
|
10124
|
-
debug('deny dotfile "%s"',
|
|
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"',
|
|
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,
|
|
10134
|
+
return sendIndex(request, path10, opts);
|
|
10135
10135
|
}
|
|
10136
|
-
return sendFile(request,
|
|
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
|
|
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(
|
|
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 =
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
10968
|
-
route =
|
|
10967
|
+
if (options.names?.includes(path9.basename(route))) {
|
|
10968
|
+
route = path9.normalize(path9.join(route, ".."));
|
|
10969
10969
|
}
|
|
10970
10970
|
return {
|
|
10971
|
-
href: encodeURI(
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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 =
|
|
11158
|
+
const key = path9.posix.basename(route);
|
|
11159
11159
|
if (indexes.has(key) && !indexDirs.has(key)) {
|
|
11160
|
-
indexDirs.set(
|
|
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 (
|
|
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
|
|
11216
|
+
const path10 = metadata.path;
|
|
11217
11217
|
if (opts.list) {
|
|
11218
11218
|
await dirList.send({
|
|
11219
11219
|
reply,
|
|
11220
|
-
dir:
|
|
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((
|
|
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 (
|
|
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(
|
|
11407
|
-
const type = send.mime.getType(
|
|
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 =
|
|
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
|
|
11882
|
+
var path9 = require("path");
|
|
11883
11883
|
var fs7 = require("fs");
|
|
11884
|
-
var candidates = __dirname.split(
|
|
11885
|
-
const prefix = array.slice(0, index + 1).join(
|
|
11886
|
-
if (!prefix.includes("node_modules" +
|
|
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
|
-
|
|
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(
|
|
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.
|
|
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"
|
|
@@ -11971,6 +11971,7 @@ var require_package = __commonJS({
|
|
|
11971
11971
|
"@fastify/static": "^8.2.0",
|
|
11972
11972
|
"@google/genai": "^1.7.0",
|
|
11973
11973
|
"@inquirer/prompts": "^5.0.0",
|
|
11974
|
+
"@musistudio/llms": "^1.0.53",
|
|
11974
11975
|
dotenv: "^16.4.7",
|
|
11975
11976
|
"find-process": "^2.0.0",
|
|
11976
11977
|
json5: "^2.2.3",
|
|
@@ -11997,6 +11998,7 @@ var require_package = __commonJS({
|
|
|
11997
11998
|
},
|
|
11998
11999
|
files: [
|
|
11999
12000
|
"dist/",
|
|
12001
|
+
"packages/core/dist/",
|
|
12000
12002
|
"examples/",
|
|
12001
12003
|
"LICENSE",
|
|
12002
12004
|
"README.md",
|
|
@@ -12472,11 +12474,11 @@ var require_find_pid = __commonJS({
|
|
|
12472
12474
|
var fs7 = __importStar(require("fs"));
|
|
12473
12475
|
var utils_1 = __importDefault(require_utils());
|
|
12474
12476
|
var logger_1 = __importDefault(require_logger());
|
|
12475
|
-
var ensureDir2 = (
|
|
12476
|
-
if (fs7.existsSync(
|
|
12477
|
+
var ensureDir2 = (path9) => new Promise((resolve, reject) => {
|
|
12478
|
+
if (fs7.existsSync(path9)) {
|
|
12477
12479
|
resolve();
|
|
12478
12480
|
} else {
|
|
12479
|
-
fs7.mkdir(
|
|
12481
|
+
fs7.mkdir(path9, (err) => {
|
|
12480
12482
|
err ? reject(err) : resolve();
|
|
12481
12483
|
});
|
|
12482
12484
|
}
|
|
@@ -12675,7 +12677,7 @@ var require_find_process = __commonJS({
|
|
|
12675
12677
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
12676
12678
|
};
|
|
12677
12679
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12678
|
-
var
|
|
12680
|
+
var path9 = __importStar(require("path"));
|
|
12679
12681
|
var utils_1 = __importDefault(require_utils());
|
|
12680
12682
|
function matchName(text, name) {
|
|
12681
12683
|
if (!name) {
|
|
@@ -12687,7 +12689,7 @@ var require_find_process = __commonJS({
|
|
|
12687
12689
|
return false;
|
|
12688
12690
|
}
|
|
12689
12691
|
function fetchBin(cmd) {
|
|
12690
|
-
const pieces = cmd.split(
|
|
12692
|
+
const pieces = cmd.split(path9.sep);
|
|
12691
12693
|
const last = pieces[pieces.length - 1];
|
|
12692
12694
|
if (last) {
|
|
12693
12695
|
pieces[pieces.length - 1] = last.split(" ")[0];
|
|
@@ -12704,16 +12706,16 @@ var require_find_process = __commonJS({
|
|
|
12704
12706
|
}
|
|
12705
12707
|
fixed.push(part);
|
|
12706
12708
|
}
|
|
12707
|
-
return fixed.join(
|
|
12709
|
+
return fixed.join(path9.sep);
|
|
12708
12710
|
}
|
|
12709
12711
|
function fetchName(fullpath) {
|
|
12710
12712
|
if (process.platform === "darwin") {
|
|
12711
12713
|
const idx = fullpath.indexOf(".app/");
|
|
12712
12714
|
if (idx >= 0) {
|
|
12713
|
-
return
|
|
12715
|
+
return path9.basename(fullpath.substring(0, idx));
|
|
12714
12716
|
}
|
|
12715
12717
|
}
|
|
12716
|
-
return
|
|
12718
|
+
return path9.basename(fullpath);
|
|
12717
12719
|
}
|
|
12718
12720
|
var finders = {
|
|
12719
12721
|
darwin(cond) {
|
|
@@ -14046,14 +14048,14 @@ var require_util2 = __commonJS({
|
|
|
14046
14048
|
}
|
|
14047
14049
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
14048
14050
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
14049
|
-
let
|
|
14051
|
+
let path9 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
14050
14052
|
if (origin[origin.length - 1] === "/") {
|
|
14051
14053
|
origin = origin.slice(0, origin.length - 1);
|
|
14052
14054
|
}
|
|
14053
|
-
if (
|
|
14054
|
-
|
|
14055
|
+
if (path9 && path9[0] !== "/") {
|
|
14056
|
+
path9 = `/${path9}`;
|
|
14055
14057
|
}
|
|
14056
|
-
return new URL(`${origin}${
|
|
14058
|
+
return new URL(`${origin}${path9}`);
|
|
14057
14059
|
}
|
|
14058
14060
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
14059
14061
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -14873,9 +14875,9 @@ var require_diagnostics = __commonJS({
|
|
|
14873
14875
|
"undici:client:sendHeaders",
|
|
14874
14876
|
(evt) => {
|
|
14875
14877
|
const {
|
|
14876
|
-
request: { method, path:
|
|
14878
|
+
request: { method, path: path9, origin }
|
|
14877
14879
|
} = evt;
|
|
14878
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
14880
|
+
debugLog("sending request to %s %s%s", method, origin, path9);
|
|
14879
14881
|
}
|
|
14880
14882
|
);
|
|
14881
14883
|
}
|
|
@@ -14893,14 +14895,14 @@ var require_diagnostics = __commonJS({
|
|
|
14893
14895
|
"undici:request:headers",
|
|
14894
14896
|
(evt) => {
|
|
14895
14897
|
const {
|
|
14896
|
-
request: { method, path:
|
|
14898
|
+
request: { method, path: path9, origin },
|
|
14897
14899
|
response: { statusCode }
|
|
14898
14900
|
} = evt;
|
|
14899
14901
|
debugLog(
|
|
14900
14902
|
"received response to %s %s%s - HTTP %d",
|
|
14901
14903
|
method,
|
|
14902
14904
|
origin,
|
|
14903
|
-
|
|
14905
|
+
path9,
|
|
14904
14906
|
statusCode
|
|
14905
14907
|
);
|
|
14906
14908
|
}
|
|
@@ -14909,23 +14911,23 @@ var require_diagnostics = __commonJS({
|
|
|
14909
14911
|
"undici:request:trailers",
|
|
14910
14912
|
(evt) => {
|
|
14911
14913
|
const {
|
|
14912
|
-
request: { method, path:
|
|
14914
|
+
request: { method, path: path9, origin }
|
|
14913
14915
|
} = evt;
|
|
14914
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
14916
|
+
debugLog("trailers received from %s %s%s", method, origin, path9);
|
|
14915
14917
|
}
|
|
14916
14918
|
);
|
|
14917
14919
|
diagnosticsChannel.subscribe(
|
|
14918
14920
|
"undici:request:error",
|
|
14919
14921
|
(evt) => {
|
|
14920
14922
|
const {
|
|
14921
|
-
request: { method, path:
|
|
14923
|
+
request: { method, path: path9, origin },
|
|
14922
14924
|
error
|
|
14923
14925
|
} = evt;
|
|
14924
14926
|
debugLog(
|
|
14925
14927
|
"request to %s %s%s errored - %s",
|
|
14926
14928
|
method,
|
|
14927
14929
|
origin,
|
|
14928
|
-
|
|
14930
|
+
path9,
|
|
14929
14931
|
error.message
|
|
14930
14932
|
);
|
|
14931
14933
|
}
|
|
@@ -15025,7 +15027,7 @@ var require_request = __commonJS({
|
|
|
15025
15027
|
var kHandler = Symbol("handler");
|
|
15026
15028
|
var Request = class {
|
|
15027
15029
|
constructor(origin, {
|
|
15028
|
-
path:
|
|
15030
|
+
path: path9,
|
|
15029
15031
|
method,
|
|
15030
15032
|
body,
|
|
15031
15033
|
headers,
|
|
@@ -15041,11 +15043,11 @@ var require_request = __commonJS({
|
|
|
15041
15043
|
throwOnError,
|
|
15042
15044
|
maxRedirections
|
|
15043
15045
|
}, handler) {
|
|
15044
|
-
if (typeof
|
|
15046
|
+
if (typeof path9 !== "string") {
|
|
15045
15047
|
throw new InvalidArgumentError("path must be a string");
|
|
15046
|
-
} else if (
|
|
15048
|
+
} else if (path9[0] !== "/" && !(path9.startsWith("http://") || path9.startsWith("https://")) && method !== "CONNECT") {
|
|
15047
15049
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
15048
|
-
} else if (invalidPathRegex.test(
|
|
15050
|
+
} else if (invalidPathRegex.test(path9)) {
|
|
15049
15051
|
throw new InvalidArgumentError("invalid request path");
|
|
15050
15052
|
}
|
|
15051
15053
|
if (typeof method !== "string") {
|
|
@@ -15113,7 +15115,7 @@ var require_request = __commonJS({
|
|
|
15113
15115
|
this.completed = false;
|
|
15114
15116
|
this.aborted = false;
|
|
15115
15117
|
this.upgrade = upgrade || null;
|
|
15116
|
-
this.path = query ? serializePathWithQuery(
|
|
15118
|
+
this.path = query ? serializePathWithQuery(path9, query) : path9;
|
|
15117
15119
|
this.origin = origin;
|
|
15118
15120
|
this.protocol = getProtocolFromUrlString(origin);
|
|
15119
15121
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -20105,7 +20107,7 @@ var require_client_h1 = __commonJS({
|
|
|
20105
20107
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
20106
20108
|
}
|
|
20107
20109
|
function writeH1(client, request) {
|
|
20108
|
-
const { method, path:
|
|
20110
|
+
const { method, path: path9, host, upgrade, blocking, reset } = request;
|
|
20109
20111
|
let { body, headers, contentLength } = request;
|
|
20110
20112
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
20111
20113
|
if (util.isFormDataLike(body)) {
|
|
@@ -20171,7 +20173,7 @@ var require_client_h1 = __commonJS({
|
|
|
20171
20173
|
if (blocking) {
|
|
20172
20174
|
socket[kBlocking] = true;
|
|
20173
20175
|
}
|
|
20174
|
-
let header = `${method} ${
|
|
20176
|
+
let header = `${method} ${path9} HTTP/1.1\r
|
|
20175
20177
|
`;
|
|
20176
20178
|
if (typeof host === "string") {
|
|
20177
20179
|
header += `host: ${host}\r
|
|
@@ -20777,7 +20779,7 @@ var require_client_h2 = __commonJS({
|
|
|
20777
20779
|
function writeH2(client, request) {
|
|
20778
20780
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
20779
20781
|
const session = client[kHTTP2Session];
|
|
20780
|
-
const { method, path:
|
|
20782
|
+
const { method, path: path9, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
20781
20783
|
let { body } = request;
|
|
20782
20784
|
if (upgrade != null && upgrade !== "websocket") {
|
|
20783
20785
|
util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -20845,7 +20847,7 @@ var require_client_h2 = __commonJS({
|
|
|
20845
20847
|
}
|
|
20846
20848
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
20847
20849
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
20848
|
-
headers[HTTP2_HEADER_PATH] =
|
|
20850
|
+
headers[HTTP2_HEADER_PATH] = path9;
|
|
20849
20851
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
20850
20852
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
20851
20853
|
} else {
|
|
@@ -20886,7 +20888,7 @@ var require_client_h2 = __commonJS({
|
|
|
20886
20888
|
stream.setTimeout(requestTimeout);
|
|
20887
20889
|
return true;
|
|
20888
20890
|
}
|
|
20889
|
-
headers[HTTP2_HEADER_PATH] =
|
|
20891
|
+
headers[HTTP2_HEADER_PATH] = path9;
|
|
20890
20892
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
20891
20893
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
20892
20894
|
if (body && typeof body.read === "function") {
|
|
@@ -22486,10 +22488,10 @@ var require_proxy_agent = __commonJS({
|
|
|
22486
22488
|
};
|
|
22487
22489
|
const {
|
|
22488
22490
|
origin,
|
|
22489
|
-
path:
|
|
22491
|
+
path: path9 = "/",
|
|
22490
22492
|
headers = {}
|
|
22491
22493
|
} = opts;
|
|
22492
|
-
opts.path = origin +
|
|
22494
|
+
opts.path = origin + path9;
|
|
22493
22495
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
22494
22496
|
const { host } = new URL(origin);
|
|
22495
22497
|
headers.host = host;
|
|
@@ -24531,20 +24533,20 @@ var require_mock_utils = __commonJS({
|
|
|
24531
24533
|
}
|
|
24532
24534
|
return normalizedQp;
|
|
24533
24535
|
}
|
|
24534
|
-
function safeUrl(
|
|
24535
|
-
if (typeof
|
|
24536
|
-
return
|
|
24536
|
+
function safeUrl(path9) {
|
|
24537
|
+
if (typeof path9 !== "string") {
|
|
24538
|
+
return path9;
|
|
24537
24539
|
}
|
|
24538
|
-
const pathSegments =
|
|
24540
|
+
const pathSegments = path9.split("?", 3);
|
|
24539
24541
|
if (pathSegments.length !== 2) {
|
|
24540
|
-
return
|
|
24542
|
+
return path9;
|
|
24541
24543
|
}
|
|
24542
24544
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
24543
24545
|
qp.sort();
|
|
24544
24546
|
return [...pathSegments, qp.toString()].join("?");
|
|
24545
24547
|
}
|
|
24546
|
-
function matchKey(mockDispatch2, { path:
|
|
24547
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
24548
|
+
function matchKey(mockDispatch2, { path: path9, method, body, headers }) {
|
|
24549
|
+
const pathMatch = matchValue(mockDispatch2.path, path9);
|
|
24548
24550
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
24549
24551
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
24550
24552
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -24569,8 +24571,8 @@ var require_mock_utils = __commonJS({
|
|
|
24569
24571
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
24570
24572
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
24571
24573
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
24572
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
24573
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
24574
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path9, ignoreTrailingSlash }) => {
|
|
24575
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path9)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path9), resolvedPath);
|
|
24574
24576
|
});
|
|
24575
24577
|
if (matchedMockDispatches.length === 0) {
|
|
24576
24578
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -24608,19 +24610,19 @@ var require_mock_utils = __commonJS({
|
|
|
24608
24610
|
mockDispatches.splice(index, 1);
|
|
24609
24611
|
}
|
|
24610
24612
|
}
|
|
24611
|
-
function removeTrailingSlash(
|
|
24612
|
-
while (
|
|
24613
|
-
|
|
24613
|
+
function removeTrailingSlash(path9) {
|
|
24614
|
+
while (path9.endsWith("/")) {
|
|
24615
|
+
path9 = path9.slice(0, -1);
|
|
24614
24616
|
}
|
|
24615
|
-
if (
|
|
24616
|
-
|
|
24617
|
+
if (path9.length === 0) {
|
|
24618
|
+
path9 = "/";
|
|
24617
24619
|
}
|
|
24618
|
-
return
|
|
24620
|
+
return path9;
|
|
24619
24621
|
}
|
|
24620
24622
|
function buildKey(opts) {
|
|
24621
|
-
const { path:
|
|
24623
|
+
const { path: path9, method, body, headers, query } = opts;
|
|
24622
24624
|
return {
|
|
24623
|
-
path:
|
|
24625
|
+
path: path9,
|
|
24624
24626
|
method,
|
|
24625
24627
|
body,
|
|
24626
24628
|
headers,
|
|
@@ -25277,10 +25279,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
25277
25279
|
}
|
|
25278
25280
|
format(pendingInterceptors) {
|
|
25279
25281
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
25280
|
-
({ method, path:
|
|
25282
|
+
({ method, path: path9, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
25281
25283
|
Method: method,
|
|
25282
25284
|
Origin: origin,
|
|
25283
|
-
Path:
|
|
25285
|
+
Path: path9,
|
|
25284
25286
|
"Status code": statusCode,
|
|
25285
25287
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
25286
25288
|
Invocations: timesInvoked,
|
|
@@ -25360,9 +25362,9 @@ var require_mock_agent = __commonJS({
|
|
|
25360
25362
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
25361
25363
|
const dispatchOpts = { ...opts };
|
|
25362
25364
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
25363
|
-
const [
|
|
25365
|
+
const [path9, searchParams] = dispatchOpts.path.split("?");
|
|
25364
25366
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
25365
|
-
dispatchOpts.path = `${
|
|
25367
|
+
dispatchOpts.path = `${path9}?${normalizedSearchParams}`;
|
|
25366
25368
|
}
|
|
25367
25369
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
25368
25370
|
}
|
|
@@ -25763,12 +25765,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
25763
25765
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
25764
25766
|
*/
|
|
25765
25767
|
async loadSnapshots(filePath) {
|
|
25766
|
-
const
|
|
25767
|
-
if (!
|
|
25768
|
+
const path9 = filePath || this.#snapshotPath;
|
|
25769
|
+
if (!path9) {
|
|
25768
25770
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
25769
25771
|
}
|
|
25770
25772
|
try {
|
|
25771
|
-
const data = await readFile4(resolve(
|
|
25773
|
+
const data = await readFile4(resolve(path9), "utf8");
|
|
25772
25774
|
const parsed = JSON.parse(data);
|
|
25773
25775
|
if (Array.isArray(parsed)) {
|
|
25774
25776
|
this.#snapshots.clear();
|
|
@@ -25782,7 +25784,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
25782
25784
|
if (error.code === "ENOENT") {
|
|
25783
25785
|
this.#snapshots.clear();
|
|
25784
25786
|
} else {
|
|
25785
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
25787
|
+
throw new UndiciError(`Failed to load snapshots from ${path9}`, { cause: error });
|
|
25786
25788
|
}
|
|
25787
25789
|
}
|
|
25788
25790
|
}
|
|
@@ -25793,11 +25795,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
25793
25795
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
25794
25796
|
*/
|
|
25795
25797
|
async saveSnapshots(filePath) {
|
|
25796
|
-
const
|
|
25797
|
-
if (!
|
|
25798
|
+
const path9 = filePath || this.#snapshotPath;
|
|
25799
|
+
if (!path9) {
|
|
25798
25800
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
25799
25801
|
}
|
|
25800
|
-
const resolvedPath = resolve(
|
|
25802
|
+
const resolvedPath = resolve(path9);
|
|
25801
25803
|
await mkdir2(dirname(resolvedPath), { recursive: true });
|
|
25802
25804
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
25803
25805
|
hash,
|
|
@@ -26422,15 +26424,15 @@ var require_redirect_handler = __commonJS({
|
|
|
26422
26424
|
return;
|
|
26423
26425
|
}
|
|
26424
26426
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
26425
|
-
const
|
|
26426
|
-
const redirectUrlString = `${origin}${
|
|
26427
|
+
const path9 = search ? `${pathname}${search}` : pathname;
|
|
26428
|
+
const redirectUrlString = `${origin}${path9}`;
|
|
26427
26429
|
for (const historyUrl of this.history) {
|
|
26428
26430
|
if (historyUrl.toString() === redirectUrlString) {
|
|
26429
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.`);
|
|
26430
26432
|
}
|
|
26431
26433
|
}
|
|
26432
26434
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
26433
|
-
this.opts.path =
|
|
26435
|
+
this.opts.path = path9;
|
|
26434
26436
|
this.opts.origin = origin;
|
|
26435
26437
|
this.opts.query = null;
|
|
26436
26438
|
}
|
|
@@ -33196,9 +33198,9 @@ var require_util5 = __commonJS({
|
|
|
33196
33198
|
}
|
|
33197
33199
|
}
|
|
33198
33200
|
}
|
|
33199
|
-
function validateCookiePath(
|
|
33200
|
-
for (let i = 0; i <
|
|
33201
|
-
const code =
|
|
33201
|
+
function validateCookiePath(path9) {
|
|
33202
|
+
for (let i = 0; i < path9.length; ++i) {
|
|
33203
|
+
const code = path9.charCodeAt(i);
|
|
33202
33204
|
if (code < 32 || // exclude CTLs (0-31)
|
|
33203
33205
|
code === 127 || // DEL
|
|
33204
33206
|
code === 59) {
|
|
@@ -36308,11 +36310,11 @@ var require_undici = __commonJS({
|
|
|
36308
36310
|
if (typeof opts.path !== "string") {
|
|
36309
36311
|
throw new InvalidArgumentError("invalid opts.path");
|
|
36310
36312
|
}
|
|
36311
|
-
let
|
|
36313
|
+
let path9 = opts.path;
|
|
36312
36314
|
if (!opts.path.startsWith("/")) {
|
|
36313
|
-
|
|
36315
|
+
path9 = `/${path9}`;
|
|
36314
36316
|
}
|
|
36315
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
36317
|
+
url = new URL(util.parseOrigin(url).origin + path9);
|
|
36316
36318
|
} else {
|
|
36317
36319
|
if (!opts) {
|
|
36318
36320
|
opts = typeof url === "object" ? url : {};
|
|
@@ -37944,15 +37946,15 @@ var require_route = __commonJS({
|
|
|
37944
37946
|
};
|
|
37945
37947
|
}
|
|
37946
37948
|
function wrapConversion(toModel, graph) {
|
|
37947
|
-
const
|
|
37949
|
+
const path9 = [graph[toModel].parent, toModel];
|
|
37948
37950
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
37949
37951
|
let cur = graph[toModel].parent;
|
|
37950
37952
|
while (graph[cur].parent) {
|
|
37951
|
-
|
|
37953
|
+
path9.unshift(graph[cur].parent);
|
|
37952
37954
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
37953
37955
|
cur = graph[cur].parent;
|
|
37954
37956
|
}
|
|
37955
|
-
fn.conversion =
|
|
37957
|
+
fn.conversion = path9;
|
|
37956
37958
|
return fn;
|
|
37957
37959
|
}
|
|
37958
37960
|
module2.exports = function(fromModel) {
|
|
@@ -42023,11 +42025,24 @@ function normalizeConfig(config) {
|
|
|
42023
42025
|
|
|
42024
42026
|
// src/server.ts
|
|
42025
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
|
+
}
|
|
42026
42036
|
try {
|
|
42027
|
-
|
|
42037
|
+
const coreModule = require(corePath);
|
|
42038
|
+
Server = coreModule.default || coreModule;
|
|
42028
42039
|
} catch (e) {
|
|
42029
|
-
|
|
42030
|
-
|
|
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
|
+
}
|
|
42031
42046
|
}
|
|
42032
42047
|
var createServer = (config) => {
|
|
42033
42048
|
const server = new Server(config);
|
|
@@ -42355,11 +42370,11 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
42355
42370
|
timeout;
|
|
42356
42371
|
timeoutPromise;
|
|
42357
42372
|
constructor(generator, options) {
|
|
42358
|
-
const { encoding, history, maxFiles, maxSize, path:
|
|
42373
|
+
const { encoding, history, maxFiles, maxSize, path: path9 } = options;
|
|
42359
42374
|
super({ decodeStrings: true, defaultEncoding: encoding });
|
|
42360
42375
|
this.createGzip = import_zlib.createGzip;
|
|
42361
42376
|
this.exec = import_child_process3.exec;
|
|
42362
|
-
this.filename =
|
|
42377
|
+
this.filename = path9 + generator(null);
|
|
42363
42378
|
this.fsCreateReadStream = import_fs3.createReadStream;
|
|
42364
42379
|
this.fsCreateWriteStream = import_fs3.createWriteStream;
|
|
42365
42380
|
this.fsOpen = import_promises5.open;
|
|
@@ -42371,7 +42386,7 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
42371
42386
|
this.options = options;
|
|
42372
42387
|
this.stdout = process.stdout;
|
|
42373
42388
|
if (maxFiles || maxSize)
|
|
42374
|
-
options.history =
|
|
42389
|
+
options.history = path9 + (history ? history : this.generator(null) + ".txt");
|
|
42375
42390
|
this.on("close", () => this.finished ? null : this.emit("finish"));
|
|
42376
42391
|
this.on("finish", () => this.finished = this.clear());
|
|
42377
42392
|
(async () => {
|
|
@@ -42499,9 +42514,9 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
42499
42514
|
return this.move();
|
|
42500
42515
|
}
|
|
42501
42516
|
async findName() {
|
|
42502
|
-
const { interval, path:
|
|
42517
|
+
const { interval, path: path9, intervalBoundary } = this.options;
|
|
42503
42518
|
for (let index = 1; index < 1e3; ++index) {
|
|
42504
|
-
const filename =
|
|
42519
|
+
const filename = path9 + this.generator(interval && intervalBoundary ? new Date(this.prev) : this.rotation, index);
|
|
42505
42520
|
if (!await exists(filename))
|
|
42506
42521
|
return filename;
|
|
42507
42522
|
}
|
|
@@ -42531,11 +42546,11 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
42531
42546
|
return this.unlink(filename);
|
|
42532
42547
|
}
|
|
42533
42548
|
async classical() {
|
|
42534
|
-
const { compress, path:
|
|
42549
|
+
const { compress, path: path9, rotate: rotate2 } = this.options;
|
|
42535
42550
|
let rotatedName = "";
|
|
42536
42551
|
for (let count = rotate2; count > 0; --count) {
|
|
42537
|
-
const currName =
|
|
42538
|
-
const prevName = count === 1 ? this.filename :
|
|
42552
|
+
const currName = path9 + this.generator(count);
|
|
42553
|
+
const prevName = count === 1 ? this.filename : path9 + this.generator(count - 1);
|
|
42539
42554
|
if (!await exists(prevName))
|
|
42540
42555
|
continue;
|
|
42541
42556
|
if (!rotatedName)
|
|
@@ -44452,7 +44467,7 @@ async function renderPowerlineStyle(theme, variables) {
|
|
|
44452
44467
|
|
|
44453
44468
|
// src/utils/modelSelector.ts
|
|
44454
44469
|
var fs5 = __toESM(require("fs"));
|
|
44455
|
-
var
|
|
44470
|
+
var path8 = __toESM(require("path"));
|
|
44456
44471
|
|
|
44457
44472
|
// node_modules/@inquirer/core/dist/esm/lib/key.mjs
|
|
44458
44473
|
var isUpKey = (key) => (
|
|
@@ -45818,11 +45833,11 @@ var AVAILABLE_TRANSFORMERS = [
|
|
|
45818
45833
|
"rovo-cli"
|
|
45819
45834
|
];
|
|
45820
45835
|
function getConfigPath() {
|
|
45821
|
-
const configDir =
|
|
45836
|
+
const configDir = path8.join(
|
|
45822
45837
|
process.env.HOME || process.env.USERPROFILE || "",
|
|
45823
45838
|
".claude-code-router"
|
|
45824
45839
|
);
|
|
45825
|
-
const configPath =
|
|
45840
|
+
const configPath = path8.join(configDir, "config.json");
|
|
45826
45841
|
if (!fs5.existsSync(configPath)) {
|
|
45827
45842
|
throw new Error(`config.json not found at ${configPath}`);
|
|
45828
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.
|
|
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"
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@fastify/static": "^8.2.0",
|
|
51
51
|
"@google/genai": "^1.7.0",
|
|
52
52
|
"@inquirer/prompts": "^5.0.0",
|
|
53
|
+
"@musistudio/llms": "^1.0.53",
|
|
53
54
|
"dotenv": "^16.4.7",
|
|
54
55
|
"find-process": "^2.0.0",
|
|
55
56
|
"json5": "^2.2.3",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
},
|
|
77
78
|
"files": [
|
|
78
79
|
"dist/",
|
|
80
|
+
"packages/core/dist/",
|
|
79
81
|
"examples/",
|
|
80
82
|
"LICENSE",
|
|
81
83
|
"README.md",
|