mpd-llm-cli 0.1.44 → 0.1.45

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 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.44";
27727
+ const version2 = "0.1.45";
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.44";
166415
+ return "0.1.45";
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.44";
62354
+ const version3 = "0.1.45";
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.44", "unknown"),
199414
+ cli_version: this.safeString("0.1.45", "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.44",
200581
+ cli_version: "0.1.45",
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.44",
200640
+ cli_version: "0.1.45",
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.44",
200712
+ cli_version: "0.1.45",
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.44";
206133
+ return "0.1.45";
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
- return config2;
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.9",
276832
+ version: "0.1.10",
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 = "a3c918a (local modifications)";
310817
+ var GIT_COMMIT_INFO = "8491a55 (local modifications)";
310813
310818
 
310814
310819
  // packages/cli/src/ui/hooks/slashCommandProcessor.ts
310815
310820
  init_version5();
@@ -311116,6 +311121,87 @@ 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
+ const authResponse = await authService.authenticate(credentials);
311170
+ if (!authResponse.success || !authResponse.models) {
311171
+ return {
311172
+ type: "message",
311173
+ messageType: "error",
311174
+ content: "\u274C Failed to fetch available models."
311175
+ };
311176
+ }
311177
+ const currentRouterModel = await getCurrentRouterModel();
311178
+ let selectedModel = null;
311179
+ if (currentRouterModel) {
311180
+ selectedModel = authResponse.models.find(
311181
+ (m) => m.LLM_PROVIDER === currentRouterModel.provider && m.LLM_MODEL_NAME === currentRouterModel.model
311182
+ ) || null;
311183
+ }
311184
+ context2.models = authResponse.models;
311185
+ context2.currentModel = selectedModel;
311186
+ context2.isRouterConfig = true;
311187
+ return {
311188
+ type: "dialog",
311189
+ dialog: "claudeCodeModel"
311190
+ };
311191
+ } catch (error) {
311192
+ return {
311193
+ type: "message",
311194
+ messageType: "error",
311195
+ content: `\u274C Error: ${error instanceof Error ? error.message : "Unknown error"}`
311196
+ };
311197
+ }
311198
+ }
311199
+ }
311200
+ ]
311201
+ }
311202
+ ]
311203
+ };
311204
+
311119
311205
  // packages/cli/src/services/CommandService.ts
