mpd-llm-cli 0.1.38 → 0.1.41

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.38";
27727
+ const version2 = "0.1.41";
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.38";
166415
+ return "0.1.41";
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.38";
62354
+ const version3 = "0.1.41";
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.38", "unknown"),
199414
+ cli_version: this.safeString("0.1.41", "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.38",
200581
+ cli_version: "0.1.41",
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.38",
200640
+ cli_version: "0.1.41",
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.38",
200712
+ cli_version: "0.1.41",
200713
200713
  auth_type: this.config.getContentGeneratorConfig()?.authType
200714
200714
  }
200715
200715
  });
@@ -205955,6 +205955,11 @@ var init_mpdaiConfig = __esm({
205955
205955
  const config2 = this.loadConfig();
205956
205956
  return config2?.retryAttempts || 3;
205957
205957
  }
205958
+ getTokenUrl() {
205959
+ const config2 = this.loadConfig();
205960
+ if (!config2) return "http://lb-100-123-141-85.lbaas.jpe2f.dcnw.rakuten/api/auth/token";
205961
+ return `${config2.api.baseUrl}/api/auth/token`;
205962
+ }
205958
205963
  };
205959
205964
  }
205960
205965
  });
@@ -207674,13 +207679,17 @@ var init_AuthService = __esm({
207674
207679
  AuthService = class {
207675
207680
  userJsonPath;
207676
207681
  keysJsonPath;
207682
+ idTokenPath;
207677
207683
  authApiUrl;
207684
+ tokenApiUrl;
207678
207685
  mpdaiConfig;
207679
207686
  constructor(authApiUrl) {
207680
207687
  this.mpdaiConfig = MpdaiConfigManager.getInstance();
207681
207688
  this.authApiUrl = authApiUrl || this.mpdaiConfig.getAuthUrl();
207689
+ this.tokenApiUrl = this.mpdaiConfig.getTokenUrl();
207682
207690
  this.userJsonPath = join17(homedir12(), ".mpdai", "user.json");
207683
207691
  this.keysJsonPath = join17(homedir12(), ".mpdai", "keys.json");
207692
+ this.idTokenPath = join17(homedir12(), ".mpdai", "id.token");
207684
207693
  }
207685
207694
  /**
207686
207695
  * 检查本地是否存在用户凭据文件
@@ -207708,6 +207717,91 @@ var init_AuthService = __esm({
207708
207717
  return null;
207709
207718
  }
207710
207719
  }
207720
+ /**
207721
+ * 检查是否有 username 但没有 encodedPassword
207722
+ */
207723
+ hasUsernameWithoutPassword() {
207724
+ try {
207725
+ if (!this.hasLocalCredentials()) {
207726
+ return false;
207727
+ }
207728
+ const content = readFileSync11(this.userJsonPath, "utf-8");
207729
+ const credentials = JSON.parse(content);
207730
+ return !!(credentials.username && !credentials.encodedPassword);
207731
+ } catch (error) {
207732
+ return false;
207733
+ }
207734
+ }
207735
+ /**
207736
+ * 读取 id.token 文件
207737
+ */
207738
+ readIdToken() {
207739
+ try {
207740
+ if (!existsSync12(this.idTokenPath)) {
207741
+ return null;
207742
+ }
207743
+ const token2 = readFileSync11(this.idTokenPath, "utf-8").trim();
207744
+ return token2 || null;
207745
+ } catch (error) {
207746
+ console.error("Failed to read id.token:", error);
207747
+ return null;
207748
+ }
207749
+ }
207750
+ /**
207751
+ * 解析 JWT token 的 payload 部分(不验证签名)
207752
+ */
207753
+ parseJwtPayload(token2) {
207754
+ try {
207755
+ const parts = token2.split(".");
207756
+ if (parts.length !== 3) {
207757
+ throw new Error("Invalid JWT format");
207758
+ }
207759
+ const payload = parts[1];
207760
+ const base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
207761
+ const padding = base64.length % 4;
207762
+ const paddedBase64 = padding ? base64 + "=".repeat(4 - padding) : base64;
207763
+ const decoded = Buffer.from(paddedBase64, "base64").toString("utf-8");
207764
+ return JSON.parse(decoded);
207765
+ } catch (error) {
207766
+ console.error("Failed to parse JWT payload:", error);
207767
+ return null;
207768
+ }
207769
+ }
207770
+ /**
207771
+ * 使用 token payload 进行认证
207772
+ */
207773
+ async authenticateWithToken(tokenPayload) {
207774
+ const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207775
+ try {
207776
+ if (isDebugMode) {
207777
+ console.log(`Attempting to authenticate with token API: ${this.tokenApiUrl}`);
207778
+ }
207779
+ const response = await fetch(this.tokenApiUrl, {
207780
+ method: "POST",
207781
+ headers: {
207782
+ "Content-Type": "application/json"
207783
+ },
207784
+ body: JSON.stringify(tokenPayload)
207785
+ });
207786
+ if (!response.ok) {
207787
+ throw new Error(`Token authentication failed: ${response.status} ${response.statusText}`);
207788
+ }
207789
+ const data = await response.json();
207790
+ if (!data.success) {
207791
+ throw new Error("Token authentication failed: Invalid token payload");
207792
+ }
207793
+ return data;
207794
+ } catch (error) {
207795
+ console.error("Token authentication error:", error);
207796
+ if (error instanceof Error && error.message.includes("fetch failed")) {
207797
+ console.error("\n\u274C \u65E0\u6CD5\u8FDE\u63A5\u5230\u8BA4\u8BC1\u670D\u52A1\u5668\uFF01");
207798
+ console.error("\u8BF7\u786E\u4FDD\u8BA4\u8BC1API\u670D\u52A1\u6B63\u5728\u8FD0\u884C:");
207799
+ console.error(` ${this.tokenApiUrl}`);
207800
+ console.error("\n\u5982\u679C\u60A8\u8FD8\u6CA1\u6709\u542F\u52A8\u8BA4\u8BC1\u670D\u52A1\uFF0C\u8BF7\u5148\u542F\u52A8\u5B83\u3002");
207801
+ }
207802
+ throw error;
207803
+ }
207804
+ }
207711
207805
  /**
207712
207806
  * 保存用户凭据到本地文件
207713
207807
  */
@@ -207833,6 +207927,39 @@ var init_AuthService = __esm({
207833
207927
  async performAuthFlow() {
207834
207928
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207835
207929
  let credentials = this.getLocalCredentials();
207930
+ if (this.hasUsernameWithoutPassword()) {
207931
+ if (isDebugMode) {
207932
+ console.log("Found username without password, trying token-based authentication...");
207933
+ }
207934
+ const idToken = this.readIdToken();
207935
+ if (idToken) {
207936
+ if (isDebugMode) {
207937
+ console.log("Found id.token file, parsing JWT payload...");
207938
+ }
207939
+ const tokenPayload = this.parseJwtPayload(idToken);
207940
+ if (tokenPayload) {
207941
+ if (isDebugMode) {
207942
+ console.log("JWT payload parsed successfully, using token authentication...");
207943
+ }
207944
+ const authResponse2 = await this.authenticateWithToken(tokenPayload);
207945
+ if (authResponse2.keys && authResponse2.keys.length > 0) {
207946
+ this.saveKeys(authResponse2.keys);
207947
+ if (isDebugMode) {
207948
+ console.log(`Saved ${authResponse2.keys.length} keys to local storage`);
207949
+ }
207950
+ }
207951
+ return authResponse2;
207952
+ } else {
207953
+ if (isDebugMode) {
207954
+ console.warn("Failed to parse JWT payload, falling back to password authentication...");
207955
+ }
207956
+ }
207957
+ } else {
207958
+ if (isDebugMode) {
207959
+ console.warn("id.token file not found or empty, falling back to password authentication...");
207960
+ }
207961
+ }
207962
+ }
207836
207963
  if (!credentials) {
207837
207964
  if (isDebugMode) {
207838
207965
  console.log("No local credentials found, prompting for user input...");
@@ -209070,12 +209197,13 @@ var require_lib6 = __commonJS({
209070
209197
  // packages/router/dist/src/constants.js
209071
209198
  import path37 from "node:path";
209072
209199
  import os11 from "node:os";
209073
- var HOME_DIR, CONFIG_FILE, PLUGINS_DIR, PID_FILE, REFERENCE_COUNT_FILE, CLAUDE_PROJECTS_DIR, DEFAULT_CONFIG;
209200
+ var HOME_DIR, CONFIG_FILE, RAKUTENSOLO_CONFIG_FILE, PLUGINS_DIR, PID_FILE, REFERENCE_COUNT_FILE, CLAUDE_PROJECTS_DIR, DEFAULT_CONFIG;
209074
209201
  var init_constants2 = __esm({
209075
209202
  "packages/router/dist/src/constants.js"() {
209076
209203
  "use strict";
209077
209204
  HOME_DIR = path37.join(os11.homedir(), ".mpdai");
209078
209205
  CONFIG_FILE = path37.join(HOME_DIR, "router-config.json");
209206
+ RAKUTENSOLO_CONFIG_FILE = path37.join(HOME_DIR, "rakutensolo.json");
209079
209207
  PLUGINS_DIR = path37.join(HOME_DIR, "plugins");
209080
209208
  PID_FILE = path37.join(HOME_DIR, ".mpdai-router.pid");
209081
209209
  REFERENCE_COUNT_FILE = path37.join(os11.tmpdir(), "mpdai-router-reference-count.txt");
@@ -209181,7 +209309,7 @@ var init_update = __esm({
209181
209309
  // packages/router/dist/src/utils/index.js
209182
209310
  import fs33 from "node:fs/promises";
209183
209311
  import path39 from "node:path";
209184
- var import_json5, interpolateEnvVars, ensureDir, initDir, readConfigFile, backupConfigFile, writeConfigFile, initConfig, updateRouterConfigFromModel;
209312
+ var import_json5, interpolateEnvVars, ensureDir, initDir, getConfigFilePath, readAndParseConfig, readConfigFile, backupConfigFile, writeConfigFile, initConfig, updateRouterConfigFromModel;
209185
209313
  var init_utils6 = __esm({
209186
209314
  "packages/router/dist/src/utils/index.js"() {
209187
209315
  "use strict";
@@ -209218,85 +209346,101 @@ var init_utils6 = __esm({
209218
209346
  await ensureDir(PLUGINS_DIR);
209219
209347
  await ensureDir(path39.join(HOME_DIR, "logs"));
209220
209348
  };
209221
- readConfigFile = async () => {
209349
+ getConfigFilePath = async () => {
209222
209350
  try {
209223
- const config2 = await fs33.readFile(CONFIG_FILE, "utf-8");
209351
+ await fs33.access(RAKUTENSOLO_CONFIG_FILE);
209352
+ return RAKUTENSOLO_CONFIG_FILE;
209353
+ } catch {
209354
+ return CONFIG_FILE;
209355
+ }
209356
+ };
209357
+ readAndParseConfig = async (filePath) => {
209358
+ try {
209359
+ const config2 = await fs33.readFile(filePath, "utf-8");
209224
209360
  try {
209225
209361
  const parsedConfig = import_json5.default.parse(config2);
209226
209362
  return interpolateEnvVars(parsedConfig);
209227
209363
  } catch (parseError) {
209228
- console.error(`Failed to parse config file at ${CONFIG_FILE}`);
209364
+ console.error(`Failed to parse config file at ${filePath}`);
209229
209365
  console.error("Error details:", parseError.message);
209230
209366
  console.error("Please check your config file syntax.");
209231
- process.exit(1);
209367
+ throw parseError;
209232
209368
  }
209233
- } catch (readError) {
209234
- if (readError.code === "ENOENT") {
209235
- try {
209236
- await initDir();
209237
- const backupPath = await backupConfigFile();
209238
- if (backupPath) {
209239
- console.log(`Backed up existing configuration file to ${backupPath}`);
209240
- }
209241
- const config2 = {
209242
- LOG: true,
209243
- LOG_LEVEL: "debug",
209244
- CLAUDE_PATH: "",
209245
- HOST: "127.0.0.1",
209246
- PORT: 3456,
209247
- APIKEY: "123456",
209248
- API_TIMEOUT_MS: "600000",
209249
- PROXY_URL: "",
209250
- transformers: [],
209251
- Providers: [
209252
- {
209253
- name: "Rakuten-AI",
209254
- api_base_url: "https://api.ai.public.rakuten-it.com/rakutenllms/v1/chat/completions",
209255
- api_key: "raik-sk-b0bf37082r10ai3ba52386dd24bb102fb0a7348fa7564a3ba52386dd24bb102f",
209256
- models: [
209257
- "Rakuten-AI-3.0-Alpha"
209258
- ],
209259
- transformer: {
209260
- use: [
209261
- "openrouter"
209262
- ]
209263
- }
209264
- }
209265
- ],
209266
- StatusLine: {
209267
- enabled: false,
209268
- currentStyle: "default",
209269
- default: {
209270
- modules: []
209271
- },
209272
- powerline: {
209273
- modules: []
209274
- }
209275
- },
209276
- Router: {
209277
- default: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209278
- background: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209279
- think: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209280
- longContext: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209281
- longContextThreshold: 6e4,
209282
- webSearch: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209283
- image: "Rakuten-AI,Rakuten-AI-3.0-Alpha"
209284
- },
209285
- CUSTOM_ROUTER_PATH: ""
209286
- };
209287
- await writeConfigFile(config2);
209288
- console.log("Created default configuration file at ~/.mpdai/router-config.json");
209289
- console.log("Please edit this file with your actual configuration.");
209290
- return config2;
209291
- } catch (error) {
209292
- console.error("Failed to create default configuration:", error.message);
209293
- process.exit(1);
209294
- }
209295
- } else {
209296
- console.error(`Failed to read config file at ${CONFIG_FILE}`);
209297
- console.error("Error details:", readError.message);
209298
- process.exit(1);
209369
+ } catch (error) {
209370
+ if (error.code === "ENOENT") {
209371
+ return null;
209299
209372
  }
209373
+ throw error;
209374
+ }
209375
+ };
209376
+ readConfigFile = async () => {
209377
+ let config2 = await readAndParseConfig(RAKUTENSOLO_CONFIG_FILE);
209378
+ if (config2 !== null) {
209379
+ return config2;
209380
+ }
209381
+ config2 = await readAndParseConfig(CONFIG_FILE);
209382
+ if (config2 !== null) {
209383
+ return config2;
209384
+ }
209385
+ try {
209386
+ await initDir();
209387
+ const backupPath = await backupConfigFile();
209388
+ if (backupPath) {
209389
+ console.log(`Backed up existing configuration file to ${backupPath}`);
209390
+ }
209391
+ const config3 = {
209392
+ LOG: true,
209393
+ LOG_LEVEL: "debug",
209394
+ CLAUDE_PATH: "",
209395
+ HOST: "127.0.0.1",
209396
+ PORT: 3456,
209397
+ APIKEY: "123456",
209398
+ API_TIMEOUT_MS: "600000",
209399
+ PROXY_URL: "",
209400
+ transformers: [],
209401
+ Providers: [
209402
+ {
209403
+ name: "Rakuten-AI",
209404
+ api_base_url: "https://api.ai.public.rakuten-it.com/rakutenllms/v1/chat/completions",
209405
+ api_key: "raik-sk-b0bf37082r10ai3ba52386dd24bb102fb0a7348fa7564a3ba52386dd24bb102f",
209406
+ models: [
209407
+ "Rakuten-AI-3.0-Alpha"
209408
+ ],
209409
+ transformer: {
209410
+ use: [
209411
+ "openrouter"
209412
+ ]
209413
+ }
209414
+ }
209415
+ ],
209416
+ StatusLine: {
209417
+ enabled: false,
209418
+ currentStyle: "default",
209419
+ default: {
209420
+ modules: []
209421
+ },
209422
+ powerline: {
209423
+ modules: []
209424
+ }
209425
+ },
209426
+ Router: {
209427
+ default: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209428
+ background: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209429
+ think: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209430
+ longContext: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209431
+ longContextThreshold: 6e4,
209432
+ webSearch: "Rakuten-AI,Rakuten-AI-3.0-Alpha",
209433
+ image: "Rakuten-AI,Rakuten-AI-3.0-Alpha"
209434
+ },
209435
+ CUSTOM_ROUTER_PATH: ""
209436
+ };
209437
+ await writeConfigFile(config3);
209438
+ console.log("Created default configuration file at ~/.mpdai/router-config.json");
209439
+ console.log("Please edit this file with your actual configuration.");
209440
+ return config3;
209441
+ } catch (error) {
209442
+ console.error("Failed to create default configuration:", error.message);
209443
+ process.exit(1);
209300
209444
  }
209301
209445
  };
209302
209446
  backupConfigFile = async () => {
@@ -276131,7 +276275,7 @@ var require_package7 = __commonJS({
276131
276275
  "packages/router/package.json"(exports2, module2) {
276132
276276
  module2.exports = {
276133
276277
  name: "@mpdai/router",
276134
- version: "0.1.2",
276278
+ version: "0.1.6",
276135
276279
  description: "MPD AI Router - Route Claude Code to other LLM providers",
276136
276280
  type: "module",
276137
276281
  main: "dist/index.js",
@@ -277947,8 +278091,9 @@ async function run(options = {}) {
277947
278091
  maxSize: "50M"
277948
278092
  })
277949
278093
  } : false;
278094
+ const actualConfigFilePath = await getConfigFilePath();
277950
278095
  const server = createServer3({
277951
- jsonPath: CONFIG_FILE,
278096
+ jsonPath: actualConfigFilePath,
277952
278097
  initialConfig: {
277953
278098
  providers: config2.Providers || config2.providers,
277954
278099
  HOST,
@@ -278183,7 +278328,6 @@ var init_src2 = __esm({
278183
278328
  init_auth3();
278184
278329
  init_processCheck();
278185
278330
  init_constants2();
278186
- init_constants2();
278187
278331
  init_cache();
278188
278332
  init_SSEParser_transform();
278189
278333
  init_SSESerializer_transform();
@@ -282368,6 +282512,7 @@ __export(dist_exports2, {
282368
282512
  HOME_DIR: () => HOME_DIR,
282369
282513
  PID_FILE: () => PID_FILE,
282370
282514
  PLUGINS_DIR: () => PLUGINS_DIR,
282515
+ RAKUTENSOLO_CONFIG_FILE: () => RAKUTENSOLO_CONFIG_FILE,
282371
282516
  REFERENCE_COUNT_FILE: () => REFERENCE_COUNT_FILE,
282372
282517
  backupConfigFile: () => backupConfigFile,
282373
282518
  checkForUpdates: () => checkForUpdates,
@@ -282375,6 +282520,7 @@ __export(dist_exports2, {
282375
282520
  cleanupPidFile: () => cleanupPidFile,
282376
282521
  decrementReferenceCount: () => decrementReferenceCount,
282377
282522
  executeCodeCommand: () => executeCodeCommand,
282523
+ getConfigFilePath: () => getConfigFilePath,
282378
282524
  getReferenceCount: () => getReferenceCount,
282379
282525
  getServiceInfo: () => getServiceInfo,
282380
282526
  getServicePid: () => getServicePid,
@@ -310114,7 +310260,7 @@ import { promises as fs36 } from "fs";
310114
310260
  import path40 from "path";
310115
310261
 
310116
310262
  // packages/cli/src/generated/git-commit.ts
310117
- var GIT_COMMIT_INFO = "3f6bfbf (local modifications)";
310263
+ var GIT_COMMIT_INFO = "77abd11 (local modifications)";
310118
310264
 
310119
310265
  // node_modules/read-package-up/index.js
310120
310266
  import path35 from "node:path";
@@ -310327,7 +310473,7 @@ async function getPackageJson() {
310327
310473
  // packages/cli/src/utils/version.ts
310328
310474
  async function getCliVersion() {
310329
310475
  const pkgJson = await getPackageJson();
310330
- return "0.1.38";
310476
+ return "0.1.41";
310331
310477
  }
310332
310478
 
310333
310479
  // packages/cli/src/ui/commands/memoryCommand.ts
@@ -331596,7 +331742,7 @@ var DataCollector = class {
331596
331742
  // 提取元数据
331597
331743
  extractMetadata(data) {
331598
331744
  return {
331599
- cli_version: "0.1.38",
331745
+ cli_version: "0.1.41",
331600
331746
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
331601
331747
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
331602
331748
  project_path: data.projectPath,
@@ -332016,7 +332162,7 @@ var ToolConfirmationMessage = ({
332016
332162
  }
332017
332163
  };
332018
332164
  let bodyContent = null;
332019
- let question3;
332165
+ let question2;
332020
332166
  const options = new Array();
332021
332167
  function availableBodyContentHeight() {
332022
332168
  if (options.length === 0) {
@@ -332051,7 +332197,7 @@ var ToolConfirmationMessage = ({
332051
332197
  }
332052
332198
  );
332053
332199
  }
332054
- question3 = `Apply this change?`;
332200
+ question2 = `Apply this change?`;
332055
332201
  options.push(
332056
332202
  {
332057
332203
  label: "Yes, allow once",
@@ -332078,7 +332224,7 @@ var ToolConfirmationMessage = ({
332078
332224
  );
332079
332225
  } else if (confirmationDetails.type === "exec") {
332080
332226
  const executionProps = confirmationDetails;
332081
- question3 = `Allow execution?`;
332227
+ question2 = `Allow execution?`;
332082
332228
  options.push(
332083
332229
  {
332084
332230
  label: "Yes, allow once",
@@ -332105,7 +332251,7 @@ var ToolConfirmationMessage = ({
332105
332251
  } else if (confirmationDetails.type === "info") {
332106
332252
  const infoProps = confirmationDetails;
332107
332253
  const displayUrls = infoProps.urls && !(infoProps.urls.length === 1 && infoProps.urls[0] === infoProps.prompt);
332108
- question3 = `Do you want to proceed?`;
332254
+ question2 = `Do you want to proceed?`;
332109
332255
  options.push(
332110
332256
  {
332111
332257
  label: "Yes, allow once",
@@ -332143,7 +332289,7 @@ var ToolConfirmationMessage = ({
332143
332289
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { color: Colors.Gray, children: mcpProps.args ? JSON.stringify(mcpProps.args, null, 2) : "No parameters" }) })
332144
332290
  ] })
332145
332291
  ] });
332146
- question3 = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
332292
+ question2 = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
332147
332293
  options.push(
332148
332294
  {
332149
332295
  label: "Yes, allow once",
@@ -332163,7 +332309,7 @@ var ToolConfirmationMessage = ({
332163
332309
  }
332164
332310
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Box_default, { flexDirection: "column", padding: 1, width: childWidth, children: [
332165
332311
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { flexGrow: 1, flexShrink: 1, overflow: "hidden", marginBottom: 1, children: bodyContent }),
332166
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { marginBottom: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { wrap: "truncate", children: question3 }) }),
332312
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { marginBottom: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { wrap: "truncate", children: question2 }) }),
332167
332313
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
332168
332314
  RadioButtonSelect,
332169
332315
  {
@@ -339066,7 +339212,6 @@ Example:
339066
339212
  init_dist4();
339067
339213
  init_dist4();
339068
339214
  init_dist4();
339069
- var readlineSync2 = __toESM(require_readline_sync(), 1);
339070
339215
  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
339071
339216
  function getNodeMemoryArgs(config2) {
339072
339217
  const totalMemoryMB = os23.totalmem() / (1024 * 1024);
@@ -339118,8 +339263,8 @@ async function waitForService3(timeout2 = 1e4, initialDelay = 1e3) {
339118
339263
  }
339119
339264
  async function installClaudeCode() {
339120
339265
  return new Promise((resolve18) => {
339121
- console.log("Installing @anthropic-ai/claude-code@2.0.35...");
339122
- const installProcess = spawn11("npm", ["install", "-g", "@anthropic-ai/claude-code@2.0.35"], {
339266
+ console.log("Installing mpdai-claude-code@2.0.35...");
339267
+ const installProcess = spawn11("npm", ["install", "-g", "mpdai-claude-code@2.0.35"], {
339123
339268
  stdio: "inherit",
339124
339269
  shell: true
339125
339270
  });
@@ -339156,25 +339301,15 @@ async function handleClaudeCodeCommand(args) {
339156
339301
  shell: true
339157
339302
  });
339158
339303
  checkProcess.on("error", async (error) => {
339159
- console.error("\u274C Claude Code is not installed or not found in PATH");
339160
- console.log("\nTo install Claude Code, run:");
339161
- console.log(" npm install -g @anthropic-ai/claude-code@2.0.35\n");
339162
- if (process.stdin.isTTY && process.stdout.isTTY) {
339163
- const answer = readlineSync2.question("Would you like to install it now? (y/n): ");
339164
- const shouldInstall = answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
339165
- if (shouldInstall) {
339166
- const installed = await installClaudeCode();
339167
- if (installed) {
339168
- executeCodeCommand(args);
339169
- resolve18();
339170
- } else {
339171
- reject(new Error("Installation failed"));
339172
- }
339173
- } else {
339174
- reject(new Error("User declined installation"));
339175
- }
339304
+ console.log("\u274C Claude Code is not installed or not found in PATH");
339305
+ console.log("\u{1F4E6} Automatically installing mpdai-claude-code@2.0.35...\n");
339306
+ const installed = await installClaudeCode();
339307
+ if (installed) {
339308
+ console.log("\u2705 Installation complete, executing command...\n");
339309
+ executeCodeCommand(args);
339310
+ resolve18();
339176
339311
  } else {
339177
- reject(new Error("Claude Code not found and cannot install in non-interactive mode"));
339312
+ reject(new Error("Failed to install Claude Code. Please install manually: npm install -g mpdai-claude-code@2.0.35"));
339178
339313
  }
339179
339314
  });
339180
339315
  checkProcess.on("close", (code) => {
@@ -339203,9 +339338,14 @@ async function main() {
339203
339338
  return;
339204
339339
  }
339205
339340
  }
339206
- if (args.length > 0 && args[0] === "claude" && args.length > 1 && args[1] === "code") {
339207
- await handleClaudeCodeCommand(args.slice(2));
339208
- return;
339341
+ if (args.length > 0 && args[0] === "claude") {
339342
+ if (args.length > 1 && args[1] === "code") {
339343
+ await handleClaudeCodeCommand(args.slice(2));
339344
+ return;
339345
+ } else {
339346
+ await handleClaudeCodeCommand(args.slice(1));
339347
+ return;
339348
+ }
339209
339349
  }
339210
339350
  loadStartupConfig();
339211
339351
  const workspaceRoot = process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mpd-llm-cli",
3
- "version": "0.1.38",
3
+ "version": "0.1.41",
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.37"
16
+ "sandboxImageUri": "xx:0.1.41"
17
17
  },
18
18
  "scripts": {
19
19
  "start": "node scripts/start.js",