mpd-llm-cli 0.1.44 → 0.1.46
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/bundle/api.js +2 -2
- package/bundle/gemini.js +241 -17
- package/package.json +2 -2
package/bundle/api.js
CHANGED
|
@@ -27724,7 +27724,7 @@ async function createContentGeneratorConfig(model, authType) {
|
|
|
27724
27724
|
return contentGeneratorConfig;
|
|
27725
27725
|
}
|
|
27726
27726
|
async function createContentGenerator(config2, sessionId2) {
|
|
27727
|
-
const version2 = "0.1.
|
|
27727
|
+
const version2 = "0.1.46";
|
|
27728
27728
|
const httpOptions = {
|
|
27729
27729
|
headers: {
|
|
27730
27730
|
"User-Agent": `GeminiCLI/${version2} (${process.platform}; ${process.arch})`
|
|
@@ -166412,7 +166412,7 @@ async function getPackageJson() {
|
|
|
166412
166412
|
// packages/cli/src/utils/version.ts
|
|
166413
166413
|
async function getCliVersion() {
|
|
166414
166414
|
const pkgJson = await getPackageJson();
|
|
166415
|
-
return "0.1.
|
|
166415
|
+
return "0.1.46";
|
|
166416
166416
|
}
|
|
166417
166417
|
|
|
166418
166418
|
// packages/cli/src/config/sandboxConfig.ts
|
package/bundle/gemini.js
CHANGED
|
@@ -62351,7 +62351,7 @@ async function createContentGeneratorConfig(model, authType) {
|
|
|
62351
62351
|
return contentGeneratorConfig;
|
|
62352
62352
|
}
|
|
62353
62353
|
async function createContentGenerator(config2, sessionId2) {
|
|
62354
|
-
const version3 = "0.1.
|
|
62354
|
+
const version3 = "0.1.46";
|
|
62355
62355
|
const httpOptions = {
|
|
62356
62356
|
headers: {
|
|
62357
62357
|
"User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
|
|
@@ -199411,7 +199411,7 @@ var init_langfuseClient = __esm({
|
|
|
199411
199411
|
userId,
|
|
199412
199412
|
metadata: {
|
|
199413
199413
|
...safeMetadata,
|
|
199414
|
-
cli_version: this.safeString("0.1.
|
|
199414
|
+
cli_version: this.safeString("0.1.46", "unknown"),
|
|
199415
199415
|
model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
|
|
199416
199416
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
199417
199417
|
environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
|
|
@@ -200578,7 +200578,7 @@ var init_langfuseIntegration = __esm({
|
|
|
200578
200578
|
const metadata = {
|
|
200579
200579
|
model: this.config.getModel(),
|
|
200580
200580
|
auth_type: this.config.getContentGeneratorConfig()?.authType,
|
|
200581
|
-
cli_version: "0.1.
|
|
200581
|
+
cli_version: "0.1.46",
|
|
200582
200582
|
start_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
200583
200583
|
session_id: this.sessionId
|
|
200584
200584
|
};
|
|
@@ -200637,7 +200637,7 @@ var init_langfuseIntegration = __esm({
|
|
|
200637
200637
|
totalCachedTokens: sessionStats.totalCachedTokens,
|
|
200638
200638
|
totalPromptTokens: sessionStats.totalPromptTokens,
|
|
200639
200639
|
metadata: {
|
|
200640
|
-
cli_version: "0.1.
|
|
200640
|
+
cli_version: "0.1.46",
|
|
200641
200641
|
auth_type: this.config.getContentGeneratorConfig()?.authType,
|
|
200642
200642
|
session_end_time: (/* @__PURE__ */ new Date()).toISOString()
|
|
200643
200643
|
}
|
|
@@ -200709,7 +200709,7 @@ var init_langfuseIntegration = __esm({
|
|
|
200709
200709
|
error,
|
|
200710
200710
|
metadata: {
|
|
200711
200711
|
session_id: this.sessionId,
|
|
200712
|
-
cli_version: "0.1.
|
|
200712
|
+
cli_version: "0.1.46",
|
|
200713
200713
|
auth_type: this.config.getContentGeneratorConfig()?.authType
|
|
200714
200714
|
}
|
|
200715
200715
|
});
|
|
@@ -206130,7 +206130,7 @@ __export(version_exports, {
|
|
|
206130
206130
|
});
|
|
206131
206131
|
async function getCliVersion() {
|
|
206132
206132
|
const pkgJson = await getPackageJson();
|
|
206133
|
-
return "0.1.
|
|
206133
|
+
return "0.1.46";
|
|
206134
206134
|
}
|
|
206135
206135
|
var init_version5 = __esm({
|
|
206136
206136
|
"packages/cli/src/utils/version.ts"() {
|
|
@@ -209929,7 +209929,12 @@ var init_utils6 = __esm({
|
|
|
209929
209929
|
}
|
|
209930
209930
|
config2 = await readAndParseConfig(CONFIG_FILE);
|
|
209931
209931
|
if (config2 !== null) {
|
|
209932
|
-
|
|
209932
|
+
if (config2.Providers && Array.isArray(config2.Providers) && config2.Providers.length > 0) {
|
|
209933
|
+
return config2;
|
|
209934
|
+
}
|
|
209935
|
+
if (config2.Router && typeof config2.Router === "object" && Object.keys(config2.Router).length > 0) {
|
|
209936
|
+
return config2;
|
|
209937
|
+
}
|
|
209933
209938
|
}
|
|
209934
209939
|
try {
|
|
209935
209940
|
await initDir();
|
|
@@ -276824,7 +276829,7 @@ var require_package7 = __commonJS({
|
|
|
276824
276829
|
"packages/router/package.json"(exports2, module2) {
|
|
276825
276830
|
module2.exports = {
|
|
276826
276831
|
name: "@mpdai/router",
|
|
276827
|
-
version: "0.1.
|
|
276832
|
+
version: "0.1.11",
|
|
276828
276833
|
description: "MPD AI Router - Route Claude Code to other LLM providers",
|
|
276829
276834
|
type: "module",
|
|
276830
276835
|
main: "dist/index.js",
|
|
@@ -310809,7 +310814,7 @@ import { promises as fs36 } from "fs";
|
|
|
310809
310814
|
import path40 from "path";
|
|
310810
310815
|
|
|
310811
310816
|
// packages/cli/src/generated/git-commit.ts
|
|
310812
|
-
var GIT_COMMIT_INFO = "
|
|
310817
|
+
var GIT_COMMIT_INFO = "d960e15 (local modifications)";
|
|
310813
310818
|
|
|
310814
310819
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
310815
310820
|
init_version5();
|
|
@@ -311116,6 +311121,107 @@ var routerCommand = {
|
|
|
311116
311121
|
]
|
|
311117
311122
|
};
|
|
311118
311123
|
|
|
311124
|
+
// packages/cli/src/ui/commands/claudeCodeModelCommand.ts
|
|
311125
|
+
init_AuthService();
|
|
311126
|
+
async function getCurrentRouterModel() {
|
|
311127
|
+
try {
|
|
311128
|
+
const { readConfigFile: readConfigFile3 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
|
|
311129
|
+
const config2 = await readConfigFile3();
|
|
311130
|
+
if (config2?.Router?.default) {
|
|
311131
|
+
const [provider, model] = config2.Router.default.split(",");
|
|
311132
|
+
if (provider && model) {
|
|
311133
|
+
return { provider: provider.trim(), model: model.trim() };
|
|
311134
|
+
}
|
|
311135
|
+
}
|
|
311136
|
+
} catch (error) {
|
|
311137
|
+
}
|
|
311138
|
+
return null;
|
|
311139
|
+
}
|
|
311140
|
+
var claudeCodeModelCommand = {
|
|
311141
|
+
name: "claude",
|
|
311142
|
+
description: "claude code model selection",
|
|
311143
|
+
subCommands: [
|
|
311144
|
+
{
|
|
311145
|
+
name: "code",
|
|
311146
|
+
description: "claude code commands",
|
|
311147
|
+
subCommands: [
|
|
311148
|
+
{
|
|
311149
|
+
name: "model",
|
|
311150
|
+
description: "select model for claude code (updates router-config.json)",
|
|
311151
|
+
action: async (context2, _args) => {
|
|
311152
|
+
try {
|
|
311153
|
+
const authService = new AuthService();
|
|
311154
|
+
if (!authService.hasLocalCredentials()) {
|
|
311155
|
+
return {
|
|
311156
|
+
type: "message",
|
|
311157
|
+
messageType: "error",
|
|
311158
|
+
content: "\u274C No authentication found. Please run authentication first."
|
|
311159
|
+
};
|
|
311160
|
+
}
|
|
311161
|
+
const credentials = authService.getLocalCredentials();
|
|
311162
|
+
if (!credentials) {
|
|
311163
|
+
return {
|
|
311164
|
+
type: "message",
|
|
311165
|
+
messageType: "error",
|
|
311166
|
+
content: "\u274C Failed to load user credentials."
|
|
311167
|
+
};
|
|
311168
|
+
}
|
|
311169
|
+
let authResponse;
|
|
311170
|
+
if (credentials.sso) {
|
|
311171
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
311172
|
+
const tokenPayload = {
|
|
311173
|
+
r10_transaction_type: "LOGIN",
|
|
311174
|
+
aud: ["jid_sample_client"],
|
|
311175
|
+
sub: credentials.username.split("@")[0],
|
|
311176
|
+
// 使用用户名部分作为 sub
|
|
311177
|
+
r10_factor: "password",
|
|
311178
|
+
r10_mobile_email: credentials.username,
|
|
311179
|
+
auth_time: now,
|
|
311180
|
+
iss: "https://stg.login.account.rakuten.com",
|
|
311181
|
+
exp: now + 365 * 24 * 60 * 60,
|
|
311182
|
+
// 1年后过期
|
|
311183
|
+
iat: now,
|
|
311184
|
+
email: credentials.username
|
|
311185
|
+
};
|
|
311186
|
+
authResponse = await authService.authenticateWithToken(tokenPayload);
|
|
311187
|
+
} else {
|
|
311188
|
+
authResponse = await authService.authenticate(credentials);
|
|
311189
|
+
}
|
|
311190
|
+
if (!authResponse.success || !authResponse.models) {
|
|
311191
|
+
return {
|
|
311192
|
+
type: "message",
|
|
311193
|
+
messageType: "error",
|
|
311194
|
+
content: "\u274C Failed to fetch available models."
|
|
311195
|
+
};
|
|
311196
|
+
}
|
|
311197
|
+
const currentRouterModel = await getCurrentRouterModel();
|
|
311198
|
+
let selectedModel = null;
|
|
311199
|
+
if (currentRouterModel) {
|
|
311200
|
+
selectedModel = authResponse.models.find(
|
|
311201
|
+
(m) => m.LLM_PROVIDER === currentRouterModel.provider && m.LLM_MODEL_NAME === currentRouterModel.model
|
|
311202
|
+
) || null;
|
|
311203
|
+
}
|
|
311204
|
+
context2.models = authResponse.models;
|
|
311205
|
+
context2.currentModel = selectedModel;
|
|
311206
|
+
context2.isRouterConfig = true;
|
|
311207
|
+
return {
|
|
311208
|
+
type: "dialog",
|
|
311209
|
+
dialog: "claudeCodeModel"
|
|
311210
|
+
};
|
|
311211
|
+
} catch (error) {
|
|
311212
|
+
return {
|
|
311213
|
+
type: "message",
|
|
311214
|
+
messageType: "error",
|
|
311215
|
+
content: `\u274C Error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
311216
|
+
};
|
|
311217
|
+
}
|
|
311218
|
+
}
|
|
311219
|
+
}
|
|
311220
|
+
]
|
|
311221
|
+
}
|
|
311222
|
+
]
|
|
311223
|
+
};
|
|
311224
|
+
|
|
311119
311225
|
// packages/cli/src/services/CommandService.ts
|
|
311120
311226
|
var loadBuiltInCommands = async () => [
|
|
311121
311227
|
clearCommand,
|
|
@@ -311123,7 +311229,8 @@ var loadBuiltInCommands = async () => [
|
|
|
311123
311229
|
memoryCommand,
|
|
311124
311230
|
logoutCommand,
|
|
311125
311231
|
modelCommand,
|
|
311126
|
-
routerCommand
|
|
311232
|
+
routerCommand,
|
|
311233
|
+
claudeCodeModelCommand
|
|
311127
311234
|
];
|
|
311128
311235
|
var CommandService = class {
|
|
311129
311236
|
constructor(commandLoader = loadBuiltInCommands) {
|
|
@@ -311139,7 +311246,7 @@ var CommandService = class {
|
|
|
311139
311246
|
};
|
|
311140
311247
|
|
|
311141
311248
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
311142
|
-
var useSlashCommandProcessor = (config2, settings, history, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, onDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, toggleCorgiMode, showToolDescriptions = false, setQuittingMessages, openPrivacyNotice, openModelDialog) => {
|
|
311249
|
+
var useSlashCommandProcessor = (config2, settings, history, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, onDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, toggleCorgiMode, showToolDescriptions = false, setQuittingMessages, openPrivacyNotice, openModelDialog, openClaudeCodeModelDialog) => {
|
|
311143
311250
|
const session = useSessionStats();
|
|
311144
311251
|
const [commands, setCommands] = (0, import_react36.useState)([]);
|
|
311145
311252
|
const gitService = (0, import_react36.useMemo)(() => {
|
|
@@ -312093,6 +312200,9 @@ ${fileList}`,
|
|
|
312093
312200
|
case "model":
|
|
312094
312201
|
openModelDialog();
|
|
312095
312202
|
return { type: "handled" };
|
|
312203
|
+
case "claudeCodeModel":
|
|
312204
|
+
openClaudeCodeModelDialog();
|
|
312205
|
+
return { type: "handled" };
|
|
312096
312206
|
default: {
|
|
312097
312207
|
const unhandled = result.dialog;
|
|
312098
312208
|
throw new Error(
|
|
@@ -332084,7 +332194,7 @@ var DataCollector = class {
|
|
|
332084
332194
|
// 提取元数据
|
|
332085
332195
|
extractMetadata(data) {
|
|
332086
332196
|
return {
|
|
332087
|
-
cli_version: "0.1.
|
|
332197
|
+
cli_version: "0.1.46",
|
|
332088
332198
|
model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
|
|
332089
332199
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
332090
332200
|
project_path: data.projectPath,
|
|
@@ -337864,6 +337974,9 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
|
|
|
337864
337974
|
const [showPrivacyNotice, setShowPrivacyNotice] = (0, import_react70.useState)(false);
|
|
337865
337975
|
const [showModelDialog, setShowModelDialog] = (0, import_react70.useState)(false);
|
|
337866
337976
|
const [availableModels, setAvailableModels] = (0, import_react70.useState)([]);
|
|
337977
|
+
const [showClaudeCodeModelDialog, setShowClaudeCodeModelDialog] = (0, import_react70.useState)(false);
|
|
337978
|
+
const [availableClaudeCodeModels, setAvailableClaudeCodeModels] = (0, import_react70.useState)([]);
|
|
337979
|
+
const [currentClaudeCodeModel, setCurrentClaudeCodeModel] = (0, import_react70.useState)(null);
|
|
337867
337980
|
const openPrivacyNotice = (0, import_react70.useCallback)(() => {
|
|
337868
337981
|
setShowPrivacyNotice(true);
|
|
337869
337982
|
}, []);
|
|
@@ -337942,6 +338055,43 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
|
|
|
337942
338055
|
);
|
|
337943
338056
|
}
|
|
337944
338057
|
}, [addItem, closeModelDialog]);
|
|
338058
|
+
const closeClaudeCodeModelDialog = (0, import_react70.useCallback)(() => {
|
|
338059
|
+
setShowClaudeCodeModelDialog(false);
|
|
338060
|
+
}, []);
|
|
338061
|
+
const handleClaudeCodeModelSelect = (0, import_react70.useCallback)(async (model) => {
|
|
338062
|
+
if (!model) {
|
|
338063
|
+
closeClaudeCodeModelDialog();
|
|
338064
|
+
return;
|
|
338065
|
+
}
|
|
338066
|
+
try {
|
|
338067
|
+
const { updateRouterConfigFromModel: updateRouterConfigFromModel2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
|
|
338068
|
+
await updateRouterConfigFromModel2({
|
|
338069
|
+
LLM_PROVIDER: model.LLM_PROVIDER,
|
|
338070
|
+
LLM_MODEL_NAME: model.LLM_MODEL_NAME,
|
|
338071
|
+
LLM_API_KEY: model.LLM_API_KEY,
|
|
338072
|
+
LLM_ENDPOINT: model.LLM_ENDPOINT,
|
|
338073
|
+
LLM_TEMPERATURE: model.LLM_TEMPERATURE,
|
|
338074
|
+
LLM_MAX_TOKENS: model.LLM_MAX_TOKENS,
|
|
338075
|
+
LLM_TOP_P: model.LLM_TOP_P
|
|
338076
|
+
});
|
|
338077
|
+
addItem(
|
|
338078
|
+
{
|
|
338079
|
+
type: "info" /* INFO */,
|
|
338080
|
+
text: `\u2705 Updated router-config.json with model: ${model.LLM_MODEL_NAME} (${model.LLM_PROVIDER})`
|
|
338081
|
+
},
|
|
338082
|
+
Date.now()
|
|
338083
|
+
);
|
|
338084
|
+
closeClaudeCodeModelDialog();
|
|
338085
|
+
} catch (error) {
|
|
338086
|
+
addItem(
|
|
338087
|
+
{
|
|
338088
|
+
type: "error" /* ERROR */,
|
|
338089
|
+
text: `\u274C Failed to update router-config.json: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
338090
|
+
},
|
|
338091
|
+
Date.now()
|
|
338092
|
+
);
|
|
338093
|
+
}
|
|
338094
|
+
}, [addItem, closeClaudeCodeModelDialog]);
|
|
337945
338095
|
const errorCount = (0, import_react70.useMemo)(
|
|
337946
338096
|
() => consoleMessages.filter((msg) => msg.type === "error").length,
|
|
337947
338097
|
[consoleMessages]
|
|
@@ -338046,6 +338196,12 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
|
|
|
338046
338196
|
};
|
|
338047
338197
|
config2.setFlashFallbackHandler(flashFallbackHandler);
|
|
338048
338198
|
}, [config2, addItem]);
|
|
338199
|
+
const [openClaudeCodeModelDialogRef, setOpenClaudeCodeModelDialogRef] = (0, import_react70.useState)(null);
|
|
338200
|
+
const openClaudeCodeModelDialog = (0, import_react70.useCallback)(async () => {
|
|
338201
|
+
if (openClaudeCodeModelDialogRef) {
|
|
338202
|
+
openClaudeCodeModelDialogRef();
|
|
338203
|
+
}
|
|
338204
|
+
}, [openClaudeCodeModelDialogRef]);
|
|
338049
338205
|
const {
|
|
338050
338206
|
handleSlashCommand,
|
|
338051
338207
|
slashCommands,
|
|
@@ -338068,8 +338224,29 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
|
|
|
338068
338224
|
showToolDescriptions,
|
|
338069
338225
|
setQuittingMessages,
|
|
338070
338226
|
openPrivacyNotice,
|
|
338071
|
-
openModelDialog
|
|
338227
|
+
openModelDialog,
|
|
338228
|
+
openClaudeCodeModelDialog
|
|
338072
338229
|
);
|
|
338230
|
+
(0, import_react70.useEffect)(() => {
|
|
338231
|
+
const actualOpenClaudeCodeModelDialog = async () => {
|
|
338232
|
+
const models = commandContext.models;
|
|
338233
|
+
const currentModel2 = commandContext.currentModel;
|
|
338234
|
+
if (models && Array.isArray(models)) {
|
|
338235
|
+
setAvailableClaudeCodeModels(models);
|
|
338236
|
+
setCurrentClaudeCodeModel(currentModel2 || null);
|
|
338237
|
+
setShowClaudeCodeModelDialog(true);
|
|
338238
|
+
} else {
|
|
338239
|
+
addItem(
|
|
338240
|
+
{
|
|
338241
|
+
type: "error" /* ERROR */,
|
|
338242
|
+
text: "\u274C No models available. Please try again."
|
|
338243
|
+
},
|
|
338244
|
+
Date.now()
|
|
338245
|
+
);
|
|
338246
|
+
}
|
|
338247
|
+
};
|
|
338248
|
+
setOpenClaudeCodeModelDialogRef(() => actualOpenClaudeCodeModelDialog);
|
|
338249
|
+
}, [commandContext, addItem]);
|
|
338073
338250
|
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
|
|
338074
338251
|
const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
|
|
338075
338252
|
const isInitialMount = (0, import_react70.useRef)(true);
|
|
@@ -338406,6 +338583,13 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
|
|
|
338406
338583
|
userId: 0
|
|
338407
338584
|
} : void 0
|
|
338408
338585
|
}
|
|
338586
|
+
) }) : showClaudeCodeModelDialog ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
338587
|
+
ModelDialog,
|
|
338588
|
+
{
|
|
338589
|
+
onSelect: handleClaudeCodeModelSelect,
|
|
338590
|
+
models: availableClaudeCodeModels,
|
|
338591
|
+
currentModel: currentClaudeCodeModel || void 0
|
|
338592
|
+
}
|
|
338409
338593
|
) }) : showPrivacyNotice ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
338410
338594
|
PrivacyNotice,
|
|
338411
338595
|
{
|
|
@@ -339912,10 +340096,50 @@ async function performUserAuthentication() {
|
|
|
339912
340096
|
console.log(`Environment configuration updated: ${envPath}`);
|
|
339913
340097
|
}
|
|
339914
340098
|
try {
|
|
339915
|
-
const {
|
|
339916
|
-
await
|
|
339917
|
-
|
|
339918
|
-
|
|
340099
|
+
const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
|
|
340100
|
+
const fs54 = await import("fs/promises");
|
|
340101
|
+
const path56 = await import("path");
|
|
340102
|
+
const { homedir: homedir18 } = await import("os");
|
|
340103
|
+
let shouldUpdate = false;
|
|
340104
|
+
try {
|
|
340105
|
+
const configFilePath2 = await getConfigFilePath2();
|
|
340106
|
+
try {
|
|
340107
|
+
await fs54.access(configFilePath2);
|
|
340108
|
+
const fileContent = await fs54.readFile(configFilePath2, "utf-8");
|
|
340109
|
+
const existingConfig = JSON.parse(fileContent);
|
|
340110
|
+
const hasValidConfig = existingConfig && (existingConfig.Providers && Array.isArray(existingConfig.Providers) && existingConfig.Providers.length > 0 || existingConfig.Router && typeof existingConfig.Router === "object" && Object.keys(existingConfig.Router).length > 0);
|
|
340111
|
+
if (!hasValidConfig) {
|
|
340112
|
+
shouldUpdate = true;
|
|
340113
|
+
if (isDebugMode) {
|
|
340114
|
+
console.log("router-config.json exists but is empty or invalid, will update with default model");
|
|
340115
|
+
}
|
|
340116
|
+
} else {
|
|
340117
|
+
if (isDebugMode) {
|
|
340118
|
+
console.log("router-config.json already exists with valid content, keeping existing configuration");
|
|
340119
|
+
}
|
|
340120
|
+
}
|
|
340121
|
+
} catch (accessError) {
|
|
340122
|
+
if (accessError.code === "ENOENT") {
|
|
340123
|
+
shouldUpdate = true;
|
|
340124
|
+
if (isDebugMode) {
|
|
340125
|
+
console.log("router-config.json does not exist, will create with default model");
|
|
340126
|
+
}
|
|
340127
|
+
} else {
|
|
340128
|
+
throw accessError;
|
|
340129
|
+
}
|
|
340130
|
+
}
|
|
340131
|
+
} catch (error) {
|
|
340132
|
+
if (isDebugMode) {
|
|
340133
|
+
console.warn("Failed to check router-config.json:", error.message);
|
|
340134
|
+
}
|
|
340135
|
+
shouldUpdate = false;
|
|
340136
|
+
}
|
|
340137
|
+
if (shouldUpdate) {
|
|
340138
|
+
const { updateRouterConfigFromModel: updateRouterConfigFromModel2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
|
|
340139
|
+
await updateRouterConfigFromModel2(defaultModel);
|
|
340140
|
+
if (isDebugMode) {
|
|
340141
|
+
console.log("Router configuration created/updated with default model");
|
|
340142
|
+
}
|
|
339919
340143
|
}
|
|
339920
340144
|
} catch (error) {
|
|
339921
340145
|
if (isDebugMode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpd-llm-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://git.rakuten-it.com/scm/mpd-ai/mpd-llm-cli.git"
|
|
14
14
|
},
|
|
15
15
|
"config": {
|
|
16
|
-
"sandboxImageUri": "xx:0.1.
|
|
16
|
+
"sandboxImageUri": "xx:0.1.46"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "node scripts/start.js",
|