311120
311206
  var loadBuiltInCommands = async () => [
311121
311207
  clearCommand,
@@ -311123,7 +311209,8 @@ var loadBuiltInCommands = async () => [
311123
311209
  memoryCommand,
311124
311210
  logoutCommand,
311125
311211
  modelCommand,
311126
- routerCommand
311212
+ routerCommand,
311213
+ claudeCodeModelCommand
311127
311214
  ];
311128
311215
  var CommandService = class {
311129
311216
  constructor(commandLoader = loadBuiltInCommands) {
@@ -311139,7 +311226,7 @@ var CommandService = class {
311139
311226
  };
311140
311227
 
311141
311228
  // 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) => {
311229
+ var useSlashCommandProcessor = (config2, settings, history, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, onDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, toggleCorgiMode, showToolDescriptions = false, setQuittingMessages, openPrivacyNotice, openModelDialog, openClaudeCodeModelDialog) => {
311143
311230
  const session = useSessionStats();
311144
311231
  const [commands, setCommands] = (0, import_react36.useState)([]);
311145
311232
  const gitService = (0, import_react36.useMemo)(() => {
@@ -312093,6 +312180,9 @@ ${fileList}`,
312093
312180
  case "model":
312094
312181
  openModelDialog();
312095
312182
  return { type: "handled" };
312183
+ case "claudeCodeModel":
312184
+ openClaudeCodeModelDialog();
312185
+ return { type: "handled" };
312096
312186
  default: {
312097
312187
  const unhandled = result.dialog;
312098
312188
  throw new Error(
@@ -332084,7 +332174,7 @@ var DataCollector = class {
332084
332174
  // 提取元数据
332085
332175
  extractMetadata(data) {
332086
332176
  return {
332087
- cli_version: "0.1.44",
332177
+ cli_version: "0.1.45",
332088
332178
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
332089
332179
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
332090
332180
  project_path: data.projectPath,
@@ -337864,6 +337954,9 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
337864
337954
  const [showPrivacyNotice, setShowPrivacyNotice] = (0, import_react70.useState)(false);
337865
337955
  const [showModelDialog, setShowModelDialog] = (0, import_react70.useState)(false);
337866
337956
  const [availableModels, setAvailableModels] = (0, import_react70.useState)([]);
337957
+ const [showClaudeCodeModelDialog, setShowClaudeCodeModelDialog] = (0, import_react70.useState)(false);
337958
+ const [availableClaudeCodeModels, setAvailableClaudeCodeModels] = (0, import_react70.useState)([]);
337959
+ const [currentClaudeCodeModel, setCurrentClaudeCodeModel] = (0, import_react70.useState)(null);
337867
337960
  const openPrivacyNotice = (0, import_react70.useCallback)(() => {
337868
337961
  setShowPrivacyNotice(true);
337869
337962
  }, []);
@@ -337942,6 +338035,43 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
337942
338035
  );
337943
338036
  }
337944
338037
  }, [addItem, closeModelDialog]);
338038
+ const closeClaudeCodeModelDialog = (0, import_react70.useCallback)(() => {
338039
+ setShowClaudeCodeModelDialog(false);
338040
+ }, []);
338041
+ const handleClaudeCodeModelSelect = (0, import_react70.useCallback)(async (model) => {
338042
+ if (!model) {
338043
+ closeClaudeCodeModelDialog();
338044
+ return;
338045
+ }
338046
+ try {
338047
+ const { updateRouterConfigFromModel: updateRouterConfigFromModel2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
338048
+ await updateRouterConfigFromModel2({
338049
+ LLM_PROVIDER: model.LLM_PROVIDER,
338050
+ LLM_MODEL_NAME: model.LLM_MODEL_NAME,
338051
+ LLM_API_KEY: model.LLM_API_KEY,
338052
+ LLM_ENDPOINT: model.LLM_ENDPOINT,
338053
+ LLM_TEMPERATURE: model.LLM_TEMPERATURE,
338054
+ LLM_MAX_TOKENS: model.LLM_MAX_TOKENS,
338055
+ LLM_TOP_P: model.LLM_TOP_P
338056
+ });
338057
+ addItem(
338058
+ {
338059
+ type: "info" /* INFO */,
338060
+ text: `\u2705 Updated router-config.json with model: ${model.LLM_MODEL_NAME} (${model.LLM_PROVIDER})`
338061
+ },
338062
+ Date.now()
338063
+ );
338064
+ closeClaudeCodeModelDialog();
338065
+ } catch (error) {
338066
+ addItem(
338067
+ {
338068
+ type: "error" /* ERROR */,
338069
+ text: `\u274C Failed to update router-config.json: ${error instanceof Error ? error.message : "Unknown error"}`
338070
+ },
338071
+ Date.now()
338072
+ );
338073
+ }
338074
+ }, [addItem, closeClaudeCodeModelDialog]);
337945
338075
  const errorCount = (0, import_react70.useMemo)(
337946
338076
  () => consoleMessages.filter((msg) => msg.type === "error").length,
337947
338077
  [consoleMessages]
@@ -338046,6 +338176,12 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
338046
338176
  };
338047
338177
  config2.setFlashFallbackHandler(flashFallbackHandler);
338048
338178
  }, [config2, addItem]);
338179
+ const [openClaudeCodeModelDialogRef, setOpenClaudeCodeModelDialogRef] = (0, import_react70.useState)(null);
338180
+ const openClaudeCodeModelDialog = (0, import_react70.useCallback)(async () => {
338181
+ if (openClaudeCodeModelDialogRef) {
338182
+ openClaudeCodeModelDialogRef();
338183
+ }
338184
+ }, [openClaudeCodeModelDialogRef]);
338049
338185
  const {
338050
338186
  handleSlashCommand,
338051
338187
  slashCommands,
@@ -338068,8 +338204,29 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
338068
338204
  showToolDescriptions,
338069
338205
  setQuittingMessages,
338070
338206
  openPrivacyNotice,
338071
- openModelDialog
338207
+ openModelDialog,
338208
+ openClaudeCodeModelDialog
338072
338209
  );
338210
+ (0, import_react70.useEffect)(() => {
338211
+ const actualOpenClaudeCodeModelDialog = async () => {
338212
+ const models = commandContext.models;
338213
+ const currentModel2 = commandContext.currentModel;
338214
+ if (models && Array.isArray(models)) {
338215
+ setAvailableClaudeCodeModels(models);
338216
+ setCurrentClaudeCodeModel(currentModel2 || null);
338217
+ setShowClaudeCodeModelDialog(true);
338218
+ } else {
338219
+ addItem(
338220
+ {
338221
+ type: "error" /* ERROR */,
338222
+ text: "\u274C No models available. Please try again."
338223
+ },
338224
+ Date.now()
338225
+ );
338226
+ }
338227
+ };
338228
+ setOpenClaudeCodeModelDialogRef(() => actualOpenClaudeCodeModelDialog);
338229
+ }, [commandContext, addItem]);
338073
338230
  const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
338074
338231
  const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
338075
338232
  const isInitialMount = (0, import_react70.useRef)(true);
@@ -338406,6 +338563,13 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
338406
338563
  userId: 0
338407
338564
  } : void 0
338408
338565
  }
338566
+ ) }) : showClaudeCodeModelDialog ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
338567
+ ModelDialog,
338568
+ {
338569
+ onSelect: handleClaudeCodeModelSelect,
338570
+ models: availableClaudeCodeModels,
338571
+ currentModel: currentClaudeCodeModel || void 0
338572
+ }
338409
338573
  ) }) : showPrivacyNotice ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
338410
338574
  PrivacyNotice,
338411
338575
  {
@@ -339912,10 +340076,50 @@ async function performUserAuthentication() {
339912
340076
  console.log(`Environment configuration updated: ${envPath}`);
339913
340077
  }
339914
340078
  try {
339915
- const { updateRouterConfigFromModel: updateRouterConfigFromModel2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
339916
- await updateRouterConfigFromModel2(defaultModel);
339917
- if (isDebugMode) {
339918
- console.log("Router configuration updated with default model");
340079
+ const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
340080
+ const fs54 = await import("fs/promises");
340081
+ const path56 = await import("path");
340082
+ const { homedir: homedir18 } = await import("os");
340083
+ let shouldUpdate = false;
340084
+ try {
340085
+ const configFilePath2 = await getConfigFilePath2();
340086
+ try {
340087
+ await fs54.access(configFilePath2);
340088
+ const fileContent = await fs54.readFile(configFilePath2, "utf-8");
340089
+ const existingConfig = JSON.parse(fileContent);
340090
+ 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);
340091
+ if (!hasValidConfig) {
340092
+ shouldUpdate = true;
340093
+ if (isDebugMode) {
340094
+ console.log("router-config.json exists but is empty or invalid, will update with default model");
340095
+ }
340096
+ } else {
340097
+ if (isDebugMode) {
340098
+ console.log("router-config.json already exists with valid content, keeping existing configuration");
340099
+ }
340100
+ }
340101
+ } catch (accessError) {
340102
+ if (accessError.code === "ENOENT") {
340103
+ shouldUpdate = true;
340104
+ if (isDebugMode) {
340105
+ console.log("router-config.json does not exist, will create with default model");
340106
+ }
340107
+ } else {
340108
+ throw accessError;
340109
+ }
340110
+ }
340111
+ } catch (error) {
340112
+ if (isDebugMode) {
340113
+ console.warn("Failed to check router-config.json:", error.message);
340114
+ }
340115
+ shouldUpdate = false;
340116
+ }
340117
+ if (shouldUpdate) {
340118
+ const { updateRouterConfigFromModel: updateRouterConfigFromModel2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
340119
+ await updateRouterConfigFromModel2(defaultModel);
340120
+ if (isDebugMode) {
340121
+ console.log("Router configuration created/updated with default model");
340122
+ }
339919
340123
  }
339920
340124
  } catch (error) {
339921
340125
  if (isDebugMode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mpd-llm-cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
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.44"
16
+ "sandboxImageUri": "xx:0.1.45"
17
17
  },
18
18
  "scripts": {
19
19
  "start": "node scripts/start.js",