mpd-llm-cli 0.1.28 → 0.1.31

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  </div>
10
10
 
11
- This repository contains the MPD LLM CLI([Gemini Cli](https://github.com/google-gemini/gemini-cli) version of the Fork), a command-line AI workflow tool that connects to your
11
+ This repository contains the MPD LLM CLI([MPD AI Cli](https://git.rakuten-it.com/projects/MPD-AI/repos/mpd-llm-cli/browse/) version of the Fork), a command-line AI workflow tool that connects to your
12
12
  tools, understands your code and accelerates your workflows. It supports multiple LLM providers including Gemini, OpenAI, and any custom LLM API that follows OpenAI's API format.
13
13
 
14
14
 
package/bundle/api.cjs CHANGED
@@ -19951,7 +19951,7 @@ var init_setup = __esm({
19951
19951
  init_server();
19952
19952
  ProjectIdRequiredError = class extends Error {
19953
19953
  constructor() {
19954
- super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gca");
19954
+ super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://git.rakuten-it.com/projects/MPD-AI/repos/mpd-llm-cli/browse/docs/cli/authentication.md");
19955
19955
  }
19956
19956
  };
19957
19957
  }
@@ -140499,6 +140499,12 @@ function _sanitizeParameters(schema, visited) {
140499
140499
  return;
140500
140500
  }
140501
140501
  visited.add(schema);
140502
+ if ("$schema" in schema) {
140503
+ delete schema.$schema;
140504
+ }
140505
+ if ("additionalProperties" in schema) {
140506
+ delete schema.additionalProperties;
140507
+ }
140502
140508
  if (schema.anyOf) {
140503
140509
  schema.default = void 0;
140504
140510
  for (const item of schema.anyOf) {
package/bundle/api.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url); globalThis.__filename = require('url').fileURLToPath(import.meta.url); globalThis.__dirname = require('path').dirname(globalThis.__filename);
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url); globalThis.require = require; globalThis.__filename = require('url').fileURLToPath(import.meta.url); globalThis.__dirname = require('path').dirname(globalThis.__filename);
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19955,7 +19955,7 @@ var init_setup = __esm({
19955
19955
  init_server();
19956
19956
  ProjectIdRequiredError = class extends Error {
19957
19957
  constructor() {
19958
- super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gca");
19958
+ super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://git.rakuten-it.com/projects/MPD-AI/repos/mpd-llm-cli/browse/docs/cli/authentication.md");
19959
19959
  }
19960
19960
  };
19961
19961
  }
@@ -27717,7 +27717,7 @@ async function createContentGeneratorConfig(model, authType) {
27717
27717
  return contentGeneratorConfig;
27718
27718
  }
27719
27719
  async function createContentGenerator(config2, sessionId2) {
27720
- const version2 = "0.1.28";
27720
+ const version2 = "0.1.31";
27721
27721
  const httpOptions = {
27722
27722
  headers: {
27723
27723
  "User-Agent": `GeminiCLI/${version2} (${process.platform}; ${process.arch})`
@@ -140495,6 +140495,12 @@ function _sanitizeParameters(schema, visited) {
140495
140495
  return;
140496
140496
  }
140497
140497
  visited.add(schema);
140498
+ if ("$schema" in schema) {
140499
+ delete schema.$schema;
140500
+ }
140501
+ if ("additionalProperties" in schema) {
140502
+ delete schema.additionalProperties;
140503
+ }
140498
140504
  if (schema.anyOf) {
140499
140505
  schema.default = void 0;
140500
140506
  for (const item of schema.anyOf) {
@@ -166399,7 +166405,7 @@ async function getPackageJson() {
166399
166405
  // packages/cli/src/utils/version.ts
166400
166406
  async function getCliVersion() {
166401
166407
  const pkgJson = await getPackageJson();
166402
- return "0.1.28";
166408
+ return "0.1.31";
166403
166409
  }
166404
166410
 
166405
166411
  // packages/cli/src/config/sandboxConfig.ts
package/bundle/gemini.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from 'module'; const require = createRequire(import.meta.url); globalThis.__filename = require('url').fileURLToPath(import.meta.url); globalThis.__dirname = require('path').dirname(globalThis.__filename);
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url); globalThis.require = require; globalThis.__filename = require('url').fileURLToPath(import.meta.url); globalThis.__dirname = require('path').dirname(globalThis.__filename);
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -70520,7 +70520,7 @@ var init_setup = __esm({
70520
70520
  init_server();
70521
70521
  ProjectIdRequiredError = class extends Error {
70522
70522
  constructor() {
70523
- super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gca");
70523
+ super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://git.rakuten-it.com/projects/MPD-AI/repos/mpd-llm-cli/browse/docs/cli/authentication.md");
70524
70524
  }
70525
70525
  };
70526
70526
  }
@@ -78281,7 +78281,7 @@ async function createContentGeneratorConfig(model, authType) {
78281
78281
  return contentGeneratorConfig;
78282
78282
  }
78283
78283
  async function createContentGenerator(config2, sessionId2) {
78284
- const version3 = "0.1.28";
78284
+ const version3 = "0.1.31";
78285
78285
  const httpOptions = {
78286
78286
  headers: {
78287
78287
  "User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
@@ -92912,6 +92912,12 @@ function _sanitizeParameters(schema, visited) {
92912
92912
  return;
92913
92913
  }
92914
92914
  visited.add(schema);
92915
+ if ("$schema" in schema) {
92916
+ delete schema.$schema;
92917
+ }
92918
+ if ("additionalProperties" in schema) {
92919
+ delete schema.additionalProperties;
92920
+ }
92915
92921
  if (schema.anyOf) {
92916
92922
  schema.default = void 0;
92917
92923
  for (const item of schema.anyOf) {
@@ -176593,8 +176599,8 @@ var require_sync = __commonJS({
176593
176599
  }
176594
176600
  return x;
176595
176601
  };
176596
- var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync17, pkgfile) {
176597
- var body = readFileSync17(pkgfile);
176602
+ var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync19, pkgfile) {
176603
+ var body = readFileSync19(pkgfile);
176598
176604
  try {
176599
176605
  var pkg2 = JSON.parse(body);
176600
176606
  return pkg2;
@@ -176614,7 +176620,7 @@ var require_sync = __commonJS({
176614
176620
  }
176615
176621
  var opts = normalizeOptions(x, options);
176616
176622
  var isFile = opts.isFile || defaultIsFile;
176617
- var readFileSync17 = opts.readFileSync || fs51.readFileSync;
176623
+ var readFileSync19 = opts.readFileSync || fs51.readFileSync;
176618
176624
  var isDirectory = opts.isDirectory || defaultIsDir;
176619
176625
  var realpathSync2 = opts.realpathSync || defaultRealpathSync;
176620
176626
  var readPackageSync2 = opts.readPackageSync || defaultReadPackageSync;
@@ -176671,7 +176677,7 @@ var require_sync = __commonJS({
176671
176677
  if (!isFile(pkgfile)) {
176672
176678
  return loadpkg(path53.dirname(dir));
176673
176679
  }
176674
- var pkg2 = readPackageSync2(readFileSync17, pkgfile);
176680
+ var pkg2 = readPackageSync2(readFileSync19, pkgfile);
176675
176681
  if (pkg2 && opts.packageFilter) {
176676
176682
  pkg2 = opts.packageFilter(
176677
176683
  pkg2,
@@ -176685,7 +176691,7 @@ var require_sync = __commonJS({
176685
176691
  var pkgfile = path53.join(maybeRealpathSync(realpathSync2, x2, opts), "/package.json");
176686
176692
  if (isFile(pkgfile)) {
176687
176693
  try {
176688
- var pkg2 = readPackageSync2(readFileSync17, pkgfile);
176694
+ var pkg2 = readPackageSync2(readFileSync19, pkgfile);
176689
176695
  } catch (e2) {
176690
176696
  }
176691
176697
  if (pkg2 && opts.packageFilter) {
@@ -215336,7 +215342,7 @@ var init_langfuseClient = __esm({
215336
215342
  userId,
215337
215343
  metadata: {
215338
215344
  ...safeMetadata,
215339
- cli_version: this.safeString("0.1.28", "unknown"),
215345
+ cli_version: this.safeString("0.1.31", "unknown"),
215340
215346
  model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
215341
215347
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
215342
215348
  environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
@@ -216503,7 +216509,7 @@ var init_langfuseIntegration = __esm({
216503
216509
  const metadata = {
216504
216510
  model: this.config.getModel(),
216505
216511
  auth_type: this.config.getContentGeneratorConfig()?.authType,
216506
- cli_version: "0.1.28",
216512
+ cli_version: "0.1.31",
216507
216513
  start_time: (/* @__PURE__ */ new Date()).toISOString(),
216508
216514
  session_id: this.sessionId
216509
216515
  };
@@ -216562,7 +216568,7 @@ var init_langfuseIntegration = __esm({
216562
216568
  totalCachedTokens: sessionStats.totalCachedTokens,
216563
216569
  totalPromptTokens: sessionStats.totalPromptTokens,
216564
216570
  metadata: {
216565
- cli_version: "0.1.28",
216571
+ cli_version: "0.1.31",
216566
216572
  auth_type: this.config.getContentGeneratorConfig()?.authType,
216567
216573
  session_end_time: (/* @__PURE__ */ new Date()).toISOString()
216568
216574
  }
@@ -216634,7 +216640,7 @@ var init_langfuseIntegration = __esm({
216634
216640
  error,
216635
216641
  metadata: {
216636
216642
  session_id: this.sessionId,
216637
- cli_version: "0.1.28",
216643
+ cli_version: "0.1.31",
216638
216644
  auth_type: this.config.getContentGeneratorConfig()?.authType
216639
216645
  }
216640
216646
  });
@@ -252943,7 +252949,7 @@ import { promises as fs33 } from "fs";
252943
252949
  import path37 from "path";
252944
252950
 
252945
252951
  // packages/cli/src/generated/git-commit.ts
252946
- var GIT_COMMIT_INFO = "92a0c14 (local modifications)";
252952
+ var GIT_COMMIT_INFO = "cc090d6";
252947
252953
 
252948
252954
  // node_modules/read-package-up/index.js
252949
252955
  import path35 from "node:path";
@@ -253156,7 +253162,7 @@ async function getPackageJson() {
253156
253162
  // packages/cli/src/utils/version.ts
253157
253163
  async function getCliVersion() {
253158
253164
  const pkgJson = await getPackageJson();
253159
- return "0.1.28";
253165
+ return "0.1.31";
253160
253166
  }
253161
253167
 
253162
253168
  // packages/cli/src/ui/commands/memoryCommand.ts
@@ -253253,7 +253259,7 @@ ${memoryContent}
253253
253259
  var helpCommand = {
253254
253260
  name: "help",
253255
253261
  altName: "?",
253256
- description: "for help on gemini-cli",
253262
+ description: "for help on mpdai-cli",
253257
253263
  action: (_context, _args) => {
253258
253264
  console.debug("Opening help UI ...");
253259
253265
  return {
@@ -253401,13 +253407,144 @@ var modelCommand = {
253401
253407
  }
253402
253408
  };
253403
253409
 
253410
+ // packages/cli/src/ui/commands/routerCommand.ts
253411
+ import { run as runRouter } from "@mpdai/router";
253412
+ import { showStatus, executeCodeCommand, runModelSelector } from "@mpdai/router";
253413
+ import { isServiceRunning, cleanupPidFile } from "@mpdai/router";
253414
+ import { PID_FILE, REFERENCE_COUNT_FILE } from "@mpdai/router";
253415
+ import { readFileSync as readFileSync12, existsSync as existsSync13, unlinkSync as unlinkSync2 } from "fs";
253416
+ async function waitForService(timeout2 = 1e4, initialDelay = 1e3) {
253417
+ await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
253418
+ const startTime = Date.now();
253419
+ while (Date.now() - startTime < timeout2) {
253420
+ const isRunning = await isServiceRunning();
253421
+ if (isRunning) {
253422
+ await new Promise((resolve18) => setTimeout(resolve18, 500));
253423
+ return true;
253424
+ }
253425
+ await new Promise((resolve18) => setTimeout(resolve18, 100));
253426
+ }
253427
+ return false;
253428
+ }
253429
+ async function handleRouterStart() {
253430
+ await runRouter();
253431
+ }
253432
+ async function handleRouterStop() {
253433
+ try {
253434
+ const pid = parseInt(readFileSync12(PID_FILE, "utf-8"));
253435
+ process.kill(pid);
253436
+ cleanupPidFile();
253437
+ if (existsSync13(REFERENCE_COUNT_FILE)) {
253438
+ try {
253439
+ unlinkSync2(REFERENCE_COUNT_FILE);
253440
+ } catch (e2) {
253441
+ }
253442
+ }
253443
+ console.log("MPD AI router service has been successfully stopped.");
253444
+ } catch (e2) {
253445
+ console.log("Failed to stop the service. It may have already been stopped.");
253446
+ cleanupPidFile();
253447
+ }
253448
+ }
253449
+ async function handleRouterRestart() {
253450
+ try {
253451
+ const pid = parseInt(readFileSync12(PID_FILE, "utf-8"));
253452
+ process.kill(pid);
253453
+ cleanupPidFile();
253454
+ if (existsSync13(REFERENCE_COUNT_FILE)) {
253455
+ try {
253456
+ unlinkSync2(REFERENCE_COUNT_FILE);
253457
+ } catch (e2) {
253458
+ }
253459
+ }
253460
+ console.log("MPD AI router service has been stopped.");
253461
+ } catch (e2) {
253462
+ console.log("Service was not running or failed to stop.");
253463
+ cleanupPidFile();
253464
+ }
253465
+ console.log("Starting MPD AI router service...");
253466
+ await runRouter();
253467
+ }
253468
+ async function handleRouterStatus() {
253469
+ await showStatus();
253470
+ }
253471
+ async function handleRouterCode(args) {
253472
+ const isRunning = await isServiceRunning();
253473
+ if (!isRunning) {
253474
+ console.log("Service not running, starting service...");
253475
+ await runRouter();
253476
+ if (await waitForService()) {
253477
+ const codeArgs = args ? args.split(" ") : [];
253478
+ executeCodeCommand(codeArgs);
253479
+ } else {
253480
+ console.error("Service startup timeout, please manually run `mpdai router start` to start the service");
253481
+ process.exit(1);
253482
+ }
253483
+ } else {
253484
+ const codeArgs = args ? args.split(" ") : [];
253485
+ executeCodeCommand(codeArgs);
253486
+ }
253487
+ }
253488
+ async function handleRouterModel() {
253489
+ await runModelSelector();
253490
+ }
253491
+ var routerCommand = {
253492
+ name: "router",
253493
+ description: "Router commands for managing the MPD AI router service",
253494
+ subCommands: [
253495
+ {
253496
+ name: "start",
253497
+ description: "Start the router service",
253498
+ action: async (_context, _args) => {
253499
+ await handleRouterStart();
253500
+ }
253501
+ },
253502
+ {
253503
+ name: "stop",
253504
+ description: "Stop the router service",
253505
+ action: async (_context, _args) => {
253506
+ await handleRouterStop();
253507
+ }
253508
+ },
253509
+ {
253510
+ name: "restart",
253511
+ description: "Restart the router service",
253512
+ action: async (_context, _args) => {
253513
+ await handleRouterRestart();
253514
+ }
253515
+ },
253516
+ {
253517
+ name: "status",
253518
+ description: "Show router service status",
253519
+ action: async (_context, _args) => {
253520
+ await handleRouterStatus();
253521
+ }
253522
+ },
253523
+ {
253524
+ name: "code",
253525
+ description: "Execute Claude Code command",
253526
+ action: async (_context, args) => {
253527
+ await handleRouterCode(args);
253528
+ }
253529
+ },
253530
+ {
253531
+ name: "model",
253532
+ description: "Interactive model selection and configuration",
253533
+ action: async (_context, _args) => {
253534
+ await handleRouterModel();
253535
+ }
253536
+ }
253537
+ ]
253538
+ };
253539
+
253404
253540
  // packages/cli/src/services/CommandService.ts
253405
253541
  var loadBuiltInCommands = async () => [
253406
253542
  clearCommand,
253407
253543
  helpCommand,
253408
253544
  memoryCommand,
253409
253545
  logoutCommand,
253410
- modelCommand
253546
+ modelCommand,
253547
+ routerCommand
253411
253548
  ];
253412
253549
  var CommandService = class {
253413
253550
  constructor(commandLoader = loadBuiltInCommands) {
@@ -253650,7 +253787,7 @@ ${docsUrl}`,
253650
253787
  const mcpServers = config2?.getMcpServers() || {};
253651
253788
  const serverNames = Object.keys(mcpServers);
253652
253789
  if (serverNames.length === 0) {
253653
- const docsUrl = "https://goo.gle/gemini-cli-docs-mcp";
253790
+ const docsUrl = "http://lb-100-123-141-85.lbaas.jpe2f.dcnw.rakuten/management/docs/tools/mcp-server.html";
253654
253791
  if (process25.env.SANDBOX && process25.env.SANDBOX !== "sandbox-exec") {
253655
253792
  addMessage({
253656
253793
  type: "info" /* INFO */,
@@ -272447,7 +272584,7 @@ function stripQuotes(val) {
272447
272584
  }
272448
272585
 
272449
272586
  // node_modules/yargs-parser/build/lib/index.js
272450
- import { readFileSync as readFileSync13 } from "fs";
272587
+ import { readFileSync as readFileSync14 } from "fs";
272451
272588
  var _a5;
272452
272589
  var _b;
272453
272590
  var _c;
@@ -272474,7 +272611,7 @@ var parser4 = new YargsParser({
272474
272611
  if (typeof __require !== "undefined") {
272475
272612
  return __require(path53);
272476
272613
  } else if (path53.match(/\.json$/)) {
272477
- return JSON.parse(readFileSync13(path53, "utf8"));
272614
+ return JSON.parse(readFileSync14(path53, "utf8"));
272478
272615
  } else {
272479
272616
  throw Error("only .json config files are supported in ESM");
272480
272617
  }
@@ -272802,17 +272939,17 @@ function sync_default(start, callback) {
272802
272939
 
272803
272940
  // node_modules/yargs/lib/platform-shims/esm.mjs
272804
272941
  import { inspect } from "util";
272805
- import { readFileSync as readFileSync15 } from "fs";
272942
+ import { readFileSync as readFileSync16 } from "fs";
272806
272943
  import { fileURLToPath as fileURLToPath7 } from "url";
272807
272944
  import { basename as basename4, dirname as dirname10, extname as extname2, relative as relative6, resolve as resolve17 } from "path";
272808
272945
 
272809
272946
  // node_modules/y18n/build/lib/platform-shims/node.js
272810
- import { readFileSync as readFileSync14, statSync as statSync3, writeFile as writeFile5 } from "fs";
272947
+ import { readFileSync as readFileSync15, statSync as statSync3, writeFile as writeFile5 } from "fs";
272811
272948
  import { format as format2 } from "util";
272812
272949
  import { resolve as resolve16 } from "path";
272813
272950
  var node_default = {
272814
272951
  fs: {
272815
- readFileSync: readFileSync14,
272952
+ readFileSync: readFileSync15,
272816
272953
  writeFile: writeFile5
272817
272954
  },
272818
272955
  format: format2,
@@ -273036,7 +273173,7 @@ var esm_default3 = {
273036
273173
  nextTick: process.nextTick,
273037
273174
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
273038
273175
  },
273039
- readFileSync: readFileSync15,
273176
+ readFileSync: readFileSync16,
273040
273177
  require: () => {
273041
273178
  throw new YError(REQUIRE_ERROR);
273042
273179
  },
@@ -274364,7 +274501,7 @@ var DataCollector = class {
274364
274501
  // 提取元数据
274365
274502
  extractMetadata(data) {
274366
274503
  return {
274367
- cli_version: "0.1.28",
274504
+ cli_version: "0.1.31",
274368
274505
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
274369
274506
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
274370
274507
  project_path: data.projectPath,
@@ -274784,7 +274921,7 @@ var ToolConfirmationMessage = ({
274784
274921
  }
274785
274922
  };
274786
274923
  let bodyContent = null;
274787
- let question2;
274924
+ let question3;
274788
274925
  const options = new Array();
274789
274926
  function availableBodyContentHeight() {
274790
274927
  if (options.length === 0) {
@@ -274819,7 +274956,7 @@ var ToolConfirmationMessage = ({
274819
274956
  }
274820
274957
  );
274821
274958
  }
274822
- question2 = `Apply this change?`;
274959
+ question3 = `Apply this change?`;
274823
274960
  options.push(
274824
274961
  {
274825
274962
  label: "Yes, allow once",
@@ -274846,7 +274983,7 @@ var ToolConfirmationMessage = ({
274846
274983
  );
274847
274984
  } else if (confirmationDetails.type === "exec") {
274848
274985
  const executionProps = confirmationDetails;
274849
- question2 = `Allow execution?`;
274986
+ question3 = `Allow execution?`;
274850
274987
  options.push(
274851
274988
  {
274852
274989
  label: "Yes, allow once",
@@ -274873,7 +275010,7 @@ var ToolConfirmationMessage = ({
274873
275010
  } else if (confirmationDetails.type === "info") {
274874
275011
  const infoProps = confirmationDetails;
274875
275012
  const displayUrls = infoProps.urls && !(infoProps.urls.length === 1 && infoProps.urls[0] === infoProps.prompt);
274876
- question2 = `Do you want to proceed?`;
275013
+ question3 = `Do you want to proceed?`;
274877
275014
  options.push(
274878
275015
  {
274879
275016
  label: "Yes, allow once",
@@ -274911,7 +275048,7 @@ var ToolConfirmationMessage = ({
274911
275048
  /* @__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" }) })
274912
275049
  ] })
274913
275050
  ] });
274914
- question2 = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
275051
+ question3 = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
274915
275052
  options.push(
274916
275053
  {
274917
275054
  label: "Yes, allow once",
@@ -274931,7 +275068,7 @@ var ToolConfirmationMessage = ({
274931
275068
  }
274932
275069
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Box_default, { flexDirection: "column", padding: 1, width: childWidth, children: [
274933
275070
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { flexGrow: 1, flexShrink: 1, overflow: "hidden", marginBottom: 1, children: bodyContent }),
274934
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { marginBottom: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { wrap: "truncate", children: question2 }) }),
275071
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { marginBottom: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { wrap: "truncate", children: question3 }) }),
274935
275072
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
274936
275073
  RadioButtonSelect,
274937
275074
  {
@@ -275083,7 +275220,7 @@ var AboutBox = ({
275083
275220
  marginY: 1,
275084
275221
  width: "100%",
275085
275222
  children: [
275086
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, color: Colors.AccentPurple, children: "About Gemini CLI" }) }),
275223
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, color: Colors.AccentPurple, children: "About MPDAI CLI" }) }),
275087
275224
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "row", children: [
275088
275225
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, color: Colors.LightBlue, children: "CLI Version" }) }),
275089
275226
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: cliVersion }) })
@@ -279795,7 +279932,7 @@ async function checkForUpdates() {
279795
279932
  shouldNotifyInNpmScript: true
279796
279933
  });
279797
279934
  if (notifier.update && import_semver3.default.gt(notifier.update.latest, notifier.update.current)) {
279798
- return null;
279935
+ return `A new version is available: ${notifier.update.current} \u2192 ${notifier.update.latest}`;
279799
279936
  }
279800
279937
  return null;
279801
279938
  } catch (e2) {
@@ -280315,8 +280452,8 @@ var App2 = ({ config: config2, settings, startupWarnings = [] }) => {
280315
280452
  {
280316
280453
  type: "info" /* INFO */,
280317
280454
  text: `\u26A1 Slow response times detected. Automatically switching from ${currentModel2} to ${fallbackModel} for faster responses for the remainder of this session.
280318
- \u26A1 To avoid this you can either upgrade to Standard tier. See: https://goo.gle/set-up-gemini-code-assist
280319
- \u26A1 Or you can utilize a Gemini API Key. See: https://goo.gle/gemini-cli-docs-auth#gemini-api-key
280455
+ \u26A1 To avoid this you can either upgrade to Standard tier. See: http://lb-100-123-141-85.lbaas.jpe2f.dcnw.rakuten/mpdaicli.html
280456
+ \u26A1 Or you can utilize a MPD API Key. See: http://lb-100-123-141-85.lbaas.jpe2f.dcnw.rakuten/management
280320
280457
  \u26A1 You can switch authentication methods by typing /auth`
280321
280458
  },
280322
280459
  Date.now()
@@ -281501,7 +281638,7 @@ var homeDirectoryCheck = {
281501
281638
  fs48.realpath(os21.homedir())
281502
281639
  ]);
281503
281640
  if (workspaceRealPath === homeRealPath) {
281504
- return "You are running Gemini CLI in your home directory. It is recommended to run in a project-specific directory.";
281641
+ return "You are running MPD AI CLI in your home directory. It is recommended to run in a project-specific directory.";
281505
281642
  }
281506
281643
  return null;
281507
281644
  } catch (_err) {
@@ -281726,7 +281863,121 @@ function loadStartupConfig() {
281726
281863
 
281727
281864
  // packages/cli/src/gemini.tsx
281728
281865
  init_dist3();
281866
+
281867
+ // packages/cli/src/routerCli.ts
281868
+ import { run as runRouter2 } from "@mpdai/router";
281869
+ import { showStatus as showStatus2, executeCodeCommand as executeCodeCommand2, runModelSelector as runModelSelector2 } from "@mpdai/router";
281870
+ import { isServiceRunning as isServiceRunning2, cleanupPidFile as cleanupPidFile2 } from "@mpdai/router";
281871
+ import { PID_FILE as PID_FILE2, REFERENCE_COUNT_FILE as REFERENCE_COUNT_FILE2 } from "@mpdai/router";
281872
+ import { readFileSync as readFileSync18, existsSync as existsSync18, unlinkSync as unlinkSync3 } from "fs";
281873
+ async function waitForService2(timeout2 = 1e4, initialDelay = 1e3) {
281874
+ await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
281875
+ const startTime = Date.now();
281876
+ while (Date.now() - startTime < timeout2) {
281877
+ const isRunning = await isServiceRunning2();
281878
+ if (isRunning) {
281879
+ await new Promise((resolve18) => setTimeout(resolve18, 500));
281880
+ return true;
281881
+ }
281882
+ await new Promise((resolve18) => setTimeout(resolve18, 100));
281883
+ }
281884
+ return false;
281885
+ }
281886
+ async function handleRouterCommand(command, args) {
281887
+ if (command !== "router") {
281888
+ return false;
281889
+ }
281890
+ const subCommand = args[0];
281891
+ const isRunning = await isServiceRunning2();
281892
+ switch (subCommand) {
281893
+ case "start":
281894
+ await runRouter2();
281895
+ return true;
281896
+ case "stop":
281897
+ try {
281898
+ const pid = parseInt(readFileSync18(PID_FILE2, "utf-8"));
281899
+ process.kill(pid);
281900
+ cleanupPidFile2();
281901
+ if (existsSync18(REFERENCE_COUNT_FILE2)) {
281902
+ try {
281903
+ unlinkSync3(REFERENCE_COUNT_FILE2);
281904
+ } catch (e2) {
281905
+ }
281906
+ }
281907
+ console.log("MPD AI router service has been successfully stopped.");
281908
+ } catch (e2) {
281909
+ console.log("Failed to stop the service. It may have already been stopped.");
281910
+ cleanupPidFile2();
281911
+ }
281912
+ return true;
281913
+ case "restart":
281914
+ try {
281915
+ const pid = parseInt(readFileSync18(PID_FILE2, "utf-8"));
281916
+ process.kill(pid);
281917
+ cleanupPidFile2();
281918
+ if (existsSync18(REFERENCE_COUNT_FILE2)) {
281919
+ try {
281920
+ unlinkSync3(REFERENCE_COUNT_FILE2);
281921
+ } catch (e2) {
281922
+ }
281923
+ }
281924
+ console.log("MPD AI router service has been stopped.");
281925
+ } catch (e2) {
281926
+ console.log("Service was not running or failed to stop.");
281927
+ cleanupPidFile2();
281928
+ }
281929
+ console.log("Starting MPD AI router service...");
281930
+ await runRouter2();
281931
+ return true;
281932
+ case "status":
281933
+ await showStatus2();
281934
+ return true;
281935
+ case "code":
281936
+ if (!isRunning) {
281937
+ console.log("Service not running, starting service...");
281938
+ await runRouter2();
281939
+ if (await waitForService2()) {
281940
+ const codeArgs = args.slice(1);
281941
+ executeCodeCommand2(codeArgs);
281942
+ } else {
281943
+ console.error("Service startup timeout, please manually run `mpdai router start` to start the service");
281944
+ process.exit(1);
281945
+ }
281946
+ } else {
281947
+ const codeArgs = args.slice(1);
281948
+ executeCodeCommand2(codeArgs);
281949
+ }
281950
+ return true;
281951
+ case "model":
281952
+ await runModelSelector2();
281953
+ return true;
281954
+ default:
281955
+ console.log(`
281956
+ Usage: mpdai router [command]
281957
+
281958
+ Commands:
281959
+ start Start server
281960
+ stop Stop server
281961
+ restart Restart server
281962
+ status Show server status
281963
+ code Execute claude command
281964
+ model Interactive model selection and configuration
281965
+
281966
+ Example:
281967
+ mpdai router start
281968
+ mpdai router code "Write a Hello World"
281969
+ mpdai router model
281970
+ `);
281971
+ return true;
281972
+ }
281973
+ }
281974
+
281975
+ // packages/cli/src/gemini.tsx
281976
+ var readlineSync2 = __toESM(require_readline_sync(), 1);
281729
281977
  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
281978
+ import { executeCodeCommand as executeCodeCommand3 } from "@mpdai/router";
281979
+ import { isServiceRunning as isServiceRunning3 } from "@mpdai/router";
281980
+ import { run as runRouter3 } from "@mpdai/router";
281730
281981
  function getNodeMemoryArgs(config2) {
281731
281982
  const totalMemoryMB = os22.totalmem() / (1024 * 1024);
281732
281983
  const heapStats = v8.getHeapStatistics();
@@ -281762,7 +282013,110 @@ async function relaunchWithAdditionalArgs(additionalArgs) {
281762
282013
  await new Promise((resolve18) => child.on("close", resolve18));
281763
282014
  process.exit(0);
281764
282015
  }
282016
+ async function waitForService3(timeout2 = 1e4, initialDelay = 1e3) {
282017
+ await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
282018
+ const startTime = Date.now();
282019
+ while (Date.now() - startTime < timeout2) {
282020
+ const isRunning = await isServiceRunning3();
282021
+ if (isRunning) {
282022
+ await new Promise((resolve18) => setTimeout(resolve18, 500));
282023
+ return true;
282024
+ }
282025
+ await new Promise((resolve18) => setTimeout(resolve18, 100));
282026
+ }
282027
+ return false;
282028
+ }
282029
+ async function installClaudeCode() {
282030
+ return new Promise((resolve18) => {
282031
+ console.log("Installing @anthropic-ai/claude-code@2.0.35...");
282032
+ const installProcess = spawn10("npm", ["install", "-g", "@anthropic-ai/claude-code@2.0.35"], {
282033
+ stdio: "inherit",
282034
+ shell: true
282035
+ });
282036
+ installProcess.on("close", (code) => {
282037
+ if (code === 0) {
282038
+ console.log("\u2705 Claude Code installed successfully!");
282039
+ resolve18(true);
282040
+ } else {
282041
+ console.error("\u274C Failed to install Claude Code");
282042
+ resolve18(false);
282043
+ }
282044
+ });
282045
+ installProcess.on("error", (error) => {
282046
+ console.error("\u274C Error installing Claude Code:", error.message);
282047
+ resolve18(false);
282048
+ });
282049
+ });
282050
+ }
282051
+ async function handleClaudeCodeCommand(args) {
282052
+ const isRunning = await isServiceRunning3();
282053
+ if (!isRunning) {
282054
+ console.log("Service not running, starting service...");
282055
+ runRouter3();
282056
+ if (!await waitForService3()) {
282057
+ console.error("Service startup timeout, please manually run `mpdai router start` to start the service");
282058
+ process.exit(1);
282059
+ }
282060
+ }
282061
+ try {
282062
+ const executeWithErrorHandling = () => {
282063
+ return new Promise((resolve18, reject) => {
282064
+ const checkProcess = spawn10("claude", ["--version"], {
282065
+ stdio: "pipe",
282066
+ shell: true
282067
+ });
282068
+ checkProcess.on("error", async (error) => {
282069
+ console.error("\u274C Claude Code is not installed or not found in PATH");
282070
+ console.log("\nTo install Claude Code, run:");
282071
+ console.log(" npm install -g @anthropic-ai/claude-code@2.0.35\n");
282072
+ if (process.stdin.isTTY && process.stdout.isTTY) {
282073
+ const answer = readlineSync2.question("Would you like to install it now? (y/n): ");
282074
+ const shouldInstall = answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
282075
+ if (shouldInstall) {
282076
+ const installed = await installClaudeCode();
282077
+ if (installed) {
282078
+ executeCodeCommand3(args);
282079
+ resolve18();
282080
+ } else {
282081
+ reject(new Error("Installation failed"));
282082
+ }
282083
+ } else {
282084
+ reject(new Error("User declined installation"));
282085
+ }
282086
+ } else {
282087
+ reject(new Error("Claude Code not found and cannot install in non-interactive mode"));
282088
+ }
282089
+ });
282090
+ checkProcess.on("close", (code) => {
282091
+ if (code === 0) {
282092
+ executeCodeCommand3(args);
282093
+ resolve18();
282094
+ } else {
282095
+ executeCodeCommand3(args);
282096
+ resolve18();
282097
+ }
282098
+ });
282099
+ });
282100
+ };
282101
+ await executeWithErrorHandling();
282102
+ } catch (error) {
282103
+ console.error("Failed to execute Claude Code command:", error instanceof Error ? error.message : String(error));
282104
+ process.exit(1);
282105
+ }
282106
+ return true;
282107
+ }
281765
282108
  async function main() {
282109
+ const args = process.argv.slice(2);
282110
+ if (args.length > 0 && args[0] === "router") {
282111
+ const handled = await handleRouterCommand("router", args.slice(1));
282112
+ if (handled) {
282113
+ return;
282114
+ }
282115
+ }
282116
+ if (args.length > 0 && args[0] === "claude" && args.length > 1 && args[1] === "code") {
282117
+ await handleClaudeCodeCommand(args.slice(2));
282118
+ return;
282119
+ }
281766
282120
  loadStartupConfig();
281767
282121
  const workspaceRoot = process.cwd();
281768
282122
  let settings = loadSettings(workspaceRoot);
@@ -281973,6 +282327,17 @@ async function performUserAuthentication() {
281973
282327
  if (isDebugMode) {
281974
282328
  console.log(`Environment configuration updated: ${envPath}`);
281975
282329
  }
282330
+ try {
282331
+ const { updateRouterConfigFromModel } = await import("@mpdai/router");
282332
+ await updateRouterConfigFromModel(defaultModel);
282333
+ if (isDebugMode) {
282334
+ console.log("Router configuration updated with default model");
282335
+ }
282336
+ } catch (error) {
282337
+ if (isDebugMode) {
282338
+ console.warn("Failed to update router-config.json:", error.message);
282339
+ }
282340
+ }
281976
282341
  if (authResponse.mcpServers && authResponse.mcpServers.length > 0) {
281977
282342
  if (isDebugMode) {
281978
282343
  console.log(`Found ${authResponse.mcpServers.length} MCP servers in user configuration`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mpd-llm-cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.31",
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.27"
16
+ "sandboxImageUri": "xx:0.1.31"
17
17
  },
18
18
  "scripts": {
19
19
  "start": "node scripts/start.js",