@musistudio/claude-code-router 1.0.16 → 1.0.18
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 +36 -34
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -5263,7 +5263,7 @@ var require_thread_stream = __commonJS({
|
|
|
5263
5263
|
var { version: version2 } = require_package();
|
|
5264
5264
|
var { EventEmitter } = require("events");
|
|
5265
5265
|
var { Worker } = require("worker_threads");
|
|
5266
|
-
var { join:
|
|
5266
|
+
var { join: join4 } = require("path");
|
|
5267
5267
|
var { pathToFileURL } = require("url");
|
|
5268
5268
|
var { wait } = require_wait();
|
|
5269
5269
|
var {
|
|
@@ -5299,7 +5299,7 @@ var require_thread_stream = __commonJS({
|
|
|
5299
5299
|
function createWorker(stream, opts) {
|
|
5300
5300
|
const { filename, workerData } = opts;
|
|
5301
5301
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
5302
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
5302
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join4(__dirname, "lib", "worker.js");
|
|
5303
5303
|
const worker = new Worker(toExecute, {
|
|
5304
5304
|
...opts.workerOpts,
|
|
5305
5305
|
trackUnmanagedFds: false,
|
|
@@ -5685,7 +5685,7 @@ var require_transport = __commonJS({
|
|
|
5685
5685
|
"use strict";
|
|
5686
5686
|
var { createRequire } = require("module");
|
|
5687
5687
|
var getCallers = require_caller();
|
|
5688
|
-
var { join:
|
|
5688
|
+
var { join: join4, isAbsolute, sep } = require("node:path");
|
|
5689
5689
|
var sleep = require_atomic_sleep();
|
|
5690
5690
|
var onExit = require_on_exit_leak_free();
|
|
5691
5691
|
var ThreadStream = require_thread_stream();
|
|
@@ -5748,7 +5748,7 @@ var require_transport = __commonJS({
|
|
|
5748
5748
|
throw new Error("only one of target or targets can be specified");
|
|
5749
5749
|
}
|
|
5750
5750
|
if (targets) {
|
|
5751
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
5751
|
+
target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
|
|
5752
5752
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
5753
5753
|
return {
|
|
5754
5754
|
...dest,
|
|
@@ -5766,7 +5766,7 @@ var require_transport = __commonJS({
|
|
|
5766
5766
|
});
|
|
5767
5767
|
});
|
|
5768
5768
|
} else if (pipeline) {
|
|
5769
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
5769
|
+
target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
|
|
5770
5770
|
options.pipelines = [pipeline.map((dest) => {
|
|
5771
5771
|
return {
|
|
5772
5772
|
...dest,
|
|
@@ -5788,7 +5788,7 @@ var require_transport = __commonJS({
|
|
|
5788
5788
|
return origin;
|
|
5789
5789
|
}
|
|
5790
5790
|
if (origin === "pino/file") {
|
|
5791
|
-
return
|
|
5791
|
+
return join4(__dirname, "..", "file.js");
|
|
5792
5792
|
}
|
|
5793
5793
|
let fixTarget2;
|
|
5794
5794
|
for (const filePath of callers) {
|
|
@@ -6739,7 +6739,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
6739
6739
|
return circularValue;
|
|
6740
6740
|
}
|
|
6741
6741
|
let res = "";
|
|
6742
|
-
let
|
|
6742
|
+
let join4 = ",";
|
|
6743
6743
|
const originalIndentation = indentation;
|
|
6744
6744
|
if (Array.isArray(value)) {
|
|
6745
6745
|
if (value.length === 0) {
|
|
@@ -6753,7 +6753,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
6753
6753
|
indentation += spacer;
|
|
6754
6754
|
res += `
|
|
6755
6755
|
${indentation}`;
|
|
6756
|
-
|
|
6756
|
+
join4 = `,
|
|
6757
6757
|
${indentation}`;
|
|
6758
6758
|
}
|
|
6759
6759
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -6761,13 +6761,13 @@ ${indentation}`;
|
|
|
6761
6761
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
6762
6762
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
6763
6763
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
6764
|
-
res +=
|
|
6764
|
+
res += join4;
|
|
6765
6765
|
}
|
|
6766
6766
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
6767
6767
|
res += tmp !== void 0 ? tmp : "null";
|
|
6768
6768
|
if (value.length - 1 > maximumBreadth) {
|
|
6769
6769
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6770
|
-
res += `${
|
|
6770
|
+
res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6771
6771
|
}
|
|
6772
6772
|
if (spacer !== "") {
|
|
6773
6773
|
res += `
|
|
@@ -6788,7 +6788,7 @@ ${originalIndentation}`;
|
|
|
6788
6788
|
let separator = "";
|
|
6789
6789
|
if (spacer !== "") {
|
|
6790
6790
|
indentation += spacer;
|
|
6791
|
-
|
|
6791
|
+
join4 = `,
|
|
6792
6792
|
${indentation}`;
|
|
6793
6793
|
whitespace = " ";
|
|
6794
6794
|
}
|
|
@@ -6802,13 +6802,13 @@ ${indentation}`;
|
|
|
6802
6802
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
6803
6803
|
if (tmp !== void 0) {
|
|
6804
6804
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
6805
|
-
separator =
|
|
6805
|
+
separator = join4;
|
|
6806
6806
|
}
|
|
6807
6807
|
}
|
|
6808
6808
|
if (keyLength > maximumBreadth) {
|
|
6809
6809
|
const removedKeys = keyLength - maximumBreadth;
|
|
6810
6810
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
6811
|
-
separator =
|
|
6811
|
+
separator = join4;
|
|
6812
6812
|
}
|
|
6813
6813
|
if (spacer !== "" && separator.length > 1) {
|
|
6814
6814
|
res = `
|
|
@@ -6849,7 +6849,7 @@ ${originalIndentation}`;
|
|
|
6849
6849
|
}
|
|
6850
6850
|
const originalIndentation = indentation;
|
|
6851
6851
|
let res = "";
|
|
6852
|
-
let
|
|
6852
|
+
let join4 = ",";
|
|
6853
6853
|
if (Array.isArray(value)) {
|
|
6854
6854
|
if (value.length === 0) {
|
|
6855
6855
|
return "[]";
|
|
@@ -6862,7 +6862,7 @@ ${originalIndentation}`;
|
|
|
6862
6862
|
indentation += spacer;
|
|
6863
6863
|
res += `
|
|
6864
6864
|
${indentation}`;
|
|
6865
|
-
|
|
6865
|
+
join4 = `,
|
|
6866
6866
|
${indentation}`;
|
|
6867
6867
|
}
|
|
6868
6868
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -6870,13 +6870,13 @@ ${indentation}`;
|
|
|
6870
6870
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
6871
6871
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
6872
6872
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
6873
|
-
res +=
|
|
6873
|
+
res += join4;
|
|
6874
6874
|
}
|
|
6875
6875
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
6876
6876
|
res += tmp !== void 0 ? tmp : "null";
|
|
6877
6877
|
if (value.length - 1 > maximumBreadth) {
|
|
6878
6878
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6879
|
-
res += `${
|
|
6879
|
+
res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6880
6880
|
}
|
|
6881
6881
|
if (spacer !== "") {
|
|
6882
6882
|
res += `
|
|
@@ -6889,7 +6889,7 @@ ${originalIndentation}`;
|
|
|
6889
6889
|
let whitespace = "";
|
|
6890
6890
|
if (spacer !== "") {
|
|
6891
6891
|
indentation += spacer;
|
|
6892
|
-
|
|
6892
|
+
join4 = `,
|
|
6893
6893
|
${indentation}`;
|
|
6894
6894
|
whitespace = " ";
|
|
6895
6895
|
}
|
|
@@ -6898,7 +6898,7 @@ ${indentation}`;
|
|
|
6898
6898
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
6899
6899
|
if (tmp !== void 0) {
|
|
6900
6900
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
6901
|
-
separator =
|
|
6901
|
+
separator = join4;
|
|
6902
6902
|
}
|
|
6903
6903
|
}
|
|
6904
6904
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -6956,20 +6956,20 @@ ${originalIndentation}`;
|
|
|
6956
6956
|
indentation += spacer;
|
|
6957
6957
|
let res2 = `
|
|
6958
6958
|
${indentation}`;
|
|
6959
|
-
const
|
|
6959
|
+
const join5 = `,
|
|
6960
6960
|
${indentation}`;
|
|
6961
6961
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
6962
6962
|
let i = 0;
|
|
6963
6963
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
6964
6964
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
6965
6965
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
6966
|
-
res2 +=
|
|
6966
|
+
res2 += join5;
|
|
6967
6967
|
}
|
|
6968
6968
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
6969
6969
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
6970
6970
|
if (value.length - 1 > maximumBreadth) {
|
|
6971
6971
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6972
|
-
res2 += `${
|
|
6972
|
+
res2 += `${join5}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6973
6973
|
}
|
|
6974
6974
|
res2 += `
|
|
6975
6975
|
${originalIndentation}`;
|
|
@@ -6985,16 +6985,16 @@ ${originalIndentation}`;
|
|
|
6985
6985
|
return '"[Object]"';
|
|
6986
6986
|
}
|
|
6987
6987
|
indentation += spacer;
|
|
6988
|
-
const
|
|
6988
|
+
const join4 = `,
|
|
6989
6989
|
${indentation}`;
|
|
6990
6990
|
let res = "";
|
|
6991
6991
|
let separator = "";
|
|
6992
6992
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
6993
6993
|
if (isTypedArrayWithEntries(value)) {
|
|
6994
|
-
res += stringifyTypedArray(value,
|
|
6994
|
+
res += stringifyTypedArray(value, join4, maximumBreadth);
|
|
6995
6995
|
keys = keys.slice(value.length);
|
|
6996
6996
|
maximumPropertiesToStringify -= value.length;
|
|
6997
|
-
separator =
|
|
6997
|
+
separator = join4;
|
|
6998
6998
|
}
|
|
6999
6999
|
if (deterministic) {
|
|
7000
7000
|
keys = sort(keys, comparator);
|
|
@@ -7005,13 +7005,13 @@ ${indentation}`;
|
|
|
7005
7005
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
7006
7006
|
if (tmp !== void 0) {
|
|
7007
7007
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
7008
|
-
separator =
|
|
7008
|
+
separator = join4;
|
|
7009
7009
|
}
|
|
7010
7010
|
}
|
|
7011
7011
|
if (keyLength > maximumBreadth) {
|
|
7012
7012
|
const removedKeys = keyLength - maximumBreadth;
|
|
7013
7013
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
7014
|
-
separator =
|
|
7014
|
+
separator = join4;
|
|
7015
7015
|
}
|
|
7016
7016
|
if (separator !== "") {
|
|
7017
7017
|
res = `
|
|
@@ -54884,10 +54884,10 @@ var import_node_readline = __toESM(require("node:readline"));
|
|
|
54884
54884
|
var import_node_path = __toESM(require("node:path"));
|
|
54885
54885
|
var import_node_os = __toESM(require("node:os"));
|
|
54886
54886
|
var HOME_DIR = import_node_path.default.join(import_node_os.default.homedir(), ".claude-code-router");
|
|
54887
|
-
var CONFIG_FILE =
|
|
54888
|
-
var PLUGINS_DIR =
|
|
54887
|
+
var CONFIG_FILE = import_node_path.default.join(HOME_DIR, "config.json");
|
|
54888
|
+
var PLUGINS_DIR = import_node_path.default.join(HOME_DIR, "plugins");
|
|
54889
54889
|
var PID_FILE = import_node_path.default.join(HOME_DIR, ".claude-code-router.pid");
|
|
54890
|
-
var REFERENCE_COUNT_FILE = "
|
|
54890
|
+
var REFERENCE_COUNT_FILE = import_node_path.default.join(import_node_os.default.tmpdir(), "claude-code-reference-count.txt");
|
|
54891
54891
|
var DEFAULT_CONFIG = {
|
|
54892
54892
|
LOG: false,
|
|
54893
54893
|
OPENAI_API_KEY: "",
|
|
@@ -56125,8 +56125,8 @@ function getServiceInfo() {
|
|
|
56125
56125
|
|
|
56126
56126
|
// src/index.ts
|
|
56127
56127
|
async function initializeClaudeConfig() {
|
|
56128
|
-
const homeDir =
|
|
56129
|
-
const configPath =
|
|
56128
|
+
const homeDir = (0, import_os.homedir)();
|
|
56129
|
+
const configPath = (0, import_path2.join)(homeDir, ".claude.json");
|
|
56130
56130
|
if (!(0, import_fs3.existsSync)(configPath)) {
|
|
56131
56131
|
const userID = Array.from(
|
|
56132
56132
|
{ length: 64 },
|
|
@@ -56264,11 +56264,12 @@ async function executeCodeCommand(args = []) {
|
|
|
56264
56264
|
}
|
|
56265
56265
|
|
|
56266
56266
|
// package.json
|
|
56267
|
-
var version = "1.0.
|
|
56267
|
+
var version = "1.0.18";
|
|
56268
56268
|
|
|
56269
56269
|
// src/cli.ts
|
|
56270
56270
|
var import_child_process2 = require("child_process");
|
|
56271
56271
|
var import_fs5 = require("fs");
|
|
56272
|
+
var import_path4 = require("path");
|
|
56272
56273
|
var command = process.argv[2];
|
|
56273
56274
|
var HELP_TEXT = `
|
|
56274
56275
|
Usage: ccr [command]
|
|
@@ -56329,7 +56330,8 @@ async function main() {
|
|
|
56329
56330
|
case "code":
|
|
56330
56331
|
if (!isServiceRunning()) {
|
|
56331
56332
|
console.log("Service not running, starting service...");
|
|
56332
|
-
const
|
|
56333
|
+
const cliPath = (0, import_path4.join)(__dirname, "cli.js");
|
|
56334
|
+
const startProcess = (0, import_child_process2.spawn)("node", [cliPath, "start"], {
|
|
56333
56335
|
detached: true,
|
|
56334
56336
|
stdio: "ignore"
|
|
56335
56337
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@musistudio/claude-code-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ccr": "./dist/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js && cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm"
|
|
9
|
+
"build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js && shx cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"claude",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"esbuild": "^0.25.1",
|
|
28
|
+
"shx": "^0.4.0",
|
|
28
29
|
"typescript": "^5.8.2"
|
|
29
30
|
},
|
|
30
31
|
"publishConfig": {
|