@bonginkan/maria 4.2.4 → 4.2.5
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/dist/bin/maria.cjs +1042 -600
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +912 -476
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var path8 = require('path');
|
|
6
6
|
var dotenv = require('dotenv');
|
|
7
|
-
var
|
|
7
|
+
var chalk17 = require('chalk');
|
|
8
8
|
var os = require('os');
|
|
9
9
|
var fsp = require('fs/promises');
|
|
10
|
-
var
|
|
10
|
+
var crypto2 = require('crypto');
|
|
11
11
|
var http = require('http');
|
|
12
12
|
var url = require('url');
|
|
13
13
|
var open = require('open');
|
|
@@ -21,6 +21,8 @@ var zlib = require('zlib');
|
|
|
21
21
|
var secretManager = require('@google-cloud/secret-manager');
|
|
22
22
|
var readline = require('readline');
|
|
23
23
|
var zod = require('zod');
|
|
24
|
+
require('strip-ansi');
|
|
25
|
+
require('string-width');
|
|
24
26
|
var process$1 = require('process');
|
|
25
27
|
var ora = require('ora');
|
|
26
28
|
var perf_hooks = require('perf_hooks');
|
|
@@ -50,10 +52,10 @@ function _interopNamespace(e) {
|
|
|
50
52
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
51
53
|
var path8__namespace = /*#__PURE__*/_interopNamespace(path8);
|
|
52
54
|
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
53
|
-
var
|
|
55
|
+
var chalk17__default = /*#__PURE__*/_interopDefault(chalk17);
|
|
54
56
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
55
57
|
var fsp__namespace = /*#__PURE__*/_interopNamespace(fsp);
|
|
56
|
-
var
|
|
58
|
+
var crypto2__default = /*#__PURE__*/_interopDefault(crypto2);
|
|
57
59
|
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
58
60
|
var open__default = /*#__PURE__*/_interopDefault(open);
|
|
59
61
|
var Stream__default = /*#__PURE__*/_interopDefault(Stream);
|
|
@@ -250,7 +252,7 @@ var init_animations = __esm({
|
|
|
250
252
|
start() {
|
|
251
253
|
this.interval = setInterval(() => {
|
|
252
254
|
process.stdout.write(
|
|
253
|
-
`\r${
|
|
255
|
+
`\r${chalk17__default.default.cyan(this.frames[this.currentFrame])} ${chalk17__default.default.gray(this.message)}...`
|
|
254
256
|
);
|
|
255
257
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
256
258
|
}, 80);
|
|
@@ -288,7 +290,7 @@ var init_animations = __esm({
|
|
|
288
290
|
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
289
291
|
const stage = this.stages[this.currentStage];
|
|
290
292
|
process.stdout.write(
|
|
291
|
-
`\r${
|
|
293
|
+
`\r${chalk17__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage.icon} ${chalk17__default.default.gray(stage.message)}... ${chalk17__default.default.dim(`[${elapsed}s]`)}`
|
|
292
294
|
);
|
|
293
295
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
294
296
|
}, 80);
|
|
@@ -350,11 +352,11 @@ var init_animations = __esm({
|
|
|
350
352
|
const stage = stages[this.currentStage];
|
|
351
353
|
if (this.isComplex) {
|
|
352
354
|
process.stdout.write(
|
|
353
|
-
`\r${
|
|
355
|
+
`\r${chalk17__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage} ${chalk17__default.default.dim(`[${elapsed}s]`)}`
|
|
354
356
|
);
|
|
355
357
|
} else {
|
|
356
358
|
process.stdout.write(
|
|
357
|
-
`\r${
|
|
359
|
+
`\r${chalk17__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${chalk17__default.default.gray(stage)}...`
|
|
358
360
|
);
|
|
359
361
|
}
|
|
360
362
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
@@ -397,7 +399,7 @@ var init_animations = __esm({
|
|
|
397
399
|
start() {
|
|
398
400
|
this.interval = setInterval(() => {
|
|
399
401
|
process.stdout.write(
|
|
400
|
-
`\r${
|
|
402
|
+
`\r${chalk17__default.default.cyan(this.message)}${this.dots[this.currentDot]}`
|
|
401
403
|
);
|
|
402
404
|
this.currentDot = (this.currentDot + 1) % this.dots.length;
|
|
403
405
|
}, 300);
|
|
@@ -426,7 +428,7 @@ var init_animations = __esm({
|
|
|
426
428
|
const frame = this.frames[this.currentFrame];
|
|
427
429
|
const message = this.messages[this.currentFrame];
|
|
428
430
|
process.stdout.write(
|
|
429
|
-
`\r${frame} ${
|
|
431
|
+
`\r${frame} ${chalk17__default.default.cyan(message)}...`
|
|
430
432
|
);
|
|
431
433
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
432
434
|
}, 1e3);
|
|
@@ -454,7 +456,7 @@ var init_animations = __esm({
|
|
|
454
456
|
const percentage = Math.floor(this.current / this.total * 100);
|
|
455
457
|
const filled = Math.floor(this.current / this.total * this.width);
|
|
456
458
|
const empty = this.width - filled;
|
|
457
|
-
const bar =
|
|
459
|
+
const bar = chalk17__default.default.green("\u2588").repeat(filled) + chalk17__default.default.gray("\u2591").repeat(empty);
|
|
458
460
|
process.stdout.write(`\r${this.label}: [${bar}] ${percentage}%`);
|
|
459
461
|
if (this.current >= this.total) {
|
|
460
462
|
process.stdout.write("\n");
|
|
@@ -598,8 +600,8 @@ var init_TokenStorage = __esm({
|
|
|
598
600
|
async saveToFile(tokens) {
|
|
599
601
|
await fsp__namespace.default.mkdir(this.CONFIG_DIR, { recursive: true });
|
|
600
602
|
const key2 = await this.getEncryptionKey();
|
|
601
|
-
const iv =
|
|
602
|
-
const cipher =
|
|
603
|
+
const iv = crypto2__default.default.randomBytes(16);
|
|
604
|
+
const cipher = crypto2__default.default.createCipheriv("aes-256-gcm", key2, iv);
|
|
603
605
|
const tokenData = JSON.stringify(tokens);
|
|
604
606
|
let encrypted = cipher.update(tokenData, "utf8", "hex");
|
|
605
607
|
encrypted += cipher.final("hex");
|
|
@@ -641,7 +643,7 @@ var init_TokenStorage = __esm({
|
|
|
641
643
|
const key2 = await this.getEncryptionKey();
|
|
642
644
|
const iv = Buffer.from(fileData.iv, "hex");
|
|
643
645
|
const authTag = Buffer.from(fileData.authTag, "hex");
|
|
644
|
-
const decipher =
|
|
646
|
+
const decipher = crypto2__default.default.createDecipheriv("aes-256-gcm", key2, iv);
|
|
645
647
|
decipher.setAuthTag(authTag);
|
|
646
648
|
let decrypted = decipher.update(fileData.data, "hex", "utf8");
|
|
647
649
|
decrypted += decipher.final("utf8");
|
|
@@ -657,7 +659,7 @@ var init_TokenStorage = __esm({
|
|
|
657
659
|
try {
|
|
658
660
|
const key2 = await this.getEncryptionKey();
|
|
659
661
|
const keyBuffer = Buffer.from(key2.slice(0, 32));
|
|
660
|
-
const decipher =
|
|
662
|
+
const decipher = crypto2__default.default.createDecipheriv("aes-256-cbc", keyBuffer, Buffer.alloc(16, 0));
|
|
661
663
|
let decrypted = decipher.update(fileData.data, "hex", "utf8");
|
|
662
664
|
decrypted += decipher.final("utf8");
|
|
663
665
|
const tokens = JSON.parse(decrypted);
|
|
@@ -672,7 +674,7 @@ var init_TokenStorage = __esm({
|
|
|
672
674
|
*/
|
|
673
675
|
async getEncryptionKey() {
|
|
674
676
|
const machineId = `maria-cli:${os__namespace.default.hostname()}:${os__namespace.default.platform()}:${os__namespace.default.arch()}:${os__namespace.default.userInfo().username}`;
|
|
675
|
-
return
|
|
677
|
+
return crypto2__default.default.createHash("sha256").update(machineId).digest().slice(0, 32);
|
|
676
678
|
}
|
|
677
679
|
/**
|
|
678
680
|
* Check if secure storage is available
|
|
@@ -699,14 +701,33 @@ var init_AuthenticationManager = __esm({
|
|
|
699
701
|
// 2 minutes clock skew tolerance
|
|
700
702
|
constructor() {
|
|
701
703
|
this.tokenStorage = new TokenStorage();
|
|
702
|
-
this.authBase = process.env.MARIA_AUTH_BASE ||
|
|
703
|
-
|
|
704
|
-
this.authBase = "https://auth-server-1098737975582.us-central1.run.app";
|
|
705
|
-
console.debug("Using Cloud Run URL for auth (DNS pending for auth.maria-code.ai)");
|
|
706
|
-
}
|
|
707
|
-
this.apiBase = process.env.MARIA_API_BASE || "https://api.maria-code.ai";
|
|
704
|
+
this.authBase = process.env.MARIA_AUTH_BASE || this.getAuthBaseUrl();
|
|
705
|
+
this.apiBase = process.env.MARIA_API_BASE || this.getApiBaseUrl();
|
|
708
706
|
this.clientId = process.env.MARIA_CLIENT_ID || "maria-cli";
|
|
709
707
|
}
|
|
708
|
+
getAuthBaseUrl() {
|
|
709
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
710
|
+
console.debug("Using local auth server (development mode)");
|
|
711
|
+
return "http://localhost:3001";
|
|
712
|
+
}
|
|
713
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
714
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
715
|
+
console.debug("Attempting to use custom domain auth.maria-code.ai");
|
|
716
|
+
return "https://auth.maria-code.ai";
|
|
717
|
+
}
|
|
718
|
+
console.debug("Using Cloud Run URL for auth:", cloudRunUrl);
|
|
719
|
+
return cloudRunUrl;
|
|
720
|
+
}
|
|
721
|
+
getApiBaseUrl() {
|
|
722
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
723
|
+
return "http://localhost:3000/api";
|
|
724
|
+
}
|
|
725
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
726
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
727
|
+
return "https://api.maria-code.ai";
|
|
728
|
+
}
|
|
729
|
+
return cloudRunApiUrl;
|
|
730
|
+
}
|
|
710
731
|
/**
|
|
711
732
|
* Check if user is authenticated
|
|
712
733
|
*/
|
|
@@ -735,6 +756,27 @@ var init_AuthenticationManager = __esm({
|
|
|
735
756
|
* Get current authenticated user
|
|
736
757
|
*/
|
|
737
758
|
async getCurrentUser() {
|
|
759
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
760
|
+
const tokens2 = await this.tokenStorage.load();
|
|
761
|
+
if (!tokens2) {
|
|
762
|
+
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
763
|
+
}
|
|
764
|
+
return {
|
|
765
|
+
id: "local-dev-user",
|
|
766
|
+
email: "developer@localhost",
|
|
767
|
+
name: "Local Developer",
|
|
768
|
+
plan: "ultra",
|
|
769
|
+
usage: {
|
|
770
|
+
requests: Math.floor(Math.random() * 100),
|
|
771
|
+
// Random usage for testing
|
|
772
|
+
requestLimit: 999999,
|
|
773
|
+
requestsRemaining: 999999,
|
|
774
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
775
|
+
},
|
|
776
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
777
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
778
|
+
};
|
|
779
|
+
}
|
|
738
780
|
const tokens = await this.getValidTokens();
|
|
739
781
|
if (!tokens) {
|
|
740
782
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
@@ -772,6 +814,9 @@ var init_AuthenticationManager = __esm({
|
|
|
772
814
|
const user2 = await this.getCurrentUser();
|
|
773
815
|
return { success: true, user: user2 };
|
|
774
816
|
}
|
|
817
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
818
|
+
return await this.loginWithLocalMock();
|
|
819
|
+
}
|
|
775
820
|
let tokens;
|
|
776
821
|
if (options.device) {
|
|
777
822
|
tokens = await this.loginWithDeviceFlow();
|
|
@@ -779,6 +824,19 @@ var init_AuthenticationManager = __esm({
|
|
|
779
824
|
try {
|
|
780
825
|
tokens = await this.loginWithPKCEFlow();
|
|
781
826
|
} catch (error2) {
|
|
827
|
+
if (error2.message?.includes("ECONNREFUSED") || error2.message?.includes("fetch failed")) {
|
|
828
|
+
console.error("\n\u274C Authentication service is currently unavailable");
|
|
829
|
+
console.error("Please try one of the following:");
|
|
830
|
+
console.error("1. Set MARIA_AUTH_MODE=local for local development");
|
|
831
|
+
console.error("2. Check your internet connection");
|
|
832
|
+
console.error("3. Visit https://status.maria-code.ai for service status\n");
|
|
833
|
+
if (!process.env.MARIA_AUTH_MODE) {
|
|
834
|
+
console.log("\u{1F4A1} Tip: Run with local auth mode:");
|
|
835
|
+
console.log(" export MARIA_AUTH_MODE=local");
|
|
836
|
+
console.log(" maria /login\n");
|
|
837
|
+
}
|
|
838
|
+
throw new Error("Authentication service unavailable. See above for alternatives.");
|
|
839
|
+
}
|
|
782
840
|
console.warn("PKCE flow failed, falling back to device flow");
|
|
783
841
|
tokens = await this.loginWithDeviceFlow();
|
|
784
842
|
}
|
|
@@ -793,6 +851,43 @@ var init_AuthenticationManager = __esm({
|
|
|
793
851
|
};
|
|
794
852
|
}
|
|
795
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Local mock authentication for development
|
|
856
|
+
*/
|
|
857
|
+
async loginWithLocalMock() {
|
|
858
|
+
console.log("\u{1F510} Local Development Mode - Mock Authentication");
|
|
859
|
+
const mockTokens = {
|
|
860
|
+
idToken: "mock-id-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
861
|
+
accessToken: "mock-access-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
862
|
+
refreshToken: "mock-refresh-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
863
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1e3
|
|
864
|
+
// 24 hours
|
|
865
|
+
};
|
|
866
|
+
await this.tokenStorage.save(mockTokens);
|
|
867
|
+
const mockUser = {
|
|
868
|
+
id: "local-dev-user",
|
|
869
|
+
email: "developer@localhost",
|
|
870
|
+
name: "Local Developer",
|
|
871
|
+
plan: "ultra",
|
|
872
|
+
// Give full access in dev mode
|
|
873
|
+
usage: {
|
|
874
|
+
requests: 0,
|
|
875
|
+
requestLimit: 999999,
|
|
876
|
+
requestsRemaining: 999999,
|
|
877
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
878
|
+
},
|
|
879
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
880
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
881
|
+
};
|
|
882
|
+
console.log("\u2705 Logged in as developer@localhost (Local Mode)");
|
|
883
|
+
console.log(" Plan: Ultra (Development)");
|
|
884
|
+
console.log(" All features enabled for testing\n");
|
|
885
|
+
return {
|
|
886
|
+
success: true,
|
|
887
|
+
user: mockUser,
|
|
888
|
+
tokens: mockTokens
|
|
889
|
+
};
|
|
890
|
+
}
|
|
796
891
|
/**
|
|
797
892
|
* Logout and clean up
|
|
798
893
|
*/
|
|
@@ -954,9 +1049,9 @@ var init_AuthenticationManager = __esm({
|
|
|
954
1049
|
* Generate PKCE parameters
|
|
955
1050
|
*/
|
|
956
1051
|
generatePKCEParams() {
|
|
957
|
-
const codeVerifier =
|
|
958
|
-
const codeChallenge =
|
|
959
|
-
const state =
|
|
1052
|
+
const codeVerifier = crypto2__default.default.randomBytes(32).toString("base64url");
|
|
1053
|
+
const codeChallenge = crypto2__default.default.createHash("sha256").update(codeVerifier).digest("base64url");
|
|
1054
|
+
const state = crypto2__default.default.randomBytes(16).toString("hex");
|
|
960
1055
|
return { codeVerifier, codeChallenge, state };
|
|
961
1056
|
}
|
|
962
1057
|
/**
|
|
@@ -1119,7 +1214,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1119
1214
|
*/
|
|
1120
1215
|
secureCompare(a2, b) {
|
|
1121
1216
|
if (a2.length !== b.length) return false;
|
|
1122
|
-
return
|
|
1217
|
+
return crypto2__default.default.timingSafeEqual(Buffer.from(a2), Buffer.from(b));
|
|
1123
1218
|
}
|
|
1124
1219
|
/**
|
|
1125
1220
|
* HTML page for successful authentication
|
|
@@ -1198,7 +1293,7 @@ function withAuth(fn) {
|
|
|
1198
1293
|
try {
|
|
1199
1294
|
const tokens = await authManager.getValidTokens();
|
|
1200
1295
|
if (!tokens) {
|
|
1201
|
-
console.log(
|
|
1296
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1202
1297
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1203
1298
|
}
|
|
1204
1299
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -1207,28 +1302,28 @@ function withAuth(fn) {
|
|
|
1207
1302
|
return await fn(...args);
|
|
1208
1303
|
} catch (error2) {
|
|
1209
1304
|
if (error2.code === "AUTH_REQUIRED") {
|
|
1210
|
-
console.log(
|
|
1305
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1211
1306
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1212
1307
|
}
|
|
1213
1308
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
1214
|
-
console.log(
|
|
1309
|
+
console.log(chalk17__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
1215
1310
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
1216
1311
|
}
|
|
1217
1312
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
1218
|
-
console.log(
|
|
1313
|
+
console.log(chalk17__default.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
1219
1314
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
1220
1315
|
}
|
|
1221
1316
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
1222
|
-
console.log(
|
|
1317
|
+
console.log(chalk17__default.default.yellow("\u{1F512} Not available in current plan"));
|
|
1223
1318
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
1224
1319
|
}
|
|
1225
1320
|
if (error2.code === "RATE_LIMITED") {
|
|
1226
1321
|
const retryAfter = error2.retryAfter || 5;
|
|
1227
|
-
console.log(
|
|
1322
|
+
console.log(chalk17__default.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
1228
1323
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
1229
1324
|
}
|
|
1230
1325
|
if (error2.code === "NETWORK_ERROR") {
|
|
1231
|
-
console.log(
|
|
1326
|
+
console.log(chalk17__default.default.red("\u{1F310} Network error, check connection"));
|
|
1232
1327
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
1233
1328
|
}
|
|
1234
1329
|
throw error2;
|
|
@@ -1258,7 +1353,7 @@ var init_withAuth = __esm({
|
|
|
1258
1353
|
});
|
|
1259
1354
|
function rng() {
|
|
1260
1355
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
1261
|
-
|
|
1356
|
+
crypto2__default.default.randomFillSync(rnds8Pool);
|
|
1262
1357
|
poolPtr = 0;
|
|
1263
1358
|
}
|
|
1264
1359
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
@@ -1288,7 +1383,7 @@ var native_default;
|
|
|
1288
1383
|
var init_native = __esm({
|
|
1289
1384
|
"node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js"() {
|
|
1290
1385
|
native_default = {
|
|
1291
|
-
randomUUID:
|
|
1386
|
+
randomUUID: crypto2__default.default.randomUUID
|
|
1292
1387
|
};
|
|
1293
1388
|
}
|
|
1294
1389
|
});
|
|
@@ -12537,21 +12632,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
12537
12632
|
process.stdout.write("\x1B[s");
|
|
12538
12633
|
process.stdout.write("\n");
|
|
12539
12634
|
process.stdout.write(
|
|
12540
|
-
"\x1B[K" +
|
|
12635
|
+
"\x1B[K" + chalk17__default.default.white(
|
|
12541
12636
|
"\u250C\u2500 Suggestions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"
|
|
12542
12637
|
) + "\n"
|
|
12543
12638
|
);
|
|
12544
12639
|
this.suggestions.forEach((suggestion, index) => {
|
|
12545
12640
|
const isSelected = index === this.selectedIndex;
|
|
12546
|
-
const prefix = isSelected ?
|
|
12547
|
-
const nameStyle = isSelected ?
|
|
12641
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
12642
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse : (s2) => s2;
|
|
12548
12643
|
const displayName = suggestion.name.padEnd(20);
|
|
12549
12644
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
12550
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
12645
|
+
const line = `\u2502${prefix}${nameStyle(chalk17__default.default.white(displayName) + " " + chalk17__default.default.gray(displayDesc))} \u2502`;
|
|
12551
12646
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
12552
12647
|
});
|
|
12553
12648
|
process.stdout.write(
|
|
12554
|
-
"\x1B[K" +
|
|
12649
|
+
"\x1B[K" + chalk17__default.default.white(
|
|
12555
12650
|
"\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"
|
|
12556
12651
|
) + "\n"
|
|
12557
12652
|
);
|
|
@@ -12965,7 +13060,7 @@ var init_interactive_cli = __esm({
|
|
|
12965
13060
|
}
|
|
12966
13061
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
12967
13062
|
readline__namespace.clearLine(process.stdout, 0);
|
|
12968
|
-
const prompt =
|
|
13063
|
+
const prompt = chalk17__default.default.cyan("> ");
|
|
12969
13064
|
const displayInput = this.currentInput;
|
|
12970
13065
|
process.stdout.write(prompt + displayInput);
|
|
12971
13066
|
const promptLength = 2;
|
|
@@ -12985,9 +13080,9 @@ var init_interactive_cli = __esm({
|
|
|
12985
13080
|
readline__namespace.moveCursor(process.stdout, 0, 2);
|
|
12986
13081
|
this.suggestions.forEach((suggestion, index) => {
|
|
12987
13082
|
const isSelected = index === this.selectedIndex;
|
|
12988
|
-
const prefix = isSelected ?
|
|
12989
|
-
const nameStyle = isSelected ?
|
|
12990
|
-
const descStyle = isSelected ?
|
|
13083
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
13084
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse.white : chalk17__default.default.white;
|
|
13085
|
+
const descStyle = isSelected ? chalk17__default.default.inverse.gray : chalk17__default.default.gray;
|
|
12991
13086
|
const name2 = suggestion.name.padEnd(15);
|
|
12992
13087
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
12993
13088
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
@@ -13008,20 +13103,20 @@ var init_interactive_cli = __esm({
|
|
|
13008
13103
|
const promptLength = 2;
|
|
13009
13104
|
const savedX = this.cursorPosition + promptLength;
|
|
13010
13105
|
process.stdout.write("\n");
|
|
13011
|
-
process.stdout.write(
|
|
13106
|
+
process.stdout.write(chalk17__default.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
13012
13107
|
this.suggestions.forEach((suggestion, index) => {
|
|
13013
13108
|
const isSelected = index === this.selectedIndex;
|
|
13014
|
-
const prefix = isSelected ?
|
|
13015
|
-
const nameStyle = isSelected ?
|
|
13016
|
-
const descStyle = isSelected ?
|
|
13109
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
13110
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse.white : chalk17__default.default.white;
|
|
13111
|
+
const descStyle = isSelected ? chalk17__default.default.inverse.gray : chalk17__default.default.gray;
|
|
13017
13112
|
const name2 = suggestion.name.padEnd(15);
|
|
13018
13113
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
13019
13114
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
13020
13115
|
`);
|
|
13021
13116
|
});
|
|
13022
|
-
process.stdout.write(
|
|
13117
|
+
process.stdout.write(chalk17__default.default.white("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n"));
|
|
13023
13118
|
process.stdout.write(
|
|
13024
|
-
|
|
13119
|
+
chalk17__default.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
13025
13120
|
);
|
|
13026
13121
|
const totalLines = this.suggestions.length + 4;
|
|
13027
13122
|
readline__namespace.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -13121,27 +13216,27 @@ var init_logger = __esm({
|
|
|
13121
13216
|
}
|
|
13122
13217
|
debug(...args) {
|
|
13123
13218
|
if (this.level <= 0 /* DEBUG */) {
|
|
13124
|
-
console.log(
|
|
13219
|
+
console.log(chalk17__default.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
13125
13220
|
}
|
|
13126
13221
|
}
|
|
13127
13222
|
info(...args) {
|
|
13128
13223
|
if (this.level <= 1 /* INFO */) {
|
|
13129
|
-
console.log(
|
|
13224
|
+
console.log(chalk17__default.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
13130
13225
|
}
|
|
13131
13226
|
}
|
|
13132
13227
|
warn(...args) {
|
|
13133
13228
|
if (this.level <= 2 /* WARN */) {
|
|
13134
|
-
console.warn(
|
|
13229
|
+
console.warn(chalk17__default.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
13135
13230
|
}
|
|
13136
13231
|
}
|
|
13137
13232
|
error(...args) {
|
|
13138
13233
|
if (this.level <= 3 /* ERROR */) {
|
|
13139
|
-
console.error(
|
|
13234
|
+
console.error(chalk17__default.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
13140
13235
|
}
|
|
13141
13236
|
}
|
|
13142
13237
|
success(...args) {
|
|
13143
13238
|
if (this.level <= 1 /* INFO */) {
|
|
13144
|
-
console.log(
|
|
13239
|
+
console.log(chalk17__default.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
13145
13240
|
}
|
|
13146
13241
|
}
|
|
13147
13242
|
task(taskName, status, message) {
|
|
@@ -13155,10 +13250,10 @@ var init_logger = __esm({
|
|
|
13155
13250
|
error: "\u274C"
|
|
13156
13251
|
};
|
|
13157
13252
|
const statusColors = {
|
|
13158
|
-
start:
|
|
13159
|
-
progress:
|
|
13160
|
-
complete:
|
|
13161
|
-
error:
|
|
13253
|
+
start: chalk17__default.default.bold.magenta,
|
|
13254
|
+
progress: chalk17__default.default.magenta,
|
|
13255
|
+
complete: chalk17__default.default.bold.magenta,
|
|
13256
|
+
error: chalk17__default.default.bold.magenta
|
|
13162
13257
|
};
|
|
13163
13258
|
const icon = statusIcons[status];
|
|
13164
13259
|
const color = statusColors[status];
|
|
@@ -13175,14 +13270,14 @@ var init_logger = __esm({
|
|
|
13175
13270
|
if (this.level > 0 /* DEBUG */) {
|
|
13176
13271
|
return;
|
|
13177
13272
|
}
|
|
13178
|
-
console.log(
|
|
13273
|
+
console.log(chalk17__default.default.magenta(`${this.prefix} [JSON]`));
|
|
13179
13274
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
13180
13275
|
}
|
|
13181
13276
|
divider() {
|
|
13182
13277
|
if (this.level > 1 /* INFO */) {
|
|
13183
13278
|
return;
|
|
13184
13279
|
}
|
|
13185
|
-
console.log(
|
|
13280
|
+
console.log(chalk17__default.default.magenta("\u2500".repeat(60)));
|
|
13186
13281
|
}
|
|
13187
13282
|
clear() {
|
|
13188
13283
|
console.clear();
|
|
@@ -13202,7 +13297,7 @@ var init_logger = __esm({
|
|
|
13202
13297
|
const progressText = `${current}/${total}`;
|
|
13203
13298
|
const labelText = label ? ` ${label}` : "";
|
|
13204
13299
|
process.stdout.write(
|
|
13205
|
-
`\r${
|
|
13300
|
+
`\r${chalk17__default.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
13206
13301
|
);
|
|
13207
13302
|
if (current === total) {
|
|
13208
13303
|
process.stdout.write("\n");
|
|
@@ -13610,7 +13705,7 @@ var init_quick_persistence = __esm({
|
|
|
13610
13705
|
}
|
|
13611
13706
|
}
|
|
13612
13707
|
static hash(text) {
|
|
13613
|
-
return
|
|
13708
|
+
return crypto2.createHash("sha256").update(text).digest("hex");
|
|
13614
13709
|
}
|
|
13615
13710
|
static async save(mem) {
|
|
13616
13711
|
await this.init();
|
|
@@ -15877,9 +15972,9 @@ var init_HelpCommand = __esm({
|
|
|
15877
15972
|
const stats = await this.readyService.getStatistics();
|
|
15878
15973
|
const lines = [];
|
|
15879
15974
|
lines.push("\u2550".repeat(60));
|
|
15880
|
-
lines.push(
|
|
15975
|
+
lines.push(chalk17__default.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
15881
15976
|
lines.push("");
|
|
15882
|
-
lines.push(
|
|
15977
|
+
lines.push(chalk17__default.default.bold("Quick Access:"));
|
|
15883
15978
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
15884
15979
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
15885
15980
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -15894,7 +15989,7 @@ var init_HelpCommand = __esm({
|
|
|
15894
15989
|
}
|
|
15895
15990
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
15896
15991
|
for (const category of categories) {
|
|
15897
|
-
lines.push(
|
|
15992
|
+
lines.push(chalk17__default.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
15898
15993
|
const showCommands = category.commands.slice(0, 4);
|
|
15899
15994
|
for (const cmd of showCommands) {
|
|
15900
15995
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -15914,7 +16009,7 @@ var init_HelpCommand = __esm({
|
|
|
15914
16009
|
}
|
|
15915
16010
|
lines.push("");
|
|
15916
16011
|
}
|
|
15917
|
-
lines.push(
|
|
16012
|
+
lines.push(chalk17__default.default.bold("Pro Tips:"));
|
|
15918
16013
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
15919
16014
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
15920
16015
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -15953,33 +16048,33 @@ var init_HelpCommand = __esm({
|
|
|
15953
16048
|
formatCommandHelp(command) {
|
|
15954
16049
|
const lines = [];
|
|
15955
16050
|
lines.push("");
|
|
15956
|
-
lines.push(`\u{1F4D6} ${
|
|
16051
|
+
lines.push(`\u{1F4D6} ${chalk17__default.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
15957
16052
|
lines.push("\u2550".repeat(50));
|
|
15958
16053
|
lines.push("");
|
|
15959
|
-
lines.push(
|
|
16054
|
+
lines.push(chalk17__default.default.bold("\u2139\uFE0F Information:"));
|
|
15960
16055
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
15961
16056
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
15962
16057
|
if (command.aliases && command.aliases.length > 0) {
|
|
15963
16058
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
15964
16059
|
}
|
|
15965
16060
|
lines.push("");
|
|
15966
|
-
lines.push(
|
|
16061
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Usage:"));
|
|
15967
16062
|
lines.push(` ${command.usage}`);
|
|
15968
16063
|
lines.push("");
|
|
15969
|
-
lines.push(
|
|
16064
|
+
lines.push(chalk17__default.default.bold("\u{1F4CB} Contract Validation:"));
|
|
15970
16065
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
15971
16066
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15972
16067
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15973
16068
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15974
16069
|
lines.push("");
|
|
15975
16070
|
if (command.examples && command.examples.length > 0) {
|
|
15976
|
-
lines.push(
|
|
16071
|
+
lines.push(chalk17__default.default.bold("\u{1F4DD} Examples:"));
|
|
15977
16072
|
for (const example of command.examples) {
|
|
15978
16073
|
lines.push(` ${example}`);
|
|
15979
16074
|
}
|
|
15980
16075
|
lines.push("");
|
|
15981
16076
|
}
|
|
15982
|
-
lines.push(
|
|
16077
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Quick Tips:"));
|
|
15983
16078
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
15984
16079
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
15985
16080
|
if (command.category !== "core") {
|
|
@@ -16030,7 +16125,7 @@ var init_HelpCommand = __esm({
|
|
|
16030
16125
|
};
|
|
16031
16126
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
16032
16127
|
lines.push("");
|
|
16033
|
-
lines.push(`${emoji} ${
|
|
16128
|
+
lines.push(`${emoji} ${chalk17__default.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
16034
16129
|
lines.push("\u2550".repeat(50));
|
|
16035
16130
|
lines.push("");
|
|
16036
16131
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -16064,7 +16159,7 @@ var init_HelpCommand = __esm({
|
|
|
16064
16159
|
formatSearchResults(searchTerm, results) {
|
|
16065
16160
|
const lines = [];
|
|
16066
16161
|
lines.push("");
|
|
16067
|
-
lines.push(`\u{1F50D} ${
|
|
16162
|
+
lines.push(`\u{1F50D} ${chalk17__default.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
16068
16163
|
lines.push("\u2550".repeat(50));
|
|
16069
16164
|
lines.push("");
|
|
16070
16165
|
for (const result of results) {
|
|
@@ -16077,7 +16172,7 @@ var init_HelpCommand = __esm({
|
|
|
16077
16172
|
}
|
|
16078
16173
|
lines.push("");
|
|
16079
16174
|
}
|
|
16080
|
-
lines.push(
|
|
16175
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
16081
16176
|
lines.push("");
|
|
16082
16177
|
return lines.join("\n");
|
|
16083
16178
|
}
|
|
@@ -16088,38 +16183,38 @@ var init_HelpCommand = __esm({
|
|
|
16088
16183
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
16089
16184
|
const lines = [];
|
|
16090
16185
|
lines.push("");
|
|
16091
|
-
lines.push(`\u{1F680} ${
|
|
16186
|
+
lines.push(`\u{1F680} ${chalk17__default.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
16092
16187
|
lines.push("\u2550".repeat(50));
|
|
16093
16188
|
lines.push("");
|
|
16094
|
-
lines.push(
|
|
16189
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
16095
16190
|
lines.push("");
|
|
16096
|
-
lines.push(
|
|
16191
|
+
lines.push(chalk17__default.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
16097
16192
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
16098
16193
|
if (modelCmd) {
|
|
16099
16194
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
16100
16195
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
16101
16196
|
}
|
|
16102
16197
|
lines.push("");
|
|
16103
|
-
lines.push(
|
|
16198
|
+
lines.push(chalk17__default.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
16104
16199
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
16105
16200
|
if (statusCmd) {
|
|
16106
16201
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
16107
16202
|
lines.push(` Try: /status`);
|
|
16108
16203
|
}
|
|
16109
16204
|
lines.push("");
|
|
16110
|
-
lines.push(
|
|
16205
|
+
lines.push(chalk17__default.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
16111
16206
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
16112
16207
|
if (codeCmd) {
|
|
16113
16208
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
16114
16209
|
lines.push(` Try: /code create a hello world function`);
|
|
16115
16210
|
}
|
|
16116
16211
|
lines.push("");
|
|
16117
|
-
lines.push(
|
|
16212
|
+
lines.push(chalk17__default.default.bold("\u{1F527} Essential Commands:"));
|
|
16118
16213
|
for (const cmd of quickCommands) {
|
|
16119
16214
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
16120
16215
|
}
|
|
16121
16216
|
lines.push("");
|
|
16122
|
-
lines.push(
|
|
16217
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Next Steps:"));
|
|
16123
16218
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
16124
16219
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
16125
16220
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -16134,20 +16229,20 @@ var init_HelpCommand = __esm({
|
|
|
16134
16229
|
const categories = await this.readyService.getCategories();
|
|
16135
16230
|
const lines = [];
|
|
16136
16231
|
lines.push("");
|
|
16137
|
-
lines.push(`\u{1F4CA} ${
|
|
16232
|
+
lines.push(`\u{1F4CA} ${chalk17__default.default.bold("READY COMMANDS STATISTICS")}`);
|
|
16138
16233
|
lines.push("\u2550".repeat(40));
|
|
16139
16234
|
lines.push("");
|
|
16140
|
-
lines.push(
|
|
16235
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Overall:"));
|
|
16141
16236
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
16142
16237
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
16143
16238
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
16144
16239
|
lines.push("");
|
|
16145
|
-
lines.push(
|
|
16240
|
+
lines.push(chalk17__default.default.bold("\u26A1 Performance:"));
|
|
16146
16241
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
16147
16242
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
16148
16243
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
16149
16244
|
lines.push("");
|
|
16150
|
-
lines.push(
|
|
16245
|
+
lines.push(chalk17__default.default.bold("\u{1F4CB} By Category:"));
|
|
16151
16246
|
for (const category of categories) {
|
|
16152
16247
|
const avgTime = Math.round(
|
|
16153
16248
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -16155,7 +16250,7 @@ var init_HelpCommand = __esm({
|
|
|
16155
16250
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
16156
16251
|
}
|
|
16157
16252
|
lines.push("");
|
|
16158
|
-
lines.push(
|
|
16253
|
+
lines.push(chalk17__default.default.bold("\u2705 Contract Validation:"));
|
|
16159
16254
|
lines.push(" All commands tested for:");
|
|
16160
16255
|
lines.push(" \u2022 Basic execution without crashes");
|
|
16161
16256
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -16329,10 +16424,10 @@ var init_LoginCommand = __esm({
|
|
|
16329
16424
|
if (!authResult.success) {
|
|
16330
16425
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
16331
16426
|
}
|
|
16332
|
-
const
|
|
16333
|
-
const plan =
|
|
16334
|
-
const quotaLeft =
|
|
16335
|
-
const email =
|
|
16427
|
+
const userInfo2 = authResult.user;
|
|
16428
|
+
const plan = userInfo2?.plan || "Free";
|
|
16429
|
+
const quotaLeft = userInfo2?.usage?.requestsRemaining || 100;
|
|
16430
|
+
const email = userInfo2?.email || "user";
|
|
16336
16431
|
await trackCommand({
|
|
16337
16432
|
cmd: "login",
|
|
16338
16433
|
status: "success",
|
|
@@ -16849,8 +16944,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16849
16944
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16850
16945
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16851
16946
|
const _path = await importNodeBuiltin2("path");
|
|
16852
|
-
const
|
|
16853
|
-
const targetPath = configPath || _path.join(
|
|
16947
|
+
const os9 = await importNodeBuiltin2("os");
|
|
16948
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
16854
16949
|
try {
|
|
16855
16950
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
16856
16951
|
return JSON.parse(data2);
|
|
@@ -16868,8 +16963,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16868
16963
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16869
16964
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16870
16965
|
const _path = await importNodeBuiltin2("path");
|
|
16871
|
-
const
|
|
16872
|
-
const targetPath = configPath || _path.join(
|
|
16966
|
+
const os9 = await importNodeBuiltin2("os");
|
|
16967
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
16873
16968
|
try {
|
|
16874
16969
|
if (options?.backup) {
|
|
16875
16970
|
try {
|
|
@@ -17045,7 +17140,7 @@ var init_model_selector_ui = __esm({
|
|
|
17045
17140
|
output: process.stdout,
|
|
17046
17141
|
terminal: true
|
|
17047
17142
|
});
|
|
17048
|
-
console.log(
|
|
17143
|
+
console.log(chalk17__default.default.green(
|
|
17049
17144
|
"\u250C\u2500[ MODEL MATRIX ]\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"
|
|
17050
17145
|
));
|
|
17051
17146
|
process.stdout.write("\x1B7");
|
|
@@ -17113,14 +17208,14 @@ var init_model_selector_ui = __esm({
|
|
|
17113
17208
|
}
|
|
17114
17209
|
renderFromSavedPosition() {
|
|
17115
17210
|
if (this.isDestroyed) return;
|
|
17116
|
-
console.log(
|
|
17117
|
-
"\u2502 " +
|
|
17211
|
+
console.log(chalk17__default.default.green(
|
|
17212
|
+
"\u2502 " + chalk17__default.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
17118
17213
|
));
|
|
17119
17214
|
this.renderContent();
|
|
17120
17215
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
17121
17216
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
17122
|
-
console.log(
|
|
17123
|
-
console.log(
|
|
17217
|
+
console.log(chalk17__default.default.green("\u2502 ") + chalk17__default.default.dim.green(helpText.padEnd(76)) + chalk17__default.default.green(" \u2502"));
|
|
17218
|
+
console.log(chalk17__default.default.green(
|
|
17124
17219
|
"\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"
|
|
17125
17220
|
));
|
|
17126
17221
|
}
|
|
@@ -17161,19 +17256,19 @@ var init_model_selector_ui = __esm({
|
|
|
17161
17256
|
const item = displayItems[i2];
|
|
17162
17257
|
if (item.type === "group") {
|
|
17163
17258
|
console.log(
|
|
17164
|
-
|
|
17259
|
+
chalk17__default.default.green("\u2502") + chalk17__default.default.dim.green(" \u2501\u2501\u2501 ") + chalk17__default.default.greenBright(item.content.substring(2, item.content.indexOf(" \u2500"))) + chalk17__default.default.dim.green(" " + "\u2501".repeat(71 - item.content.indexOf(" \u2500"))) + chalk17__default.default.green("\u2502")
|
|
17165
17260
|
);
|
|
17166
17261
|
} else {
|
|
17167
17262
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
17168
|
-
const prefix = isSelected ?
|
|
17263
|
+
const prefix = isSelected ? chalk17__default.default.greenBright("\u25B6 ") : " ";
|
|
17169
17264
|
const modelText = item.content;
|
|
17170
17265
|
if (isSelected) {
|
|
17171
17266
|
console.log(
|
|
17172
|
-
|
|
17267
|
+
chalk17__default.default.green("\u2502") + prefix + chalk17__default.default.black.bgGreen(modelText.padEnd(75)) + chalk17__default.default.green("\u2502")
|
|
17173
17268
|
);
|
|
17174
17269
|
} else {
|
|
17175
17270
|
console.log(
|
|
17176
|
-
|
|
17271
|
+
chalk17__default.default.green("\u2502") + prefix + chalk17__default.default.green(modelText.substring(0, 75).padEnd(75)) + chalk17__default.default.green("\u2502")
|
|
17177
17272
|
);
|
|
17178
17273
|
}
|
|
17179
17274
|
}
|
|
@@ -19398,6 +19493,332 @@ var init_ConfigCommand = __esm({
|
|
|
19398
19493
|
};
|
|
19399
19494
|
}
|
|
19400
19495
|
});
|
|
19496
|
+
function getSafeTerminalWidth() {
|
|
19497
|
+
if (process.env.MARIA_FIXED_WIDTH) {
|
|
19498
|
+
const fixed = Number(process.env.MARIA_FIXED_WIDTH);
|
|
19499
|
+
if (Number.isFinite(fixed) && fixed > 0) {
|
|
19500
|
+
return fixed;
|
|
19501
|
+
}
|
|
19502
|
+
}
|
|
19503
|
+
const isTTY = process.stdout && process.stdout.isTTY;
|
|
19504
|
+
if (isTTY && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
|
|
19505
|
+
return process.stdout.columns;
|
|
19506
|
+
}
|
|
19507
|
+
const envColumns = Number(process.env.COLUMNS);
|
|
19508
|
+
if (Number.isFinite(envColumns) && envColumns > 0) {
|
|
19509
|
+
return envColumns;
|
|
19510
|
+
}
|
|
19511
|
+
if (process.platform === "win32") {
|
|
19512
|
+
try {
|
|
19513
|
+
const { execSync } = __require("child_process");
|
|
19514
|
+
const result = execSync('powershell -command "$host.UI.RawUI.WindowSize.Width"', {
|
|
19515
|
+
encoding: "utf8",
|
|
19516
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
19517
|
+
// Suppress stderr
|
|
19518
|
+
});
|
|
19519
|
+
const width = parseInt(result.trim());
|
|
19520
|
+
if (Number.isFinite(width) && width > 0) {
|
|
19521
|
+
return width;
|
|
19522
|
+
}
|
|
19523
|
+
} catch {
|
|
19524
|
+
}
|
|
19525
|
+
}
|
|
19526
|
+
return 80;
|
|
19527
|
+
}
|
|
19528
|
+
function getResponsiveWidth(config2) {
|
|
19529
|
+
if (process.env.MARIA_DISABLE_RESPONSIVE === "1") {
|
|
19530
|
+
return config2?.maxWidth || 120;
|
|
19531
|
+
}
|
|
19532
|
+
const terminalWidth = getSafeTerminalWidth();
|
|
19533
|
+
const marginLeft = config2?.marginLeft ?? 5;
|
|
19534
|
+
const marginRight = config2?.marginRight ?? 5;
|
|
19535
|
+
const minWidth = config2?.minWidth ?? 40;
|
|
19536
|
+
const maxWidth = config2?.maxWidth ?? 200;
|
|
19537
|
+
const availableWidth = terminalWidth - marginLeft - marginRight;
|
|
19538
|
+
return Math.max(minWidth, Math.min(availableWidth, maxWidth));
|
|
19539
|
+
}
|
|
19540
|
+
function disposeSharedLayoutManager() {
|
|
19541
|
+
if (sharedManager) {
|
|
19542
|
+
sharedManager.dispose();
|
|
19543
|
+
sharedManager = null;
|
|
19544
|
+
}
|
|
19545
|
+
}
|
|
19546
|
+
function isCI() {
|
|
19547
|
+
return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.JENKINS_HOME || process.env.TRAVIS || process.env.CIRCLECI || process.env.BUILDKITE || process.env.DRONE);
|
|
19548
|
+
}
|
|
19549
|
+
function autoConfigureForEnvironment() {
|
|
19550
|
+
if (isCI() || !process.stdout.isTTY) {
|
|
19551
|
+
if (!process.env.MARIA_FIXED_WIDTH) {
|
|
19552
|
+
process.env.MARIA_FIXED_WIDTH = "80";
|
|
19553
|
+
}
|
|
19554
|
+
}
|
|
19555
|
+
}
|
|
19556
|
+
var sharedManager;
|
|
19557
|
+
var init_responsive_width = __esm({
|
|
19558
|
+
"src/ui/integrated-cli/responsive-width.ts"() {
|
|
19559
|
+
sharedManager = null;
|
|
19560
|
+
autoConfigureForEnvironment();
|
|
19561
|
+
if (process.env.NODE_ENV !== "production") {
|
|
19562
|
+
process.on("exit", () => {
|
|
19563
|
+
disposeSharedLayoutManager();
|
|
19564
|
+
});
|
|
19565
|
+
}
|
|
19566
|
+
}
|
|
19567
|
+
});
|
|
19568
|
+
|
|
19569
|
+
// src/services/startup-display.ts
|
|
19570
|
+
var startup_display_exports = {};
|
|
19571
|
+
__export(startup_display_exports, {
|
|
19572
|
+
displayCompactLogo: () => displayCompactLogo,
|
|
19573
|
+
displayDashboardHeader: () => displayDashboardHeader,
|
|
19574
|
+
displayFinalStartupScreen: () => displayFinalStartupScreen,
|
|
19575
|
+
displayLogsBox: () => displayLogsBox,
|
|
19576
|
+
displayRoundedInputBox: () => displayRoundedInputBox,
|
|
19577
|
+
displaySpinner: () => displaySpinner,
|
|
19578
|
+
displayStartupLogo: () => displayStartupLogo
|
|
19579
|
+
});
|
|
19580
|
+
function displayStartupLogo() {
|
|
19581
|
+
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19582
|
+
console.log("");
|
|
19583
|
+
console.log(
|
|
19584
|
+
chalk17__default.default.magentaBright(
|
|
19585
|
+
"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"
|
|
19586
|
+
)
|
|
19587
|
+
);
|
|
19588
|
+
console.log(
|
|
19589
|
+
chalk17__default.default.magentaBright(
|
|
19590
|
+
"\u2551 \u2551"
|
|
19591
|
+
)
|
|
19592
|
+
);
|
|
19593
|
+
console.log(
|
|
19594
|
+
chalk17__default.default.magentaBright(
|
|
19595
|
+
"\u2551 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19596
|
+
)
|
|
19597
|
+
);
|
|
19598
|
+
console.log(
|
|
19599
|
+
chalk17__default.default.magentaBright(
|
|
19600
|
+
"\u2551 \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2551"
|
|
19601
|
+
)
|
|
19602
|
+
);
|
|
19603
|
+
console.log(
|
|
19604
|
+
chalk17__default.default.magentaBright(
|
|
19605
|
+
"\u2551 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2551"
|
|
19606
|
+
)
|
|
19607
|
+
);
|
|
19608
|
+
console.log(
|
|
19609
|
+
chalk17__default.default.magentaBright(
|
|
19610
|
+
"\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2551"
|
|
19611
|
+
)
|
|
19612
|
+
);
|
|
19613
|
+
console.log(
|
|
19614
|
+
chalk17__default.default.magentaBright(
|
|
19615
|
+
"\u2551 \u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2551"
|
|
19616
|
+
)
|
|
19617
|
+
);
|
|
19618
|
+
console.log(
|
|
19619
|
+
chalk17__default.default.magentaBright(
|
|
19620
|
+
"\u2551 \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u2551"
|
|
19621
|
+
)
|
|
19622
|
+
);
|
|
19623
|
+
console.log(
|
|
19624
|
+
chalk17__default.default.magentaBright(
|
|
19625
|
+
"\u2551 \u2551"
|
|
19626
|
+
)
|
|
19627
|
+
);
|
|
19628
|
+
console.log(
|
|
19629
|
+
chalk17__default.default.magentaBright(
|
|
19630
|
+
"\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19631
|
+
)
|
|
19632
|
+
);
|
|
19633
|
+
console.log(
|
|
19634
|
+
chalk17__default.default.magentaBright(
|
|
19635
|
+
"\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2551"
|
|
19636
|
+
)
|
|
19637
|
+
);
|
|
19638
|
+
console.log(
|
|
19639
|
+
chalk17__default.default.magentaBright(
|
|
19640
|
+
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19641
|
+
)
|
|
19642
|
+
);
|
|
19643
|
+
console.log(
|
|
19644
|
+
chalk17__default.default.magentaBright(
|
|
19645
|
+
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551"
|
|
19646
|
+
)
|
|
19647
|
+
);
|
|
19648
|
+
console.log(
|
|
19649
|
+
chalk17__default.default.magentaBright(
|
|
19650
|
+
"\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19651
|
+
)
|
|
19652
|
+
);
|
|
19653
|
+
console.log(
|
|
19654
|
+
chalk17__default.default.magentaBright(
|
|
19655
|
+
"\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551"
|
|
19656
|
+
)
|
|
19657
|
+
);
|
|
19658
|
+
console.log(
|
|
19659
|
+
chalk17__default.default.magentaBright(
|
|
19660
|
+
"\u2551 \u2551"
|
|
19661
|
+
)
|
|
19662
|
+
);
|
|
19663
|
+
console.log(
|
|
19664
|
+
chalk17__default.default.magentaBright(
|
|
19665
|
+
"\u2551 AI-Powered Development Platform \u2551"
|
|
19666
|
+
)
|
|
19667
|
+
);
|
|
19668
|
+
console.log(
|
|
19669
|
+
chalk17__default.default.magentaBright(
|
|
19670
|
+
"\u2551 (c) 2025 Bonginkan Inc. \u2551"
|
|
19671
|
+
)
|
|
19672
|
+
);
|
|
19673
|
+
console.log(
|
|
19674
|
+
chalk17__default.default.magentaBright(
|
|
19675
|
+
"\u2551 \u2551"
|
|
19676
|
+
)
|
|
19677
|
+
);
|
|
19678
|
+
console.log(
|
|
19679
|
+
chalk17__default.default.magentaBright(
|
|
19680
|
+
"\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"
|
|
19681
|
+
)
|
|
19682
|
+
);
|
|
19683
|
+
console.log("");
|
|
19684
|
+
console.log(
|
|
19685
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19686
|
+
);
|
|
19687
|
+
console.log(
|
|
19688
|
+
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19689
|
+
);
|
|
19690
|
+
console.log("");
|
|
19691
|
+
}
|
|
19692
|
+
function displayCompactLogo() {
|
|
19693
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
19694
|
+
console.log(
|
|
19695
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19696
|
+
);
|
|
19697
|
+
console.log(
|
|
19698
|
+
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19699
|
+
);
|
|
19700
|
+
console.log("");
|
|
19701
|
+
}
|
|
19702
|
+
function displayDashboardHeader() {
|
|
19703
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
19704
|
+
const version = chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`);
|
|
19705
|
+
const commands = chalk17__default.default.gray(" | /help /status /model");
|
|
19706
|
+
const providers = chalk17__default.default.gray(
|
|
19707
|
+
"Providers: 8/8 OK (openai, anthropic, google, groq, lmstudio, ollama, vllm)"
|
|
19708
|
+
);
|
|
19709
|
+
console.log(version + commands);
|
|
19710
|
+
console.log(providers);
|
|
19711
|
+
console.log("");
|
|
19712
|
+
}
|
|
19713
|
+
function displayLogsBox(logs) {
|
|
19714
|
+
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 120 });
|
|
19715
|
+
const borderColor = chalk17__default.default.white;
|
|
19716
|
+
const titleColor = chalk17__default.default.cyan;
|
|
19717
|
+
const topLeft = "\u250C";
|
|
19718
|
+
const topRight = "\u2510";
|
|
19719
|
+
const bottomLeft = "\u2514";
|
|
19720
|
+
const bottomRight = "\u2518";
|
|
19721
|
+
const horizontal = "\u2500";
|
|
19722
|
+
const vertical = "\u2502";
|
|
19723
|
+
const lines = [];
|
|
19724
|
+
const title = " Logs ";
|
|
19725
|
+
lines.push(
|
|
19726
|
+
borderColor(topLeft) + titleColor(title) + borderColor(horizontal.repeat(width - title.length - 2)) + borderColor(topRight)
|
|
19727
|
+
);
|
|
19728
|
+
logs.forEach((log) => {
|
|
19729
|
+
const contentWidth = width - 4;
|
|
19730
|
+
const truncatedLog = log.length > contentWidth ? log.substring(0, contentWidth - 3) + "..." : log;
|
|
19731
|
+
const padding = width - truncatedLog.length - 4;
|
|
19732
|
+
lines.push(
|
|
19733
|
+
borderColor(vertical) + " " + truncatedLog + " ".repeat(Math.max(0, padding)) + " " + borderColor(vertical)
|
|
19734
|
+
);
|
|
19735
|
+
});
|
|
19736
|
+
if (logs.length === 0) {
|
|
19737
|
+
lines.push(
|
|
19738
|
+
borderColor(vertical) + " ".repeat(width - 2) + borderColor(vertical)
|
|
19739
|
+
);
|
|
19740
|
+
}
|
|
19741
|
+
lines.push(
|
|
19742
|
+
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19743
|
+
);
|
|
19744
|
+
console.log(lines.join("\n"));
|
|
19745
|
+
}
|
|
19746
|
+
function displaySpinner(text = "Processing") {
|
|
19747
|
+
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
19748
|
+
const frame = spinnerFrames[Math.floor(Date.now() / 80) % spinnerFrames.length];
|
|
19749
|
+
process.stdout.write(`\r[${chalk17__default.default.cyan(frame)}] ${text}...`);
|
|
19750
|
+
}
|
|
19751
|
+
function getCurrentPath() {
|
|
19752
|
+
return process.cwd();
|
|
19753
|
+
}
|
|
19754
|
+
function getSystemInfo() {
|
|
19755
|
+
return {
|
|
19756
|
+
platform: os__namespace.platform(),
|
|
19757
|
+
hostname: os__namespace.hostname(),
|
|
19758
|
+
user: os__namespace.userInfo().username,
|
|
19759
|
+
cwd: getCurrentPath()
|
|
19760
|
+
};
|
|
19761
|
+
}
|
|
19762
|
+
async function displayFinalStartupScreen(_selectedProvider, _selectedModel) {
|
|
19763
|
+
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19764
|
+
const version = getVersion();
|
|
19765
|
+
const systemInfo = getSystemInfo();
|
|
19766
|
+
console.log(
|
|
19767
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${version}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19768
|
+
);
|
|
19769
|
+
const cwd = systemInfo.cwd.replace(os__namespace.homedir(), "~");
|
|
19770
|
+
console.log(chalk17__default.default.gray("cwd: ") + chalk17__default.default.white(cwd));
|
|
19771
|
+
try {
|
|
19772
|
+
const { authManager: authManager2 } = await import('../cli-auth/index.js').catch(() => ({ authManager: null }));
|
|
19773
|
+
if (authManager2 && await authManager2.isAuthenticated()) {
|
|
19774
|
+
try {
|
|
19775
|
+
const user = await authManager2.getCurrentUser();
|
|
19776
|
+
console.log(chalk17__default.default.green(`Signed in: ${user.email}`));
|
|
19777
|
+
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19778
|
+
} catch {
|
|
19779
|
+
console.log(chalk17__default.default.green("Signed in"));
|
|
19780
|
+
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19781
|
+
}
|
|
19782
|
+
} else {
|
|
19783
|
+
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19784
|
+
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19785
|
+
}
|
|
19786
|
+
} catch {
|
|
19787
|
+
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19788
|
+
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19789
|
+
}
|
|
19790
|
+
console.log("");
|
|
19791
|
+
}
|
|
19792
|
+
function displayRoundedInputBox() {
|
|
19793
|
+
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 90 });
|
|
19794
|
+
const borderColor = chalk17__default.default.white;
|
|
19795
|
+
const promptColor = chalk17__default.default.cyan;
|
|
19796
|
+
const topLeft = "\u256D";
|
|
19797
|
+
const topRight = "\u256E";
|
|
19798
|
+
const bottomLeft = "\u2570";
|
|
19799
|
+
const bottomRight = "\u256F";
|
|
19800
|
+
const horizontal = "\u2500";
|
|
19801
|
+
const vertical = "\u2502";
|
|
19802
|
+
const lines = [];
|
|
19803
|
+
lines.push(borderColor(topLeft + horizontal.repeat(width - 2) + topRight));
|
|
19804
|
+
const promptStr = promptColor("> ");
|
|
19805
|
+
const placeholder = chalk17__default.default.gray("");
|
|
19806
|
+
const inputLine = promptStr + placeholder;
|
|
19807
|
+
const padding = width - 4;
|
|
19808
|
+
lines.push(
|
|
19809
|
+
borderColor(vertical) + inputLine + " ".repeat(Math.max(0, padding)) + borderColor(vertical)
|
|
19810
|
+
);
|
|
19811
|
+
lines.push(
|
|
19812
|
+
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19813
|
+
);
|
|
19814
|
+
console.log(lines.join("\n"));
|
|
19815
|
+
}
|
|
19816
|
+
var init_startup_display = __esm({
|
|
19817
|
+
"src/services/startup-display.ts"() {
|
|
19818
|
+
init_responsive_width();
|
|
19819
|
+
init_version();
|
|
19820
|
+
}
|
|
19821
|
+
});
|
|
19401
19822
|
|
|
19402
19823
|
// src/services/llm-health-checker.ts
|
|
19403
19824
|
var llm_health_checker_exports = {};
|
|
@@ -19535,29 +19956,29 @@ var init_provider_selector = __esm({
|
|
|
19535
19956
|
const inquirer = await import('inquirer');
|
|
19536
19957
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
19537
19958
|
const providers = await this.getAvailableProviders();
|
|
19538
|
-
console.log(
|
|
19539
|
-
console.log(
|
|
19959
|
+
console.log(chalk17__default.default.cyan("\nAvailable AI Providers:"));
|
|
19960
|
+
console.log(chalk17__default.default.gray("\u2500".repeat(50)));
|
|
19540
19961
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
19541
19962
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
19542
19963
|
if (_cloudProviders.length > 0) {
|
|
19543
|
-
console.log(
|
|
19964
|
+
console.log(chalk17__default.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
19544
19965
|
_cloudProviders.forEach((p) => {
|
|
19545
19966
|
if (p.available) {
|
|
19546
19967
|
console.log(
|
|
19547
|
-
` ${
|
|
19968
|
+
` ${chalk17__default.default.green("*")} ${chalk17__default.default.white(p.name.split(" ")[0])}`
|
|
19548
19969
|
);
|
|
19549
19970
|
} else {
|
|
19550
|
-
console.log(` ${
|
|
19971
|
+
console.log(` ${chalk17__default.default.gray(p.name.split(" ")[0])}`);
|
|
19551
19972
|
}
|
|
19552
19973
|
});
|
|
19553
19974
|
}
|
|
19554
19975
|
if (_localProviders.length > 0) {
|
|
19555
|
-
console.log(
|
|
19976
|
+
console.log(chalk17__default.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
19556
19977
|
_localProviders.forEach((p) => {
|
|
19557
19978
|
if (p.available) {
|
|
19558
|
-
console.log(` ${
|
|
19979
|
+
console.log(` ${chalk17__default.default.green("*")} ${chalk17__default.default.white(p.name)}`);
|
|
19559
19980
|
} else {
|
|
19560
|
-
console.log(` ${
|
|
19981
|
+
console.log(` ${chalk17__default.default.green("*")} ${chalk17__default.default.gray(p.name)}`);
|
|
19561
19982
|
}
|
|
19562
19983
|
});
|
|
19563
19984
|
}
|
|
@@ -19572,20 +19993,20 @@ var init_provider_selector = __esm({
|
|
|
19572
19993
|
});
|
|
19573
19994
|
if (selectableProviders.length === 0) {
|
|
19574
19995
|
console.log(
|
|
19575
|
-
|
|
19996
|
+
chalk17__default.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
19576
19997
|
);
|
|
19577
|
-
console.log(
|
|
19998
|
+
console.log(chalk17__default.default.gray("\nTo use MARIA, you need to:"));
|
|
19578
19999
|
console.log(
|
|
19579
|
-
|
|
20000
|
+
chalk17__default.default.gray(
|
|
19580
20001
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
19581
20002
|
)
|
|
19582
20003
|
);
|
|
19583
|
-
console.log(
|
|
20004
|
+
console.log(chalk17__default.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
19584
20005
|
console.log(
|
|
19585
|
-
|
|
20006
|
+
chalk17__default.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
19586
20007
|
);
|
|
19587
|
-
console.log(
|
|
19588
|
-
console.log(
|
|
20008
|
+
console.log(chalk17__default.default.gray(" Example: maria setup-ollama"));
|
|
20009
|
+
console.log(chalk17__default.default.gray("\nFor more information, run: maria --help"));
|
|
19589
20010
|
process.exit(1);
|
|
19590
20011
|
}
|
|
19591
20012
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -19606,29 +20027,29 @@ var init_provider_selector = __esm({
|
|
|
19606
20027
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
19607
20028
|
if (provider && provider.type === "local" && !provider.available) {
|
|
19608
20029
|
console.log(
|
|
19609
|
-
|
|
20030
|
+
chalk17__default.default.yellow(`
|
|
19610
20031
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
19611
20032
|
);
|
|
19612
|
-
console.log(
|
|
20033
|
+
console.log(chalk17__default.default.gray(`
|
|
19613
20034
|
To use ${provider.name}, you need to:`));
|
|
19614
20035
|
if (selectedProvider === "ollama") {
|
|
19615
|
-
console.log(
|
|
19616
|
-
console.log(
|
|
19617
|
-
console.log(
|
|
20036
|
+
console.log(chalk17__default.default.gray("1. Install Ollama: brew install ollama"));
|
|
20037
|
+
console.log(chalk17__default.default.gray("2. Start Ollama: ollama serve"));
|
|
20038
|
+
console.log(chalk17__default.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
19618
20039
|
console.log(
|
|
19619
|
-
|
|
20040
|
+
chalk17__default.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
19620
20041
|
);
|
|
19621
20042
|
} else if (selectedProvider === "lmstudio") {
|
|
19622
20043
|
console.log(
|
|
19623
|
-
|
|
20044
|
+
chalk17__default.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
19624
20045
|
);
|
|
19625
|
-
console.log(
|
|
19626
|
-
console.log(
|
|
19627
|
-
console.log(
|
|
20046
|
+
console.log(chalk17__default.default.gray("2. Start LM Studio application"));
|
|
20047
|
+
console.log(chalk17__default.default.gray("3. Load a model in LM Studio"));
|
|
20048
|
+
console.log(chalk17__default.default.gray("4. Start the local server in LM Studio"));
|
|
19628
20049
|
} else if (selectedProvider === "vllm") {
|
|
19629
|
-
console.log(
|
|
19630
|
-
console.log(
|
|
19631
|
-
console.log(
|
|
20050
|
+
console.log(chalk17__default.default.gray("1. Install vLLM: pip install vllm"));
|
|
20051
|
+
console.log(chalk17__default.default.gray("2. Start vLLM server with a model"));
|
|
20052
|
+
console.log(chalk17__default.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
19632
20053
|
}
|
|
19633
20054
|
process.exit(1);
|
|
19634
20055
|
}
|
|
@@ -22883,7 +23304,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
22883
23304
|
this.emit("initialized");
|
|
22884
23305
|
} catch (_error) {
|
|
22885
23306
|
console._error(
|
|
22886
|
-
|
|
23307
|
+
chalk17__default.default.red("Failed to initialize Intelligent Router:"),
|
|
22887
23308
|
_error
|
|
22888
23309
|
);
|
|
22889
23310
|
throw _error;
|
|
@@ -22937,7 +23358,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
22937
23358
|
} catch (_error) {
|
|
22938
23359
|
this.metrics.failedRoutes++;
|
|
22939
23360
|
this.emit("route:_error", { input: input3, _error });
|
|
22940
|
-
console._error(
|
|
23361
|
+
console._error(chalk17__default.default.red("Routing _error:"), _error);
|
|
22941
23362
|
return null;
|
|
22942
23363
|
}
|
|
22943
23364
|
}
|
|
@@ -23620,28 +24041,28 @@ var init_ChalkAdapter = __esm({
|
|
|
23620
24041
|
spinnerId = 0;
|
|
23621
24042
|
async showWelcome() {
|
|
23622
24043
|
console.log(
|
|
23623
|
-
|
|
24044
|
+
chalk17__default.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
23624
24045
|
);
|
|
23625
|
-
console.log(
|
|
24046
|
+
console.log(chalk17__default.default.gray("Type /help for available commands\n"));
|
|
23626
24047
|
}
|
|
23627
24048
|
showGoodbye() {
|
|
23628
24049
|
this.stopAllSpinners();
|
|
23629
|
-
console.log(
|
|
24050
|
+
console.log(chalk17__default.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
23630
24051
|
}
|
|
23631
24052
|
async print(message) {
|
|
23632
24053
|
console.log(message);
|
|
23633
24054
|
}
|
|
23634
24055
|
error(message) {
|
|
23635
|
-
console.error(
|
|
24056
|
+
console.error(chalk17__default.default.red(`\u274C ${message}`));
|
|
23636
24057
|
}
|
|
23637
24058
|
success(message) {
|
|
23638
|
-
console.log(
|
|
24059
|
+
console.log(chalk17__default.default.green(`\u2705 ${message}`));
|
|
23639
24060
|
}
|
|
23640
24061
|
warning(message) {
|
|
23641
|
-
console.warn(
|
|
24062
|
+
console.warn(chalk17__default.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
23642
24063
|
}
|
|
23643
24064
|
info(message) {
|
|
23644
|
-
console.info(
|
|
24065
|
+
console.info(chalk17__default.default.blue(`\u2139\uFE0F ${message}`));
|
|
23645
24066
|
}
|
|
23646
24067
|
startSpinner(message) {
|
|
23647
24068
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -23691,12 +24112,12 @@ var init_ChalkAdapter = __esm({
|
|
|
23691
24112
|
* Format helpers for consistent styling
|
|
23692
24113
|
*/
|
|
23693
24114
|
static format = {
|
|
23694
|
-
command: (text) =>
|
|
23695
|
-
keyword: (text) =>
|
|
23696
|
-
value: (text) =>
|
|
23697
|
-
dim: (text) =>
|
|
23698
|
-
bold: (text) =>
|
|
23699
|
-
code: (text) =>
|
|
24115
|
+
command: (text) => chalk17__default.default.cyan(text),
|
|
24116
|
+
keyword: (text) => chalk17__default.default.magenta(text),
|
|
24117
|
+
value: (text) => chalk17__default.default.green(text),
|
|
24118
|
+
dim: (text) => chalk17__default.default.gray(text),
|
|
24119
|
+
bold: (text) => chalk17__default.default.bold(text),
|
|
24120
|
+
code: (text) => chalk17__default.default.bgGray.white(` ${text} `)
|
|
23700
24121
|
};
|
|
23701
24122
|
};
|
|
23702
24123
|
}
|
|
@@ -28846,26 +29267,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28846
29267
|
const _lang = options.language || "en";
|
|
28847
29268
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
28848
29269
|
console.log("");
|
|
28849
|
-
console.log(
|
|
29270
|
+
console.log(chalk17__default.default.gray("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
28850
29271
|
console.log(
|
|
28851
|
-
|
|
29272
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28852
29273
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
28853
|
-
) +
|
|
29274
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28854
29275
|
);
|
|
28855
|
-
console.log(
|
|
29276
|
+
console.log(chalk17__default.default.gray("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));
|
|
28856
29277
|
const _requestId = `AP-${(/* @__PURE__ */ new Date()).getFullYear()}-${String((/* @__PURE__ */ new Date()).getMonth() + 1).padStart(2, "0")}${String((/* @__PURE__ */ new Date()).getDate()).padStart(2, "0")}-${String(Math.floor(Math.random() * 999)).padStart(3, "0")}`;
|
|
28857
29278
|
console.log(
|
|
28858
|
-
|
|
28859
|
-
` > ${_labels.id}: ${
|
|
28860
|
-
) +
|
|
29279
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
29280
|
+
` > ${_labels.id}: ${chalk17__default.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
29281
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28861
29282
|
);
|
|
28862
29283
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
28863
29284
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
28864
29285
|
const _titleLabel = ` ${_labels._title}:`;
|
|
28865
29286
|
console.log(
|
|
28866
|
-
|
|
29287
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28867
29288
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
28868
|
-
) +
|
|
29289
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28869
29290
|
);
|
|
28870
29291
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
28871
29292
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -28873,37 +29294,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28873
29294
|
const _levelLabel = ` ${_labels.level}:`;
|
|
28874
29295
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
28875
29296
|
console.log(
|
|
28876
|
-
|
|
29297
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28877
29298
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
28878
|
-
) +
|
|
29299
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28879
29300
|
);
|
|
28880
29301
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
28881
29302
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
28882
29303
|
console.log(
|
|
28883
|
-
|
|
29304
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28884
29305
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
28885
|
-
) +
|
|
29306
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28886
29307
|
);
|
|
28887
29308
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
28888
29309
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
28889
29310
|
console.log(
|
|
28890
|
-
|
|
29311
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28891
29312
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
28892
|
-
) +
|
|
29313
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28893
29314
|
);
|
|
28894
29315
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
28895
29316
|
const _timeStr = `${_deadline.getFullYear()}-${String(_deadline.getMonth() + 1).padStart(2, "0")}-${String(_deadline.getDate()).padStart(2, "0")} ${String(_deadline.getHours()).padStart(2, "0")}:${String(_deadline.getMinutes()).padStart(2, "0")}`;
|
|
28896
29317
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
28897
29318
|
console.log(
|
|
28898
|
-
|
|
29319
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28899
29320
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
28900
|
-
) +
|
|
29321
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28901
29322
|
);
|
|
28902
|
-
console.log(
|
|
29323
|
+
console.log(chalk17__default.default.gray("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));
|
|
28903
29324
|
console.log(
|
|
28904
|
-
|
|
29325
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28905
29326
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
28906
|
-
) +
|
|
29327
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28907
29328
|
);
|
|
28908
29329
|
this.menuOptions.forEach((option, _index) => {
|
|
28909
29330
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -28914,32 +29335,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28914
29335
|
switch (option) {
|
|
28915
29336
|
case "approve":
|
|
28916
29337
|
label = _labels.approve;
|
|
28917
|
-
color =
|
|
29338
|
+
color = chalk17__default.default.green;
|
|
28918
29339
|
break;
|
|
28919
29340
|
case "reject":
|
|
28920
29341
|
label = _labels.reject;
|
|
28921
|
-
color =
|
|
29342
|
+
color = chalk17__default.default.red;
|
|
28922
29343
|
break;
|
|
28923
29344
|
case "cancel":
|
|
28924
29345
|
label = _labels.cancel;
|
|
28925
|
-
color =
|
|
29346
|
+
color = chalk17__default.default.yellow;
|
|
28926
29347
|
break;
|
|
28927
29348
|
}
|
|
28928
29349
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
28929
29350
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
28930
29351
|
console.log(
|
|
28931
|
-
|
|
29352
|
+
chalk17__default.default.gray("\u2502") + _colorFunc(
|
|
28932
29353
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
28933
|
-
) +
|
|
29354
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28934
29355
|
);
|
|
28935
29356
|
});
|
|
28936
|
-
console.log(
|
|
29357
|
+
console.log(chalk17__default.default.gray("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));
|
|
28937
29358
|
console.log(
|
|
28938
|
-
|
|
29359
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28939
29360
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
28940
|
-
) +
|
|
29361
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28941
29362
|
);
|
|
28942
|
-
console.log(
|
|
29363
|
+
console.log(chalk17__default.default.gray("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
28943
29364
|
console.log("");
|
|
28944
29365
|
}
|
|
28945
29366
|
/**
|
|
@@ -28955,13 +29376,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28955
29376
|
};
|
|
28956
29377
|
const _formatted = keyMap[_key] || _key;
|
|
28957
29378
|
const colorMap = {
|
|
28958
|
-
"shift+tab":
|
|
28959
|
-
"ctrl+y":
|
|
28960
|
-
"ctrl+n":
|
|
28961
|
-
"ctrl+t":
|
|
28962
|
-
"ctrl+r":
|
|
29379
|
+
"shift+tab": chalk17__default.default.bgGreen.black.bold,
|
|
29380
|
+
"ctrl+y": chalk17__default.default.bgBlue.white.bold,
|
|
29381
|
+
"ctrl+n": chalk17__default.default.bgRed.white.bold,
|
|
29382
|
+
"ctrl+t": chalk17__default.default.bgMagenta.white.bold,
|
|
29383
|
+
"ctrl+r": chalk17__default.default.bgYellow.black.bold
|
|
28963
29384
|
};
|
|
28964
|
-
const _colorFunc = colorMap[_key] ||
|
|
29385
|
+
const _colorFunc = colorMap[_key] || chalk17__default.default.bgCyan.black.bold;
|
|
28965
29386
|
return _colorFunc(` ${_formatted} `);
|
|
28966
29387
|
}
|
|
28967
29388
|
/**
|
|
@@ -28970,15 +29391,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28970
29391
|
formatRiskLevel(risk) {
|
|
28971
29392
|
switch (risk.toLowerCase()) {
|
|
28972
29393
|
case "critical":
|
|
28973
|
-
return
|
|
29394
|
+
return chalk17__default.default.red.bold("CRITICAL");
|
|
28974
29395
|
case "high":
|
|
28975
|
-
return
|
|
29396
|
+
return chalk17__default.default.red("HIGH");
|
|
28976
29397
|
case "medium":
|
|
28977
|
-
return
|
|
29398
|
+
return chalk17__default.default.yellow("MEDIUM");
|
|
28978
29399
|
case "low":
|
|
28979
|
-
return
|
|
29400
|
+
return chalk17__default.default.green("LOW");
|
|
28980
29401
|
default:
|
|
28981
|
-
return
|
|
29402
|
+
return chalk17__default.default.white(risk);
|
|
28982
29403
|
}
|
|
28983
29404
|
}
|
|
28984
29405
|
/**
|
|
@@ -29048,7 +29469,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29048
29469
|
}
|
|
29049
29470
|
if (_key === "") {
|
|
29050
29471
|
console.log(`
|
|
29051
|
-
${
|
|
29472
|
+
${chalk17__default.default.red("Approval cancelled by user")}`);
|
|
29052
29473
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
29053
29474
|
return;
|
|
29054
29475
|
}
|
|
@@ -29105,20 +29526,20 @@ ${chalk16__default.default.red("Approval cancelled by user")}`);
|
|
|
29105
29526
|
}
|
|
29106
29527
|
console.clear();
|
|
29107
29528
|
console.log(`
|
|
29108
|
-
${
|
|
29529
|
+
${chalk17__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29109
29530
|
console.log(
|
|
29110
|
-
|
|
29531
|
+
chalk17__default.default.bgGreen.black.bold("\u2502") + chalk17__default.default.bgGreen.black.bold(
|
|
29111
29532
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
29112
|
-
) +
|
|
29533
|
+
) + chalk17__default.default.bgGreen.black.bold("\u2502")
|
|
29113
29534
|
);
|
|
29114
|
-
console.log(
|
|
29535
|
+
console.log(chalk17__default.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
29115
29536
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
29116
29537
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
29117
29538
|
console.log(
|
|
29118
|
-
|
|
29539
|
+
chalk17__default.default.bgGreen.black.bold("\u2502") + chalk17__default.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + chalk17__default.default.bgGreen.black.bold("\u2502")
|
|
29119
29540
|
);
|
|
29120
|
-
console.log(
|
|
29121
|
-
console.log(
|
|
29541
|
+
console.log(chalk17__default.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29542
|
+
console.log(chalk17__default.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
29122
29543
|
try {
|
|
29123
29544
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
29124
29545
|
this.currentRequest.id,
|
|
@@ -29128,30 +29549,30 @@ ${chalk16__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u251
|
|
|
29128
29549
|
);
|
|
29129
29550
|
response.quickDecision = true;
|
|
29130
29551
|
console.log(`
|
|
29131
|
-
${
|
|
29552
|
+
${chalk17__default.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29132
29553
|
console.log(
|
|
29133
|
-
|
|
29554
|
+
chalk17__default.default.bgGreen.black("\u2502") + chalk17__default.default.bgGreen.black(
|
|
29134
29555
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
29135
|
-
) +
|
|
29556
|
+
) + chalk17__default.default.bgGreen.black("\u2502")
|
|
29136
29557
|
);
|
|
29137
|
-
console.log(
|
|
29558
|
+
console.log(chalk17__default.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29138
29559
|
if (_choice.trustLevel) {
|
|
29139
29560
|
console.log(
|
|
29140
|
-
|
|
29561
|
+
chalk17__default.default.blue(`
|
|
29141
29562
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
29142
29563
|
);
|
|
29143
29564
|
}
|
|
29144
29565
|
this.emit("approval-_response", _response);
|
|
29145
29566
|
} catch (_error) {
|
|
29146
29567
|
console.log(`
|
|
29147
|
-
${
|
|
29568
|
+
${chalk17__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29148
29569
|
console.log(
|
|
29149
|
-
|
|
29570
|
+
chalk17__default.default.bgRed.white.bold("\u2502") + chalk17__default.default.bgRed.white.bold(
|
|
29150
29571
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
29151
|
-
) +
|
|
29572
|
+
) + chalk17__default.default.bgRed.white.bold("\u2502")
|
|
29152
29573
|
);
|
|
29153
|
-
console.log(
|
|
29154
|
-
console._error(
|
|
29574
|
+
console.log(chalk17__default.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29575
|
+
console._error(chalk17__default.default.red("\nError details:"), _error);
|
|
29155
29576
|
this.emit("approval-_error", _error);
|
|
29156
29577
|
}
|
|
29157
29578
|
}
|
|
@@ -29165,7 +29586,7 @@ ${chalk16__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`
|
|
|
29165
29586
|
timeoutId = setTimeout(() => {
|
|
29166
29587
|
console.log(
|
|
29167
29588
|
`
|
|
29168
|
-
${
|
|
29589
|
+
${chalk17__default.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
29169
29590
|
);
|
|
29170
29591
|
this.handleTimeoutResponse(resolve);
|
|
29171
29592
|
}, timeout);
|
|
@@ -29209,7 +29630,7 @@ ${chalk16__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29209
29630
|
response.quickDecision = true;
|
|
29210
29631
|
resolve(_response);
|
|
29211
29632
|
} catch (_error) {
|
|
29212
|
-
console._error(
|
|
29633
|
+
console._error(chalk17__default.default.red("Error processing timeout approval:"), _error);
|
|
29213
29634
|
}
|
|
29214
29635
|
}
|
|
29215
29636
|
/**
|
|
@@ -29224,11 +29645,11 @@ ${chalk16__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29224
29645
|
);
|
|
29225
29646
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
29226
29647
|
console.log(
|
|
29227
|
-
|
|
29648
|
+
chalk17__default.default.blue(
|
|
29228
29649
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
29229
29650
|
)
|
|
29230
29651
|
);
|
|
29231
|
-
console.log(
|
|
29652
|
+
console.log(chalk17__default.default.gray(`Reason: ${event.reason}`));
|
|
29232
29653
|
});
|
|
29233
29654
|
}
|
|
29234
29655
|
/**
|
|
@@ -30012,22 +30433,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
30012
30433
|
}
|
|
30013
30434
|
function formatError(message, code) {
|
|
30014
30435
|
const prefix = "";
|
|
30015
|
-
return
|
|
30436
|
+
return chalk17__default.default.red(`\u274C ${prefix}${message}`);
|
|
30016
30437
|
}
|
|
30017
30438
|
function formatSuccess(message) {
|
|
30018
|
-
return
|
|
30439
|
+
return chalk17__default.default.green(`\u2705 ${message}`);
|
|
30019
30440
|
}
|
|
30020
30441
|
function formatWarning(message) {
|
|
30021
|
-
return
|
|
30442
|
+
return chalk17__default.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
30022
30443
|
}
|
|
30023
30444
|
function formatInfo(message) {
|
|
30024
|
-
return
|
|
30445
|
+
return chalk17__default.default.blue(`\u2139\uFE0F ${message}`);
|
|
30025
30446
|
}
|
|
30026
30447
|
function formatTable(headers, rows, options = {}) {
|
|
30027
30448
|
const {
|
|
30028
30449
|
columnWidths = headers.map(() => 20),
|
|
30029
30450
|
separator = " | ",
|
|
30030
|
-
headerColor =
|
|
30451
|
+
headerColor = chalk17__default.default.cyan.bold
|
|
30031
30452
|
} = options;
|
|
30032
30453
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
30033
30454
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -30039,8 +30460,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
30039
30460
|
function formatKeyValue(data2, options = {}) {
|
|
30040
30461
|
const {
|
|
30041
30462
|
keyWidth = 20,
|
|
30042
|
-
keyColor =
|
|
30043
|
-
valueColor =
|
|
30463
|
+
keyColor = chalk17__default.default.gray,
|
|
30464
|
+
valueColor = chalk17__default.default.white,
|
|
30044
30465
|
separator = ": "
|
|
30045
30466
|
} = options;
|
|
30046
30467
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -30090,7 +30511,7 @@ var init_DisplayManager = __esm({
|
|
|
30090
30511
|
theme: options.theme ?? "auto"
|
|
30091
30512
|
};
|
|
30092
30513
|
if (!this.options.enableColors) {
|
|
30093
|
-
|
|
30514
|
+
chalk17__default.default.level = 0;
|
|
30094
30515
|
}
|
|
30095
30516
|
this.setupCleanupHandlers();
|
|
30096
30517
|
}
|
|
@@ -30207,7 +30628,7 @@ var init_DisplayManager = __esm({
|
|
|
30207
30628
|
const {
|
|
30208
30629
|
padding = 1,
|
|
30209
30630
|
borderStyle = "single",
|
|
30210
|
-
borderColor =
|
|
30631
|
+
borderColor = chalk17__default.default.gray
|
|
30211
30632
|
} = options;
|
|
30212
30633
|
const lines = content.split("\n");
|
|
30213
30634
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -30265,7 +30686,7 @@ var init_DisplayManager = __esm({
|
|
|
30265
30686
|
*/
|
|
30266
30687
|
startSpinner(text) {
|
|
30267
30688
|
if (!this.options.enableAnimations) {
|
|
30268
|
-
this.writeLine(
|
|
30689
|
+
this.writeLine(chalk17__default.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
30269
30690
|
return "no-animation";
|
|
30270
30691
|
}
|
|
30271
30692
|
return this.spinnerManager.start({ text });
|
|
@@ -30369,11 +30790,11 @@ var init_StatusDisplay = __esm({
|
|
|
30369
30790
|
*/
|
|
30370
30791
|
static renderSystemStatus(status, detailed = false) {
|
|
30371
30792
|
const lines = [];
|
|
30372
|
-
lines.push(
|
|
30793
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F4CA} System Status"));
|
|
30373
30794
|
lines.push("");
|
|
30374
30795
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
30375
30796
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
30376
|
-
const statusColor = status.operational ?
|
|
30797
|
+
const statusColor = status.operational ? chalk17__default.default.green : chalk17__default.default.red;
|
|
30377
30798
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
30378
30799
|
lines.push(
|
|
30379
30800
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -30394,15 +30815,15 @@ var init_StatusDisplay = __esm({
|
|
|
30394
30815
|
if (status.errors > 0 || status.warnings > 0) {
|
|
30395
30816
|
lines.push("");
|
|
30396
30817
|
if (status.errors > 0) {
|
|
30397
|
-
lines.push(
|
|
30818
|
+
lines.push(chalk17__default.default.red(`\u274C Errors: ${status.errors}`));
|
|
30398
30819
|
}
|
|
30399
30820
|
if (status.warnings > 0) {
|
|
30400
|
-
lines.push(
|
|
30821
|
+
lines.push(chalk17__default.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
30401
30822
|
}
|
|
30402
30823
|
}
|
|
30403
30824
|
if (detailed) {
|
|
30404
30825
|
lines.push("");
|
|
30405
|
-
lines.push(
|
|
30826
|
+
lines.push(chalk17__default.default.gray("Detailed Information:"));
|
|
30406
30827
|
const details = formatKeyValue(
|
|
30407
30828
|
{
|
|
30408
30829
|
"Process ID": process.pid,
|
|
@@ -30412,8 +30833,8 @@ var init_StatusDisplay = __esm({
|
|
|
30412
30833
|
"Working Directory": process.cwd()
|
|
30413
30834
|
},
|
|
30414
30835
|
{
|
|
30415
|
-
keyColor:
|
|
30416
|
-
valueColor:
|
|
30836
|
+
keyColor: chalk17__default.default.gray,
|
|
30837
|
+
valueColor: chalk17__default.default.white
|
|
30417
30838
|
}
|
|
30418
30839
|
);
|
|
30419
30840
|
lines.push(details);
|
|
@@ -30427,9 +30848,9 @@ var init_StatusDisplay = __esm({
|
|
|
30427
30848
|
*/
|
|
30428
30849
|
static renderMemoryStatus(status) {
|
|
30429
30850
|
const lines = [];
|
|
30430
|
-
lines.push(
|
|
30851
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
30431
30852
|
lines.push("");
|
|
30432
|
-
lines.push(
|
|
30853
|
+
lines.push(chalk17__default.default.yellow("System 1 (Fast):"));
|
|
30433
30854
|
const s1NodeBar = formatProgressBar(
|
|
30434
30855
|
status.system1.nodes,
|
|
30435
30856
|
status.system1.maxNodes,
|
|
@@ -30447,7 +30868,7 @@ var init_StatusDisplay = __esm({
|
|
|
30447
30868
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
30448
30869
|
);
|
|
30449
30870
|
lines.push("");
|
|
30450
|
-
lines.push(
|
|
30871
|
+
lines.push(chalk17__default.default.blue("System 2 (Deep):"));
|
|
30451
30872
|
const s2TraceBar = formatProgressBar(
|
|
30452
30873
|
status.system2.traces,
|
|
30453
30874
|
status.system2.maxTraces,
|
|
@@ -30465,7 +30886,7 @@ var init_StatusDisplay = __esm({
|
|
|
30465
30886
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
30466
30887
|
);
|
|
30467
30888
|
lines.push("");
|
|
30468
|
-
lines.push(
|
|
30889
|
+
lines.push(chalk17__default.default.green("Total:"));
|
|
30469
30890
|
const totalBar = formatProgressBar(
|
|
30470
30891
|
status.total.tokens,
|
|
30471
30892
|
status.total.maxTokens,
|
|
@@ -30474,7 +30895,7 @@ var init_StatusDisplay = __esm({
|
|
|
30474
30895
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
30475
30896
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
30476
30897
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
30477
|
-
const usageColor = usage > 80 ?
|
|
30898
|
+
const usageColor = usage > 80 ? chalk17__default.default.red : usage > 60 ? chalk17__default.default.yellow : chalk17__default.default.green;
|
|
30478
30899
|
lines.push(
|
|
30479
30900
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
30480
30901
|
);
|
|
@@ -30487,9 +30908,9 @@ var init_StatusDisplay = __esm({
|
|
|
30487
30908
|
*/
|
|
30488
30909
|
static renderModelStatus(status) {
|
|
30489
30910
|
const lines = [];
|
|
30490
|
-
lines.push(
|
|
30911
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F916} Model Status"));
|
|
30491
30912
|
lines.push("");
|
|
30492
|
-
lines.push(
|
|
30913
|
+
lines.push(chalk17__default.default.green(`Current: ${chalk17__default.default.bold(status.current)}`));
|
|
30493
30914
|
lines.push("");
|
|
30494
30915
|
lines.push("Available Models:");
|
|
30495
30916
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -30501,7 +30922,7 @@ var init_StatusDisplay = __esm({
|
|
|
30501
30922
|
const table = formatTable(headers, rows, {
|
|
30502
30923
|
columnWidths: [20, 15, 8, 30],
|
|
30503
30924
|
separator: " \u2502 ",
|
|
30504
|
-
headerColor:
|
|
30925
|
+
headerColor: chalk17__default.default.gray
|
|
30505
30926
|
});
|
|
30506
30927
|
lines.push(table);
|
|
30507
30928
|
return lines.join("\n");
|
|
@@ -30513,19 +30934,19 @@ var init_StatusDisplay = __esm({
|
|
|
30513
30934
|
*/
|
|
30514
30935
|
static renderHealthChecks(checks) {
|
|
30515
30936
|
const lines = [];
|
|
30516
|
-
lines.push(
|
|
30937
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
30517
30938
|
lines.push("");
|
|
30518
30939
|
for (const check of checks) {
|
|
30519
30940
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
30520
|
-
const statusColor = check.status === "ok" ?
|
|
30941
|
+
const statusColor = check.status === "ok" ? chalk17__default.default.green : check.status === "warning" ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30521
30942
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
30522
30943
|
if (check.latency !== void 0) {
|
|
30523
|
-
const latencyColor = check.latency < 100 ?
|
|
30944
|
+
const latencyColor = check.latency < 100 ? chalk17__default.default.green : check.latency < 500 ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30524
30945
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
30525
30946
|
}
|
|
30526
30947
|
lines.push(line);
|
|
30527
30948
|
if (check.message) {
|
|
30528
|
-
lines.push(
|
|
30949
|
+
lines.push(chalk17__default.default.gray(` ${check.message}`));
|
|
30529
30950
|
}
|
|
30530
30951
|
}
|
|
30531
30952
|
lines.push("");
|
|
@@ -30534,16 +30955,16 @@ var init_StatusDisplay = __esm({
|
|
|
30534
30955
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
30535
30956
|
if (errorCount > 0) {
|
|
30536
30957
|
lines.push(
|
|
30537
|
-
|
|
30958
|
+
chalk17__default.default.red(
|
|
30538
30959
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
30539
30960
|
)
|
|
30540
30961
|
);
|
|
30541
30962
|
} else if (warningCount > 0) {
|
|
30542
30963
|
lines.push(
|
|
30543
|
-
|
|
30964
|
+
chalk17__default.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
30544
30965
|
);
|
|
30545
30966
|
} else {
|
|
30546
|
-
lines.push(
|
|
30967
|
+
lines.push(chalk17__default.default.green("\u2705 All systems operational"));
|
|
30547
30968
|
}
|
|
30548
30969
|
return lines.join("\n");
|
|
30549
30970
|
}
|
|
@@ -30554,7 +30975,7 @@ var init_StatusDisplay = __esm({
|
|
|
30554
30975
|
*/
|
|
30555
30976
|
static renderSessionStats(stats) {
|
|
30556
30977
|
const lines = [];
|
|
30557
|
-
lines.push(
|
|
30978
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
30558
30979
|
lines.push("");
|
|
30559
30980
|
const data2 = formatKeyValue(
|
|
30560
30981
|
{
|
|
@@ -30567,14 +30988,14 @@ var init_StatusDisplay = __esm({
|
|
|
30567
30988
|
},
|
|
30568
30989
|
{
|
|
30569
30990
|
keyWidth: 20,
|
|
30570
|
-
keyColor:
|
|
30571
|
-
valueColor:
|
|
30991
|
+
keyColor: chalk17__default.default.gray,
|
|
30992
|
+
valueColor: chalk17__default.default.white
|
|
30572
30993
|
}
|
|
30573
30994
|
);
|
|
30574
30995
|
lines.push(data2);
|
|
30575
30996
|
lines.push("");
|
|
30576
30997
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
30577
|
-
const perfColor = performance3 === "Excellent" ?
|
|
30998
|
+
const perfColor = performance3 === "Excellent" ? chalk17__default.default.green : performance3 === "Good" ? chalk17__default.default.blue : performance3 === "Fair" ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30578
30999
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
30579
31000
|
return lines.join("\n");
|
|
30580
31001
|
}
|
|
@@ -30586,22 +31007,22 @@ var init_StatusDisplay = __esm({
|
|
|
30586
31007
|
static renderStatusBar(data2) {
|
|
30587
31008
|
const segments = [];
|
|
30588
31009
|
if (data2.mode) {
|
|
30589
|
-
segments.push(
|
|
31010
|
+
segments.push(chalk17__default.default.cyan(`[${data2.mode}]`));
|
|
30590
31011
|
}
|
|
30591
31012
|
if (data2.model) {
|
|
30592
|
-
segments.push(
|
|
31013
|
+
segments.push(chalk17__default.default.blue(`\u{1F916} ${data2.model}`));
|
|
30593
31014
|
}
|
|
30594
31015
|
if (data2.memory !== void 0) {
|
|
30595
|
-
const memoryColor = data2.memory > 80 ?
|
|
31016
|
+
const memoryColor = data2.memory > 80 ? chalk17__default.default.red : data2.memory > 60 ? chalk17__default.default.yellow : chalk17__default.default.green;
|
|
30596
31017
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
30597
31018
|
}
|
|
30598
31019
|
if (data2.latency !== void 0) {
|
|
30599
|
-
const latencyColor = data2.latency < 100 ?
|
|
31020
|
+
const latencyColor = data2.latency < 100 ? chalk17__default.default.green : data2.latency < 500 ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30600
31021
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
30601
31022
|
}
|
|
30602
31023
|
if (data2.time) {
|
|
30603
31024
|
segments.push(
|
|
30604
|
-
|
|
31025
|
+
chalk17__default.default.gray(formatTimestamp(data2.time, "short"))
|
|
30605
31026
|
);
|
|
30606
31027
|
}
|
|
30607
31028
|
return segments.join(" \u2502 ");
|
|
@@ -30620,7 +31041,7 @@ var init_CoreHandlers = __esm({
|
|
|
30620
31041
|
async execute(args) {
|
|
30621
31042
|
const startTime = perf_hooks.performance.now();
|
|
30622
31043
|
const commands = this.registry.getCommands();
|
|
30623
|
-
let message =
|
|
31044
|
+
let message = chalk17__default.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
30624
31045
|
|
|
30625
31046
|
`);
|
|
30626
31047
|
const categories = {
|
|
@@ -30631,17 +31052,17 @@ var init_CoreHandlers = __esm({
|
|
|
30631
31052
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
30632
31053
|
};
|
|
30633
31054
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
30634
|
-
message +=
|
|
31055
|
+
message += chalk17__default.default.yellow(`
|
|
30635
31056
|
${category.toUpperCase()}:
|
|
30636
31057
|
`);
|
|
30637
31058
|
for (const cmd of cmds) {
|
|
30638
31059
|
if (commands.includes(cmd)) {
|
|
30639
|
-
message += ` ${
|
|
31060
|
+
message += ` ${chalk17__default.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
30640
31061
|
`;
|
|
30641
31062
|
}
|
|
30642
31063
|
}
|
|
30643
31064
|
}
|
|
30644
|
-
message +=
|
|
31065
|
+
message += chalk17__default.default.gray(
|
|
30645
31066
|
`
|
|
30646
31067
|
Type '/help <command>' for detailed information about a specific command.`
|
|
30647
31068
|
);
|
|
@@ -30689,7 +31110,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30689
31110
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30690
31111
|
return {
|
|
30691
31112
|
success: true,
|
|
30692
|
-
message:
|
|
31113
|
+
message: chalk17__default.default.gray("Terminal cleared."),
|
|
30693
31114
|
metadata: {
|
|
30694
31115
|
processingTime,
|
|
30695
31116
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -30700,7 +31121,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30700
31121
|
ExitHandler = class {
|
|
30701
31122
|
async execute(args) {
|
|
30702
31123
|
const startTime = perf_hooks.performance.now();
|
|
30703
|
-
const message =
|
|
31124
|
+
const message = chalk17__default.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
30704
31125
|
process.emit("SIGTERM");
|
|
30705
31126
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30706
31127
|
return {
|
|
@@ -30724,23 +31145,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30724
31145
|
platform: process.platform,
|
|
30725
31146
|
arch: process.arch
|
|
30726
31147
|
};
|
|
30727
|
-
let message =
|
|
30728
|
-
message +=
|
|
31148
|
+
let message = chalk17__default.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
31149
|
+
message += chalk17__default.default.white(` Version: ${chalk17__default.default.green(packageInfo.version)}
|
|
30729
31150
|
`);
|
|
30730
|
-
message +=
|
|
31151
|
+
message += chalk17__default.default.white(` Package: ${chalk17__default.default.green(packageInfo.name)}
|
|
30731
31152
|
`);
|
|
30732
|
-
message +=
|
|
31153
|
+
message += chalk17__default.default.white(` Node: ${chalk17__default.default.green(packageInfo.node)}
|
|
30733
31154
|
`);
|
|
30734
|
-
message +=
|
|
30735
|
-
` Platform: ${
|
|
31155
|
+
message += chalk17__default.default.white(
|
|
31156
|
+
` Platform: ${chalk17__default.default.green(packageInfo.platform)}
|
|
30736
31157
|
`
|
|
30737
31158
|
);
|
|
30738
|
-
message +=
|
|
31159
|
+
message += chalk17__default.default.white(` Arch: ${chalk17__default.default.green(packageInfo.arch)}
|
|
30739
31160
|
`);
|
|
30740
|
-
message +=
|
|
31161
|
+
message += chalk17__default.default.gray(`
|
|
30741
31162
|
Build: Production
|
|
30742
31163
|
`);
|
|
30743
|
-
message +=
|
|
31164
|
+
message += chalk17__default.default.gray(` License: MIT
|
|
30744
31165
|
`);
|
|
30745
31166
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30746
31167
|
return {
|
|
@@ -30765,15 +31186,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30765
31186
|
this.history.push("/history");
|
|
30766
31187
|
}
|
|
30767
31188
|
const recent = this.history.slice(-limit);
|
|
30768
|
-
let message =
|
|
31189
|
+
let message = chalk17__default.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
30769
31190
|
|
|
30770
31191
|
`);
|
|
30771
31192
|
recent.forEach((cmd, index) => {
|
|
30772
31193
|
const num = this.history.length - recent.length + index + 1;
|
|
30773
|
-
message +=
|
|
31194
|
+
message += chalk17__default.default.gray(` ${num.toString().padStart(3)}: `) + chalk17__default.default.white(cmd) + "\n";
|
|
30774
31195
|
});
|
|
30775
31196
|
if (recent.length === 0) {
|
|
30776
|
-
message =
|
|
31197
|
+
message = chalk17__default.default.gray("No command history available.");
|
|
30777
31198
|
}
|
|
30778
31199
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30779
31200
|
return {
|
|
@@ -30819,13 +31240,13 @@ var init_DevHandlers = __esm({
|
|
|
30819
31240
|
if (!prompt) {
|
|
30820
31241
|
return {
|
|
30821
31242
|
ok: false,
|
|
30822
|
-
message:
|
|
31243
|
+
message: chalk17__default.default.red("\u274C Please provide a code generation request.\n") + chalk17__default.default.gray("Usage: /code <description>\n") + chalk17__default.default.gray("Example: /code create a React button component")
|
|
30823
31244
|
};
|
|
30824
31245
|
}
|
|
30825
31246
|
if (signal?.aborted) {
|
|
30826
31247
|
return {
|
|
30827
31248
|
ok: false,
|
|
30828
|
-
message:
|
|
31249
|
+
message: chalk17__default.default.yellow("Code generation canceled")
|
|
30829
31250
|
};
|
|
30830
31251
|
}
|
|
30831
31252
|
try {
|
|
@@ -30836,9 +31257,9 @@ var init_DevHandlers = __esm({
|
|
|
30836
31257
|
if (dryRun) {
|
|
30837
31258
|
return {
|
|
30838
31259
|
ok: true,
|
|
30839
|
-
message:
|
|
30840
|
-
`) +
|
|
30841
|
-
`) +
|
|
31260
|
+
message: chalk17__default.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + chalk17__default.default.gray(`Language: ${language}
|
|
31261
|
+
`) + chalk17__default.default.gray(`Framework: ${framework || "none"}
|
|
31262
|
+
`) + chalk17__default.default.gray(`Prompt: ${cleanPrompt}`)
|
|
30842
31263
|
};
|
|
30843
31264
|
}
|
|
30844
31265
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -30850,7 +31271,7 @@ function generated() {
|
|
|
30850
31271
|
export { generated };`;
|
|
30851
31272
|
return {
|
|
30852
31273
|
ok: true,
|
|
30853
|
-
message:
|
|
31274
|
+
message: chalk17__default.default.green("\u2705 Code generated successfully:\n\n") + chalk17__default.default.gray("```" + language + "\n") + generatedCode + chalk17__default.default.gray("\n```"),
|
|
30854
31275
|
data: {
|
|
30855
31276
|
code: generatedCode,
|
|
30856
31277
|
language,
|
|
@@ -30863,7 +31284,7 @@ export { generated };`;
|
|
|
30863
31284
|
} catch (error2) {
|
|
30864
31285
|
return {
|
|
30865
31286
|
ok: false,
|
|
30866
|
-
message:
|
|
31287
|
+
message: chalk17__default.default.red(`Code generation failed: ${error2}`)
|
|
30867
31288
|
};
|
|
30868
31289
|
}
|
|
30869
31290
|
}
|
|
@@ -30877,7 +31298,7 @@ export { generated };`;
|
|
|
30877
31298
|
if (signal?.aborted) {
|
|
30878
31299
|
return {
|
|
30879
31300
|
ok: false,
|
|
30880
|
-
message:
|
|
31301
|
+
message: chalk17__default.default.yellow("Test operation canceled")
|
|
30881
31302
|
};
|
|
30882
31303
|
}
|
|
30883
31304
|
const subcommand = args[0] || "run";
|
|
@@ -30893,8 +31314,8 @@ export { generated };`;
|
|
|
30893
31314
|
default:
|
|
30894
31315
|
return {
|
|
30895
31316
|
ok: false,
|
|
30896
|
-
message:
|
|
30897
|
-
`) +
|
|
31317
|
+
message: chalk17__default.default.red(`Unknown test subcommand: ${subcommand}
|
|
31318
|
+
`) + chalk17__default.default.gray("Available: generate, run, coverage")
|
|
30898
31319
|
};
|
|
30899
31320
|
}
|
|
30900
31321
|
}
|
|
@@ -30902,7 +31323,7 @@ export { generated };`;
|
|
|
30902
31323
|
if (!target) {
|
|
30903
31324
|
return {
|
|
30904
31325
|
ok: false,
|
|
30905
|
-
message:
|
|
31326
|
+
message: chalk17__default.default.red(
|
|
30906
31327
|
"Please specify a file or function to generate tests for"
|
|
30907
31328
|
)
|
|
30908
31329
|
};
|
|
@@ -30919,9 +31340,9 @@ describe("${target}", () => {
|
|
|
30919
31340
|
});`;
|
|
30920
31341
|
return {
|
|
30921
31342
|
ok: true,
|
|
30922
|
-
message:
|
|
31343
|
+
message: chalk17__default.default.green(`\u2705 Tests generated for ${target}:
|
|
30923
31344
|
|
|
30924
|
-
`) +
|
|
31345
|
+
`) + chalk17__default.default.gray("```typescript\n") + testCode + chalk17__default.default.gray("\n```"),
|
|
30925
31346
|
data: { testCode, framework, target }
|
|
30926
31347
|
};
|
|
30927
31348
|
}
|
|
@@ -30934,23 +31355,23 @@ describe("${target}", () => {
|
|
|
30934
31355
|
if (coverage) command += " --coverage";
|
|
30935
31356
|
return {
|
|
30936
31357
|
ok: true,
|
|
30937
|
-
message:
|
|
30938
|
-
`) +
|
|
31358
|
+
message: chalk17__default.default.cyan(`\u{1F9EA} Running tests...
|
|
31359
|
+
`) + chalk17__default.default.gray(`Command: ${command}
|
|
30939
31360
|
|
|
30940
|
-
`) +
|
|
31361
|
+
`) + chalk17__default.default.green("\u2705 All tests passed!"),
|
|
30941
31362
|
data: { command, passed: true }
|
|
30942
31363
|
};
|
|
30943
31364
|
}
|
|
30944
31365
|
async showCoverage(options) {
|
|
30945
31366
|
return {
|
|
30946
31367
|
ok: true,
|
|
30947
|
-
message:
|
|
31368
|
+
message: chalk17__default.default.cyan("\u{1F4CA} Test Coverage Report:\n\n") + chalk17__default.default.gray("File".padEnd(40) + "% Stmts".padEnd(10) + "% Lines\n") + chalk17__default.default.gray("-".repeat(60) + "\n") + chalk17__default.default.green(
|
|
30948
31369
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
30949
|
-
) +
|
|
31370
|
+
) + chalk17__default.default.green(
|
|
30950
31371
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
30951
|
-
) +
|
|
31372
|
+
) + chalk17__default.default.yellow(
|
|
30952
31373
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
30953
|
-
) +
|
|
31374
|
+
) + chalk17__default.default.gray("-".repeat(60) + "\n") + chalk17__default.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
30954
31375
|
};
|
|
30955
31376
|
}
|
|
30956
31377
|
};
|
|
@@ -30964,33 +31385,33 @@ describe("${target}", () => {
|
|
|
30964
31385
|
if (!file) {
|
|
30965
31386
|
return {
|
|
30966
31387
|
ok: false,
|
|
30967
|
-
message:
|
|
31388
|
+
message: chalk17__default.default.red("Please specify a file to review\n") + chalk17__default.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
30968
31389
|
};
|
|
30969
31390
|
}
|
|
30970
31391
|
const checkSecurity = args.includes("--security");
|
|
30971
31392
|
const checkPerformance = args.includes("--performance");
|
|
30972
|
-
let message =
|
|
31393
|
+
let message = chalk17__default.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
30973
31394
|
|
|
30974
31395
|
`);
|
|
30975
|
-
message +=
|
|
30976
|
-
message +=
|
|
30977
|
-
message +=
|
|
30978
|
-
message +=
|
|
31396
|
+
message += chalk17__default.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
31397
|
+
message += chalk17__default.default.gray(" 1. Line 42: ") + chalk17__default.default.yellow("Missing error handling in async function\n");
|
|
31398
|
+
message += chalk17__default.default.gray(" 2. Line 89: ") + chalk17__default.default.yellow("Potential memory leak - event listener not removed\n");
|
|
31399
|
+
message += chalk17__default.default.gray(" 3. Line 156: ") + chalk17__default.default.yellow(
|
|
30979
31400
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
30980
31401
|
);
|
|
30981
31402
|
if (checkSecurity) {
|
|
30982
|
-
message +=
|
|
30983
|
-
message +=
|
|
31403
|
+
message += chalk17__default.default.red("\u{1F512} Security Issues (1):\n");
|
|
31404
|
+
message += chalk17__default.default.gray(" 1. Line 67: ") + chalk17__default.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
30984
31405
|
}
|
|
30985
31406
|
if (checkPerformance) {
|
|
30986
|
-
message +=
|
|
30987
|
-
message +=
|
|
30988
|
-
message +=
|
|
30989
|
-
}
|
|
30990
|
-
message +=
|
|
30991
|
-
message +=
|
|
30992
|
-
message +=
|
|
30993
|
-
message +=
|
|
31407
|
+
message += chalk17__default.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
31408
|
+
message += chalk17__default.default.gray(" 1. Line 23: ") + chalk17__default.default.blue("Consider memoization for expensive calculation\n");
|
|
31409
|
+
message += chalk17__default.default.gray(" 2. Line 145: ") + chalk17__default.default.blue("Use virtualization for large list rendering\n\n");
|
|
31410
|
+
}
|
|
31411
|
+
message += chalk17__default.default.green("\u2705 Positive Findings:\n");
|
|
31412
|
+
message += chalk17__default.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
31413
|
+
message += chalk17__default.default.gray(" \u2022 Consistent code style\n");
|
|
31414
|
+
message += chalk17__default.default.gray(" \u2022 Well-documented functions\n");
|
|
30994
31415
|
return {
|
|
30995
31416
|
ok: true,
|
|
30996
31417
|
message,
|
|
@@ -31020,8 +31441,8 @@ describe("${target}", () => {
|
|
|
31020
31441
|
default:
|
|
31021
31442
|
return {
|
|
31022
31443
|
ok: false,
|
|
31023
|
-
message:
|
|
31024
|
-
`) +
|
|
31444
|
+
message: chalk17__default.default.red(`Unknown bug subcommand: ${subcommand}
|
|
31445
|
+
`) + chalk17__default.default.gray("Available: report, list, analyze")
|
|
31025
31446
|
};
|
|
31026
31447
|
}
|
|
31027
31448
|
}
|
|
@@ -31030,18 +31451,18 @@ describe("${target}", () => {
|
|
|
31030
31451
|
if (!description) {
|
|
31031
31452
|
return {
|
|
31032
31453
|
ok: false,
|
|
31033
|
-
message:
|
|
31454
|
+
message: chalk17__default.default.red("Please provide a bug description")
|
|
31034
31455
|
};
|
|
31035
31456
|
}
|
|
31036
31457
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
31037
31458
|
return {
|
|
31038
31459
|
ok: true,
|
|
31039
|
-
message:
|
|
31460
|
+
message: chalk17__default.default.green(`\u{1F41B} Bug reported successfully!
|
|
31040
31461
|
|
|
31041
|
-
`) +
|
|
31042
|
-
`) +
|
|
31043
|
-
`) +
|
|
31044
|
-
`) +
|
|
31462
|
+
`) + chalk17__default.default.cyan(`Bug ID: ${bugId}
|
|
31463
|
+
`) + chalk17__default.default.gray(`Description: ${description}
|
|
31464
|
+
`) + chalk17__default.default.gray(`Status: Open
|
|
31465
|
+
`) + chalk17__default.default.gray(`Priority: To be determined
|
|
31045
31466
|
`),
|
|
31046
31467
|
data: { bugId, description, status: "open" }
|
|
31047
31468
|
};
|
|
@@ -31049,23 +31470,23 @@ describe("${target}", () => {
|
|
|
31049
31470
|
async listBugs() {
|
|
31050
31471
|
return {
|
|
31051
31472
|
ok: true,
|
|
31052
|
-
message:
|
|
31473
|
+
message: chalk17__default.default.cyan("\u{1F41B} Active Bugs:\n\n") + chalk17__default.default.yellow("1. BUG-A1B2C3: ") + chalk17__default.default.gray("Session timeout not handled properly\n") + chalk17__default.default.yellow("2. BUG-D4E5F6: ") + chalk17__default.default.gray("Memory leak in streaming responses\n") + chalk17__default.default.yellow("3. BUG-G7H8I9: ") + chalk17__default.default.gray("Spinner not stopping on error\n\n") + chalk17__default.default.gray("Total: 3 open bugs")
|
|
31053
31474
|
};
|
|
31054
31475
|
}
|
|
31055
31476
|
async analyzeBug(bugId) {
|
|
31056
31477
|
if (!bugId) {
|
|
31057
31478
|
return {
|
|
31058
31479
|
ok: false,
|
|
31059
|
-
message:
|
|
31480
|
+
message: chalk17__default.default.red("Please provide a bug ID to analyze")
|
|
31060
31481
|
};
|
|
31061
31482
|
}
|
|
31062
31483
|
return {
|
|
31063
31484
|
ok: true,
|
|
31064
|
-
message:
|
|
31485
|
+
message: chalk17__default.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
31065
31486
|
|
|
31066
|
-
`) +
|
|
31487
|
+
`) + chalk17__default.default.yellow("Summary: ") + chalk17__default.default.gray("Session timeout not handled properly\n") + chalk17__default.default.yellow("Severity: ") + chalk17__default.default.orange("Medium\n") + chalk17__default.default.yellow("Component: ") + chalk17__default.default.gray("SessionManager\n") + chalk17__default.default.yellow("Reported: ") + chalk17__default.default.gray("2 days ago\n\n") + chalk17__default.default.cyan("Possible Causes:\n") + chalk17__default.default.gray(
|
|
31067
31488
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
31068
|
-
) +
|
|
31489
|
+
) + chalk17__default.default.gray(" 2. Deadline timer not cleared on completion\n") + chalk17__default.default.gray(" 3. Race condition in state transitions\n\n") + chalk17__default.default.green("Suggested Fix:\n") + chalk17__default.default.gray(" Ensure all async operations respect the AbortSignal\n") + chalk17__default.default.gray(" Add finally block to clear timers\n")
|
|
31069
31490
|
};
|
|
31070
31491
|
}
|
|
31071
31492
|
};
|
|
@@ -31089,7 +31510,7 @@ var init_SystemHandlers = __esm({
|
|
|
31089
31510
|
if (signal?.aborted) {
|
|
31090
31511
|
return {
|
|
31091
31512
|
ok: false,
|
|
31092
|
-
message:
|
|
31513
|
+
message: chalk17__default.default.yellow("Status check canceled")
|
|
31093
31514
|
};
|
|
31094
31515
|
}
|
|
31095
31516
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -31100,44 +31521,44 @@ var init_SystemHandlers = __esm({
|
|
|
31100
31521
|
cpu: os__namespace.cpus()[0],
|
|
31101
31522
|
platform: process.platform
|
|
31102
31523
|
};
|
|
31103
|
-
let message =
|
|
31104
|
-
message +=
|
|
31105
|
-
message +=
|
|
31524
|
+
let message = chalk17__default.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
31525
|
+
message += chalk17__default.default.green("\u2705 System: Operational\n");
|
|
31526
|
+
message += chalk17__default.default.gray(
|
|
31106
31527
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
31107
31528
|
`
|
|
31108
31529
|
);
|
|
31109
|
-
message +=
|
|
31530
|
+
message += chalk17__default.default.gray(
|
|
31110
31531
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31111
31532
|
`
|
|
31112
31533
|
);
|
|
31113
31534
|
if (verbose) {
|
|
31114
|
-
message +=
|
|
31115
|
-
message +=
|
|
31535
|
+
message += chalk17__default.default.gray("\nDetailed Information:\n");
|
|
31536
|
+
message += chalk17__default.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
31116
31537
|
`);
|
|
31117
|
-
message +=
|
|
31538
|
+
message += chalk17__default.default.gray(
|
|
31118
31539
|
` \u2022 Platform: ${status.platform} (${os__namespace.arch()})
|
|
31119
31540
|
`
|
|
31120
31541
|
);
|
|
31121
|
-
message +=
|
|
31542
|
+
message += chalk17__default.default.gray(` \u2022 Node.js: ${process.version}
|
|
31122
31543
|
`);
|
|
31123
|
-
message +=
|
|
31544
|
+
message += chalk17__default.default.gray(` \u2022 Process ID: ${process.pid}
|
|
31124
31545
|
`);
|
|
31125
|
-
message +=
|
|
31546
|
+
message += chalk17__default.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
31126
31547
|
`);
|
|
31127
|
-
message +=
|
|
31128
|
-
message +=
|
|
31548
|
+
message += chalk17__default.default.gray("\nMemory Details:\n");
|
|
31549
|
+
message += chalk17__default.default.gray(
|
|
31129
31550
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
31130
31551
|
`
|
|
31131
31552
|
);
|
|
31132
|
-
message +=
|
|
31553
|
+
message += chalk17__default.default.gray(
|
|
31133
31554
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
31134
31555
|
`
|
|
31135
31556
|
);
|
|
31136
|
-
message +=
|
|
31557
|
+
message += chalk17__default.default.gray(
|
|
31137
31558
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31138
31559
|
`
|
|
31139
31560
|
);
|
|
31140
|
-
message +=
|
|
31561
|
+
message += chalk17__default.default.gray(
|
|
31141
31562
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
31142
31563
|
`
|
|
31143
31564
|
);
|
|
@@ -31166,7 +31587,7 @@ var init_SystemHandlers = __esm({
|
|
|
31166
31587
|
if (signal?.aborted) {
|
|
31167
31588
|
return {
|
|
31168
31589
|
ok: false,
|
|
31169
|
-
message:
|
|
31590
|
+
message: chalk17__default.default.yellow("Model operation canceled")
|
|
31170
31591
|
};
|
|
31171
31592
|
}
|
|
31172
31593
|
if (args.length === 0) {
|
|
@@ -31186,17 +31607,17 @@ var init_SystemHandlers = __esm({
|
|
|
31186
31607
|
}
|
|
31187
31608
|
}
|
|
31188
31609
|
async listModels() {
|
|
31189
|
-
let message =
|
|
31190
|
-
message +=
|
|
31610
|
+
let message = chalk17__default.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
31611
|
+
message += chalk17__default.default.green(`Current: ${this.currentModel}
|
|
31191
31612
|
|
|
31192
31613
|
`);
|
|
31193
31614
|
for (const model of this.availableModels) {
|
|
31194
|
-
const status = model.available ?
|
|
31195
|
-
const name2 = model.id === this.currentModel ?
|
|
31196
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
31615
|
+
const status = model.available ? chalk17__default.default.green("\u2705") : chalk17__default.default.red("\u274C");
|
|
31616
|
+
const name2 = model.id === this.currentModel ? chalk17__default.default.green.bold(model.id) : chalk17__default.default.cyan(model.id);
|
|
31617
|
+
message += `${status} ${name2.padEnd(20)} ${chalk17__default.default.gray(`[${model.provider}]`)}
|
|
31197
31618
|
`;
|
|
31198
31619
|
}
|
|
31199
|
-
message +=
|
|
31620
|
+
message += chalk17__default.default.gray("\nUse /model <name> to switch models");
|
|
31200
31621
|
return {
|
|
31201
31622
|
ok: true,
|
|
31202
31623
|
message,
|
|
@@ -31207,27 +31628,27 @@ var init_SystemHandlers = __esm({
|
|
|
31207
31628
|
if (!modelId) {
|
|
31208
31629
|
return {
|
|
31209
31630
|
ok: false,
|
|
31210
|
-
message:
|
|
31631
|
+
message: chalk17__default.default.red("Please specify a model to switch to")
|
|
31211
31632
|
};
|
|
31212
31633
|
}
|
|
31213
31634
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
31214
31635
|
if (!model) {
|
|
31215
31636
|
return {
|
|
31216
31637
|
ok: false,
|
|
31217
|
-
message:
|
|
31218
|
-
`) +
|
|
31638
|
+
message: chalk17__default.default.red(`Unknown model: ${modelId}
|
|
31639
|
+
`) + chalk17__default.default.gray("Use /model list to see available models")
|
|
31219
31640
|
};
|
|
31220
31641
|
}
|
|
31221
31642
|
if (!model.available) {
|
|
31222
31643
|
return {
|
|
31223
31644
|
ok: false,
|
|
31224
|
-
message:
|
|
31645
|
+
message: chalk17__default.default.yellow(`Model ${modelId} is not currently available`)
|
|
31225
31646
|
};
|
|
31226
31647
|
}
|
|
31227
31648
|
this.currentModel = modelId;
|
|
31228
31649
|
return {
|
|
31229
31650
|
ok: true,
|
|
31230
|
-
message:
|
|
31651
|
+
message: chalk17__default.default.green(`\u2705 Switched to ${modelId}`),
|
|
31231
31652
|
data: { model: modelId }
|
|
31232
31653
|
};
|
|
31233
31654
|
}
|
|
@@ -31236,27 +31657,27 @@ var init_SystemHandlers = __esm({
|
|
|
31236
31657
|
if (!model) {
|
|
31237
31658
|
return {
|
|
31238
31659
|
ok: false,
|
|
31239
|
-
message:
|
|
31660
|
+
message: chalk17__default.default.red(`Unknown model: ${modelId}`)
|
|
31240
31661
|
};
|
|
31241
31662
|
}
|
|
31242
|
-
let message =
|
|
31663
|
+
let message = chalk17__default.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
31243
31664
|
|
|
31244
31665
|
`);
|
|
31245
|
-
message +=
|
|
31666
|
+
message += chalk17__default.default.gray(`Provider: ${model.provider}
|
|
31246
31667
|
`);
|
|
31247
|
-
message +=
|
|
31668
|
+
message += chalk17__default.default.gray(
|
|
31248
31669
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
31249
31670
|
`
|
|
31250
31671
|
);
|
|
31251
|
-
message +=
|
|
31672
|
+
message += chalk17__default.default.gray(
|
|
31252
31673
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
31253
31674
|
`
|
|
31254
31675
|
);
|
|
31255
|
-
message +=
|
|
31256
|
-
message +=
|
|
31257
|
-
message +=
|
|
31258
|
-
message +=
|
|
31259
|
-
message +=
|
|
31676
|
+
message += chalk17__default.default.gray("\nCapabilities:\n");
|
|
31677
|
+
message += chalk17__default.default.gray(" \u2022 Context: 128K tokens\n");
|
|
31678
|
+
message += chalk17__default.default.gray(" \u2022 Languages: 95+\n");
|
|
31679
|
+
message += chalk17__default.default.gray(" \u2022 Code: Yes\n");
|
|
31680
|
+
message += chalk17__default.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
31260
31681
|
return {
|
|
31261
31682
|
ok: true,
|
|
31262
31683
|
message,
|
|
@@ -31288,39 +31709,39 @@ var init_SystemHandlers = __esm({
|
|
|
31288
31709
|
default:
|
|
31289
31710
|
return {
|
|
31290
31711
|
ok: false,
|
|
31291
|
-
message:
|
|
31292
|
-
`) +
|
|
31712
|
+
message: chalk17__default.default.red(`Unknown memory subcommand: ${subcommand}
|
|
31713
|
+
`) + chalk17__default.default.gray("Available: status, clear, export, compact")
|
|
31293
31714
|
};
|
|
31294
31715
|
}
|
|
31295
31716
|
}
|
|
31296
31717
|
async showStatus() {
|
|
31297
|
-
let message =
|
|
31298
|
-
message +=
|
|
31299
|
-
message +=
|
|
31718
|
+
let message = chalk17__default.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
31719
|
+
message += chalk17__default.default.yellow("System 1 (Fast):\n");
|
|
31720
|
+
message += chalk17__default.default.gray(
|
|
31300
31721
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
31301
31722
|
`
|
|
31302
31723
|
);
|
|
31303
|
-
message +=
|
|
31724
|
+
message += chalk17__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
31304
31725
|
|
|
31305
31726
|
`);
|
|
31306
|
-
message +=
|
|
31307
|
-
message +=
|
|
31727
|
+
message += chalk17__default.default.blue("System 2 (Deep):\n");
|
|
31728
|
+
message += chalk17__default.default.gray(
|
|
31308
31729
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
31309
31730
|
`
|
|
31310
31731
|
);
|
|
31311
|
-
message +=
|
|
31732
|
+
message += chalk17__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
31312
31733
|
|
|
31313
31734
|
`);
|
|
31314
|
-
message +=
|
|
31315
|
-
message +=
|
|
31735
|
+
message += chalk17__default.default.green("Total:\n");
|
|
31736
|
+
message += chalk17__default.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
31316
31737
|
`);
|
|
31317
|
-
message +=
|
|
31738
|
+
message += chalk17__default.default.gray(
|
|
31318
31739
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
31319
31740
|
`
|
|
31320
31741
|
);
|
|
31321
31742
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
31322
31743
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
31323
|
-
message +=
|
|
31744
|
+
message += chalk17__default.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
31324
31745
|
`);
|
|
31325
31746
|
return {
|
|
31326
31747
|
ok: true,
|
|
@@ -31334,14 +31755,14 @@ var init_SystemHandlers = __esm({
|
|
|
31334
31755
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
31335
31756
|
return {
|
|
31336
31757
|
ok: true,
|
|
31337
|
-
message:
|
|
31758
|
+
message: chalk17__default.default.green("\u2705 System 1 memory cleared")
|
|
31338
31759
|
};
|
|
31339
31760
|
}
|
|
31340
31761
|
if (system === "system2") {
|
|
31341
31762
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
31342
31763
|
return {
|
|
31343
31764
|
ok: true,
|
|
31344
|
-
message:
|
|
31765
|
+
message: chalk17__default.default.green("\u2705 System 2 memory cleared")
|
|
31345
31766
|
};
|
|
31346
31767
|
}
|
|
31347
31768
|
this.memoryStats = {
|
|
@@ -31351,15 +31772,15 @@ var init_SystemHandlers = __esm({
|
|
|
31351
31772
|
};
|
|
31352
31773
|
return {
|
|
31353
31774
|
ok: true,
|
|
31354
|
-
message:
|
|
31775
|
+
message: chalk17__default.default.green("\u{1F9F9} All memory cleared")
|
|
31355
31776
|
};
|
|
31356
31777
|
}
|
|
31357
31778
|
async exportMemory() {
|
|
31358
31779
|
const filename = `memory-export-${Date.now()}.json`;
|
|
31359
31780
|
return {
|
|
31360
31781
|
ok: true,
|
|
31361
|
-
message:
|
|
31362
|
-
`) +
|
|
31782
|
+
message: chalk17__default.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
31783
|
+
`) + chalk17__default.default.gray(
|
|
31363
31784
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
31364
31785
|
),
|
|
31365
31786
|
data: { filename, stats: this.memoryStats }
|
|
@@ -31377,9 +31798,9 @@ var init_SystemHandlers = __esm({
|
|
|
31377
31798
|
);
|
|
31378
31799
|
return {
|
|
31379
31800
|
ok: true,
|
|
31380
|
-
message:
|
|
31381
|
-
`) +
|
|
31382
|
-
`) +
|
|
31801
|
+
message: chalk17__default.default.green("\u2728 Memory compacted successfully\n") + chalk17__default.default.gray(`Before: ${before} tokens
|
|
31802
|
+
`) + chalk17__default.default.gray(`After: ${after} tokens
|
|
31803
|
+
`) + chalk17__default.default.gray(
|
|
31383
31804
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
31384
31805
|
),
|
|
31385
31806
|
data: { before, after, saved: before - after }
|
|
@@ -31395,11 +31816,11 @@ var init_SystemHandlers = __esm({
|
|
|
31395
31816
|
if (signal?.aborted) {
|
|
31396
31817
|
return {
|
|
31397
31818
|
ok: false,
|
|
31398
|
-
message:
|
|
31819
|
+
message: chalk17__default.default.yellow("Health check canceled")
|
|
31399
31820
|
};
|
|
31400
31821
|
}
|
|
31401
31822
|
const detailed = args.includes("--detailed");
|
|
31402
|
-
let message =
|
|
31823
|
+
let message = chalk17__default.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
31403
31824
|
const checks = [
|
|
31404
31825
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
31405
31826
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -31408,11 +31829,11 @@ var init_SystemHandlers = __esm({
|
|
|
31408
31829
|
{ name: "Network", status: "warning", latency: 250 }
|
|
31409
31830
|
];
|
|
31410
31831
|
for (const check of checks) {
|
|
31411
|
-
const icon = check.status === "ok" ?
|
|
31412
|
-
const status = check.status === "ok" ?
|
|
31832
|
+
const icon = check.status === "ok" ? chalk17__default.default.green("\u2705") : check.status === "warning" ? chalk17__default.default.yellow("\u26A0\uFE0F") : chalk17__default.default.red("\u274C");
|
|
31833
|
+
const status = check.status === "ok" ? chalk17__default.default.green("OK") : check.status === "warning" ? chalk17__default.default.yellow("WARNING") : chalk17__default.default.red("ERROR");
|
|
31413
31834
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
31414
31835
|
if (detailed) {
|
|
31415
|
-
message +=
|
|
31836
|
+
message += chalk17__default.default.gray(` (${check.latency}ms)`);
|
|
31416
31837
|
}
|
|
31417
31838
|
message += "\n";
|
|
31418
31839
|
}
|
|
@@ -31420,11 +31841,11 @@ var init_SystemHandlers = __esm({
|
|
|
31420
31841
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
31421
31842
|
message += "\n";
|
|
31422
31843
|
if (hasErrors) {
|
|
31423
|
-
message +=
|
|
31844
|
+
message += chalk17__default.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
31424
31845
|
} else if (hasWarnings) {
|
|
31425
|
-
message +=
|
|
31846
|
+
message += chalk17__default.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
31426
31847
|
} else {
|
|
31427
|
-
message +=
|
|
31848
|
+
message += chalk17__default.default.green("\u2705 All systems operational");
|
|
31428
31849
|
}
|
|
31429
31850
|
return {
|
|
31430
31851
|
ok: true,
|
|
@@ -31442,12 +31863,12 @@ var init_SystemHandlers = __esm({
|
|
|
31442
31863
|
if (signal?.aborted) {
|
|
31443
31864
|
return {
|
|
31444
31865
|
ok: false,
|
|
31445
|
-
message:
|
|
31866
|
+
message: chalk17__default.default.yellow("Doctor check canceled")
|
|
31446
31867
|
};
|
|
31447
31868
|
}
|
|
31448
31869
|
const autoFix = args.includes("--fix");
|
|
31449
|
-
let message =
|
|
31450
|
-
message +=
|
|
31870
|
+
let message = chalk17__default.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
31871
|
+
message += chalk17__default.default.gray("Running diagnostics...\n\n");
|
|
31451
31872
|
const issues = [
|
|
31452
31873
|
{
|
|
31453
31874
|
severity: "warning",
|
|
@@ -31469,20 +31890,20 @@ var init_SystemHandlers = __esm({
|
|
|
31469
31890
|
}
|
|
31470
31891
|
];
|
|
31471
31892
|
if (issues.length === 0) {
|
|
31472
|
-
message +=
|
|
31893
|
+
message += chalk17__default.default.green("\u2705 No issues found - system is healthy!");
|
|
31473
31894
|
return { ok: true, message };
|
|
31474
31895
|
}
|
|
31475
|
-
message +=
|
|
31896
|
+
message += chalk17__default.default.yellow(`Found ${issues.length} issue(s):
|
|
31476
31897
|
|
|
31477
31898
|
`);
|
|
31478
31899
|
for (const issue of issues) {
|
|
31479
|
-
const icon = issue.severity === "error" ?
|
|
31900
|
+
const icon = issue.severity === "error" ? chalk17__default.default.red("\u274C") : issue.severity === "warning" ? chalk17__default.default.yellow("\u26A0\uFE0F") : chalk17__default.default.blue("\u2139\uFE0F");
|
|
31480
31901
|
message += `${icon} ${issue.issue}
|
|
31481
31902
|
`;
|
|
31482
|
-
message +=
|
|
31903
|
+
message += chalk17__default.default.gray(` Solution: ${issue.solution}
|
|
31483
31904
|
`);
|
|
31484
31905
|
if (autoFix && issue.fixable) {
|
|
31485
|
-
message +=
|
|
31906
|
+
message += chalk17__default.default.green(` \u2705 Auto-fixed
|
|
31486
31907
|
`);
|
|
31487
31908
|
}
|
|
31488
31909
|
message += "\n";
|
|
@@ -31490,7 +31911,7 @@ var init_SystemHandlers = __esm({
|
|
|
31490
31911
|
if (!autoFix) {
|
|
31491
31912
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
31492
31913
|
if (fixableCount > 0) {
|
|
31493
|
-
message +=
|
|
31914
|
+
message += chalk17__default.default.gray(
|
|
31494
31915
|
`
|
|
31495
31916
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
31496
31917
|
);
|
|
@@ -31933,7 +32354,7 @@ var init_package = __esm({
|
|
|
31933
32354
|
"package.json"() {
|
|
31934
32355
|
package_default = {
|
|
31935
32356
|
name: "@bonginkan/maria",
|
|
31936
|
-
version: "4.2.
|
|
32357
|
+
version: "4.2.5",
|
|
31937
32358
|
description: "\u{1F680} MARIA v4.2.0 - Enterprise AI Development Platform with 100% Command Availability. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
|
|
31938
32359
|
keywords: [
|
|
31939
32360
|
"ai",
|
|
@@ -32449,20 +32870,21 @@ function createCLI() {
|
|
|
32449
32870
|
}
|
|
32450
32871
|
});
|
|
32451
32872
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
32452
|
-
console.log(
|
|
32873
|
+
console.log(chalk17__default.default.cyan("Setting up Ollama..."));
|
|
32453
32874
|
console.log(
|
|
32454
|
-
|
|
32875
|
+
chalk17__default.default.yellow("Please run: brew install ollama && ollama serve")
|
|
32455
32876
|
);
|
|
32456
32877
|
});
|
|
32457
32878
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
32458
|
-
console.log(
|
|
32459
|
-
console.log(
|
|
32879
|
+
console.log(chalk17__default.default.cyan("Setting up vLLM..."));
|
|
32880
|
+
console.log(chalk17__default.default.yellow("Please run: pip install vllm"));
|
|
32460
32881
|
});
|
|
32461
32882
|
return program2;
|
|
32462
32883
|
}
|
|
32463
32884
|
var MariaAI;
|
|
32464
32885
|
var init_maria_ai = __esm({
|
|
32465
32886
|
"src/maria-ai.ts"() {
|
|
32887
|
+
init_startup_display();
|
|
32466
32888
|
init_provider_selector();
|
|
32467
32889
|
init_config2();
|
|
32468
32890
|
init_IntelligentRouterService();
|
|
@@ -32479,16 +32901,17 @@ var init_maria_ai = __esm({
|
|
|
32479
32901
|
}
|
|
32480
32902
|
async initialize() {
|
|
32481
32903
|
try {
|
|
32904
|
+
displayStartupLogo();
|
|
32482
32905
|
await this.providerSelector.initialize();
|
|
32483
32906
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
32484
32907
|
console.log(
|
|
32485
|
-
|
|
32908
|
+
chalk17__default.default.green(`
|
|
32486
32909
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
32487
32910
|
);
|
|
32488
32911
|
this.config.set("currentProvider", provider);
|
|
32489
32912
|
this.config.set("currentModel", model);
|
|
32490
32913
|
await this.config.save();
|
|
32491
|
-
console.log(
|
|
32914
|
+
console.log(chalk17__default.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
32492
32915
|
this.router = new IntelligentRouterService({
|
|
32493
32916
|
confidenceThreshold: 0.85,
|
|
32494
32917
|
enableLearning: true,
|
|
@@ -32496,12 +32919,12 @@ var init_maria_ai = __esm({
|
|
|
32496
32919
|
});
|
|
32497
32920
|
await this.router.initialize();
|
|
32498
32921
|
console.log(
|
|
32499
|
-
|
|
32922
|
+
chalk17__default.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
32500
32923
|
);
|
|
32501
32924
|
this.session = createInteractiveSession(this);
|
|
32502
32925
|
await this.session.start();
|
|
32503
32926
|
} catch (error2) {
|
|
32504
|
-
console.error(
|
|
32927
|
+
console.error(chalk17__default.default.red("\n\u274C Initialization failed:"), error2);
|
|
32505
32928
|
process.exit(1);
|
|
32506
32929
|
}
|
|
32507
32930
|
}
|
|
@@ -32509,7 +32932,7 @@ var init_maria_ai = __esm({
|
|
|
32509
32932
|
if (this.session) {
|
|
32510
32933
|
await this.session.stop();
|
|
32511
32934
|
}
|
|
32512
|
-
console.log(
|
|
32935
|
+
console.log(chalk17__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
32513
32936
|
}
|
|
32514
32937
|
};
|
|
32515
32938
|
}
|
|
@@ -32538,8 +32961,8 @@ async function loadServices() {
|
|
|
32538
32961
|
try {
|
|
32539
32962
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32540
32963
|
if (commandName === "battlecard") {
|
|
32541
|
-
console.log(
|
|
32542
|
-
console.log(
|
|
32964
|
+
console.log(chalk17__default.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
32965
|
+
console.log(chalk17__default.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32543
32966
|
return {
|
|
32544
32967
|
success: false,
|
|
32545
32968
|
message: "Command not available on Free plan"
|
|
@@ -32600,7 +33023,7 @@ async function loadServices() {
|
|
|
32600
33023
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32601
33024
|
}
|
|
32602
33025
|
} catch (e2) {
|
|
32603
|
-
console.warn(
|
|
33026
|
+
console.warn(chalk17__default.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32604
33027
|
}
|
|
32605
33028
|
}
|
|
32606
33029
|
async function init() {
|
|
@@ -32714,20 +33137,20 @@ async function enforceAuth(cmd) {
|
|
|
32714
33137
|
try {
|
|
32715
33138
|
const tokens = await authManager.getValidTokens();
|
|
32716
33139
|
if (!tokens) {
|
|
32717
|
-
console.log(
|
|
33140
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32718
33141
|
process.exit(2);
|
|
32719
33142
|
return false;
|
|
32720
33143
|
}
|
|
32721
33144
|
return true;
|
|
32722
33145
|
} catch (error2) {
|
|
32723
33146
|
if (error2.code === "AUTH_REQUIRED") {
|
|
32724
|
-
console.log(
|
|
33147
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32725
33148
|
process.exit(2);
|
|
32726
33149
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
32727
|
-
console.log(
|
|
33150
|
+
console.log(chalk17__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
32728
33151
|
process.exit(2);
|
|
32729
33152
|
} else {
|
|
32730
|
-
console.log(
|
|
33153
|
+
console.log(chalk17__default.default.red("\u{1F310} Network error, check connection"));
|
|
32731
33154
|
process.exit(1);
|
|
32732
33155
|
}
|
|
32733
33156
|
return false;
|
|
@@ -32767,7 +33190,7 @@ async function handleSlash(input3) {
|
|
|
32767
33190
|
console.log(JSON.stringify(result.data, null, 2));
|
|
32768
33191
|
}
|
|
32769
33192
|
} else {
|
|
32770
|
-
console.log(
|
|
33193
|
+
console.log(chalk17__default.default.red(`Help Error: ${result.message}`));
|
|
32771
33194
|
}
|
|
32772
33195
|
return true;
|
|
32773
33196
|
}
|
|
@@ -32775,7 +33198,7 @@ async function handleSlash(input3) {
|
|
|
32775
33198
|
if (process.env.MARIA_DEBUG === "1") {
|
|
32776
33199
|
console.error("HelpCommand error:", helpError);
|
|
32777
33200
|
}
|
|
32778
|
-
console.log(
|
|
33201
|
+
console.log(chalk17__default.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
32779
33202
|
}
|
|
32780
33203
|
const help = `
|
|
32781
33204
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -32800,7 +33223,7 @@ Chat:
|
|
|
32800
33223
|
session.length = 0;
|
|
32801
33224
|
if (ctx?.clearContext) ctx.clearContext();
|
|
32802
33225
|
console.clear();
|
|
32803
|
-
console.log(
|
|
33226
|
+
console.log(chalk17__default.default.cyan("\u2728 Session cleared"));
|
|
32804
33227
|
return true;
|
|
32805
33228
|
}
|
|
32806
33229
|
if (cmd === "code") {
|
|
@@ -32808,7 +33231,7 @@ Chat:
|
|
|
32808
33231
|
const prompt = args.join(" ").trim();
|
|
32809
33232
|
if (!prompt) {
|
|
32810
33233
|
console.log(
|
|
32811
|
-
|
|
33234
|
+
chalk17__default.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
32812
33235
|
);
|
|
32813
33236
|
return true;
|
|
32814
33237
|
}
|
|
@@ -32820,7 +33243,7 @@ Chat:
|
|
|
32820
33243
|
const prompt = args.join(" ").trim();
|
|
32821
33244
|
if (!prompt) {
|
|
32822
33245
|
console.log(
|
|
32823
|
-
|
|
33246
|
+
chalk17__default.default.cyan("\u{1F3A8} **Image Generation**\n") + chalk17__default.default.white("Usage: /image <prompt>\n") + chalk17__default.default.gray("Example: /image \u5BCC\u58EB\u5C71\u306E\u65E5\u306E\u51FA")
|
|
32824
33247
|
);
|
|
32825
33248
|
return true;
|
|
32826
33249
|
}
|
|
@@ -32832,14 +33255,14 @@ Chat:
|
|
|
32832
33255
|
options: {},
|
|
32833
33256
|
logger: {
|
|
32834
33257
|
info: (msg) => console.log(msg),
|
|
32835
|
-
error: (msg) => console.error(
|
|
32836
|
-
warn: (msg) => console.warn(
|
|
33258
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33259
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32837
33260
|
}
|
|
32838
33261
|
};
|
|
32839
33262
|
await imageCommand2.execute(context2);
|
|
32840
33263
|
}
|
|
32841
33264
|
} catch (error2) {
|
|
32842
|
-
console.error(
|
|
33265
|
+
console.error(chalk17__default.default.red("Image generation failed:"), error2.message);
|
|
32843
33266
|
}
|
|
32844
33267
|
return true;
|
|
32845
33268
|
}
|
|
@@ -32848,7 +33271,7 @@ Chat:
|
|
|
32848
33271
|
const prompt = args.join(" ").trim();
|
|
32849
33272
|
if (!prompt) {
|
|
32850
33273
|
console.log(
|
|
32851
|
-
|
|
33274
|
+
chalk17__default.default.cyan("\u{1F3AC} **Video Generation**\n") + chalk17__default.default.white("Usage: /video <prompt>\n") + chalk17__default.default.gray("Example: /video \u6D77\u306E\u6CE2\u304C\u6253\u3061\u5BC4\u305B\u308B\u69D8\u5B50")
|
|
32852
33275
|
);
|
|
32853
33276
|
return true;
|
|
32854
33277
|
}
|
|
@@ -32860,14 +33283,14 @@ Chat:
|
|
|
32860
33283
|
options: {},
|
|
32861
33284
|
logger: {
|
|
32862
33285
|
info: (msg) => console.log(msg),
|
|
32863
|
-
error: (msg) => console.error(
|
|
32864
|
-
warn: (msg) => console.warn(
|
|
33286
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33287
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32865
33288
|
}
|
|
32866
33289
|
};
|
|
32867
33290
|
await videoCommand2.execute(context2);
|
|
32868
33291
|
}
|
|
32869
33292
|
} catch (error2) {
|
|
32870
|
-
console.error(
|
|
33293
|
+
console.error(chalk17__default.default.red("Video generation failed:"), error2.message);
|
|
32871
33294
|
}
|
|
32872
33295
|
return true;
|
|
32873
33296
|
}
|
|
@@ -32876,7 +33299,7 @@ Chat:
|
|
|
32876
33299
|
const prompt = args.join(" ").trim();
|
|
32877
33300
|
if (!prompt) {
|
|
32878
33301
|
console.log(
|
|
32879
|
-
|
|
33302
|
+
chalk17__default.default.cyan("\u{1F399}\uFE0F **Voice Synthesis**\n") + chalk17__default.default.white("Usage: /voice <text>\n") + chalk17__default.default.gray("Example: /voice \u3053\u3093\u306B\u3061\u306F\u3001\u5143\u6C17\u3067\u3059\u304B\uFF1F")
|
|
32880
33303
|
);
|
|
32881
33304
|
return true;
|
|
32882
33305
|
}
|
|
@@ -32888,14 +33311,14 @@ Chat:
|
|
|
32888
33311
|
options: {},
|
|
32889
33312
|
logger: {
|
|
32890
33313
|
info: (msg) => console.log(msg),
|
|
32891
|
-
error: (msg) => console.error(
|
|
32892
|
-
warn: (msg) => console.warn(
|
|
33314
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33315
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32893
33316
|
}
|
|
32894
33317
|
};
|
|
32895
33318
|
await voiceCommand2.execute(context2);
|
|
32896
33319
|
}
|
|
32897
33320
|
} catch (error2) {
|
|
32898
|
-
console.error(
|
|
33321
|
+
console.error(chalk17__default.default.red("Voice synthesis failed:"), error2.message);
|
|
32899
33322
|
}
|
|
32900
33323
|
return true;
|
|
32901
33324
|
}
|
|
@@ -32914,36 +33337,36 @@ Chat:
|
|
|
32914
33337
|
if (args.includes("status")) {
|
|
32915
33338
|
if (await authManager.isAuthenticated()) {
|
|
32916
33339
|
const user = await authManager.getCurrentUser();
|
|
32917
|
-
console.log(
|
|
32918
|
-
console.log(
|
|
32919
|
-
console.log(
|
|
33340
|
+
console.log(chalk17__default.default.green("\u2705 Authenticated"));
|
|
33341
|
+
console.log(chalk17__default.default.white(`\u{1F464} User: ${chalk17__default.default.cyan(user.email)}`));
|
|
33342
|
+
console.log(chalk17__default.default.white(`\u{1F4CA} Plan: ${chalk17__default.default.cyan(user.plan)}`));
|
|
32920
33343
|
} else {
|
|
32921
|
-
console.log(
|
|
32922
|
-
console.log(
|
|
33344
|
+
console.log(chalk17__default.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
33345
|
+
console.log(chalk17__default.default.gray("Use /login to sign in"));
|
|
32923
33346
|
}
|
|
32924
33347
|
} else {
|
|
32925
33348
|
const result = await authManager.login(options2);
|
|
32926
33349
|
if (result.success && result.user) {
|
|
32927
|
-
console.log(
|
|
32928
|
-
console.log(
|
|
32929
|
-
console.log(
|
|
33350
|
+
console.log(chalk17__default.default.green("\u2705 Successfully logged in!"));
|
|
33351
|
+
console.log(chalk17__default.default.white(`\u{1F464} User: ${chalk17__default.default.cyan(result.user.email)}`));
|
|
33352
|
+
console.log(chalk17__default.default.white(`\u{1F4CA} Plan: ${chalk17__default.default.cyan(result.user.plan)}`));
|
|
32930
33353
|
} else {
|
|
32931
|
-
console.log(
|
|
32932
|
-
if (result.error) console.log(
|
|
33354
|
+
console.log(chalk17__default.default.red("\u274C Login failed"));
|
|
33355
|
+
if (result.error) console.log(chalk17__default.default.gray(result.error));
|
|
32933
33356
|
}
|
|
32934
33357
|
}
|
|
32935
33358
|
}
|
|
32936
33359
|
} catch (error2) {
|
|
32937
|
-
console.error(
|
|
33360
|
+
console.error(chalk17__default.default.red("Login error:"), error2.message);
|
|
32938
33361
|
}
|
|
32939
33362
|
return true;
|
|
32940
33363
|
}
|
|
32941
33364
|
if (cmd === "logout" || cmd === "signout") {
|
|
32942
33365
|
try {
|
|
32943
33366
|
await authManager.logout();
|
|
32944
|
-
console.log(
|
|
33367
|
+
console.log(chalk17__default.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
32945
33368
|
} catch (error2) {
|
|
32946
|
-
console.error(
|
|
33369
|
+
console.error(chalk17__default.default.red("Logout error:"), error2.message);
|
|
32947
33370
|
}
|
|
32948
33371
|
return true;
|
|
32949
33372
|
}
|
|
@@ -33044,11 +33467,11 @@ Chat:
|
|
|
33044
33467
|
}
|
|
33045
33468
|
}
|
|
33046
33469
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33047
|
-
console.log(
|
|
33048
|
-
console.log(
|
|
33049
|
-
console.log(
|
|
33050
|
-
console.log(
|
|
33051
|
-
console.log(
|
|
33470
|
+
console.log(chalk17__default.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33471
|
+
console.log(chalk17__default.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33472
|
+
console.log(chalk17__default.default.gray(" \u2022 Type /help to see available commands"));
|
|
33473
|
+
console.log(chalk17__default.default.gray(" \u2022 Check if you need to /login first"));
|
|
33474
|
+
console.log(chalk17__default.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33052
33475
|
}
|
|
33053
33476
|
return true;
|
|
33054
33477
|
}
|
|
@@ -33316,11 +33739,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33316
33739
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33317
33740
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33318
33741
|
console.log(
|
|
33319
|
-
|
|
33320
|
-
`) +
|
|
33321
|
-
`) +
|
|
33322
|
-
`) +
|
|
33323
|
-
`) +
|
|
33742
|
+
chalk17__default.default.green("\n\u2705 **Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33743
|
+
`) + chalk17__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33744
|
+
`) + chalk17__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33745
|
+
`) + chalk17__default.default.white(` \u{1F4DD} Language: ${language}
|
|
33746
|
+
`) + chalk17__default.default.dim(`
|
|
33324
33747
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33325
33748
|
);
|
|
33326
33749
|
} else {
|
|
@@ -33329,11 +33752,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33329
33752
|
} catch (e2) {
|
|
33330
33753
|
spinner.stop();
|
|
33331
33754
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33332
|
-
console.error(
|
|
33755
|
+
console.error(chalk17__default.default.red("Code generation error:"), e2.message || e2);
|
|
33333
33756
|
}
|
|
33334
33757
|
const fallbackCode = templateFallback(prompt);
|
|
33335
33758
|
console.log(
|
|
33336
|
-
|
|
33759
|
+
chalk17__default.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33337
33760
|
);
|
|
33338
33761
|
console.log(fallbackCode);
|
|
33339
33762
|
try {
|
|
@@ -33342,14 +33765,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33342
33765
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33343
33766
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33344
33767
|
console.log(
|
|
33345
|
-
|
|
33346
|
-
`) +
|
|
33347
|
-
`) +
|
|
33348
|
-
`) +
|
|
33768
|
+
chalk17__default.default.green("\n\u2705 **Template Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33769
|
+
`) + chalk17__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33770
|
+
`) + chalk17__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33771
|
+
`) + chalk17__default.default.dim(`
|
|
33349
33772
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33350
33773
|
);
|
|
33351
33774
|
} catch (saveError) {
|
|
33352
|
-
console.error(
|
|
33775
|
+
console.error(chalk17__default.default.red("Failed to save code:"), saveError);
|
|
33353
33776
|
}
|
|
33354
33777
|
}
|
|
33355
33778
|
}
|
|
@@ -33405,7 +33828,7 @@ ${userPrompt}`;
|
|
|
33405
33828
|
(seq) => response2.includes(seq)
|
|
33406
33829
|
);
|
|
33407
33830
|
if (guidedFlowDetected) {
|
|
33408
|
-
console.log(
|
|
33831
|
+
console.log(chalk17__default.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33409
33832
|
return null;
|
|
33410
33833
|
}
|
|
33411
33834
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33573,14 +33996,14 @@ async function streamAnswer(text) {
|
|
|
33573
33996
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33574
33997
|
} else {
|
|
33575
33998
|
animation.stop();
|
|
33576
|
-
console.log(
|
|
33999
|
+
console.log(chalk17__default.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33577
34000
|
}
|
|
33578
34001
|
} catch (e2) {
|
|
33579
34002
|
animation.stop();
|
|
33580
34003
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33581
|
-
console.log(
|
|
34004
|
+
console.log(chalk17__default.default.yellow(e2.message));
|
|
33582
34005
|
} else {
|
|
33583
|
-
console.log(
|
|
34006
|
+
console.log(chalk17__default.default.red("Error generating response:"), e2.message || e2);
|
|
33584
34007
|
}
|
|
33585
34008
|
}
|
|
33586
34009
|
}
|
|
@@ -33595,9 +34018,9 @@ async function handleLine(line) {
|
|
|
33595
34018
|
if (consumed) return;
|
|
33596
34019
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33597
34020
|
if (!isAuthenticated) {
|
|
33598
|
-
console.log(
|
|
33599
|
-
console.log(
|
|
33600
|
-
console.log(
|
|
34021
|
+
console.log(chalk17__default.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
34022
|
+
console.log(chalk17__default.default.cyan("Please run: /login"));
|
|
34023
|
+
console.log(chalk17__default.default.gray("Or use slash commands like /help, /version"));
|
|
33601
34024
|
return;
|
|
33602
34025
|
}
|
|
33603
34026
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -33619,7 +34042,7 @@ async function startInteractiveSession() {
|
|
|
33619
34042
|
}
|
|
33620
34043
|
}
|
|
33621
34044
|
const stop = async () => {
|
|
33622
|
-
console.log(
|
|
34045
|
+
console.log(chalk17__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33623
34046
|
if (store?.close) await store.close().catch(() => {
|
|
33624
34047
|
});
|
|
33625
34048
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -33629,7 +34052,7 @@ async function startInteractiveSession() {
|
|
|
33629
34052
|
process.once("SIGINT", stop);
|
|
33630
34053
|
process.once("SIGTERM", stop);
|
|
33631
34054
|
if (!isTTY) {
|
|
33632
|
-
console.log(
|
|
34055
|
+
console.log(chalk17__default.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
33633
34056
|
const rl = readline5__namespace.createInterface({
|
|
33634
34057
|
input: process$1.stdin,
|
|
33635
34058
|
output: process$1.stdout,
|
|
@@ -33644,7 +34067,7 @@ async function startInteractiveSession() {
|
|
|
33644
34067
|
if (interactiveCLI) {
|
|
33645
34068
|
while (true) {
|
|
33646
34069
|
try {
|
|
33647
|
-
const prompt =
|
|
34070
|
+
const prompt = chalk17__default.default.gray("> ");
|
|
33648
34071
|
process.stdout.write(prompt);
|
|
33649
34072
|
const line = await interactiveCLI.question("");
|
|
33650
34073
|
console.log();
|
|
@@ -33659,14 +34082,14 @@ async function startInteractiveSession() {
|
|
|
33659
34082
|
await stop();
|
|
33660
34083
|
return;
|
|
33661
34084
|
}
|
|
33662
|
-
console.error(
|
|
34085
|
+
console.error(chalk17__default.default.red("Error:"), error2?.message || error2);
|
|
33663
34086
|
}
|
|
33664
34087
|
}
|
|
33665
34088
|
} else {
|
|
33666
34089
|
const rl = readline5__namespace.createInterface({ input: process$1.stdin, output: process$1.stdout });
|
|
33667
34090
|
while (true) {
|
|
33668
34091
|
try {
|
|
33669
|
-
const prompt =
|
|
34092
|
+
const prompt = chalk17__default.default.gray("> ");
|
|
33670
34093
|
const line = await rl.question(prompt);
|
|
33671
34094
|
console.log();
|
|
33672
34095
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -33680,7 +34103,7 @@ async function startInteractiveSession() {
|
|
|
33680
34103
|
await stop();
|
|
33681
34104
|
return;
|
|
33682
34105
|
}
|
|
33683
|
-
console.error(
|
|
34106
|
+
console.error(chalk17__default.default.red("Error:"), error2?.message || error2);
|
|
33684
34107
|
}
|
|
33685
34108
|
}
|
|
33686
34109
|
}
|
|
@@ -33690,7 +34113,7 @@ function createCLI2() {
|
|
|
33690
34113
|
program2.name("maria").description(`\u{1F680} MARIA v${getVersion()} - Intelligent AI Assistant`).version(getVersion()).option("--v3-session", "Use v3 session architecture").option("--no-interactive", "Disable interactive mode for CI/CD").option("--server", "Start HTTP server mode for Cloud Run").action(async (options) => {
|
|
33691
34114
|
loadEnvironmentVariables();
|
|
33692
34115
|
if (options.server) {
|
|
33693
|
-
console.log(
|
|
34116
|
+
console.log(chalk17__default.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
33694
34117
|
try {
|
|
33695
34118
|
const serverPath = path8__namespace.join(process.cwd(), "server.mjs");
|
|
33696
34119
|
const { spawn } = await import('child_process');
|
|
@@ -33699,32 +34122,44 @@ function createCLI2() {
|
|
|
33699
34122
|
env: process.env
|
|
33700
34123
|
});
|
|
33701
34124
|
serverProcess.on("error", (error2) => {
|
|
33702
|
-
console.error(
|
|
34125
|
+
console.error(chalk17__default.default.red("\u274C Server process error:"), error2);
|
|
33703
34126
|
process.exit(1);
|
|
33704
34127
|
});
|
|
33705
34128
|
return;
|
|
33706
34129
|
} catch (error2) {
|
|
33707
|
-
console.error(
|
|
34130
|
+
console.error(chalk17__default.default.red("\u274C Failed to start server mode:"), error2);
|
|
33708
34131
|
process.exit(1);
|
|
33709
34132
|
}
|
|
33710
34133
|
}
|
|
34134
|
+
if (!startupDisplayed) {
|
|
34135
|
+
try {
|
|
34136
|
+
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
34137
|
+
displayStartupLogo2();
|
|
34138
|
+
startupDisplayed = true;
|
|
34139
|
+
} catch {
|
|
34140
|
+
console.log(chalk17__default.default.cyan(`
|
|
34141
|
+
\u{1F680} MARIA v${getVersion()}
|
|
34142
|
+
`));
|
|
34143
|
+
startupDisplayed = true;
|
|
34144
|
+
}
|
|
34145
|
+
}
|
|
33711
34146
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
33712
34147
|
if (useV3) {
|
|
33713
34148
|
try {
|
|
33714
|
-
console.log(
|
|
34149
|
+
console.log(chalk17__default.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
33715
34150
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
33716
34151
|
const maria = new MariaAI2();
|
|
33717
34152
|
await maria.initialize();
|
|
33718
34153
|
return;
|
|
33719
34154
|
} catch (e2) {
|
|
33720
|
-
console.warn(
|
|
34155
|
+
console.warn(chalk17__default.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
33721
34156
|
}
|
|
33722
34157
|
}
|
|
33723
34158
|
await startInteractiveSession();
|
|
33724
34159
|
});
|
|
33725
34160
|
return program2;
|
|
33726
34161
|
}
|
|
33727
|
-
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, program;
|
|
34162
|
+
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, startupDisplayed, program;
|
|
33728
34163
|
var init_cli = __esm({
|
|
33729
34164
|
"src/cli.ts"() {
|
|
33730
34165
|
init_env_loader();
|
|
@@ -33733,6 +34168,7 @@ var init_cli = __esm({
|
|
|
33733
34168
|
init_cli_auth();
|
|
33734
34169
|
session = [];
|
|
33735
34170
|
commandManager = null;
|
|
34171
|
+
startupDisplayed = false;
|
|
33736
34172
|
program = createCLI2();
|
|
33737
34173
|
program.parse(process.argv);
|
|
33738
34174
|
}
|