mpd-llm-cli 0.1.13 → 0.1.15
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.cjs +4 -1
- package/bundle/api.js +6 -3
- package/bundle/gemini.js +88 -38
- package/package.json +2 -2
package/bundle/api.cjs
CHANGED
|
@@ -164234,7 +164234,10 @@ var Config = class {
|
|
|
164234
164234
|
if (this.getUsageStatisticsEnabled()) {
|
|
164235
164235
|
ClearcutLogger.getInstance(this)?.logStartSessionEvent(new StartSessionEvent(this));
|
|
164236
164236
|
} else {
|
|
164237
|
-
|
|
164237
|
+
const isDebugMode = import_node_process8.default.env.DEBUG === "true" || import_node_process8.default.env.DEBUG_MODE === "true" || import_node_process8.default.env.dev === "true";
|
|
164238
|
+
if (isDebugMode) {
|
|
164239
|
+
console.log("Data collection is disabled.");
|
|
164240
|
+
}
|
|
164238
164241
|
}
|
|
164239
164242
|
}
|
|
164240
164243
|
async initialize() {
|
package/bundle/api.js
CHANGED
|
@@ -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.
|
|
27720
|
+
const version2 = "0.1.15";
|
|
27721
27721
|
const httpOptions = {
|
|
27722
27722
|
headers: {
|
|
27723
27723
|
"User-Agent": `GeminiCLI/${version2} (${process.platform}; ${process.arch})`
|
|
@@ -164230,7 +164230,10 @@ var Config = class {
|
|
|
164230
164230
|
if (this.getUsageStatisticsEnabled()) {
|
|
164231
164231
|
ClearcutLogger.getInstance(this)?.logStartSessionEvent(new StartSessionEvent(this));
|
|
164232
164232
|
} else {
|
|
164233
|
-
|
|
164233
|
+
const isDebugMode = process10.env.DEBUG === "true" || process10.env.DEBUG_MODE === "true" || process10.env.dev === "true";
|
|
164234
|
+
if (isDebugMode) {
|
|
164235
|
+
console.log("Data collection is disabled.");
|
|
164236
|
+
}
|
|
164234
164237
|
}
|
|
164235
164238
|
}
|
|
164236
164239
|
async initialize() {
|
|
@@ -165364,7 +165367,7 @@ async function getPackageJson() {
|
|
|
165364
165367
|
// packages/cli/src/utils/version.ts
|
|
165365
165368
|
async function getCliVersion() {
|
|
165366
165369
|
const pkgJson = await getPackageJson();
|
|
165367
|
-
return "0.1.
|
|
165370
|
+
return "0.1.15";
|
|
165368
165371
|
}
|
|
165369
165372
|
|
|
165370
165373
|
// packages/cli/src/config/sandboxConfig.ts
|
package/bundle/gemini.js
CHANGED
|
@@ -78252,7 +78252,7 @@ async function createContentGeneratorConfig(model, authType) {
|
|
|
78252
78252
|
return contentGeneratorConfig;
|
|
78253
78253
|
}
|
|
78254
78254
|
async function createContentGenerator(config2, sessionId2) {
|
|
78255
|
-
const version3 = "0.1.
|
|
78255
|
+
const version3 = "0.1.15";
|
|
78256
78256
|
const httpOptions = {
|
|
78257
78257
|
headers: {
|
|
78258
78258
|
"User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
|
|
@@ -237867,7 +237867,10 @@ var Config = class {
|
|
|
237867
237867
|
if (this.getUsageStatisticsEnabled()) {
|
|
237868
237868
|
ClearcutLogger.getInstance(this)?.logStartSessionEvent(new StartSessionEvent(this));
|
|
237869
237869
|
} else {
|
|
237870
|
-
|
|
237870
|
+
const isDebugMode = process21.env.DEBUG === "true" || process21.env.DEBUG_MODE === "true" || process21.env.dev === "true";
|
|
237871
|
+
if (isDebugMode) {
|
|
237872
|
+
console.log("Data collection is disabled.");
|
|
237873
|
+
}
|
|
237871
237874
|
}
|
|
237872
237875
|
}
|
|
237873
237876
|
async initialize() {
|
|
@@ -243944,7 +243947,7 @@ var LangfuseClient = class {
|
|
|
243944
243947
|
name: "MPD LLM CLI Session",
|
|
243945
243948
|
metadata: {
|
|
243946
243949
|
...safeMetadata,
|
|
243947
|
-
cli_version: this.safeString("0.1.
|
|
243950
|
+
cli_version: this.safeString("0.1.15", "unknown"),
|
|
243948
243951
|
model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
|
|
243949
243952
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
243950
243953
|
environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
|
|
@@ -244975,7 +244978,7 @@ var LangfuseIntegration = class {
|
|
|
244975
244978
|
const metadata = {
|
|
244976
244979
|
model: this.config.getModel(),
|
|
244977
244980
|
auth_type: this.config.getContentGeneratorConfig()?.authType,
|
|
244978
|
-
cli_version: "0.1.
|
|
244981
|
+
cli_version: "0.1.15",
|
|
244979
244982
|
start_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
244980
244983
|
session_id: this.sessionId
|
|
244981
244984
|
};
|
|
@@ -245045,7 +245048,7 @@ var LangfuseIntegration = class {
|
|
|
245045
245048
|
error,
|
|
245046
245049
|
metadata: {
|
|
245047
245050
|
session_id: this.sessionId,
|
|
245048
|
-
cli_version: "0.1.
|
|
245051
|
+
cli_version: "0.1.15",
|
|
245049
245052
|
auth_type: this.config.getContentGeneratorConfig()?.authType
|
|
245050
245053
|
}
|
|
245051
245054
|
});
|
|
@@ -248771,7 +248774,7 @@ import { promises as fs33 } from "fs";
|
|
|
248771
248774
|
import path37 from "path";
|
|
248772
248775
|
|
|
248773
248776
|
// packages/cli/src/generated/git-commit.ts
|
|
248774
|
-
var GIT_COMMIT_INFO = "
|
|
248777
|
+
var GIT_COMMIT_INFO = "127ecb1";
|
|
248775
248778
|
|
|
248776
248779
|
// node_modules/read-package-up/index.js
|
|
248777
248780
|
import path35 from "node:path";
|
|
@@ -248984,7 +248987,7 @@ async function getPackageJson() {
|
|
|
248984
248987
|
// packages/cli/src/utils/version.ts
|
|
248985
248988
|
async function getCliVersion() {
|
|
248986
248989
|
const pkgJson = await getPackageJson();
|
|
248987
|
-
return "0.1.
|
|
248990
|
+
return "0.1.15";
|
|
248988
248991
|
}
|
|
248989
248992
|
|
|
248990
248993
|
// packages/cli/src/ui/commands/memoryCommand.ts
|
|
@@ -270002,7 +270005,7 @@ var DataCollector = class {
|
|
|
270002
270005
|
// 提取元数据
|
|
270003
270006
|
extractMetadata(data) {
|
|
270004
270007
|
return {
|
|
270005
|
-
cli_version: "0.1.
|
|
270008
|
+
cli_version: "0.1.15",
|
|
270006
270009
|
model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
|
|
270007
270010
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
270008
270011
|
project_path: data.projectPath,
|
|
@@ -277316,8 +277319,11 @@ var AuthService = class {
|
|
|
277316
277319
|
* 调用认证接口获取用户数据
|
|
277317
277320
|
*/
|
|
277318
277321
|
async authenticate(credentials) {
|
|
277322
|
+
const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
|
|
277319
277323
|
try {
|
|
277320
|
-
|
|
277324
|
+
if (isDebugMode) {
|
|
277325
|
+
console.log(`Attempting to authenticate with API: ${this.authApiUrl}`);
|
|
277326
|
+
}
|
|
277321
277327
|
const response = await fetch(this.authApiUrl, {
|
|
277322
277328
|
method: "POST",
|
|
277323
277329
|
headers: {
|
|
@@ -277376,31 +277382,42 @@ var AuthService = class {
|
|
|
277376
277382
|
* 完整的认证流程
|
|
277377
277383
|
*/
|
|
277378
277384
|
async performAuthFlow() {
|
|
277385
|
+
const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
|
|
277379
277386
|
let credentials = this.getLocalCredentials();
|
|
277380
277387
|
if (!credentials) {
|
|
277381
|
-
|
|
277382
|
-
|
|
277383
|
-
|
|
277388
|
+
if (isDebugMode) {
|
|
277389
|
+
console.log("No local credentials found, prompting for user input...");
|
|
277390
|
+
console.log("stdin isTTY:", process.stdin.isTTY);
|
|
277391
|
+
console.log("stdout isTTY:", process.stdout.isTTY);
|
|
277392
|
+
}
|
|
277384
277393
|
const { createInterface: createInterface2 } = await import("readline");
|
|
277385
277394
|
const rl = createInterface2({
|
|
277386
277395
|
input: process.stdin,
|
|
277387
277396
|
output: process.stdout
|
|
277388
277397
|
});
|
|
277389
|
-
|
|
277398
|
+
if (isDebugMode) {
|
|
277399
|
+
console.log("Readline interface created, asking for username...");
|
|
277400
|
+
}
|
|
277390
277401
|
const username = await new Promise((resolve18) => {
|
|
277391
277402
|
rl.question("Enter your username: ", resolve18);
|
|
277392
277403
|
});
|
|
277393
|
-
|
|
277404
|
+
if (isDebugMode) {
|
|
277405
|
+
console.log("Username received, asking for password...");
|
|
277406
|
+
}
|
|
277394
277407
|
const password = await new Promise((resolve18) => {
|
|
277395
277408
|
rl.question("Enter your password: ", (answer) => {
|
|
277396
277409
|
rl.close();
|
|
277397
277410
|
resolve18(answer);
|
|
277398
277411
|
});
|
|
277399
277412
|
});
|
|
277400
|
-
|
|
277413
|
+
if (isDebugMode) {
|
|
277414
|
+
console.log("Credentials received, proceeding with authentication...");
|
|
277415
|
+
}
|
|
277401
277416
|
credentials = { username, password };
|
|
277402
277417
|
} else {
|
|
277403
|
-
|
|
277418
|
+
if (isDebugMode) {
|
|
277419
|
+
console.log("Found local credentials, using them for authentication...");
|
|
277420
|
+
}
|
|
277404
277421
|
}
|
|
277405
277422
|
const authResponse = await this.authenticate(credentials);
|
|
277406
277423
|
if (!this.hasLocalCredentials()) {
|
|
@@ -277575,14 +277592,21 @@ import { homedir as homedir14 } from "os";
|
|
|
277575
277592
|
function initializeLangfuseConfig() {
|
|
277576
277593
|
const langfuseDir = path52.join(homedir14(), ".gemini");
|
|
277577
277594
|
const settingsFile = path52.join(langfuseDir, "settings.conf");
|
|
277595
|
+
const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
|
|
277578
277596
|
try {
|
|
277579
277597
|
if (!fs50.existsSync(langfuseDir)) {
|
|
277580
|
-
|
|
277598
|
+
if (isDebugMode) {
|
|
277599
|
+
console.log("\u{1F4C1} Creating .gemini directory...");
|
|
277600
|
+
}
|
|
277581
277601
|
fs50.mkdirSync(langfuseDir, { recursive: true });
|
|
277582
|
-
|
|
277602
|
+
if (isDebugMode) {
|
|
277603
|
+
console.log("\u2705 .gemini directory created successfully");
|
|
277604
|
+
}
|
|
277583
277605
|
}
|
|
277584
277606
|
if (!fs50.existsSync(settingsFile)) {
|
|
277585
|
-
|
|
277607
|
+
if (isDebugMode) {
|
|
277608
|
+
console.log("\u{1F4DD} Creating .gemini/settings.conf...");
|
|
277609
|
+
}
|
|
277586
277610
|
const defaultSettings = {
|
|
277587
277611
|
"secretKey": "sk-lf-9da9fdd0-2198-41e6-a1fc-f1abeb08ddff",
|
|
277588
277612
|
"publicKey": "pk-lf-ed02072b-baec-48f8-a3c9-2914ea5d8ab3",
|
|
@@ -277591,27 +277615,36 @@ function initializeLangfuseConfig() {
|
|
|
277591
277615
|
"environment": "development"
|
|
277592
277616
|
};
|
|
277593
277617
|
fs50.writeFileSync(settingsFile, JSON.stringify(defaultSettings, null, 2));
|
|
277594
|
-
|
|
277618
|
+
if (isDebugMode) {
|
|
277619
|
+
console.log("\u2705 .gemini/settings.conf created successfully");
|
|
277620
|
+
}
|
|
277595
277621
|
} else {
|
|
277596
|
-
|
|
277622
|
+
if (isDebugMode) {
|
|
277623
|
+
console.log("\u2705 .gemini/settings.conf already exists");
|
|
277624
|
+
}
|
|
277597
277625
|
}
|
|
277598
277626
|
} catch (error) {
|
|
277599
277627
|
console.error("\u274C Failed to initialize Langfuse configuration:", error);
|
|
277600
277628
|
}
|
|
277601
277629
|
}
|
|
277602
277630
|
function loadStartupConfig() {
|
|
277603
|
-
|
|
277631
|
+
const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
|
|
277632
|
+
if (isDebugMode) {
|
|
277633
|
+
console.log("\u{1F527} Loading Mpdai configuration...");
|
|
277634
|
+
}
|
|
277604
277635
|
initializeLangfuseConfig();
|
|
277605
277636
|
try {
|
|
277606
277637
|
const configManager = MpdaiConfigManager.getInstance();
|
|
277607
277638
|
const config2 = configManager.loadConfig();
|
|
277608
277639
|
if (config2) {
|
|
277609
|
-
|
|
277610
|
-
|
|
277611
|
-
|
|
277612
|
-
|
|
277613
|
-
|
|
277614
|
-
|
|
277640
|
+
if (isDebugMode) {
|
|
277641
|
+
console.log("\u2705 Configuration loaded successfully:");
|
|
277642
|
+
console.log(` - API Base URL: ${config2.api.baseUrl}`);
|
|
277643
|
+
console.log(` - Auth Endpoint: ${config2.api.authEndpoint}`);
|
|
277644
|
+
console.log(` - MCP Endpoint: ${config2.api.mcpEndpoint}`);
|
|
277645
|
+
console.log(` - Timeout: ${config2.timeout}ms`);
|
|
277646
|
+
console.log(` - Environment: ${config2.environment}`);
|
|
277647
|
+
}
|
|
277615
277648
|
process.env.MPDAI_API_BASE_URL = config2.api.baseUrl;
|
|
277616
277649
|
process.env.MPDAI_AUTH_ENDPOINT = config2.api.authEndpoint;
|
|
277617
277650
|
process.env.MPDAI_MCP_ENDPOINT = config2.api.mcpEndpoint;
|
|
@@ -277619,7 +277652,9 @@ function loadStartupConfig() {
|
|
|
277619
277652
|
process.env.MPDAI_RETRY_ATTEMPTS = config2.retryAttempts.toString();
|
|
277620
277653
|
return config2;
|
|
277621
277654
|
} else {
|
|
277622
|
-
|
|
277655
|
+
if (isDebugMode) {
|
|
277656
|
+
console.log("\u26A0\uFE0F No configuration found, using defaults");
|
|
277657
|
+
}
|
|
277623
277658
|
return null;
|
|
277624
277659
|
}
|
|
277625
277660
|
} catch (error) {
|
|
@@ -277850,33 +277885,48 @@ async function validateNonInterActiveAuth(selectedAuthType, nonInteractiveConfig
|
|
|
277850
277885
|
return nonInteractiveConfig;
|
|
277851
277886
|
}
|
|
277852
277887
|
async function performUserAuthentication() {
|
|
277888
|
+
const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
|
|
277853
277889
|
if (process.env.SKIP_AUTH === "true") {
|
|
277854
|
-
|
|
277890
|
+
if (isDebugMode) {
|
|
277891
|
+
console.log("\u26A0\uFE0F Skipping authentication (test mode)");
|
|
277892
|
+
}
|
|
277855
277893
|
return;
|
|
277856
277894
|
}
|
|
277857
277895
|
try {
|
|
277858
277896
|
const authService = new AuthService();
|
|
277859
277897
|
const envConfigManager = new EnvConfigManager();
|
|
277860
|
-
|
|
277898
|
+
if (isDebugMode) {
|
|
277899
|
+
console.log("Starting user authentication...");
|
|
277900
|
+
}
|
|
277861
277901
|
const authResponse = await authService.performAuthFlow();
|
|
277862
277902
|
const defaultModel = authService.getDefaultModel(authResponse.models);
|
|
277863
277903
|
if (!defaultModel) {
|
|
277864
277904
|
throw new Error("No default model found in user configuration");
|
|
277865
277905
|
}
|
|
277866
|
-
|
|
277867
|
-
|
|
277906
|
+
if (isDebugMode) {
|
|
277907
|
+
console.log(`Authentication successful for user: ${authResponse.user.username}`);
|
|
277908
|
+
console.log(`Using default model: ${defaultModel.LLM_MODEL_NAME}`);
|
|
277909
|
+
}
|
|
277868
277910
|
const envPath = envConfigManager.updateEnvFile(defaultModel);
|
|
277869
|
-
|
|
277911
|
+
if (isDebugMode) {
|
|
277912
|
+
console.log(`Environment configuration updated: ${envPath}`);
|
|
277913
|
+
}
|
|
277870
277914
|
if (authResponse.mcpServers && authResponse.mcpServers.length > 0) {
|
|
277871
|
-
|
|
277915
|
+
if (isDebugMode) {
|
|
277916
|
+
console.log(`Found ${authResponse.mcpServers.length} MCP servers in user configuration`);
|
|
277917
|
+
}
|
|
277872
277918
|
const mcpServersConfig = authService.convertMcpServersToSettingsFormat(authResponse.mcpServers);
|
|
277873
277919
|
const workspaceRoot = process.cwd();
|
|
277874
277920
|
const settings = loadSettings(workspaceRoot);
|
|
277875
277921
|
settings.setValue("User" /* User */, "mcpServers", mcpServersConfig);
|
|
277876
|
-
|
|
277877
|
-
|
|
277922
|
+
if (isDebugMode) {
|
|
277923
|
+
console.log("MCP servers configuration updated in user settings");
|
|
277924
|
+
console.log("Configured MCP servers:", Object.keys(mcpServersConfig).join(", "));
|
|
277925
|
+
}
|
|
277878
277926
|
} else {
|
|
277879
|
-
|
|
277927
|
+
if (isDebugMode) {
|
|
277928
|
+
console.log("No MCP servers found in user configuration");
|
|
277929
|
+
}
|
|
277880
277930
|
}
|
|
277881
277931
|
const { config: config2 } = await Promise.resolve().then(() => __toESM(require_main(), 1));
|
|
277882
277932
|
config2({ path: envPath, override: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpd-llm-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "git+https://
|
|
13
|
+
"url": "git+https://git.rakuten-it.com/scm/mpd-ai/mpd-llm-cli.git"
|
|
14
14
|
},
|
|
15
15
|
"config": {
|
|
16
16
|
"sandboxImageUri": "xx:0.1.0"
|