@bonginkan/maria 4.2.4 → 4.2.6
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 +1210 -610
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +1078 -486
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
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
|
+
var secretManager = require('@google-cloud/secret-manager');
|
|
11
12
|
var http = require('http');
|
|
12
13
|
var url = require('url');
|
|
13
14
|
var open = require('open');
|
|
@@ -18,9 +19,10 @@ var buffer = require('buffer');
|
|
|
18
19
|
var net = require('net');
|
|
19
20
|
var https = require('https');
|
|
20
21
|
var zlib = require('zlib');
|
|
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
|
|
@@ -683,34 +685,212 @@ var init_TokenStorage = __esm({
|
|
|
683
685
|
};
|
|
684
686
|
}
|
|
685
687
|
});
|
|
688
|
+
var AuthSecretManager;
|
|
689
|
+
var init_AuthSecretManager = __esm({
|
|
690
|
+
"src/services/cli-auth/AuthSecretManager.ts"() {
|
|
691
|
+
AuthSecretManager = class {
|
|
692
|
+
client;
|
|
693
|
+
cache = /* @__PURE__ */ new Map();
|
|
694
|
+
cacheExpiry = /* @__PURE__ */ new Map();
|
|
695
|
+
CACHE_TTL = 36e5;
|
|
696
|
+
// 1 hour
|
|
697
|
+
projectId;
|
|
698
|
+
constructor() {
|
|
699
|
+
this.projectId = process.env.GCLOUD_PROJECT || "maria-code-470602";
|
|
700
|
+
this.client = new secretManager.SecretManagerServiceClient();
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Get authentication configuration from Secret Manager
|
|
704
|
+
*/
|
|
705
|
+
async getAuthConfig() {
|
|
706
|
+
const [authBase, apiBase, clientId] = await Promise.all([
|
|
707
|
+
this.getSecret("maria-auth-server-url").catch(() => null),
|
|
708
|
+
this.getSecret("maria-api-server-url").catch(() => null),
|
|
709
|
+
this.getSecret("maria-cli-client-id").catch(() => null)
|
|
710
|
+
]);
|
|
711
|
+
return {
|
|
712
|
+
authBase: authBase || this.getAuthBaseUrlFallback(),
|
|
713
|
+
apiBase: apiBase || this.getApiBaseUrlFallback(),
|
|
714
|
+
clientId: clientId || process.env.MARIA_CLIENT_ID || "maria-cli"
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Get a specific secret from Secret Manager
|
|
719
|
+
*/
|
|
720
|
+
async getSecret(secretName) {
|
|
721
|
+
const cached = this.getCachedSecret(secretName);
|
|
722
|
+
if (cached) {
|
|
723
|
+
return cached;
|
|
724
|
+
}
|
|
725
|
+
try {
|
|
726
|
+
const name2 = `projects/${this.projectId}/secrets/${secretName}/versions/latest`;
|
|
727
|
+
const [version] = await this.client.accessSecretVersion({ name: name2 });
|
|
728
|
+
const payload = version.payload?.data;
|
|
729
|
+
if (!payload) {
|
|
730
|
+
return null;
|
|
731
|
+
}
|
|
732
|
+
const secret = payload.toString();
|
|
733
|
+
this.cacheSecret(secretName, secret);
|
|
734
|
+
return secret;
|
|
735
|
+
} catch (error2) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Get all OAuth configuration secrets
|
|
741
|
+
*/
|
|
742
|
+
async getOAuthSecrets() {
|
|
743
|
+
const secretNames = [
|
|
744
|
+
"google-client-id",
|
|
745
|
+
"google-client-secret",
|
|
746
|
+
"github-client-id",
|
|
747
|
+
"github-client-secret",
|
|
748
|
+
"nextauth-secret",
|
|
749
|
+
"firebase-project-id",
|
|
750
|
+
"session-keys"
|
|
751
|
+
];
|
|
752
|
+
const results = await Promise.allSettled(
|
|
753
|
+
secretNames.map((name2) => this.getSecret(name2))
|
|
754
|
+
);
|
|
755
|
+
return {
|
|
756
|
+
googleClientId: results[0].status === "fulfilled" ? results[0].value || void 0 : void 0,
|
|
757
|
+
googleClientSecret: results[1].status === "fulfilled" ? results[1].value || void 0 : void 0,
|
|
758
|
+
githubClientId: results[2].status === "fulfilled" ? results[2].value || void 0 : void 0,
|
|
759
|
+
githubClientSecret: results[3].status === "fulfilled" ? results[3].value || void 0 : void 0,
|
|
760
|
+
nextAuthSecret: results[4].status === "fulfilled" ? results[4].value || void 0 : void 0,
|
|
761
|
+
firebaseProjectId: results[5].status === "fulfilled" ? results[5].value || void 0 : void 0,
|
|
762
|
+
sessionKeys: results[6].status === "fulfilled" ? results[6].value || void 0 : void 0
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Cache a secret value
|
|
767
|
+
*/
|
|
768
|
+
cacheSecret(name2, value) {
|
|
769
|
+
this.cache.set(name2, value);
|
|
770
|
+
this.cacheExpiry.set(name2, Date.now() + this.CACHE_TTL);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Get cached secret if not expired
|
|
774
|
+
*/
|
|
775
|
+
getCachedSecret(name2) {
|
|
776
|
+
const expiry = this.cacheExpiry.get(name2);
|
|
777
|
+
if (!expiry || Date.now() > expiry) {
|
|
778
|
+
this.cache.delete(name2);
|
|
779
|
+
this.cacheExpiry.delete(name2);
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
return this.cache.get(name2) || null;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Clear all cached secrets
|
|
786
|
+
*/
|
|
787
|
+
clearCache() {
|
|
788
|
+
this.cache.clear();
|
|
789
|
+
this.cacheExpiry.clear();
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Fallback for auth base URL
|
|
793
|
+
*/
|
|
794
|
+
getAuthBaseUrlFallback() {
|
|
795
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
796
|
+
return "http://localhost:3001";
|
|
797
|
+
}
|
|
798
|
+
if (process.env.MARIA_AUTH_BASE) {
|
|
799
|
+
return process.env.MARIA_AUTH_BASE;
|
|
800
|
+
}
|
|
801
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
802
|
+
return cloudRunUrl;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Fallback for API base URL
|
|
806
|
+
*/
|
|
807
|
+
getApiBaseUrlFallback() {
|
|
808
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
809
|
+
return "http://localhost:3000/api";
|
|
810
|
+
}
|
|
811
|
+
if (process.env.MARIA_API_BASE) {
|
|
812
|
+
return process.env.MARIA_API_BASE;
|
|
813
|
+
}
|
|
814
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
815
|
+
return cloudRunApiUrl;
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
new AuthSecretManager();
|
|
819
|
+
}
|
|
820
|
+
});
|
|
686
821
|
var AuthenticationManager, authManager;
|
|
687
822
|
var init_AuthenticationManager = __esm({
|
|
688
823
|
"src/services/cli-auth/AuthenticationManager.ts"() {
|
|
689
824
|
init_types();
|
|
690
825
|
init_TokenStorage();
|
|
826
|
+
init_AuthSecretManager();
|
|
691
827
|
AuthenticationManager = class {
|
|
692
828
|
tokenStorage;
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
829
|
+
secretManager;
|
|
830
|
+
authBase = "";
|
|
831
|
+
apiBase = "";
|
|
832
|
+
clientId = "";
|
|
833
|
+
initialized = false;
|
|
834
|
+
initPromise = null;
|
|
696
835
|
REFRESH_THRESHOLD = 5 * 60 * 1e3;
|
|
697
836
|
// 5 minutes
|
|
698
837
|
CLOCK_SKEW = 2 * 60 * 1e3;
|
|
699
838
|
// 2 minutes clock skew tolerance
|
|
700
839
|
constructor() {
|
|
701
840
|
this.tokenStorage = new TokenStorage();
|
|
702
|
-
this.
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
841
|
+
this.secretManager = new AuthSecretManager();
|
|
842
|
+
this.initPromise = this.initialize();
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Initialize configuration from Secret Manager
|
|
846
|
+
*/
|
|
847
|
+
async initialize() {
|
|
848
|
+
try {
|
|
849
|
+
const config2 = await this.secretManager.getAuthConfig();
|
|
850
|
+
this.authBase = config2.authBase;
|
|
851
|
+
this.apiBase = config2.apiBase;
|
|
852
|
+
this.clientId = config2.clientId;
|
|
853
|
+
this.initialized = true;
|
|
854
|
+
} catch (error2) {
|
|
855
|
+
this.authBase = this.getAuthBaseUrl();
|
|
856
|
+
this.apiBase = this.getApiBaseUrl();
|
|
857
|
+
this.clientId = process.env.MARIA_CLIENT_ID || "maria-cli";
|
|
858
|
+
this.initialized = true;
|
|
706
859
|
}
|
|
707
|
-
|
|
708
|
-
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Ensure the manager is initialized before use
|
|
863
|
+
*/
|
|
864
|
+
async ensureInitialized() {
|
|
865
|
+
if (!this.initialized && this.initPromise) {
|
|
866
|
+
await this.initPromise;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
getAuthBaseUrl() {
|
|
870
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
871
|
+
return "http://localhost:3001";
|
|
872
|
+
}
|
|
873
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
874
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
875
|
+
return "https://auth.maria-code.ai";
|
|
876
|
+
}
|
|
877
|
+
return cloudRunUrl;
|
|
878
|
+
}
|
|
879
|
+
getApiBaseUrl() {
|
|
880
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
881
|
+
return "http://localhost:3000/api";
|
|
882
|
+
}
|
|
883
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
884
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
885
|
+
return "https://api.maria-code.ai";
|
|
886
|
+
}
|
|
887
|
+
return cloudRunApiUrl;
|
|
709
888
|
}
|
|
710
889
|
/**
|
|
711
890
|
* Check if user is authenticated
|
|
712
891
|
*/
|
|
713
892
|
async isAuthenticated() {
|
|
893
|
+
await this.ensureInitialized();
|
|
714
894
|
try {
|
|
715
895
|
const tokens = await this.tokenStorage.load();
|
|
716
896
|
if (!tokens) return false;
|
|
@@ -726,6 +906,7 @@ var init_AuthenticationManager = __esm({
|
|
|
726
906
|
* Require authenticated user (throws if not authenticated)
|
|
727
907
|
*/
|
|
728
908
|
async requireUser() {
|
|
909
|
+
await this.ensureInitialized();
|
|
729
910
|
if (!await this.isAuthenticated()) {
|
|
730
911
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
731
912
|
}
|
|
@@ -735,6 +916,26 @@ var init_AuthenticationManager = __esm({
|
|
|
735
916
|
* Get current authenticated user
|
|
736
917
|
*/
|
|
737
918
|
async getCurrentUser() {
|
|
919
|
+
await this.ensureInitialized();
|
|
920
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
921
|
+
const tokens2 = await this.tokenStorage.load();
|
|
922
|
+
if (!tokens2) {
|
|
923
|
+
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
924
|
+
}
|
|
925
|
+
return {
|
|
926
|
+
id: "local-dev-user",
|
|
927
|
+
email: "developer@localhost",
|
|
928
|
+
name: "Local Developer",
|
|
929
|
+
plan: "ULTRA",
|
|
930
|
+
usage: {
|
|
931
|
+
requests: Math.floor(Math.random() * 100),
|
|
932
|
+
// Random usage for testing
|
|
933
|
+
requestLimit: 999999,
|
|
934
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
935
|
+
},
|
|
936
|
+
models: []
|
|
937
|
+
};
|
|
938
|
+
}
|
|
738
939
|
const tokens = await this.getValidTokens();
|
|
739
940
|
if (!tokens) {
|
|
740
941
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
@@ -755,7 +956,8 @@ var init_AuthenticationManager = __esm({
|
|
|
755
956
|
if (!response2.ok) {
|
|
756
957
|
throw new Error(`Failed to fetch user profile: ${response2.statusText}`);
|
|
757
958
|
}
|
|
758
|
-
|
|
959
|
+
const userData = await response2.json();
|
|
960
|
+
return userData;
|
|
759
961
|
} catch (error2) {
|
|
760
962
|
if (error2 instanceof AuthenticationRequiredError || error2 instanceof QuotaExceededError) {
|
|
761
963
|
throw error2;
|
|
@@ -767,11 +969,15 @@ var init_AuthenticationManager = __esm({
|
|
|
767
969
|
* Login with OAuth2 PKCE flow
|
|
768
970
|
*/
|
|
769
971
|
async login(options = {}) {
|
|
972
|
+
await this.ensureInitialized();
|
|
770
973
|
try {
|
|
771
974
|
if (await this.isAuthenticated() && !options.force) {
|
|
772
975
|
const user2 = await this.getCurrentUser();
|
|
773
976
|
return { success: true, user: user2 };
|
|
774
977
|
}
|
|
978
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
979
|
+
return await this.loginWithLocalMock();
|
|
980
|
+
}
|
|
775
981
|
let tokens;
|
|
776
982
|
if (options.device) {
|
|
777
983
|
tokens = await this.loginWithDeviceFlow();
|
|
@@ -779,6 +985,19 @@ var init_AuthenticationManager = __esm({
|
|
|
779
985
|
try {
|
|
780
986
|
tokens = await this.loginWithPKCEFlow();
|
|
781
987
|
} catch (error2) {
|
|
988
|
+
if (error2.message?.includes("ECONNREFUSED") || error2.message?.includes("fetch failed")) {
|
|
989
|
+
console.error("\n\u274C Authentication service is currently unavailable");
|
|
990
|
+
console.error("Please try one of the following:");
|
|
991
|
+
console.error("1. Set MARIA_AUTH_MODE=local for local development");
|
|
992
|
+
console.error("2. Check your internet connection");
|
|
993
|
+
console.error("3. Visit https://status.maria-code.ai for service status\n");
|
|
994
|
+
if (!process.env.MARIA_AUTH_MODE) {
|
|
995
|
+
console.log("\u{1F4A1} Tip: Run with local auth mode:");
|
|
996
|
+
console.log(" export MARIA_AUTH_MODE=local");
|
|
997
|
+
console.log(" maria /login\n");
|
|
998
|
+
}
|
|
999
|
+
throw new Error("Authentication service unavailable. See above for alternatives.");
|
|
1000
|
+
}
|
|
782
1001
|
console.warn("PKCE flow failed, falling back to device flow");
|
|
783
1002
|
tokens = await this.loginWithDeviceFlow();
|
|
784
1003
|
}
|
|
@@ -793,10 +1012,46 @@ var init_AuthenticationManager = __esm({
|
|
|
793
1012
|
};
|
|
794
1013
|
}
|
|
795
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Local mock authentication for development
|
|
1017
|
+
*/
|
|
1018
|
+
async loginWithLocalMock() {
|
|
1019
|
+
console.log("\u{1F510} Local Development Mode - Mock Authentication");
|
|
1020
|
+
const mockTokens = {
|
|
1021
|
+
idToken: "mock-id-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
1022
|
+
accessToken: "mock-access-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
1023
|
+
refreshToken: "mock-refresh-token-" + crypto2__default.default.randomBytes(16).toString("hex"),
|
|
1024
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1e3
|
|
1025
|
+
// 24 hours
|
|
1026
|
+
};
|
|
1027
|
+
await this.tokenStorage.save(mockTokens);
|
|
1028
|
+
const mockUser = {
|
|
1029
|
+
id: "local-dev-user",
|
|
1030
|
+
email: "developer@localhost",
|
|
1031
|
+
name: "Local Developer",
|
|
1032
|
+
plan: "ULTRA",
|
|
1033
|
+
// Give full access in dev mode
|
|
1034
|
+
usage: {
|
|
1035
|
+
requests: 0,
|
|
1036
|
+
requestLimit: 999999,
|
|
1037
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
1038
|
+
},
|
|
1039
|
+
models: []
|
|
1040
|
+
};
|
|
1041
|
+
console.log("\u2705 Logged in as developer@localhost (Local Mode)");
|
|
1042
|
+
console.log(" Plan: Ultra (Development)");
|
|
1043
|
+
console.log(" All features enabled for testing\n");
|
|
1044
|
+
return {
|
|
1045
|
+
success: true,
|
|
1046
|
+
user: mockUser,
|
|
1047
|
+
tokens: mockTokens
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
796
1050
|
/**
|
|
797
1051
|
* Logout and clean up
|
|
798
1052
|
*/
|
|
799
1053
|
async logout(options = {}) {
|
|
1054
|
+
await this.ensureInitialized();
|
|
800
1055
|
try {
|
|
801
1056
|
const tokens = await this.tokenStorage.load();
|
|
802
1057
|
if (tokens && !options.force) {
|
|
@@ -818,6 +1073,7 @@ var init_AuthenticationManager = __esm({
|
|
|
818
1073
|
* Refresh authentication token
|
|
819
1074
|
*/
|
|
820
1075
|
async refreshToken() {
|
|
1076
|
+
await this.ensureInitialized();
|
|
821
1077
|
try {
|
|
822
1078
|
const tokens = await this.tokenStorage.load();
|
|
823
1079
|
if (!tokens?.refreshToken) return false;
|
|
@@ -954,9 +1210,9 @@ var init_AuthenticationManager = __esm({
|
|
|
954
1210
|
* Generate PKCE parameters
|
|
955
1211
|
*/
|
|
956
1212
|
generatePKCEParams() {
|
|
957
|
-
const codeVerifier =
|
|
958
|
-
const codeChallenge =
|
|
959
|
-
const state =
|
|
1213
|
+
const codeVerifier = crypto2__default.default.randomBytes(32).toString("base64url");
|
|
1214
|
+
const codeChallenge = crypto2__default.default.createHash("sha256").update(codeVerifier).digest("base64url");
|
|
1215
|
+
const state = crypto2__default.default.randomBytes(16).toString("hex");
|
|
960
1216
|
return { codeVerifier, codeChallenge, state };
|
|
961
1217
|
}
|
|
962
1218
|
/**
|
|
@@ -1119,7 +1375,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1119
1375
|
*/
|
|
1120
1376
|
secureCompare(a2, b) {
|
|
1121
1377
|
if (a2.length !== b.length) return false;
|
|
1122
|
-
return
|
|
1378
|
+
return crypto2__default.default.timingSafeEqual(Buffer.from(a2), Buffer.from(b));
|
|
1123
1379
|
}
|
|
1124
1380
|
/**
|
|
1125
1381
|
* HTML page for successful authentication
|
|
@@ -1198,7 +1454,7 @@ function withAuth(fn) {
|
|
|
1198
1454
|
try {
|
|
1199
1455
|
const tokens = await authManager.getValidTokens();
|
|
1200
1456
|
if (!tokens) {
|
|
1201
|
-
console.log(
|
|
1457
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1202
1458
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1203
1459
|
}
|
|
1204
1460
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -1207,28 +1463,28 @@ function withAuth(fn) {
|
|
|
1207
1463
|
return await fn(...args);
|
|
1208
1464
|
} catch (error2) {
|
|
1209
1465
|
if (error2.code === "AUTH_REQUIRED") {
|
|
1210
|
-
console.log(
|
|
1466
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1211
1467
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1212
1468
|
}
|
|
1213
1469
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
1214
|
-
console.log(
|
|
1470
|
+
console.log(chalk17__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
1215
1471
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
1216
1472
|
}
|
|
1217
1473
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
1218
|
-
console.log(
|
|
1474
|
+
console.log(chalk17__default.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
1219
1475
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
1220
1476
|
}
|
|
1221
1477
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
1222
|
-
console.log(
|
|
1478
|
+
console.log(chalk17__default.default.yellow("\u{1F512} Not available in current plan"));
|
|
1223
1479
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
1224
1480
|
}
|
|
1225
1481
|
if (error2.code === "RATE_LIMITED") {
|
|
1226
1482
|
const retryAfter = error2.retryAfter || 5;
|
|
1227
|
-
console.log(
|
|
1483
|
+
console.log(chalk17__default.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
1228
1484
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
1229
1485
|
}
|
|
1230
1486
|
if (error2.code === "NETWORK_ERROR") {
|
|
1231
|
-
console.log(
|
|
1487
|
+
console.log(chalk17__default.default.red("\u{1F310} Network error, check connection"));
|
|
1232
1488
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
1233
1489
|
}
|
|
1234
1490
|
throw error2;
|
|
@@ -1258,7 +1514,7 @@ var init_withAuth = __esm({
|
|
|
1258
1514
|
});
|
|
1259
1515
|
function rng() {
|
|
1260
1516
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
1261
|
-
|
|
1517
|
+
crypto2__default.default.randomFillSync(rnds8Pool);
|
|
1262
1518
|
poolPtr = 0;
|
|
1263
1519
|
}
|
|
1264
1520
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
@@ -1288,7 +1544,7 @@ var native_default;
|
|
|
1288
1544
|
var init_native = __esm({
|
|
1289
1545
|
"node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js"() {
|
|
1290
1546
|
native_default = {
|
|
1291
|
-
randomUUID:
|
|
1547
|
+
randomUUID: crypto2__default.default.randomUUID
|
|
1292
1548
|
};
|
|
1293
1549
|
}
|
|
1294
1550
|
});
|
|
@@ -9215,16 +9471,12 @@ var init_SecretManagerIntegration = __esm({
|
|
|
9215
9471
|
const [version] = await this.client.accessSecretVersion({ name: name2 });
|
|
9216
9472
|
const payload = version.payload?.data;
|
|
9217
9473
|
if (!payload) {
|
|
9218
|
-
console.error(`Secret ${secretName} has no payload`);
|
|
9219
9474
|
return void 0;
|
|
9220
9475
|
}
|
|
9221
9476
|
const secret = payload.toString();
|
|
9222
9477
|
this.cacheSecret(secretName, secret);
|
|
9223
9478
|
return secret;
|
|
9224
9479
|
} catch (error2) {
|
|
9225
|
-
if (error2.code !== 5) {
|
|
9226
|
-
console.error(`Failed to access secret ${secretName}:`, error2);
|
|
9227
|
-
}
|
|
9228
9480
|
return this.getFallbackFromEnv(provider);
|
|
9229
9481
|
}
|
|
9230
9482
|
}
|
|
@@ -9307,7 +9559,6 @@ var init_SecretManagerIntegration = __esm({
|
|
|
9307
9559
|
this.cacheExpiry.delete(secretName);
|
|
9308
9560
|
return true;
|
|
9309
9561
|
} catch (error2) {
|
|
9310
|
-
console.error(`Failed to create/update secret ${secretName}:`, error2);
|
|
9311
9562
|
return false;
|
|
9312
9563
|
}
|
|
9313
9564
|
}
|
|
@@ -12537,21 +12788,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
12537
12788
|
process.stdout.write("\x1B[s");
|
|
12538
12789
|
process.stdout.write("\n");
|
|
12539
12790
|
process.stdout.write(
|
|
12540
|
-
"\x1B[K" +
|
|
12791
|
+
"\x1B[K" + chalk17__default.default.white(
|
|
12541
12792
|
"\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
12793
|
) + "\n"
|
|
12543
12794
|
);
|
|
12544
12795
|
this.suggestions.forEach((suggestion, index) => {
|
|
12545
12796
|
const isSelected = index === this.selectedIndex;
|
|
12546
|
-
const prefix = isSelected ?
|
|
12547
|
-
const nameStyle = isSelected ?
|
|
12797
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
12798
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse : (s2) => s2;
|
|
12548
12799
|
const displayName = suggestion.name.padEnd(20);
|
|
12549
12800
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
12550
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
12801
|
+
const line = `\u2502${prefix}${nameStyle(chalk17__default.default.white(displayName) + " " + chalk17__default.default.gray(displayDesc))} \u2502`;
|
|
12551
12802
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
12552
12803
|
});
|
|
12553
12804
|
process.stdout.write(
|
|
12554
|
-
"\x1B[K" +
|
|
12805
|
+
"\x1B[K" + chalk17__default.default.white(
|
|
12555
12806
|
"\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
12807
|
) + "\n"
|
|
12557
12808
|
);
|
|
@@ -12965,7 +13216,7 @@ var init_interactive_cli = __esm({
|
|
|
12965
13216
|
}
|
|
12966
13217
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
12967
13218
|
readline__namespace.clearLine(process.stdout, 0);
|
|
12968
|
-
const prompt =
|
|
13219
|
+
const prompt = chalk17__default.default.cyan("> ");
|
|
12969
13220
|
const displayInput = this.currentInput;
|
|
12970
13221
|
process.stdout.write(prompt + displayInput);
|
|
12971
13222
|
const promptLength = 2;
|
|
@@ -12985,9 +13236,9 @@ var init_interactive_cli = __esm({
|
|
|
12985
13236
|
readline__namespace.moveCursor(process.stdout, 0, 2);
|
|
12986
13237
|
this.suggestions.forEach((suggestion, index) => {
|
|
12987
13238
|
const isSelected = index === this.selectedIndex;
|
|
12988
|
-
const prefix = isSelected ?
|
|
12989
|
-
const nameStyle = isSelected ?
|
|
12990
|
-
const descStyle = isSelected ?
|
|
13239
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
13240
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse.white : chalk17__default.default.white;
|
|
13241
|
+
const descStyle = isSelected ? chalk17__default.default.inverse.gray : chalk17__default.default.gray;
|
|
12991
13242
|
const name2 = suggestion.name.padEnd(15);
|
|
12992
13243
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
12993
13244
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
@@ -13008,20 +13259,20 @@ var init_interactive_cli = __esm({
|
|
|
13008
13259
|
const promptLength = 2;
|
|
13009
13260
|
const savedX = this.cursorPosition + promptLength;
|
|
13010
13261
|
process.stdout.write("\n");
|
|
13011
|
-
process.stdout.write(
|
|
13262
|
+
process.stdout.write(chalk17__default.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
13012
13263
|
this.suggestions.forEach((suggestion, index) => {
|
|
13013
13264
|
const isSelected = index === this.selectedIndex;
|
|
13014
|
-
const prefix = isSelected ?
|
|
13015
|
-
const nameStyle = isSelected ?
|
|
13016
|
-
const descStyle = isSelected ?
|
|
13265
|
+
const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
|
|
13266
|
+
const nameStyle = isSelected ? chalk17__default.default.inverse.white : chalk17__default.default.white;
|
|
13267
|
+
const descStyle = isSelected ? chalk17__default.default.inverse.gray : chalk17__default.default.gray;
|
|
13017
13268
|
const name2 = suggestion.name.padEnd(15);
|
|
13018
13269
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
13019
13270
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
13020
13271
|
`);
|
|
13021
13272
|
});
|
|
13022
|
-
process.stdout.write(
|
|
13273
|
+
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
13274
|
process.stdout.write(
|
|
13024
|
-
|
|
13275
|
+
chalk17__default.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
13025
13276
|
);
|
|
13026
13277
|
const totalLines = this.suggestions.length + 4;
|
|
13027
13278
|
readline__namespace.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -13121,27 +13372,27 @@ var init_logger = __esm({
|
|
|
13121
13372
|
}
|
|
13122
13373
|
debug(...args) {
|
|
13123
13374
|
if (this.level <= 0 /* DEBUG */) {
|
|
13124
|
-
console.log(
|
|
13375
|
+
console.log(chalk17__default.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
13125
13376
|
}
|
|
13126
13377
|
}
|
|
13127
13378
|
info(...args) {
|
|
13128
13379
|
if (this.level <= 1 /* INFO */) {
|
|
13129
|
-
console.log(
|
|
13380
|
+
console.log(chalk17__default.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
13130
13381
|
}
|
|
13131
13382
|
}
|
|
13132
13383
|
warn(...args) {
|
|
13133
13384
|
if (this.level <= 2 /* WARN */) {
|
|
13134
|
-
console.warn(
|
|
13385
|
+
console.warn(chalk17__default.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
13135
13386
|
}
|
|
13136
13387
|
}
|
|
13137
13388
|
error(...args) {
|
|
13138
13389
|
if (this.level <= 3 /* ERROR */) {
|
|
13139
|
-
console.error(
|
|
13390
|
+
console.error(chalk17__default.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
13140
13391
|
}
|
|
13141
13392
|
}
|
|
13142
13393
|
success(...args) {
|
|
13143
13394
|
if (this.level <= 1 /* INFO */) {
|
|
13144
|
-
console.log(
|
|
13395
|
+
console.log(chalk17__default.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
13145
13396
|
}
|
|
13146
13397
|
}
|
|
13147
13398
|
task(taskName, status, message) {
|
|
@@ -13155,10 +13406,10 @@ var init_logger = __esm({
|
|
|
13155
13406
|
error: "\u274C"
|
|
13156
13407
|
};
|
|
13157
13408
|
const statusColors = {
|
|
13158
|
-
start:
|
|
13159
|
-
progress:
|
|
13160
|
-
complete:
|
|
13161
|
-
error:
|
|
13409
|
+
start: chalk17__default.default.bold.magenta,
|
|
13410
|
+
progress: chalk17__default.default.magenta,
|
|
13411
|
+
complete: chalk17__default.default.bold.magenta,
|
|
13412
|
+
error: chalk17__default.default.bold.magenta
|
|
13162
13413
|
};
|
|
13163
13414
|
const icon = statusIcons[status];
|
|
13164
13415
|
const color = statusColors[status];
|
|
@@ -13175,14 +13426,14 @@ var init_logger = __esm({
|
|
|
13175
13426
|
if (this.level > 0 /* DEBUG */) {
|
|
13176
13427
|
return;
|
|
13177
13428
|
}
|
|
13178
|
-
console.log(
|
|
13429
|
+
console.log(chalk17__default.default.magenta(`${this.prefix} [JSON]`));
|
|
13179
13430
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
13180
13431
|
}
|
|
13181
13432
|
divider() {
|
|
13182
13433
|
if (this.level > 1 /* INFO */) {
|
|
13183
13434
|
return;
|
|
13184
13435
|
}
|
|
13185
|
-
console.log(
|
|
13436
|
+
console.log(chalk17__default.default.magenta("\u2500".repeat(60)));
|
|
13186
13437
|
}
|
|
13187
13438
|
clear() {
|
|
13188
13439
|
console.clear();
|
|
@@ -13202,7 +13453,7 @@ var init_logger = __esm({
|
|
|
13202
13453
|
const progressText = `${current}/${total}`;
|
|
13203
13454
|
const labelText = label ? ` ${label}` : "";
|
|
13204
13455
|
process.stdout.write(
|
|
13205
|
-
`\r${
|
|
13456
|
+
`\r${chalk17__default.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
13206
13457
|
);
|
|
13207
13458
|
if (current === total) {
|
|
13208
13459
|
process.stdout.write("\n");
|
|
@@ -13610,7 +13861,7 @@ var init_quick_persistence = __esm({
|
|
|
13610
13861
|
}
|
|
13611
13862
|
}
|
|
13612
13863
|
static hash(text) {
|
|
13613
|
-
return
|
|
13864
|
+
return crypto2.createHash("sha256").update(text).digest("hex");
|
|
13614
13865
|
}
|
|
13615
13866
|
static async save(mem) {
|
|
13616
13867
|
await this.init();
|
|
@@ -15877,9 +16128,9 @@ var init_HelpCommand = __esm({
|
|
|
15877
16128
|
const stats = await this.readyService.getStatistics();
|
|
15878
16129
|
const lines = [];
|
|
15879
16130
|
lines.push("\u2550".repeat(60));
|
|
15880
|
-
lines.push(
|
|
16131
|
+
lines.push(chalk17__default.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
15881
16132
|
lines.push("");
|
|
15882
|
-
lines.push(
|
|
16133
|
+
lines.push(chalk17__default.default.bold("Quick Access:"));
|
|
15883
16134
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
15884
16135
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
15885
16136
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -15894,7 +16145,7 @@ var init_HelpCommand = __esm({
|
|
|
15894
16145
|
}
|
|
15895
16146
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
15896
16147
|
for (const category of categories) {
|
|
15897
|
-
lines.push(
|
|
16148
|
+
lines.push(chalk17__default.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
15898
16149
|
const showCommands = category.commands.slice(0, 4);
|
|
15899
16150
|
for (const cmd of showCommands) {
|
|
15900
16151
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -15914,7 +16165,7 @@ var init_HelpCommand = __esm({
|
|
|
15914
16165
|
}
|
|
15915
16166
|
lines.push("");
|
|
15916
16167
|
}
|
|
15917
|
-
lines.push(
|
|
16168
|
+
lines.push(chalk17__default.default.bold("Pro Tips:"));
|
|
15918
16169
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
15919
16170
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
15920
16171
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -15953,33 +16204,33 @@ var init_HelpCommand = __esm({
|
|
|
15953
16204
|
formatCommandHelp(command) {
|
|
15954
16205
|
const lines = [];
|
|
15955
16206
|
lines.push("");
|
|
15956
|
-
lines.push(`\u{1F4D6} ${
|
|
16207
|
+
lines.push(`\u{1F4D6} ${chalk17__default.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
15957
16208
|
lines.push("\u2550".repeat(50));
|
|
15958
16209
|
lines.push("");
|
|
15959
|
-
lines.push(
|
|
16210
|
+
lines.push(chalk17__default.default.bold("\u2139\uFE0F Information:"));
|
|
15960
16211
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
15961
16212
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
15962
16213
|
if (command.aliases && command.aliases.length > 0) {
|
|
15963
16214
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
15964
16215
|
}
|
|
15965
16216
|
lines.push("");
|
|
15966
|
-
lines.push(
|
|
16217
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Usage:"));
|
|
15967
16218
|
lines.push(` ${command.usage}`);
|
|
15968
16219
|
lines.push("");
|
|
15969
|
-
lines.push(
|
|
16220
|
+
lines.push(chalk17__default.default.bold("\u{1F4CB} Contract Validation:"));
|
|
15970
16221
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
15971
16222
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15972
16223
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15973
16224
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15974
16225
|
lines.push("");
|
|
15975
16226
|
if (command.examples && command.examples.length > 0) {
|
|
15976
|
-
lines.push(
|
|
16227
|
+
lines.push(chalk17__default.default.bold("\u{1F4DD} Examples:"));
|
|
15977
16228
|
for (const example of command.examples) {
|
|
15978
16229
|
lines.push(` ${example}`);
|
|
15979
16230
|
}
|
|
15980
16231
|
lines.push("");
|
|
15981
16232
|
}
|
|
15982
|
-
lines.push(
|
|
16233
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Quick Tips:"));
|
|
15983
16234
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
15984
16235
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
15985
16236
|
if (command.category !== "core") {
|
|
@@ -16030,7 +16281,7 @@ var init_HelpCommand = __esm({
|
|
|
16030
16281
|
};
|
|
16031
16282
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
16032
16283
|
lines.push("");
|
|
16033
|
-
lines.push(`${emoji} ${
|
|
16284
|
+
lines.push(`${emoji} ${chalk17__default.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
16034
16285
|
lines.push("\u2550".repeat(50));
|
|
16035
16286
|
lines.push("");
|
|
16036
16287
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -16064,7 +16315,7 @@ var init_HelpCommand = __esm({
|
|
|
16064
16315
|
formatSearchResults(searchTerm, results) {
|
|
16065
16316
|
const lines = [];
|
|
16066
16317
|
lines.push("");
|
|
16067
|
-
lines.push(`\u{1F50D} ${
|
|
16318
|
+
lines.push(`\u{1F50D} ${chalk17__default.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
16068
16319
|
lines.push("\u2550".repeat(50));
|
|
16069
16320
|
lines.push("");
|
|
16070
16321
|
for (const result of results) {
|
|
@@ -16077,7 +16328,7 @@ var init_HelpCommand = __esm({
|
|
|
16077
16328
|
}
|
|
16078
16329
|
lines.push("");
|
|
16079
16330
|
}
|
|
16080
|
-
lines.push(
|
|
16331
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
16081
16332
|
lines.push("");
|
|
16082
16333
|
return lines.join("\n");
|
|
16083
16334
|
}
|
|
@@ -16088,38 +16339,38 @@ var init_HelpCommand = __esm({
|
|
|
16088
16339
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
16089
16340
|
const lines = [];
|
|
16090
16341
|
lines.push("");
|
|
16091
|
-
lines.push(`\u{1F680} ${
|
|
16342
|
+
lines.push(`\u{1F680} ${chalk17__default.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
16092
16343
|
lines.push("\u2550".repeat(50));
|
|
16093
16344
|
lines.push("");
|
|
16094
|
-
lines.push(
|
|
16345
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
16095
16346
|
lines.push("");
|
|
16096
|
-
lines.push(
|
|
16347
|
+
lines.push(chalk17__default.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
16097
16348
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
16098
16349
|
if (modelCmd) {
|
|
16099
16350
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
16100
16351
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
16101
16352
|
}
|
|
16102
16353
|
lines.push("");
|
|
16103
|
-
lines.push(
|
|
16354
|
+
lines.push(chalk17__default.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
16104
16355
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
16105
16356
|
if (statusCmd) {
|
|
16106
16357
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
16107
16358
|
lines.push(` Try: /status`);
|
|
16108
16359
|
}
|
|
16109
16360
|
lines.push("");
|
|
16110
|
-
lines.push(
|
|
16361
|
+
lines.push(chalk17__default.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
16111
16362
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
16112
16363
|
if (codeCmd) {
|
|
16113
16364
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
16114
16365
|
lines.push(` Try: /code create a hello world function`);
|
|
16115
16366
|
}
|
|
16116
16367
|
lines.push("");
|
|
16117
|
-
lines.push(
|
|
16368
|
+
lines.push(chalk17__default.default.bold("\u{1F527} Essential Commands:"));
|
|
16118
16369
|
for (const cmd of quickCommands) {
|
|
16119
16370
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
16120
16371
|
}
|
|
16121
16372
|
lines.push("");
|
|
16122
|
-
lines.push(
|
|
16373
|
+
lines.push(chalk17__default.default.bold("\u{1F4A1} Next Steps:"));
|
|
16123
16374
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
16124
16375
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
16125
16376
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -16134,20 +16385,20 @@ var init_HelpCommand = __esm({
|
|
|
16134
16385
|
const categories = await this.readyService.getCategories();
|
|
16135
16386
|
const lines = [];
|
|
16136
16387
|
lines.push("");
|
|
16137
|
-
lines.push(`\u{1F4CA} ${
|
|
16388
|
+
lines.push(`\u{1F4CA} ${chalk17__default.default.bold("READY COMMANDS STATISTICS")}`);
|
|
16138
16389
|
lines.push("\u2550".repeat(40));
|
|
16139
16390
|
lines.push("");
|
|
16140
|
-
lines.push(
|
|
16391
|
+
lines.push(chalk17__default.default.bold("\u{1F3AF} Overall:"));
|
|
16141
16392
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
16142
16393
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
16143
16394
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
16144
16395
|
lines.push("");
|
|
16145
|
-
lines.push(
|
|
16396
|
+
lines.push(chalk17__default.default.bold("\u26A1 Performance:"));
|
|
16146
16397
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
16147
16398
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
16148
16399
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
16149
16400
|
lines.push("");
|
|
16150
|
-
lines.push(
|
|
16401
|
+
lines.push(chalk17__default.default.bold("\u{1F4CB} By Category:"));
|
|
16151
16402
|
for (const category of categories) {
|
|
16152
16403
|
const avgTime = Math.round(
|
|
16153
16404
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -16155,7 +16406,7 @@ var init_HelpCommand = __esm({
|
|
|
16155
16406
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
16156
16407
|
}
|
|
16157
16408
|
lines.push("");
|
|
16158
|
-
lines.push(
|
|
16409
|
+
lines.push(chalk17__default.default.bold("\u2705 Contract Validation:"));
|
|
16159
16410
|
lines.push(" All commands tested for:");
|
|
16160
16411
|
lines.push(" \u2022 Basic execution without crashes");
|
|
16161
16412
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -16329,10 +16580,10 @@ var init_LoginCommand = __esm({
|
|
|
16329
16580
|
if (!authResult.success) {
|
|
16330
16581
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
16331
16582
|
}
|
|
16332
|
-
const
|
|
16333
|
-
const plan =
|
|
16334
|
-
const quotaLeft =
|
|
16335
|
-
const email =
|
|
16583
|
+
const userInfo2 = authResult.user;
|
|
16584
|
+
const plan = userInfo2?.plan || "Free";
|
|
16585
|
+
const quotaLeft = userInfo2?.usage?.requestsRemaining || 100;
|
|
16586
|
+
const email = userInfo2?.email || "user";
|
|
16336
16587
|
await trackCommand({
|
|
16337
16588
|
cmd: "login",
|
|
16338
16589
|
status: "success",
|
|
@@ -16849,8 +17100,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16849
17100
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16850
17101
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16851
17102
|
const _path = await importNodeBuiltin2("path");
|
|
16852
|
-
const
|
|
16853
|
-
const targetPath = configPath || _path.join(
|
|
17103
|
+
const os9 = await importNodeBuiltin2("os");
|
|
17104
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
16854
17105
|
try {
|
|
16855
17106
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
16856
17107
|
return JSON.parse(data2);
|
|
@@ -16868,8 +17119,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16868
17119
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16869
17120
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16870
17121
|
const _path = await importNodeBuiltin2("path");
|
|
16871
|
-
const
|
|
16872
|
-
const targetPath = configPath || _path.join(
|
|
17122
|
+
const os9 = await importNodeBuiltin2("os");
|
|
17123
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
16873
17124
|
try {
|
|
16874
17125
|
if (options?.backup) {
|
|
16875
17126
|
try {
|
|
@@ -17045,7 +17296,7 @@ var init_model_selector_ui = __esm({
|
|
|
17045
17296
|
output: process.stdout,
|
|
17046
17297
|
terminal: true
|
|
17047
17298
|
});
|
|
17048
|
-
console.log(
|
|
17299
|
+
console.log(chalk17__default.default.green(
|
|
17049
17300
|
"\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
17301
|
));
|
|
17051
17302
|
process.stdout.write("\x1B7");
|
|
@@ -17113,14 +17364,14 @@ var init_model_selector_ui = __esm({
|
|
|
17113
17364
|
}
|
|
17114
17365
|
renderFromSavedPosition() {
|
|
17115
17366
|
if (this.isDestroyed) return;
|
|
17116
|
-
console.log(
|
|
17117
|
-
"\u2502 " +
|
|
17367
|
+
console.log(chalk17__default.default.green(
|
|
17368
|
+
"\u2502 " + chalk17__default.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
17118
17369
|
));
|
|
17119
17370
|
this.renderContent();
|
|
17120
17371
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
17121
17372
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
17122
|
-
console.log(
|
|
17123
|
-
console.log(
|
|
17373
|
+
console.log(chalk17__default.default.green("\u2502 ") + chalk17__default.default.dim.green(helpText.padEnd(76)) + chalk17__default.default.green(" \u2502"));
|
|
17374
|
+
console.log(chalk17__default.default.green(
|
|
17124
17375
|
"\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
17376
|
));
|
|
17126
17377
|
}
|
|
@@ -17161,19 +17412,19 @@ var init_model_selector_ui = __esm({
|
|
|
17161
17412
|
const item = displayItems[i2];
|
|
17162
17413
|
if (item.type === "group") {
|
|
17163
17414
|
console.log(
|
|
17164
|
-
|
|
17415
|
+
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
17416
|
);
|
|
17166
17417
|
} else {
|
|
17167
17418
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
17168
|
-
const prefix = isSelected ?
|
|
17419
|
+
const prefix = isSelected ? chalk17__default.default.greenBright("\u25B6 ") : " ";
|
|
17169
17420
|
const modelText = item.content;
|
|
17170
17421
|
if (isSelected) {
|
|
17171
17422
|
console.log(
|
|
17172
|
-
|
|
17423
|
+
chalk17__default.default.green("\u2502") + prefix + chalk17__default.default.black.bgGreen(modelText.padEnd(75)) + chalk17__default.default.green("\u2502")
|
|
17173
17424
|
);
|
|
17174
17425
|
} else {
|
|
17175
17426
|
console.log(
|
|
17176
|
-
|
|
17427
|
+
chalk17__default.default.green("\u2502") + prefix + chalk17__default.default.green(modelText.substring(0, 75).padEnd(75)) + chalk17__default.default.green("\u2502")
|
|
17177
17428
|
);
|
|
17178
17429
|
}
|
|
17179
17430
|
}
|
|
@@ -19398,6 +19649,332 @@ var init_ConfigCommand = __esm({
|
|
|
19398
19649
|
};
|
|
19399
19650
|
}
|
|
19400
19651
|
});
|
|
19652
|
+
function getSafeTerminalWidth() {
|
|
19653
|
+
if (process.env.MARIA_FIXED_WIDTH) {
|
|
19654
|
+
const fixed = Number(process.env.MARIA_FIXED_WIDTH);
|
|
19655
|
+
if (Number.isFinite(fixed) && fixed > 0) {
|
|
19656
|
+
return fixed;
|
|
19657
|
+
}
|
|
19658
|
+
}
|
|
19659
|
+
const isTTY = process.stdout && process.stdout.isTTY;
|
|
19660
|
+
if (isTTY && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
|
|
19661
|
+
return process.stdout.columns;
|
|
19662
|
+
}
|
|
19663
|
+
const envColumns = Number(process.env.COLUMNS);
|
|
19664
|
+
if (Number.isFinite(envColumns) && envColumns > 0) {
|
|
19665
|
+
return envColumns;
|
|
19666
|
+
}
|
|
19667
|
+
if (process.platform === "win32") {
|
|
19668
|
+
try {
|
|
19669
|
+
const { execSync } = __require("child_process");
|
|
19670
|
+
const result = execSync('powershell -command "$host.UI.RawUI.WindowSize.Width"', {
|
|
19671
|
+
encoding: "utf8",
|
|
19672
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
19673
|
+
// Suppress stderr
|
|
19674
|
+
});
|
|
19675
|
+
const width = parseInt(result.trim());
|
|
19676
|
+
if (Number.isFinite(width) && width > 0) {
|
|
19677
|
+
return width;
|
|
19678
|
+
}
|
|
19679
|
+
} catch {
|
|
19680
|
+
}
|
|
19681
|
+
}
|
|
19682
|
+
return 80;
|
|
19683
|
+
}
|
|
19684
|
+
function getResponsiveWidth(config2) {
|
|
19685
|
+
if (process.env.MARIA_DISABLE_RESPONSIVE === "1") {
|
|
19686
|
+
return config2?.maxWidth || 120;
|
|
19687
|
+
}
|
|
19688
|
+
const terminalWidth = getSafeTerminalWidth();
|
|
19689
|
+
const marginLeft = config2?.marginLeft ?? 5;
|
|
19690
|
+
const marginRight = config2?.marginRight ?? 5;
|
|
19691
|
+
const minWidth = config2?.minWidth ?? 40;
|
|
19692
|
+
const maxWidth = config2?.maxWidth ?? 200;
|
|
19693
|
+
const availableWidth = terminalWidth - marginLeft - marginRight;
|
|
19694
|
+
return Math.max(minWidth, Math.min(availableWidth, maxWidth));
|
|
19695
|
+
}
|
|
19696
|
+
function disposeSharedLayoutManager() {
|
|
19697
|
+
if (sharedManager) {
|
|
19698
|
+
sharedManager.dispose();
|
|
19699
|
+
sharedManager = null;
|
|
19700
|
+
}
|
|
19701
|
+
}
|
|
19702
|
+
function isCI() {
|
|
19703
|
+
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);
|
|
19704
|
+
}
|
|
19705
|
+
function autoConfigureForEnvironment() {
|
|
19706
|
+
if (isCI() || !process.stdout.isTTY) {
|
|
19707
|
+
if (!process.env.MARIA_FIXED_WIDTH) {
|
|
19708
|
+
process.env.MARIA_FIXED_WIDTH = "80";
|
|
19709
|
+
}
|
|
19710
|
+
}
|
|
19711
|
+
}
|
|
19712
|
+
var sharedManager;
|
|
19713
|
+
var init_responsive_width = __esm({
|
|
19714
|
+
"src/ui/integrated-cli/responsive-width.ts"() {
|
|
19715
|
+
sharedManager = null;
|
|
19716
|
+
autoConfigureForEnvironment();
|
|
19717
|
+
if (process.env.NODE_ENV !== "production") {
|
|
19718
|
+
process.on("exit", () => {
|
|
19719
|
+
disposeSharedLayoutManager();
|
|
19720
|
+
});
|
|
19721
|
+
}
|
|
19722
|
+
}
|
|
19723
|
+
});
|
|
19724
|
+
|
|
19725
|
+
// src/services/startup-display.ts
|
|
19726
|
+
var startup_display_exports = {};
|
|
19727
|
+
__export(startup_display_exports, {
|
|
19728
|
+
displayCompactLogo: () => displayCompactLogo,
|
|
19729
|
+
displayDashboardHeader: () => displayDashboardHeader,
|
|
19730
|
+
displayFinalStartupScreen: () => displayFinalStartupScreen,
|
|
19731
|
+
displayLogsBox: () => displayLogsBox,
|
|
19732
|
+
displayRoundedInputBox: () => displayRoundedInputBox,
|
|
19733
|
+
displaySpinner: () => displaySpinner,
|
|
19734
|
+
displayStartupLogo: () => displayStartupLogo
|
|
19735
|
+
});
|
|
19736
|
+
function displayStartupLogo() {
|
|
19737
|
+
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19738
|
+
console.log("");
|
|
19739
|
+
console.log(
|
|
19740
|
+
chalk17__default.default.magentaBright(
|
|
19741
|
+
"\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"
|
|
19742
|
+
)
|
|
19743
|
+
);
|
|
19744
|
+
console.log(
|
|
19745
|
+
chalk17__default.default.magentaBright(
|
|
19746
|
+
"\u2551 \u2551"
|
|
19747
|
+
)
|
|
19748
|
+
);
|
|
19749
|
+
console.log(
|
|
19750
|
+
chalk17__default.default.magentaBright(
|
|
19751
|
+
"\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"
|
|
19752
|
+
)
|
|
19753
|
+
);
|
|
19754
|
+
console.log(
|
|
19755
|
+
chalk17__default.default.magentaBright(
|
|
19756
|
+
"\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"
|
|
19757
|
+
)
|
|
19758
|
+
);
|
|
19759
|
+
console.log(
|
|
19760
|
+
chalk17__default.default.magentaBright(
|
|
19761
|
+
"\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"
|
|
19762
|
+
)
|
|
19763
|
+
);
|
|
19764
|
+
console.log(
|
|
19765
|
+
chalk17__default.default.magentaBright(
|
|
19766
|
+
"\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"
|
|
19767
|
+
)
|
|
19768
|
+
);
|
|
19769
|
+
console.log(
|
|
19770
|
+
chalk17__default.default.magentaBright(
|
|
19771
|
+
"\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"
|
|
19772
|
+
)
|
|
19773
|
+
);
|
|
19774
|
+
console.log(
|
|
19775
|
+
chalk17__default.default.magentaBright(
|
|
19776
|
+
"\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"
|
|
19777
|
+
)
|
|
19778
|
+
);
|
|
19779
|
+
console.log(
|
|
19780
|
+
chalk17__default.default.magentaBright(
|
|
19781
|
+
"\u2551 \u2551"
|
|
19782
|
+
)
|
|
19783
|
+
);
|
|
19784
|
+
console.log(
|
|
19785
|
+
chalk17__default.default.magentaBright(
|
|
19786
|
+
"\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"
|
|
19787
|
+
)
|
|
19788
|
+
);
|
|
19789
|
+
console.log(
|
|
19790
|
+
chalk17__default.default.magentaBright(
|
|
19791
|
+
"\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"
|
|
19792
|
+
)
|
|
19793
|
+
);
|
|
19794
|
+
console.log(
|
|
19795
|
+
chalk17__default.default.magentaBright(
|
|
19796
|
+
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19797
|
+
)
|
|
19798
|
+
);
|
|
19799
|
+
console.log(
|
|
19800
|
+
chalk17__default.default.magentaBright(
|
|
19801
|
+
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551"
|
|
19802
|
+
)
|
|
19803
|
+
);
|
|
19804
|
+
console.log(
|
|
19805
|
+
chalk17__default.default.magentaBright(
|
|
19806
|
+
"\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"
|
|
19807
|
+
)
|
|
19808
|
+
);
|
|
19809
|
+
console.log(
|
|
19810
|
+
chalk17__default.default.magentaBright(
|
|
19811
|
+
"\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"
|
|
19812
|
+
)
|
|
19813
|
+
);
|
|
19814
|
+
console.log(
|
|
19815
|
+
chalk17__default.default.magentaBright(
|
|
19816
|
+
"\u2551 \u2551"
|
|
19817
|
+
)
|
|
19818
|
+
);
|
|
19819
|
+
console.log(
|
|
19820
|
+
chalk17__default.default.magentaBright(
|
|
19821
|
+
"\u2551 AI-Powered Development Platform \u2551"
|
|
19822
|
+
)
|
|
19823
|
+
);
|
|
19824
|
+
console.log(
|
|
19825
|
+
chalk17__default.default.magentaBright(
|
|
19826
|
+
"\u2551 (c) 2025 Bonginkan Inc. \u2551"
|
|
19827
|
+
)
|
|
19828
|
+
);
|
|
19829
|
+
console.log(
|
|
19830
|
+
chalk17__default.default.magentaBright(
|
|
19831
|
+
"\u2551 \u2551"
|
|
19832
|
+
)
|
|
19833
|
+
);
|
|
19834
|
+
console.log(
|
|
19835
|
+
chalk17__default.default.magentaBright(
|
|
19836
|
+
"\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"
|
|
19837
|
+
)
|
|
19838
|
+
);
|
|
19839
|
+
console.log("");
|
|
19840
|
+
console.log(
|
|
19841
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19842
|
+
);
|
|
19843
|
+
console.log(
|
|
19844
|
+
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19845
|
+
);
|
|
19846
|
+
console.log("");
|
|
19847
|
+
}
|
|
19848
|
+
function displayCompactLogo() {
|
|
19849
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
19850
|
+
console.log(
|
|
19851
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19852
|
+
);
|
|
19853
|
+
console.log(
|
|
19854
|
+
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19855
|
+
);
|
|
19856
|
+
console.log("");
|
|
19857
|
+
}
|
|
19858
|
+
function displayDashboardHeader() {
|
|
19859
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
19860
|
+
const version = chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`);
|
|
19861
|
+
const commands = chalk17__default.default.gray(" | /help /status /model");
|
|
19862
|
+
const providers = chalk17__default.default.gray(
|
|
19863
|
+
"Providers: 8/8 OK (openai, anthropic, google, groq, lmstudio, ollama, vllm)"
|
|
19864
|
+
);
|
|
19865
|
+
console.log(version + commands);
|
|
19866
|
+
console.log(providers);
|
|
19867
|
+
console.log("");
|
|
19868
|
+
}
|
|
19869
|
+
function displayLogsBox(logs) {
|
|
19870
|
+
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 120 });
|
|
19871
|
+
const borderColor = chalk17__default.default.white;
|
|
19872
|
+
const titleColor = chalk17__default.default.cyan;
|
|
19873
|
+
const topLeft = "\u250C";
|
|
19874
|
+
const topRight = "\u2510";
|
|
19875
|
+
const bottomLeft = "\u2514";
|
|
19876
|
+
const bottomRight = "\u2518";
|
|
19877
|
+
const horizontal = "\u2500";
|
|
19878
|
+
const vertical = "\u2502";
|
|
19879
|
+
const lines = [];
|
|
19880
|
+
const title = " Logs ";
|
|
19881
|
+
lines.push(
|
|
19882
|
+
borderColor(topLeft) + titleColor(title) + borderColor(horizontal.repeat(width - title.length - 2)) + borderColor(topRight)
|
|
19883
|
+
);
|
|
19884
|
+
logs.forEach((log) => {
|
|
19885
|
+
const contentWidth = width - 4;
|
|
19886
|
+
const truncatedLog = log.length > contentWidth ? log.substring(0, contentWidth - 3) + "..." : log;
|
|
19887
|
+
const padding = width - truncatedLog.length - 4;
|
|
19888
|
+
lines.push(
|
|
19889
|
+
borderColor(vertical) + " " + truncatedLog + " ".repeat(Math.max(0, padding)) + " " + borderColor(vertical)
|
|
19890
|
+
);
|
|
19891
|
+
});
|
|
19892
|
+
if (logs.length === 0) {
|
|
19893
|
+
lines.push(
|
|
19894
|
+
borderColor(vertical) + " ".repeat(width - 2) + borderColor(vertical)
|
|
19895
|
+
);
|
|
19896
|
+
}
|
|
19897
|
+
lines.push(
|
|
19898
|
+
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19899
|
+
);
|
|
19900
|
+
console.log(lines.join("\n"));
|
|
19901
|
+
}
|
|
19902
|
+
function displaySpinner(text = "Processing") {
|
|
19903
|
+
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
19904
|
+
const frame = spinnerFrames[Math.floor(Date.now() / 80) % spinnerFrames.length];
|
|
19905
|
+
process.stdout.write(`\r[${chalk17__default.default.cyan(frame)}] ${text}...`);
|
|
19906
|
+
}
|
|
19907
|
+
function getCurrentPath() {
|
|
19908
|
+
return process.cwd();
|
|
19909
|
+
}
|
|
19910
|
+
function getSystemInfo() {
|
|
19911
|
+
return {
|
|
19912
|
+
platform: os__namespace.platform(),
|
|
19913
|
+
hostname: os__namespace.hostname(),
|
|
19914
|
+
user: os__namespace.userInfo().username,
|
|
19915
|
+
cwd: getCurrentPath()
|
|
19916
|
+
};
|
|
19917
|
+
}
|
|
19918
|
+
async function displayFinalStartupScreen(_selectedProvider, _selectedModel) {
|
|
19919
|
+
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19920
|
+
const version = getVersion();
|
|
19921
|
+
const systemInfo = getSystemInfo();
|
|
19922
|
+
console.log(
|
|
19923
|
+
chalk17__default.default.cyan.bold(`MARIA CODE v${version}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19924
|
+
);
|
|
19925
|
+
const cwd = systemInfo.cwd.replace(os__namespace.homedir(), "~");
|
|
19926
|
+
console.log(chalk17__default.default.gray("cwd: ") + chalk17__default.default.white(cwd));
|
|
19927
|
+
try {
|
|
19928
|
+
const { authManager: authManager2 } = await import('../cli-auth/index.js').catch(() => ({ authManager: null }));
|
|
19929
|
+
if (authManager2 && await authManager2.isAuthenticated()) {
|
|
19930
|
+
try {
|
|
19931
|
+
const user = await authManager2.getCurrentUser();
|
|
19932
|
+
console.log(chalk17__default.default.green(`Signed in: ${user.email}`));
|
|
19933
|
+
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19934
|
+
} catch {
|
|
19935
|
+
console.log(chalk17__default.default.green("Signed in"));
|
|
19936
|
+
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19937
|
+
}
|
|
19938
|
+
} else {
|
|
19939
|
+
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19940
|
+
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19941
|
+
}
|
|
19942
|
+
} catch {
|
|
19943
|
+
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19944
|
+
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19945
|
+
}
|
|
19946
|
+
console.log("");
|
|
19947
|
+
}
|
|
19948
|
+
function displayRoundedInputBox() {
|
|
19949
|
+
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 90 });
|
|
19950
|
+
const borderColor = chalk17__default.default.white;
|
|
19951
|
+
const promptColor = chalk17__default.default.cyan;
|
|
19952
|
+
const topLeft = "\u256D";
|
|
19953
|
+
const topRight = "\u256E";
|
|
19954
|
+
const bottomLeft = "\u2570";
|
|
19955
|
+
const bottomRight = "\u256F";
|
|
19956
|
+
const horizontal = "\u2500";
|
|
19957
|
+
const vertical = "\u2502";
|
|
19958
|
+
const lines = [];
|
|
19959
|
+
lines.push(borderColor(topLeft + horizontal.repeat(width - 2) + topRight));
|
|
19960
|
+
const promptStr = promptColor("> ");
|
|
19961
|
+
const placeholder = chalk17__default.default.gray("");
|
|
19962
|
+
const inputLine = promptStr + placeholder;
|
|
19963
|
+
const padding = width - 4;
|
|
19964
|
+
lines.push(
|
|
19965
|
+
borderColor(vertical) + inputLine + " ".repeat(Math.max(0, padding)) + borderColor(vertical)
|
|
19966
|
+
);
|
|
19967
|
+
lines.push(
|
|
19968
|
+
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19969
|
+
);
|
|
19970
|
+
console.log(lines.join("\n"));
|
|
19971
|
+
}
|
|
19972
|
+
var init_startup_display = __esm({
|
|
19973
|
+
"src/services/startup-display.ts"() {
|
|
19974
|
+
init_responsive_width();
|
|
19975
|
+
init_version();
|
|
19976
|
+
}
|
|
19977
|
+
});
|
|
19401
19978
|
|
|
19402
19979
|
// src/services/llm-health-checker.ts
|
|
19403
19980
|
var llm_health_checker_exports = {};
|
|
@@ -19535,29 +20112,29 @@ var init_provider_selector = __esm({
|
|
|
19535
20112
|
const inquirer = await import('inquirer');
|
|
19536
20113
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
19537
20114
|
const providers = await this.getAvailableProviders();
|
|
19538
|
-
console.log(
|
|
19539
|
-
console.log(
|
|
20115
|
+
console.log(chalk17__default.default.cyan("\nAvailable AI Providers:"));
|
|
20116
|
+
console.log(chalk17__default.default.gray("\u2500".repeat(50)));
|
|
19540
20117
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
19541
20118
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
19542
20119
|
if (_cloudProviders.length > 0) {
|
|
19543
|
-
console.log(
|
|
20120
|
+
console.log(chalk17__default.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
19544
20121
|
_cloudProviders.forEach((p) => {
|
|
19545
20122
|
if (p.available) {
|
|
19546
20123
|
console.log(
|
|
19547
|
-
` ${
|
|
20124
|
+
` ${chalk17__default.default.green("*")} ${chalk17__default.default.white(p.name.split(" ")[0])}`
|
|
19548
20125
|
);
|
|
19549
20126
|
} else {
|
|
19550
|
-
console.log(` ${
|
|
20127
|
+
console.log(` ${chalk17__default.default.gray(p.name.split(" ")[0])}`);
|
|
19551
20128
|
}
|
|
19552
20129
|
});
|
|
19553
20130
|
}
|
|
19554
20131
|
if (_localProviders.length > 0) {
|
|
19555
|
-
console.log(
|
|
20132
|
+
console.log(chalk17__default.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
19556
20133
|
_localProviders.forEach((p) => {
|
|
19557
20134
|
if (p.available) {
|
|
19558
|
-
console.log(` ${
|
|
20135
|
+
console.log(` ${chalk17__default.default.green("*")} ${chalk17__default.default.white(p.name)}`);
|
|
19559
20136
|
} else {
|
|
19560
|
-
console.log(` ${
|
|
20137
|
+
console.log(` ${chalk17__default.default.green("*")} ${chalk17__default.default.gray(p.name)}`);
|
|
19561
20138
|
}
|
|
19562
20139
|
});
|
|
19563
20140
|
}
|
|
@@ -19572,20 +20149,20 @@ var init_provider_selector = __esm({
|
|
|
19572
20149
|
});
|
|
19573
20150
|
if (selectableProviders.length === 0) {
|
|
19574
20151
|
console.log(
|
|
19575
|
-
|
|
20152
|
+
chalk17__default.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
19576
20153
|
);
|
|
19577
|
-
console.log(
|
|
20154
|
+
console.log(chalk17__default.default.gray("\nTo use MARIA, you need to:"));
|
|
19578
20155
|
console.log(
|
|
19579
|
-
|
|
20156
|
+
chalk17__default.default.gray(
|
|
19580
20157
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
19581
20158
|
)
|
|
19582
20159
|
);
|
|
19583
|
-
console.log(
|
|
20160
|
+
console.log(chalk17__default.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
19584
20161
|
console.log(
|
|
19585
|
-
|
|
20162
|
+
chalk17__default.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
19586
20163
|
);
|
|
19587
|
-
console.log(
|
|
19588
|
-
console.log(
|
|
20164
|
+
console.log(chalk17__default.default.gray(" Example: maria setup-ollama"));
|
|
20165
|
+
console.log(chalk17__default.default.gray("\nFor more information, run: maria --help"));
|
|
19589
20166
|
process.exit(1);
|
|
19590
20167
|
}
|
|
19591
20168
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -19606,29 +20183,29 @@ var init_provider_selector = __esm({
|
|
|
19606
20183
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
19607
20184
|
if (provider && provider.type === "local" && !provider.available) {
|
|
19608
20185
|
console.log(
|
|
19609
|
-
|
|
20186
|
+
chalk17__default.default.yellow(`
|
|
19610
20187
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
19611
20188
|
);
|
|
19612
|
-
console.log(
|
|
20189
|
+
console.log(chalk17__default.default.gray(`
|
|
19613
20190
|
To use ${provider.name}, you need to:`));
|
|
19614
20191
|
if (selectedProvider === "ollama") {
|
|
19615
|
-
console.log(
|
|
19616
|
-
console.log(
|
|
19617
|
-
console.log(
|
|
20192
|
+
console.log(chalk17__default.default.gray("1. Install Ollama: brew install ollama"));
|
|
20193
|
+
console.log(chalk17__default.default.gray("2. Start Ollama: ollama serve"));
|
|
20194
|
+
console.log(chalk17__default.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
19618
20195
|
console.log(
|
|
19619
|
-
|
|
20196
|
+
chalk17__default.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
19620
20197
|
);
|
|
19621
20198
|
} else if (selectedProvider === "lmstudio") {
|
|
19622
20199
|
console.log(
|
|
19623
|
-
|
|
20200
|
+
chalk17__default.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
19624
20201
|
);
|
|
19625
|
-
console.log(
|
|
19626
|
-
console.log(
|
|
19627
|
-
console.log(
|
|
20202
|
+
console.log(chalk17__default.default.gray("2. Start LM Studio application"));
|
|
20203
|
+
console.log(chalk17__default.default.gray("3. Load a model in LM Studio"));
|
|
20204
|
+
console.log(chalk17__default.default.gray("4. Start the local server in LM Studio"));
|
|
19628
20205
|
} else if (selectedProvider === "vllm") {
|
|
19629
|
-
console.log(
|
|
19630
|
-
console.log(
|
|
19631
|
-
console.log(
|
|
20206
|
+
console.log(chalk17__default.default.gray("1. Install vLLM: pip install vllm"));
|
|
20207
|
+
console.log(chalk17__default.default.gray("2. Start vLLM server with a model"));
|
|
20208
|
+
console.log(chalk17__default.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
19632
20209
|
}
|
|
19633
20210
|
process.exit(1);
|
|
19634
20211
|
}
|
|
@@ -22883,7 +23460,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
22883
23460
|
this.emit("initialized");
|
|
22884
23461
|
} catch (_error) {
|
|
22885
23462
|
console._error(
|
|
22886
|
-
|
|
23463
|
+
chalk17__default.default.red("Failed to initialize Intelligent Router:"),
|
|
22887
23464
|
_error
|
|
22888
23465
|
);
|
|
22889
23466
|
throw _error;
|
|
@@ -22937,7 +23514,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
22937
23514
|
} catch (_error) {
|
|
22938
23515
|
this.metrics.failedRoutes++;
|
|
22939
23516
|
this.emit("route:_error", { input: input3, _error });
|
|
22940
|
-
console._error(
|
|
23517
|
+
console._error(chalk17__default.default.red("Routing _error:"), _error);
|
|
22941
23518
|
return null;
|
|
22942
23519
|
}
|
|
22943
23520
|
}
|
|
@@ -23620,28 +24197,28 @@ var init_ChalkAdapter = __esm({
|
|
|
23620
24197
|
spinnerId = 0;
|
|
23621
24198
|
async showWelcome() {
|
|
23622
24199
|
console.log(
|
|
23623
|
-
|
|
24200
|
+
chalk17__default.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
23624
24201
|
);
|
|
23625
|
-
console.log(
|
|
24202
|
+
console.log(chalk17__default.default.gray("Type /help for available commands\n"));
|
|
23626
24203
|
}
|
|
23627
24204
|
showGoodbye() {
|
|
23628
24205
|
this.stopAllSpinners();
|
|
23629
|
-
console.log(
|
|
24206
|
+
console.log(chalk17__default.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
23630
24207
|
}
|
|
23631
24208
|
async print(message) {
|
|
23632
24209
|
console.log(message);
|
|
23633
24210
|
}
|
|
23634
24211
|
error(message) {
|
|
23635
|
-
console.error(
|
|
24212
|
+
console.error(chalk17__default.default.red(`\u274C ${message}`));
|
|
23636
24213
|
}
|
|
23637
24214
|
success(message) {
|
|
23638
|
-
console.log(
|
|
24215
|
+
console.log(chalk17__default.default.green(`\u2705 ${message}`));
|
|
23639
24216
|
}
|
|
23640
24217
|
warning(message) {
|
|
23641
|
-
console.warn(
|
|
24218
|
+
console.warn(chalk17__default.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
23642
24219
|
}
|
|
23643
24220
|
info(message) {
|
|
23644
|
-
console.info(
|
|
24221
|
+
console.info(chalk17__default.default.blue(`\u2139\uFE0F ${message}`));
|
|
23645
24222
|
}
|
|
23646
24223
|
startSpinner(message) {
|
|
23647
24224
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -23691,12 +24268,12 @@ var init_ChalkAdapter = __esm({
|
|
|
23691
24268
|
* Format helpers for consistent styling
|
|
23692
24269
|
*/
|
|
23693
24270
|
static format = {
|
|
23694
|
-
command: (text) =>
|
|
23695
|
-
keyword: (text) =>
|
|
23696
|
-
value: (text) =>
|
|
23697
|
-
dim: (text) =>
|
|
23698
|
-
bold: (text) =>
|
|
23699
|
-
code: (text) =>
|
|
24271
|
+
command: (text) => chalk17__default.default.cyan(text),
|
|
24272
|
+
keyword: (text) => chalk17__default.default.magenta(text),
|
|
24273
|
+
value: (text) => chalk17__default.default.green(text),
|
|
24274
|
+
dim: (text) => chalk17__default.default.gray(text),
|
|
24275
|
+
bold: (text) => chalk17__default.default.bold(text),
|
|
24276
|
+
code: (text) => chalk17__default.default.bgGray.white(` ${text} `)
|
|
23700
24277
|
};
|
|
23701
24278
|
};
|
|
23702
24279
|
}
|
|
@@ -28846,26 +29423,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28846
29423
|
const _lang = options.language || "en";
|
|
28847
29424
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
28848
29425
|
console.log("");
|
|
28849
|
-
console.log(
|
|
29426
|
+
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
29427
|
console.log(
|
|
28851
|
-
|
|
29428
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28852
29429
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
28853
|
-
) +
|
|
29430
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28854
29431
|
);
|
|
28855
|
-
console.log(
|
|
29432
|
+
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
29433
|
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
29434
|
console.log(
|
|
28858
|
-
|
|
28859
|
-
` > ${_labels.id}: ${
|
|
28860
|
-
) +
|
|
29435
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
29436
|
+
` > ${_labels.id}: ${chalk17__default.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
29437
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28861
29438
|
);
|
|
28862
29439
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
28863
29440
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
28864
29441
|
const _titleLabel = ` ${_labels._title}:`;
|
|
28865
29442
|
console.log(
|
|
28866
|
-
|
|
29443
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28867
29444
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
28868
|
-
) +
|
|
29445
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28869
29446
|
);
|
|
28870
29447
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
28871
29448
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -28873,37 +29450,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28873
29450
|
const _levelLabel = ` ${_labels.level}:`;
|
|
28874
29451
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
28875
29452
|
console.log(
|
|
28876
|
-
|
|
29453
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28877
29454
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
28878
|
-
) +
|
|
29455
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28879
29456
|
);
|
|
28880
29457
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
28881
29458
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
28882
29459
|
console.log(
|
|
28883
|
-
|
|
29460
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28884
29461
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
28885
|
-
) +
|
|
29462
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28886
29463
|
);
|
|
28887
29464
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
28888
29465
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
28889
29466
|
console.log(
|
|
28890
|
-
|
|
29467
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28891
29468
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
28892
|
-
) +
|
|
29469
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28893
29470
|
);
|
|
28894
29471
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
28895
29472
|
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
29473
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
28897
29474
|
console.log(
|
|
28898
|
-
|
|
29475
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28899
29476
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
28900
|
-
) +
|
|
29477
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28901
29478
|
);
|
|
28902
|
-
console.log(
|
|
29479
|
+
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
29480
|
console.log(
|
|
28904
|
-
|
|
29481
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28905
29482
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
28906
|
-
) +
|
|
29483
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28907
29484
|
);
|
|
28908
29485
|
this.menuOptions.forEach((option, _index) => {
|
|
28909
29486
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -28914,32 +29491,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28914
29491
|
switch (option) {
|
|
28915
29492
|
case "approve":
|
|
28916
29493
|
label = _labels.approve;
|
|
28917
|
-
color =
|
|
29494
|
+
color = chalk17__default.default.green;
|
|
28918
29495
|
break;
|
|
28919
29496
|
case "reject":
|
|
28920
29497
|
label = _labels.reject;
|
|
28921
|
-
color =
|
|
29498
|
+
color = chalk17__default.default.red;
|
|
28922
29499
|
break;
|
|
28923
29500
|
case "cancel":
|
|
28924
29501
|
label = _labels.cancel;
|
|
28925
|
-
color =
|
|
29502
|
+
color = chalk17__default.default.yellow;
|
|
28926
29503
|
break;
|
|
28927
29504
|
}
|
|
28928
29505
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
28929
29506
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
28930
29507
|
console.log(
|
|
28931
|
-
|
|
29508
|
+
chalk17__default.default.gray("\u2502") + _colorFunc(
|
|
28932
29509
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
28933
|
-
) +
|
|
29510
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28934
29511
|
);
|
|
28935
29512
|
});
|
|
28936
|
-
console.log(
|
|
29513
|
+
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
29514
|
console.log(
|
|
28938
|
-
|
|
29515
|
+
chalk17__default.default.gray("\u2502") + chalk17__default.default.white(
|
|
28939
29516
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
28940
|
-
) +
|
|
29517
|
+
) + chalk17__default.default.gray("\u2502")
|
|
28941
29518
|
);
|
|
28942
|
-
console.log(
|
|
29519
|
+
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
29520
|
console.log("");
|
|
28944
29521
|
}
|
|
28945
29522
|
/**
|
|
@@ -28955,13 +29532,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28955
29532
|
};
|
|
28956
29533
|
const _formatted = keyMap[_key] || _key;
|
|
28957
29534
|
const colorMap = {
|
|
28958
|
-
"shift+tab":
|
|
28959
|
-
"ctrl+y":
|
|
28960
|
-
"ctrl+n":
|
|
28961
|
-
"ctrl+t":
|
|
28962
|
-
"ctrl+r":
|
|
29535
|
+
"shift+tab": chalk17__default.default.bgGreen.black.bold,
|
|
29536
|
+
"ctrl+y": chalk17__default.default.bgBlue.white.bold,
|
|
29537
|
+
"ctrl+n": chalk17__default.default.bgRed.white.bold,
|
|
29538
|
+
"ctrl+t": chalk17__default.default.bgMagenta.white.bold,
|
|
29539
|
+
"ctrl+r": chalk17__default.default.bgYellow.black.bold
|
|
28963
29540
|
};
|
|
28964
|
-
const _colorFunc = colorMap[_key] ||
|
|
29541
|
+
const _colorFunc = colorMap[_key] || chalk17__default.default.bgCyan.black.bold;
|
|
28965
29542
|
return _colorFunc(` ${_formatted} `);
|
|
28966
29543
|
}
|
|
28967
29544
|
/**
|
|
@@ -28970,15 +29547,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
28970
29547
|
formatRiskLevel(risk) {
|
|
28971
29548
|
switch (risk.toLowerCase()) {
|
|
28972
29549
|
case "critical":
|
|
28973
|
-
return
|
|
29550
|
+
return chalk17__default.default.red.bold("CRITICAL");
|
|
28974
29551
|
case "high":
|
|
28975
|
-
return
|
|
29552
|
+
return chalk17__default.default.red("HIGH");
|
|
28976
29553
|
case "medium":
|
|
28977
|
-
return
|
|
29554
|
+
return chalk17__default.default.yellow("MEDIUM");
|
|
28978
29555
|
case "low":
|
|
28979
|
-
return
|
|
29556
|
+
return chalk17__default.default.green("LOW");
|
|
28980
29557
|
default:
|
|
28981
|
-
return
|
|
29558
|
+
return chalk17__default.default.white(risk);
|
|
28982
29559
|
}
|
|
28983
29560
|
}
|
|
28984
29561
|
/**
|
|
@@ -29048,7 +29625,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29048
29625
|
}
|
|
29049
29626
|
if (_key === "") {
|
|
29050
29627
|
console.log(`
|
|
29051
|
-
${
|
|
29628
|
+
${chalk17__default.default.red("Approval cancelled by user")}`);
|
|
29052
29629
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
29053
29630
|
return;
|
|
29054
29631
|
}
|
|
@@ -29105,20 +29682,20 @@ ${chalk16__default.default.red("Approval cancelled by user")}`);
|
|
|
29105
29682
|
}
|
|
29106
29683
|
console.clear();
|
|
29107
29684
|
console.log(`
|
|
29108
|
-
${
|
|
29685
|
+
${chalk17__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29109
29686
|
console.log(
|
|
29110
|
-
|
|
29687
|
+
chalk17__default.default.bgGreen.black.bold("\u2502") + chalk17__default.default.bgGreen.black.bold(
|
|
29111
29688
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
29112
|
-
) +
|
|
29689
|
+
) + chalk17__default.default.bgGreen.black.bold("\u2502")
|
|
29113
29690
|
);
|
|
29114
|
-
console.log(
|
|
29691
|
+
console.log(chalk17__default.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
29115
29692
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
29116
29693
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
29117
29694
|
console.log(
|
|
29118
|
-
|
|
29695
|
+
chalk17__default.default.bgGreen.black.bold("\u2502") + chalk17__default.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + chalk17__default.default.bgGreen.black.bold("\u2502")
|
|
29119
29696
|
);
|
|
29120
|
-
console.log(
|
|
29121
|
-
console.log(
|
|
29697
|
+
console.log(chalk17__default.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29698
|
+
console.log(chalk17__default.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
29122
29699
|
try {
|
|
29123
29700
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
29124
29701
|
this.currentRequest.id,
|
|
@@ -29128,30 +29705,30 @@ ${chalk16__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u251
|
|
|
29128
29705
|
);
|
|
29129
29706
|
response.quickDecision = true;
|
|
29130
29707
|
console.log(`
|
|
29131
|
-
${
|
|
29708
|
+
${chalk17__default.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29132
29709
|
console.log(
|
|
29133
|
-
|
|
29710
|
+
chalk17__default.default.bgGreen.black("\u2502") + chalk17__default.default.bgGreen.black(
|
|
29134
29711
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
29135
|
-
) +
|
|
29712
|
+
) + chalk17__default.default.bgGreen.black("\u2502")
|
|
29136
29713
|
);
|
|
29137
|
-
console.log(
|
|
29714
|
+
console.log(chalk17__default.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29138
29715
|
if (_choice.trustLevel) {
|
|
29139
29716
|
console.log(
|
|
29140
|
-
|
|
29717
|
+
chalk17__default.default.blue(`
|
|
29141
29718
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
29142
29719
|
);
|
|
29143
29720
|
}
|
|
29144
29721
|
this.emit("approval-_response", _response);
|
|
29145
29722
|
} catch (_error) {
|
|
29146
29723
|
console.log(`
|
|
29147
|
-
${
|
|
29724
|
+
${chalk17__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29148
29725
|
console.log(
|
|
29149
|
-
|
|
29726
|
+
chalk17__default.default.bgRed.white.bold("\u2502") + chalk17__default.default.bgRed.white.bold(
|
|
29150
29727
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
29151
|
-
) +
|
|
29728
|
+
) + chalk17__default.default.bgRed.white.bold("\u2502")
|
|
29152
29729
|
);
|
|
29153
|
-
console.log(
|
|
29154
|
-
console._error(
|
|
29730
|
+
console.log(chalk17__default.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29731
|
+
console._error(chalk17__default.default.red("\nError details:"), _error);
|
|
29155
29732
|
this.emit("approval-_error", _error);
|
|
29156
29733
|
}
|
|
29157
29734
|
}
|
|
@@ -29165,7 +29742,7 @@ ${chalk16__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`
|
|
|
29165
29742
|
timeoutId = setTimeout(() => {
|
|
29166
29743
|
console.log(
|
|
29167
29744
|
`
|
|
29168
|
-
${
|
|
29745
|
+
${chalk17__default.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
29169
29746
|
);
|
|
29170
29747
|
this.handleTimeoutResponse(resolve);
|
|
29171
29748
|
}, timeout);
|
|
@@ -29209,7 +29786,7 @@ ${chalk16__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29209
29786
|
response.quickDecision = true;
|
|
29210
29787
|
resolve(_response);
|
|
29211
29788
|
} catch (_error) {
|
|
29212
|
-
console._error(
|
|
29789
|
+
console._error(chalk17__default.default.red("Error processing timeout approval:"), _error);
|
|
29213
29790
|
}
|
|
29214
29791
|
}
|
|
29215
29792
|
/**
|
|
@@ -29224,11 +29801,11 @@ ${chalk16__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29224
29801
|
);
|
|
29225
29802
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
29226
29803
|
console.log(
|
|
29227
|
-
|
|
29804
|
+
chalk17__default.default.blue(
|
|
29228
29805
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
29229
29806
|
)
|
|
29230
29807
|
);
|
|
29231
|
-
console.log(
|
|
29808
|
+
console.log(chalk17__default.default.gray(`Reason: ${event.reason}`));
|
|
29232
29809
|
});
|
|
29233
29810
|
}
|
|
29234
29811
|
/**
|
|
@@ -30012,22 +30589,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
30012
30589
|
}
|
|
30013
30590
|
function formatError(message, code) {
|
|
30014
30591
|
const prefix = "";
|
|
30015
|
-
return
|
|
30592
|
+
return chalk17__default.default.red(`\u274C ${prefix}${message}`);
|
|
30016
30593
|
}
|
|
30017
30594
|
function formatSuccess(message) {
|
|
30018
|
-
return
|
|
30595
|
+
return chalk17__default.default.green(`\u2705 ${message}`);
|
|
30019
30596
|
}
|
|
30020
30597
|
function formatWarning(message) {
|
|
30021
|
-
return
|
|
30598
|
+
return chalk17__default.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
30022
30599
|
}
|
|
30023
30600
|
function formatInfo(message) {
|
|
30024
|
-
return
|
|
30601
|
+
return chalk17__default.default.blue(`\u2139\uFE0F ${message}`);
|
|
30025
30602
|
}
|
|
30026
30603
|
function formatTable(headers, rows, options = {}) {
|
|
30027
30604
|
const {
|
|
30028
30605
|
columnWidths = headers.map(() => 20),
|
|
30029
30606
|
separator = " | ",
|
|
30030
|
-
headerColor =
|
|
30607
|
+
headerColor = chalk17__default.default.cyan.bold
|
|
30031
30608
|
} = options;
|
|
30032
30609
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
30033
30610
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -30039,8 +30616,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
30039
30616
|
function formatKeyValue(data2, options = {}) {
|
|
30040
30617
|
const {
|
|
30041
30618
|
keyWidth = 20,
|
|
30042
|
-
keyColor =
|
|
30043
|
-
valueColor =
|
|
30619
|
+
keyColor = chalk17__default.default.gray,
|
|
30620
|
+
valueColor = chalk17__default.default.white,
|
|
30044
30621
|
separator = ": "
|
|
30045
30622
|
} = options;
|
|
30046
30623
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -30090,7 +30667,7 @@ var init_DisplayManager = __esm({
|
|
|
30090
30667
|
theme: options.theme ?? "auto"
|
|
30091
30668
|
};
|
|
30092
30669
|
if (!this.options.enableColors) {
|
|
30093
|
-
|
|
30670
|
+
chalk17__default.default.level = 0;
|
|
30094
30671
|
}
|
|
30095
30672
|
this.setupCleanupHandlers();
|
|
30096
30673
|
}
|
|
@@ -30207,7 +30784,7 @@ var init_DisplayManager = __esm({
|
|
|
30207
30784
|
const {
|
|
30208
30785
|
padding = 1,
|
|
30209
30786
|
borderStyle = "single",
|
|
30210
|
-
borderColor =
|
|
30787
|
+
borderColor = chalk17__default.default.gray
|
|
30211
30788
|
} = options;
|
|
30212
30789
|
const lines = content.split("\n");
|
|
30213
30790
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -30265,7 +30842,7 @@ var init_DisplayManager = __esm({
|
|
|
30265
30842
|
*/
|
|
30266
30843
|
startSpinner(text) {
|
|
30267
30844
|
if (!this.options.enableAnimations) {
|
|
30268
|
-
this.writeLine(
|
|
30845
|
+
this.writeLine(chalk17__default.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
30269
30846
|
return "no-animation";
|
|
30270
30847
|
}
|
|
30271
30848
|
return this.spinnerManager.start({ text });
|
|
@@ -30369,11 +30946,11 @@ var init_StatusDisplay = __esm({
|
|
|
30369
30946
|
*/
|
|
30370
30947
|
static renderSystemStatus(status, detailed = false) {
|
|
30371
30948
|
const lines = [];
|
|
30372
|
-
lines.push(
|
|
30949
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F4CA} System Status"));
|
|
30373
30950
|
lines.push("");
|
|
30374
30951
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
30375
30952
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
30376
|
-
const statusColor = status.operational ?
|
|
30953
|
+
const statusColor = status.operational ? chalk17__default.default.green : chalk17__default.default.red;
|
|
30377
30954
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
30378
30955
|
lines.push(
|
|
30379
30956
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -30394,15 +30971,15 @@ var init_StatusDisplay = __esm({
|
|
|
30394
30971
|
if (status.errors > 0 || status.warnings > 0) {
|
|
30395
30972
|
lines.push("");
|
|
30396
30973
|
if (status.errors > 0) {
|
|
30397
|
-
lines.push(
|
|
30974
|
+
lines.push(chalk17__default.default.red(`\u274C Errors: ${status.errors}`));
|
|
30398
30975
|
}
|
|
30399
30976
|
if (status.warnings > 0) {
|
|
30400
|
-
lines.push(
|
|
30977
|
+
lines.push(chalk17__default.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
30401
30978
|
}
|
|
30402
30979
|
}
|
|
30403
30980
|
if (detailed) {
|
|
30404
30981
|
lines.push("");
|
|
30405
|
-
lines.push(
|
|
30982
|
+
lines.push(chalk17__default.default.gray("Detailed Information:"));
|
|
30406
30983
|
const details = formatKeyValue(
|
|
30407
30984
|
{
|
|
30408
30985
|
"Process ID": process.pid,
|
|
@@ -30412,8 +30989,8 @@ var init_StatusDisplay = __esm({
|
|
|
30412
30989
|
"Working Directory": process.cwd()
|
|
30413
30990
|
},
|
|
30414
30991
|
{
|
|
30415
|
-
keyColor:
|
|
30416
|
-
valueColor:
|
|
30992
|
+
keyColor: chalk17__default.default.gray,
|
|
30993
|
+
valueColor: chalk17__default.default.white
|
|
30417
30994
|
}
|
|
30418
30995
|
);
|
|
30419
30996
|
lines.push(details);
|
|
@@ -30427,9 +31004,9 @@ var init_StatusDisplay = __esm({
|
|
|
30427
31004
|
*/
|
|
30428
31005
|
static renderMemoryStatus(status) {
|
|
30429
31006
|
const lines = [];
|
|
30430
|
-
lines.push(
|
|
31007
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
30431
31008
|
lines.push("");
|
|
30432
|
-
lines.push(
|
|
31009
|
+
lines.push(chalk17__default.default.yellow("System 1 (Fast):"));
|
|
30433
31010
|
const s1NodeBar = formatProgressBar(
|
|
30434
31011
|
status.system1.nodes,
|
|
30435
31012
|
status.system1.maxNodes,
|
|
@@ -30447,7 +31024,7 @@ var init_StatusDisplay = __esm({
|
|
|
30447
31024
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
30448
31025
|
);
|
|
30449
31026
|
lines.push("");
|
|
30450
|
-
lines.push(
|
|
31027
|
+
lines.push(chalk17__default.default.blue("System 2 (Deep):"));
|
|
30451
31028
|
const s2TraceBar = formatProgressBar(
|
|
30452
31029
|
status.system2.traces,
|
|
30453
31030
|
status.system2.maxTraces,
|
|
@@ -30465,7 +31042,7 @@ var init_StatusDisplay = __esm({
|
|
|
30465
31042
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
30466
31043
|
);
|
|
30467
31044
|
lines.push("");
|
|
30468
|
-
lines.push(
|
|
31045
|
+
lines.push(chalk17__default.default.green("Total:"));
|
|
30469
31046
|
const totalBar = formatProgressBar(
|
|
30470
31047
|
status.total.tokens,
|
|
30471
31048
|
status.total.maxTokens,
|
|
@@ -30474,7 +31051,7 @@ var init_StatusDisplay = __esm({
|
|
|
30474
31051
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
30475
31052
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
30476
31053
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
30477
|
-
const usageColor = usage > 80 ?
|
|
31054
|
+
const usageColor = usage > 80 ? chalk17__default.default.red : usage > 60 ? chalk17__default.default.yellow : chalk17__default.default.green;
|
|
30478
31055
|
lines.push(
|
|
30479
31056
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
30480
31057
|
);
|
|
@@ -30487,9 +31064,9 @@ var init_StatusDisplay = __esm({
|
|
|
30487
31064
|
*/
|
|
30488
31065
|
static renderModelStatus(status) {
|
|
30489
31066
|
const lines = [];
|
|
30490
|
-
lines.push(
|
|
31067
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F916} Model Status"));
|
|
30491
31068
|
lines.push("");
|
|
30492
|
-
lines.push(
|
|
31069
|
+
lines.push(chalk17__default.default.green(`Current: ${chalk17__default.default.bold(status.current)}`));
|
|
30493
31070
|
lines.push("");
|
|
30494
31071
|
lines.push("Available Models:");
|
|
30495
31072
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -30501,7 +31078,7 @@ var init_StatusDisplay = __esm({
|
|
|
30501
31078
|
const table = formatTable(headers, rows, {
|
|
30502
31079
|
columnWidths: [20, 15, 8, 30],
|
|
30503
31080
|
separator: " \u2502 ",
|
|
30504
|
-
headerColor:
|
|
31081
|
+
headerColor: chalk17__default.default.gray
|
|
30505
31082
|
});
|
|
30506
31083
|
lines.push(table);
|
|
30507
31084
|
return lines.join("\n");
|
|
@@ -30513,19 +31090,19 @@ var init_StatusDisplay = __esm({
|
|
|
30513
31090
|
*/
|
|
30514
31091
|
static renderHealthChecks(checks) {
|
|
30515
31092
|
const lines = [];
|
|
30516
|
-
lines.push(
|
|
31093
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
30517
31094
|
lines.push("");
|
|
30518
31095
|
for (const check of checks) {
|
|
30519
31096
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
30520
|
-
const statusColor = check.status === "ok" ?
|
|
31097
|
+
const statusColor = check.status === "ok" ? chalk17__default.default.green : check.status === "warning" ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30521
31098
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
30522
31099
|
if (check.latency !== void 0) {
|
|
30523
|
-
const latencyColor = check.latency < 100 ?
|
|
31100
|
+
const latencyColor = check.latency < 100 ? chalk17__default.default.green : check.latency < 500 ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30524
31101
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
30525
31102
|
}
|
|
30526
31103
|
lines.push(line);
|
|
30527
31104
|
if (check.message) {
|
|
30528
|
-
lines.push(
|
|
31105
|
+
lines.push(chalk17__default.default.gray(` ${check.message}`));
|
|
30529
31106
|
}
|
|
30530
31107
|
}
|
|
30531
31108
|
lines.push("");
|
|
@@ -30534,16 +31111,16 @@ var init_StatusDisplay = __esm({
|
|
|
30534
31111
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
30535
31112
|
if (errorCount > 0) {
|
|
30536
31113
|
lines.push(
|
|
30537
|
-
|
|
31114
|
+
chalk17__default.default.red(
|
|
30538
31115
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
30539
31116
|
)
|
|
30540
31117
|
);
|
|
30541
31118
|
} else if (warningCount > 0) {
|
|
30542
31119
|
lines.push(
|
|
30543
|
-
|
|
31120
|
+
chalk17__default.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
30544
31121
|
);
|
|
30545
31122
|
} else {
|
|
30546
|
-
lines.push(
|
|
31123
|
+
lines.push(chalk17__default.default.green("\u2705 All systems operational"));
|
|
30547
31124
|
}
|
|
30548
31125
|
return lines.join("\n");
|
|
30549
31126
|
}
|
|
@@ -30554,7 +31131,7 @@ var init_StatusDisplay = __esm({
|
|
|
30554
31131
|
*/
|
|
30555
31132
|
static renderSessionStats(stats) {
|
|
30556
31133
|
const lines = [];
|
|
30557
|
-
lines.push(
|
|
31134
|
+
lines.push(chalk17__default.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
30558
31135
|
lines.push("");
|
|
30559
31136
|
const data2 = formatKeyValue(
|
|
30560
31137
|
{
|
|
@@ -30567,14 +31144,14 @@ var init_StatusDisplay = __esm({
|
|
|
30567
31144
|
},
|
|
30568
31145
|
{
|
|
30569
31146
|
keyWidth: 20,
|
|
30570
|
-
keyColor:
|
|
30571
|
-
valueColor:
|
|
31147
|
+
keyColor: chalk17__default.default.gray,
|
|
31148
|
+
valueColor: chalk17__default.default.white
|
|
30572
31149
|
}
|
|
30573
31150
|
);
|
|
30574
31151
|
lines.push(data2);
|
|
30575
31152
|
lines.push("");
|
|
30576
31153
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
30577
|
-
const perfColor = performance3 === "Excellent" ?
|
|
31154
|
+
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
31155
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
30579
31156
|
return lines.join("\n");
|
|
30580
31157
|
}
|
|
@@ -30586,22 +31163,22 @@ var init_StatusDisplay = __esm({
|
|
|
30586
31163
|
static renderStatusBar(data2) {
|
|
30587
31164
|
const segments = [];
|
|
30588
31165
|
if (data2.mode) {
|
|
30589
|
-
segments.push(
|
|
31166
|
+
segments.push(chalk17__default.default.cyan(`[${data2.mode}]`));
|
|
30590
31167
|
}
|
|
30591
31168
|
if (data2.model) {
|
|
30592
|
-
segments.push(
|
|
31169
|
+
segments.push(chalk17__default.default.blue(`\u{1F916} ${data2.model}`));
|
|
30593
31170
|
}
|
|
30594
31171
|
if (data2.memory !== void 0) {
|
|
30595
|
-
const memoryColor = data2.memory > 80 ?
|
|
31172
|
+
const memoryColor = data2.memory > 80 ? chalk17__default.default.red : data2.memory > 60 ? chalk17__default.default.yellow : chalk17__default.default.green;
|
|
30596
31173
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
30597
31174
|
}
|
|
30598
31175
|
if (data2.latency !== void 0) {
|
|
30599
|
-
const latencyColor = data2.latency < 100 ?
|
|
31176
|
+
const latencyColor = data2.latency < 100 ? chalk17__default.default.green : data2.latency < 500 ? chalk17__default.default.yellow : chalk17__default.default.red;
|
|
30600
31177
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
30601
31178
|
}
|
|
30602
31179
|
if (data2.time) {
|
|
30603
31180
|
segments.push(
|
|
30604
|
-
|
|
31181
|
+
chalk17__default.default.gray(formatTimestamp(data2.time, "short"))
|
|
30605
31182
|
);
|
|
30606
31183
|
}
|
|
30607
31184
|
return segments.join(" \u2502 ");
|
|
@@ -30620,7 +31197,7 @@ var init_CoreHandlers = __esm({
|
|
|
30620
31197
|
async execute(args) {
|
|
30621
31198
|
const startTime = perf_hooks.performance.now();
|
|
30622
31199
|
const commands = this.registry.getCommands();
|
|
30623
|
-
let message =
|
|
31200
|
+
let message = chalk17__default.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
30624
31201
|
|
|
30625
31202
|
`);
|
|
30626
31203
|
const categories = {
|
|
@@ -30631,17 +31208,17 @@ var init_CoreHandlers = __esm({
|
|
|
30631
31208
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
30632
31209
|
};
|
|
30633
31210
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
30634
|
-
message +=
|
|
31211
|
+
message += chalk17__default.default.yellow(`
|
|
30635
31212
|
${category.toUpperCase()}:
|
|
30636
31213
|
`);
|
|
30637
31214
|
for (const cmd of cmds) {
|
|
30638
31215
|
if (commands.includes(cmd)) {
|
|
30639
|
-
message += ` ${
|
|
31216
|
+
message += ` ${chalk17__default.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
30640
31217
|
`;
|
|
30641
31218
|
}
|
|
30642
31219
|
}
|
|
30643
31220
|
}
|
|
30644
|
-
message +=
|
|
31221
|
+
message += chalk17__default.default.gray(
|
|
30645
31222
|
`
|
|
30646
31223
|
Type '/help <command>' for detailed information about a specific command.`
|
|
30647
31224
|
);
|
|
@@ -30689,7 +31266,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30689
31266
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30690
31267
|
return {
|
|
30691
31268
|
success: true,
|
|
30692
|
-
message:
|
|
31269
|
+
message: chalk17__default.default.gray("Terminal cleared."),
|
|
30693
31270
|
metadata: {
|
|
30694
31271
|
processingTime,
|
|
30695
31272
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -30700,7 +31277,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30700
31277
|
ExitHandler = class {
|
|
30701
31278
|
async execute(args) {
|
|
30702
31279
|
const startTime = perf_hooks.performance.now();
|
|
30703
|
-
const message =
|
|
31280
|
+
const message = chalk17__default.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
30704
31281
|
process.emit("SIGTERM");
|
|
30705
31282
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30706
31283
|
return {
|
|
@@ -30724,23 +31301,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30724
31301
|
platform: process.platform,
|
|
30725
31302
|
arch: process.arch
|
|
30726
31303
|
};
|
|
30727
|
-
let message =
|
|
30728
|
-
message +=
|
|
31304
|
+
let message = chalk17__default.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
31305
|
+
message += chalk17__default.default.white(` Version: ${chalk17__default.default.green(packageInfo.version)}
|
|
30729
31306
|
`);
|
|
30730
|
-
message +=
|
|
31307
|
+
message += chalk17__default.default.white(` Package: ${chalk17__default.default.green(packageInfo.name)}
|
|
30731
31308
|
`);
|
|
30732
|
-
message +=
|
|
31309
|
+
message += chalk17__default.default.white(` Node: ${chalk17__default.default.green(packageInfo.node)}
|
|
30733
31310
|
`);
|
|
30734
|
-
message +=
|
|
30735
|
-
` Platform: ${
|
|
31311
|
+
message += chalk17__default.default.white(
|
|
31312
|
+
` Platform: ${chalk17__default.default.green(packageInfo.platform)}
|
|
30736
31313
|
`
|
|
30737
31314
|
);
|
|
30738
|
-
message +=
|
|
31315
|
+
message += chalk17__default.default.white(` Arch: ${chalk17__default.default.green(packageInfo.arch)}
|
|
30739
31316
|
`);
|
|
30740
|
-
message +=
|
|
31317
|
+
message += chalk17__default.default.gray(`
|
|
30741
31318
|
Build: Production
|
|
30742
31319
|
`);
|
|
30743
|
-
message +=
|
|
31320
|
+
message += chalk17__default.default.gray(` License: MIT
|
|
30744
31321
|
`);
|
|
30745
31322
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30746
31323
|
return {
|
|
@@ -30765,15 +31342,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30765
31342
|
this.history.push("/history");
|
|
30766
31343
|
}
|
|
30767
31344
|
const recent = this.history.slice(-limit);
|
|
30768
|
-
let message =
|
|
31345
|
+
let message = chalk17__default.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
30769
31346
|
|
|
30770
31347
|
`);
|
|
30771
31348
|
recent.forEach((cmd, index) => {
|
|
30772
31349
|
const num = this.history.length - recent.length + index + 1;
|
|
30773
|
-
message +=
|
|
31350
|
+
message += chalk17__default.default.gray(` ${num.toString().padStart(3)}: `) + chalk17__default.default.white(cmd) + "\n";
|
|
30774
31351
|
});
|
|
30775
31352
|
if (recent.length === 0) {
|
|
30776
|
-
message =
|
|
31353
|
+
message = chalk17__default.default.gray("No command history available.");
|
|
30777
31354
|
}
|
|
30778
31355
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30779
31356
|
return {
|
|
@@ -30819,13 +31396,13 @@ var init_DevHandlers = __esm({
|
|
|
30819
31396
|
if (!prompt) {
|
|
30820
31397
|
return {
|
|
30821
31398
|
ok: false,
|
|
30822
|
-
message:
|
|
31399
|
+
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
31400
|
};
|
|
30824
31401
|
}
|
|
30825
31402
|
if (signal?.aborted) {
|
|
30826
31403
|
return {
|
|
30827
31404
|
ok: false,
|
|
30828
|
-
message:
|
|
31405
|
+
message: chalk17__default.default.yellow("Code generation canceled")
|
|
30829
31406
|
};
|
|
30830
31407
|
}
|
|
30831
31408
|
try {
|
|
@@ -30836,9 +31413,9 @@ var init_DevHandlers = __esm({
|
|
|
30836
31413
|
if (dryRun) {
|
|
30837
31414
|
return {
|
|
30838
31415
|
ok: true,
|
|
30839
|
-
message:
|
|
30840
|
-
`) +
|
|
30841
|
-
`) +
|
|
31416
|
+
message: chalk17__default.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + chalk17__default.default.gray(`Language: ${language}
|
|
31417
|
+
`) + chalk17__default.default.gray(`Framework: ${framework || "none"}
|
|
31418
|
+
`) + chalk17__default.default.gray(`Prompt: ${cleanPrompt}`)
|
|
30842
31419
|
};
|
|
30843
31420
|
}
|
|
30844
31421
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -30850,7 +31427,7 @@ function generated() {
|
|
|
30850
31427
|
export { generated };`;
|
|
30851
31428
|
return {
|
|
30852
31429
|
ok: true,
|
|
30853
|
-
message:
|
|
31430
|
+
message: chalk17__default.default.green("\u2705 Code generated successfully:\n\n") + chalk17__default.default.gray("```" + language + "\n") + generatedCode + chalk17__default.default.gray("\n```"),
|
|
30854
31431
|
data: {
|
|
30855
31432
|
code: generatedCode,
|
|
30856
31433
|
language,
|
|
@@ -30863,7 +31440,7 @@ export { generated };`;
|
|
|
30863
31440
|
} catch (error2) {
|
|
30864
31441
|
return {
|
|
30865
31442
|
ok: false,
|
|
30866
|
-
message:
|
|
31443
|
+
message: chalk17__default.default.red(`Code generation failed: ${error2}`)
|
|
30867
31444
|
};
|
|
30868
31445
|
}
|
|
30869
31446
|
}
|
|
@@ -30877,7 +31454,7 @@ export { generated };`;
|
|
|
30877
31454
|
if (signal?.aborted) {
|
|
30878
31455
|
return {
|
|
30879
31456
|
ok: false,
|
|
30880
|
-
message:
|
|
31457
|
+
message: chalk17__default.default.yellow("Test operation canceled")
|
|
30881
31458
|
};
|
|
30882
31459
|
}
|
|
30883
31460
|
const subcommand = args[0] || "run";
|
|
@@ -30893,8 +31470,8 @@ export { generated };`;
|
|
|
30893
31470
|
default:
|
|
30894
31471
|
return {
|
|
30895
31472
|
ok: false,
|
|
30896
|
-
message:
|
|
30897
|
-
`) +
|
|
31473
|
+
message: chalk17__default.default.red(`Unknown test subcommand: ${subcommand}
|
|
31474
|
+
`) + chalk17__default.default.gray("Available: generate, run, coverage")
|
|
30898
31475
|
};
|
|
30899
31476
|
}
|
|
30900
31477
|
}
|
|
@@ -30902,7 +31479,7 @@ export { generated };`;
|
|
|
30902
31479
|
if (!target) {
|
|
30903
31480
|
return {
|
|
30904
31481
|
ok: false,
|
|
30905
|
-
message:
|
|
31482
|
+
message: chalk17__default.default.red(
|
|
30906
31483
|
"Please specify a file or function to generate tests for"
|
|
30907
31484
|
)
|
|
30908
31485
|
};
|
|
@@ -30919,9 +31496,9 @@ describe("${target}", () => {
|
|
|
30919
31496
|
});`;
|
|
30920
31497
|
return {
|
|
30921
31498
|
ok: true,
|
|
30922
|
-
message:
|
|
31499
|
+
message: chalk17__default.default.green(`\u2705 Tests generated for ${target}:
|
|
30923
31500
|
|
|
30924
|
-
`) +
|
|
31501
|
+
`) + chalk17__default.default.gray("```typescript\n") + testCode + chalk17__default.default.gray("\n```"),
|
|
30925
31502
|
data: { testCode, framework, target }
|
|
30926
31503
|
};
|
|
30927
31504
|
}
|
|
@@ -30934,23 +31511,23 @@ describe("${target}", () => {
|
|
|
30934
31511
|
if (coverage) command += " --coverage";
|
|
30935
31512
|
return {
|
|
30936
31513
|
ok: true,
|
|
30937
|
-
message:
|
|
30938
|
-
`) +
|
|
31514
|
+
message: chalk17__default.default.cyan(`\u{1F9EA} Running tests...
|
|
31515
|
+
`) + chalk17__default.default.gray(`Command: ${command}
|
|
30939
31516
|
|
|
30940
|
-
`) +
|
|
31517
|
+
`) + chalk17__default.default.green("\u2705 All tests passed!"),
|
|
30941
31518
|
data: { command, passed: true }
|
|
30942
31519
|
};
|
|
30943
31520
|
}
|
|
30944
31521
|
async showCoverage(options) {
|
|
30945
31522
|
return {
|
|
30946
31523
|
ok: true,
|
|
30947
|
-
message:
|
|
31524
|
+
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
31525
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
30949
|
-
) +
|
|
31526
|
+
) + chalk17__default.default.green(
|
|
30950
31527
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
30951
|
-
) +
|
|
31528
|
+
) + chalk17__default.default.yellow(
|
|
30952
31529
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
30953
|
-
) +
|
|
31530
|
+
) + chalk17__default.default.gray("-".repeat(60) + "\n") + chalk17__default.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
30954
31531
|
};
|
|
30955
31532
|
}
|
|
30956
31533
|
};
|
|
@@ -30964,33 +31541,33 @@ describe("${target}", () => {
|
|
|
30964
31541
|
if (!file) {
|
|
30965
31542
|
return {
|
|
30966
31543
|
ok: false,
|
|
30967
|
-
message:
|
|
31544
|
+
message: chalk17__default.default.red("Please specify a file to review\n") + chalk17__default.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
30968
31545
|
};
|
|
30969
31546
|
}
|
|
30970
31547
|
const checkSecurity = args.includes("--security");
|
|
30971
31548
|
const checkPerformance = args.includes("--performance");
|
|
30972
|
-
let message =
|
|
31549
|
+
let message = chalk17__default.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
30973
31550
|
|
|
30974
31551
|
`);
|
|
30975
|
-
message +=
|
|
30976
|
-
message +=
|
|
30977
|
-
message +=
|
|
30978
|
-
message +=
|
|
31552
|
+
message += chalk17__default.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
31553
|
+
message += chalk17__default.default.gray(" 1. Line 42: ") + chalk17__default.default.yellow("Missing error handling in async function\n");
|
|
31554
|
+
message += chalk17__default.default.gray(" 2. Line 89: ") + chalk17__default.default.yellow("Potential memory leak - event listener not removed\n");
|
|
31555
|
+
message += chalk17__default.default.gray(" 3. Line 156: ") + chalk17__default.default.yellow(
|
|
30979
31556
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
30980
31557
|
);
|
|
30981
31558
|
if (checkSecurity) {
|
|
30982
|
-
message +=
|
|
30983
|
-
message +=
|
|
31559
|
+
message += chalk17__default.default.red("\u{1F512} Security Issues (1):\n");
|
|
31560
|
+
message += chalk17__default.default.gray(" 1. Line 67: ") + chalk17__default.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
30984
31561
|
}
|
|
30985
31562
|
if (checkPerformance) {
|
|
30986
|
-
message +=
|
|
30987
|
-
message +=
|
|
30988
|
-
message +=
|
|
30989
|
-
}
|
|
30990
|
-
message +=
|
|
30991
|
-
message +=
|
|
30992
|
-
message +=
|
|
30993
|
-
message +=
|
|
31563
|
+
message += chalk17__default.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
31564
|
+
message += chalk17__default.default.gray(" 1. Line 23: ") + chalk17__default.default.blue("Consider memoization for expensive calculation\n");
|
|
31565
|
+
message += chalk17__default.default.gray(" 2. Line 145: ") + chalk17__default.default.blue("Use virtualization for large list rendering\n\n");
|
|
31566
|
+
}
|
|
31567
|
+
message += chalk17__default.default.green("\u2705 Positive Findings:\n");
|
|
31568
|
+
message += chalk17__default.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
31569
|
+
message += chalk17__default.default.gray(" \u2022 Consistent code style\n");
|
|
31570
|
+
message += chalk17__default.default.gray(" \u2022 Well-documented functions\n");
|
|
30994
31571
|
return {
|
|
30995
31572
|
ok: true,
|
|
30996
31573
|
message,
|
|
@@ -31020,8 +31597,8 @@ describe("${target}", () => {
|
|
|
31020
31597
|
default:
|
|
31021
31598
|
return {
|
|
31022
31599
|
ok: false,
|
|
31023
|
-
message:
|
|
31024
|
-
`) +
|
|
31600
|
+
message: chalk17__default.default.red(`Unknown bug subcommand: ${subcommand}
|
|
31601
|
+
`) + chalk17__default.default.gray("Available: report, list, analyze")
|
|
31025
31602
|
};
|
|
31026
31603
|
}
|
|
31027
31604
|
}
|
|
@@ -31030,18 +31607,18 @@ describe("${target}", () => {
|
|
|
31030
31607
|
if (!description) {
|
|
31031
31608
|
return {
|
|
31032
31609
|
ok: false,
|
|
31033
|
-
message:
|
|
31610
|
+
message: chalk17__default.default.red("Please provide a bug description")
|
|
31034
31611
|
};
|
|
31035
31612
|
}
|
|
31036
31613
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
31037
31614
|
return {
|
|
31038
31615
|
ok: true,
|
|
31039
|
-
message:
|
|
31616
|
+
message: chalk17__default.default.green(`\u{1F41B} Bug reported successfully!
|
|
31040
31617
|
|
|
31041
|
-
`) +
|
|
31042
|
-
`) +
|
|
31043
|
-
`) +
|
|
31044
|
-
`) +
|
|
31618
|
+
`) + chalk17__default.default.cyan(`Bug ID: ${bugId}
|
|
31619
|
+
`) + chalk17__default.default.gray(`Description: ${description}
|
|
31620
|
+
`) + chalk17__default.default.gray(`Status: Open
|
|
31621
|
+
`) + chalk17__default.default.gray(`Priority: To be determined
|
|
31045
31622
|
`),
|
|
31046
31623
|
data: { bugId, description, status: "open" }
|
|
31047
31624
|
};
|
|
@@ -31049,23 +31626,23 @@ describe("${target}", () => {
|
|
|
31049
31626
|
async listBugs() {
|
|
31050
31627
|
return {
|
|
31051
31628
|
ok: true,
|
|
31052
|
-
message:
|
|
31629
|
+
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
31630
|
};
|
|
31054
31631
|
}
|
|
31055
31632
|
async analyzeBug(bugId) {
|
|
31056
31633
|
if (!bugId) {
|
|
31057
31634
|
return {
|
|
31058
31635
|
ok: false,
|
|
31059
|
-
message:
|
|
31636
|
+
message: chalk17__default.default.red("Please provide a bug ID to analyze")
|
|
31060
31637
|
};
|
|
31061
31638
|
}
|
|
31062
31639
|
return {
|
|
31063
31640
|
ok: true,
|
|
31064
|
-
message:
|
|
31641
|
+
message: chalk17__default.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
31065
31642
|
|
|
31066
|
-
`) +
|
|
31643
|
+
`) + 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
31644
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
31068
|
-
) +
|
|
31645
|
+
) + 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
31646
|
};
|
|
31070
31647
|
}
|
|
31071
31648
|
};
|
|
@@ -31089,7 +31666,7 @@ var init_SystemHandlers = __esm({
|
|
|
31089
31666
|
if (signal?.aborted) {
|
|
31090
31667
|
return {
|
|
31091
31668
|
ok: false,
|
|
31092
|
-
message:
|
|
31669
|
+
message: chalk17__default.default.yellow("Status check canceled")
|
|
31093
31670
|
};
|
|
31094
31671
|
}
|
|
31095
31672
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -31100,44 +31677,44 @@ var init_SystemHandlers = __esm({
|
|
|
31100
31677
|
cpu: os__namespace.cpus()[0],
|
|
31101
31678
|
platform: process.platform
|
|
31102
31679
|
};
|
|
31103
|
-
let message =
|
|
31104
|
-
message +=
|
|
31105
|
-
message +=
|
|
31680
|
+
let message = chalk17__default.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
31681
|
+
message += chalk17__default.default.green("\u2705 System: Operational\n");
|
|
31682
|
+
message += chalk17__default.default.gray(
|
|
31106
31683
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
31107
31684
|
`
|
|
31108
31685
|
);
|
|
31109
|
-
message +=
|
|
31686
|
+
message += chalk17__default.default.gray(
|
|
31110
31687
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31111
31688
|
`
|
|
31112
31689
|
);
|
|
31113
31690
|
if (verbose) {
|
|
31114
|
-
message +=
|
|
31115
|
-
message +=
|
|
31691
|
+
message += chalk17__default.default.gray("\nDetailed Information:\n");
|
|
31692
|
+
message += chalk17__default.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
31116
31693
|
`);
|
|
31117
|
-
message +=
|
|
31694
|
+
message += chalk17__default.default.gray(
|
|
31118
31695
|
` \u2022 Platform: ${status.platform} (${os__namespace.arch()})
|
|
31119
31696
|
`
|
|
31120
31697
|
);
|
|
31121
|
-
message +=
|
|
31698
|
+
message += chalk17__default.default.gray(` \u2022 Node.js: ${process.version}
|
|
31122
31699
|
`);
|
|
31123
|
-
message +=
|
|
31700
|
+
message += chalk17__default.default.gray(` \u2022 Process ID: ${process.pid}
|
|
31124
31701
|
`);
|
|
31125
|
-
message +=
|
|
31702
|
+
message += chalk17__default.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
31126
31703
|
`);
|
|
31127
|
-
message +=
|
|
31128
|
-
message +=
|
|
31704
|
+
message += chalk17__default.default.gray("\nMemory Details:\n");
|
|
31705
|
+
message += chalk17__default.default.gray(
|
|
31129
31706
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
31130
31707
|
`
|
|
31131
31708
|
);
|
|
31132
|
-
message +=
|
|
31709
|
+
message += chalk17__default.default.gray(
|
|
31133
31710
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
31134
31711
|
`
|
|
31135
31712
|
);
|
|
31136
|
-
message +=
|
|
31713
|
+
message += chalk17__default.default.gray(
|
|
31137
31714
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31138
31715
|
`
|
|
31139
31716
|
);
|
|
31140
|
-
message +=
|
|
31717
|
+
message += chalk17__default.default.gray(
|
|
31141
31718
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
31142
31719
|
`
|
|
31143
31720
|
);
|
|
@@ -31166,7 +31743,7 @@ var init_SystemHandlers = __esm({
|
|
|
31166
31743
|
if (signal?.aborted) {
|
|
31167
31744
|
return {
|
|
31168
31745
|
ok: false,
|
|
31169
|
-
message:
|
|
31746
|
+
message: chalk17__default.default.yellow("Model operation canceled")
|
|
31170
31747
|
};
|
|
31171
31748
|
}
|
|
31172
31749
|
if (args.length === 0) {
|
|
@@ -31186,17 +31763,17 @@ var init_SystemHandlers = __esm({
|
|
|
31186
31763
|
}
|
|
31187
31764
|
}
|
|
31188
31765
|
async listModels() {
|
|
31189
|
-
let message =
|
|
31190
|
-
message +=
|
|
31766
|
+
let message = chalk17__default.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
31767
|
+
message += chalk17__default.default.green(`Current: ${this.currentModel}
|
|
31191
31768
|
|
|
31192
31769
|
`);
|
|
31193
31770
|
for (const model of this.availableModels) {
|
|
31194
|
-
const status = model.available ?
|
|
31195
|
-
const name2 = model.id === this.currentModel ?
|
|
31196
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
31771
|
+
const status = model.available ? chalk17__default.default.green("\u2705") : chalk17__default.default.red("\u274C");
|
|
31772
|
+
const name2 = model.id === this.currentModel ? chalk17__default.default.green.bold(model.id) : chalk17__default.default.cyan(model.id);
|
|
31773
|
+
message += `${status} ${name2.padEnd(20)} ${chalk17__default.default.gray(`[${model.provider}]`)}
|
|
31197
31774
|
`;
|
|
31198
31775
|
}
|
|
31199
|
-
message +=
|
|
31776
|
+
message += chalk17__default.default.gray("\nUse /model <name> to switch models");
|
|
31200
31777
|
return {
|
|
31201
31778
|
ok: true,
|
|
31202
31779
|
message,
|
|
@@ -31207,27 +31784,27 @@ var init_SystemHandlers = __esm({
|
|
|
31207
31784
|
if (!modelId) {
|
|
31208
31785
|
return {
|
|
31209
31786
|
ok: false,
|
|
31210
|
-
message:
|
|
31787
|
+
message: chalk17__default.default.red("Please specify a model to switch to")
|
|
31211
31788
|
};
|
|
31212
31789
|
}
|
|
31213
31790
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
31214
31791
|
if (!model) {
|
|
31215
31792
|
return {
|
|
31216
31793
|
ok: false,
|
|
31217
|
-
message:
|
|
31218
|
-
`) +
|
|
31794
|
+
message: chalk17__default.default.red(`Unknown model: ${modelId}
|
|
31795
|
+
`) + chalk17__default.default.gray("Use /model list to see available models")
|
|
31219
31796
|
};
|
|
31220
31797
|
}
|
|
31221
31798
|
if (!model.available) {
|
|
31222
31799
|
return {
|
|
31223
31800
|
ok: false,
|
|
31224
|
-
message:
|
|
31801
|
+
message: chalk17__default.default.yellow(`Model ${modelId} is not currently available`)
|
|
31225
31802
|
};
|
|
31226
31803
|
}
|
|
31227
31804
|
this.currentModel = modelId;
|
|
31228
31805
|
return {
|
|
31229
31806
|
ok: true,
|
|
31230
|
-
message:
|
|
31807
|
+
message: chalk17__default.default.green(`\u2705 Switched to ${modelId}`),
|
|
31231
31808
|
data: { model: modelId }
|
|
31232
31809
|
};
|
|
31233
31810
|
}
|
|
@@ -31236,27 +31813,27 @@ var init_SystemHandlers = __esm({
|
|
|
31236
31813
|
if (!model) {
|
|
31237
31814
|
return {
|
|
31238
31815
|
ok: false,
|
|
31239
|
-
message:
|
|
31816
|
+
message: chalk17__default.default.red(`Unknown model: ${modelId}`)
|
|
31240
31817
|
};
|
|
31241
31818
|
}
|
|
31242
|
-
let message =
|
|
31819
|
+
let message = chalk17__default.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
31243
31820
|
|
|
31244
31821
|
`);
|
|
31245
|
-
message +=
|
|
31822
|
+
message += chalk17__default.default.gray(`Provider: ${model.provider}
|
|
31246
31823
|
`);
|
|
31247
|
-
message +=
|
|
31824
|
+
message += chalk17__default.default.gray(
|
|
31248
31825
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
31249
31826
|
`
|
|
31250
31827
|
);
|
|
31251
|
-
message +=
|
|
31828
|
+
message += chalk17__default.default.gray(
|
|
31252
31829
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
31253
31830
|
`
|
|
31254
31831
|
);
|
|
31255
|
-
message +=
|
|
31256
|
-
message +=
|
|
31257
|
-
message +=
|
|
31258
|
-
message +=
|
|
31259
|
-
message +=
|
|
31832
|
+
message += chalk17__default.default.gray("\nCapabilities:\n");
|
|
31833
|
+
message += chalk17__default.default.gray(" \u2022 Context: 128K tokens\n");
|
|
31834
|
+
message += chalk17__default.default.gray(" \u2022 Languages: 95+\n");
|
|
31835
|
+
message += chalk17__default.default.gray(" \u2022 Code: Yes\n");
|
|
31836
|
+
message += chalk17__default.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
31260
31837
|
return {
|
|
31261
31838
|
ok: true,
|
|
31262
31839
|
message,
|
|
@@ -31288,39 +31865,39 @@ var init_SystemHandlers = __esm({
|
|
|
31288
31865
|
default:
|
|
31289
31866
|
return {
|
|
31290
31867
|
ok: false,
|
|
31291
|
-
message:
|
|
31292
|
-
`) +
|
|
31868
|
+
message: chalk17__default.default.red(`Unknown memory subcommand: ${subcommand}
|
|
31869
|
+
`) + chalk17__default.default.gray("Available: status, clear, export, compact")
|
|
31293
31870
|
};
|
|
31294
31871
|
}
|
|
31295
31872
|
}
|
|
31296
31873
|
async showStatus() {
|
|
31297
|
-
let message =
|
|
31298
|
-
message +=
|
|
31299
|
-
message +=
|
|
31874
|
+
let message = chalk17__default.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
31875
|
+
message += chalk17__default.default.yellow("System 1 (Fast):\n");
|
|
31876
|
+
message += chalk17__default.default.gray(
|
|
31300
31877
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
31301
31878
|
`
|
|
31302
31879
|
);
|
|
31303
|
-
message +=
|
|
31880
|
+
message += chalk17__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
31304
31881
|
|
|
31305
31882
|
`);
|
|
31306
|
-
message +=
|
|
31307
|
-
message +=
|
|
31883
|
+
message += chalk17__default.default.blue("System 2 (Deep):\n");
|
|
31884
|
+
message += chalk17__default.default.gray(
|
|
31308
31885
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
31309
31886
|
`
|
|
31310
31887
|
);
|
|
31311
|
-
message +=
|
|
31888
|
+
message += chalk17__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
31312
31889
|
|
|
31313
31890
|
`);
|
|
31314
|
-
message +=
|
|
31315
|
-
message +=
|
|
31891
|
+
message += chalk17__default.default.green("Total:\n");
|
|
31892
|
+
message += chalk17__default.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
31316
31893
|
`);
|
|
31317
|
-
message +=
|
|
31894
|
+
message += chalk17__default.default.gray(
|
|
31318
31895
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
31319
31896
|
`
|
|
31320
31897
|
);
|
|
31321
31898
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
31322
31899
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
31323
|
-
message +=
|
|
31900
|
+
message += chalk17__default.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
31324
31901
|
`);
|
|
31325
31902
|
return {
|
|
31326
31903
|
ok: true,
|
|
@@ -31334,14 +31911,14 @@ var init_SystemHandlers = __esm({
|
|
|
31334
31911
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
31335
31912
|
return {
|
|
31336
31913
|
ok: true,
|
|
31337
|
-
message:
|
|
31914
|
+
message: chalk17__default.default.green("\u2705 System 1 memory cleared")
|
|
31338
31915
|
};
|
|
31339
31916
|
}
|
|
31340
31917
|
if (system === "system2") {
|
|
31341
31918
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
31342
31919
|
return {
|
|
31343
31920
|
ok: true,
|
|
31344
|
-
message:
|
|
31921
|
+
message: chalk17__default.default.green("\u2705 System 2 memory cleared")
|
|
31345
31922
|
};
|
|
31346
31923
|
}
|
|
31347
31924
|
this.memoryStats = {
|
|
@@ -31351,15 +31928,15 @@ var init_SystemHandlers = __esm({
|
|
|
31351
31928
|
};
|
|
31352
31929
|
return {
|
|
31353
31930
|
ok: true,
|
|
31354
|
-
message:
|
|
31931
|
+
message: chalk17__default.default.green("\u{1F9F9} All memory cleared")
|
|
31355
31932
|
};
|
|
31356
31933
|
}
|
|
31357
31934
|
async exportMemory() {
|
|
31358
31935
|
const filename = `memory-export-${Date.now()}.json`;
|
|
31359
31936
|
return {
|
|
31360
31937
|
ok: true,
|
|
31361
|
-
message:
|
|
31362
|
-
`) +
|
|
31938
|
+
message: chalk17__default.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
31939
|
+
`) + chalk17__default.default.gray(
|
|
31363
31940
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
31364
31941
|
),
|
|
31365
31942
|
data: { filename, stats: this.memoryStats }
|
|
@@ -31377,9 +31954,9 @@ var init_SystemHandlers = __esm({
|
|
|
31377
31954
|
);
|
|
31378
31955
|
return {
|
|
31379
31956
|
ok: true,
|
|
31380
|
-
message:
|
|
31381
|
-
`) +
|
|
31382
|
-
`) +
|
|
31957
|
+
message: chalk17__default.default.green("\u2728 Memory compacted successfully\n") + chalk17__default.default.gray(`Before: ${before} tokens
|
|
31958
|
+
`) + chalk17__default.default.gray(`After: ${after} tokens
|
|
31959
|
+
`) + chalk17__default.default.gray(
|
|
31383
31960
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
31384
31961
|
),
|
|
31385
31962
|
data: { before, after, saved: before - after }
|
|
@@ -31395,11 +31972,11 @@ var init_SystemHandlers = __esm({
|
|
|
31395
31972
|
if (signal?.aborted) {
|
|
31396
31973
|
return {
|
|
31397
31974
|
ok: false,
|
|
31398
|
-
message:
|
|
31975
|
+
message: chalk17__default.default.yellow("Health check canceled")
|
|
31399
31976
|
};
|
|
31400
31977
|
}
|
|
31401
31978
|
const detailed = args.includes("--detailed");
|
|
31402
|
-
let message =
|
|
31979
|
+
let message = chalk17__default.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
31403
31980
|
const checks = [
|
|
31404
31981
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
31405
31982
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -31408,11 +31985,11 @@ var init_SystemHandlers = __esm({
|
|
|
31408
31985
|
{ name: "Network", status: "warning", latency: 250 }
|
|
31409
31986
|
];
|
|
31410
31987
|
for (const check of checks) {
|
|
31411
|
-
const icon = check.status === "ok" ?
|
|
31412
|
-
const status = check.status === "ok" ?
|
|
31988
|
+
const icon = check.status === "ok" ? chalk17__default.default.green("\u2705") : check.status === "warning" ? chalk17__default.default.yellow("\u26A0\uFE0F") : chalk17__default.default.red("\u274C");
|
|
31989
|
+
const status = check.status === "ok" ? chalk17__default.default.green("OK") : check.status === "warning" ? chalk17__default.default.yellow("WARNING") : chalk17__default.default.red("ERROR");
|
|
31413
31990
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
31414
31991
|
if (detailed) {
|
|
31415
|
-
message +=
|
|
31992
|
+
message += chalk17__default.default.gray(` (${check.latency}ms)`);
|
|
31416
31993
|
}
|
|
31417
31994
|
message += "\n";
|
|
31418
31995
|
}
|
|
@@ -31420,11 +31997,11 @@ var init_SystemHandlers = __esm({
|
|
|
31420
31997
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
31421
31998
|
message += "\n";
|
|
31422
31999
|
if (hasErrors) {
|
|
31423
|
-
message +=
|
|
32000
|
+
message += chalk17__default.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
31424
32001
|
} else if (hasWarnings) {
|
|
31425
|
-
message +=
|
|
32002
|
+
message += chalk17__default.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
31426
32003
|
} else {
|
|
31427
|
-
message +=
|
|
32004
|
+
message += chalk17__default.default.green("\u2705 All systems operational");
|
|
31428
32005
|
}
|
|
31429
32006
|
return {
|
|
31430
32007
|
ok: true,
|
|
@@ -31442,12 +32019,12 @@ var init_SystemHandlers = __esm({
|
|
|
31442
32019
|
if (signal?.aborted) {
|
|
31443
32020
|
return {
|
|
31444
32021
|
ok: false,
|
|
31445
|
-
message:
|
|
32022
|
+
message: chalk17__default.default.yellow("Doctor check canceled")
|
|
31446
32023
|
};
|
|
31447
32024
|
}
|
|
31448
32025
|
const autoFix = args.includes("--fix");
|
|
31449
|
-
let message =
|
|
31450
|
-
message +=
|
|
32026
|
+
let message = chalk17__default.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
32027
|
+
message += chalk17__default.default.gray("Running diagnostics...\n\n");
|
|
31451
32028
|
const issues = [
|
|
31452
32029
|
{
|
|
31453
32030
|
severity: "warning",
|
|
@@ -31469,20 +32046,20 @@ var init_SystemHandlers = __esm({
|
|
|
31469
32046
|
}
|
|
31470
32047
|
];
|
|
31471
32048
|
if (issues.length === 0) {
|
|
31472
|
-
message +=
|
|
32049
|
+
message += chalk17__default.default.green("\u2705 No issues found - system is healthy!");
|
|
31473
32050
|
return { ok: true, message };
|
|
31474
32051
|
}
|
|
31475
|
-
message +=
|
|
32052
|
+
message += chalk17__default.default.yellow(`Found ${issues.length} issue(s):
|
|
31476
32053
|
|
|
31477
32054
|
`);
|
|
31478
32055
|
for (const issue of issues) {
|
|
31479
|
-
const icon = issue.severity === "error" ?
|
|
32056
|
+
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
32057
|
message += `${icon} ${issue.issue}
|
|
31481
32058
|
`;
|
|
31482
|
-
message +=
|
|
32059
|
+
message += chalk17__default.default.gray(` Solution: ${issue.solution}
|
|
31483
32060
|
`);
|
|
31484
32061
|
if (autoFix && issue.fixable) {
|
|
31485
|
-
message +=
|
|
32062
|
+
message += chalk17__default.default.green(` \u2705 Auto-fixed
|
|
31486
32063
|
`);
|
|
31487
32064
|
}
|
|
31488
32065
|
message += "\n";
|
|
@@ -31490,7 +32067,7 @@ var init_SystemHandlers = __esm({
|
|
|
31490
32067
|
if (!autoFix) {
|
|
31491
32068
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
31492
32069
|
if (fixableCount > 0) {
|
|
31493
|
-
message +=
|
|
32070
|
+
message += chalk17__default.default.gray(
|
|
31494
32071
|
`
|
|
31495
32072
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
31496
32073
|
);
|
|
@@ -31933,7 +32510,7 @@ var init_package = __esm({
|
|
|
31933
32510
|
"package.json"() {
|
|
31934
32511
|
package_default = {
|
|
31935
32512
|
name: "@bonginkan/maria",
|
|
31936
|
-
version: "4.2.
|
|
32513
|
+
version: "4.2.6",
|
|
31937
32514
|
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
32515
|
keywords: [
|
|
31939
32516
|
"ai",
|
|
@@ -32449,20 +33026,21 @@ function createCLI() {
|
|
|
32449
33026
|
}
|
|
32450
33027
|
});
|
|
32451
33028
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
32452
|
-
console.log(
|
|
33029
|
+
console.log(chalk17__default.default.cyan("Setting up Ollama..."));
|
|
32453
33030
|
console.log(
|
|
32454
|
-
|
|
33031
|
+
chalk17__default.default.yellow("Please run: brew install ollama && ollama serve")
|
|
32455
33032
|
);
|
|
32456
33033
|
});
|
|
32457
33034
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
32458
|
-
console.log(
|
|
32459
|
-
console.log(
|
|
33035
|
+
console.log(chalk17__default.default.cyan("Setting up vLLM..."));
|
|
33036
|
+
console.log(chalk17__default.default.yellow("Please run: pip install vllm"));
|
|
32460
33037
|
});
|
|
32461
33038
|
return program2;
|
|
32462
33039
|
}
|
|
32463
33040
|
var MariaAI;
|
|
32464
33041
|
var init_maria_ai = __esm({
|
|
32465
33042
|
"src/maria-ai.ts"() {
|
|
33043
|
+
init_startup_display();
|
|
32466
33044
|
init_provider_selector();
|
|
32467
33045
|
init_config2();
|
|
32468
33046
|
init_IntelligentRouterService();
|
|
@@ -32479,16 +33057,17 @@ var init_maria_ai = __esm({
|
|
|
32479
33057
|
}
|
|
32480
33058
|
async initialize() {
|
|
32481
33059
|
try {
|
|
33060
|
+
displayStartupLogo();
|
|
32482
33061
|
await this.providerSelector.initialize();
|
|
32483
33062
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
32484
33063
|
console.log(
|
|
32485
|
-
|
|
33064
|
+
chalk17__default.default.green(`
|
|
32486
33065
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
32487
33066
|
);
|
|
32488
33067
|
this.config.set("currentProvider", provider);
|
|
32489
33068
|
this.config.set("currentModel", model);
|
|
32490
33069
|
await this.config.save();
|
|
32491
|
-
console.log(
|
|
33070
|
+
console.log(chalk17__default.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
32492
33071
|
this.router = new IntelligentRouterService({
|
|
32493
33072
|
confidenceThreshold: 0.85,
|
|
32494
33073
|
enableLearning: true,
|
|
@@ -32496,12 +33075,12 @@ var init_maria_ai = __esm({
|
|
|
32496
33075
|
});
|
|
32497
33076
|
await this.router.initialize();
|
|
32498
33077
|
console.log(
|
|
32499
|
-
|
|
33078
|
+
chalk17__default.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
32500
33079
|
);
|
|
32501
33080
|
this.session = createInteractiveSession(this);
|
|
32502
33081
|
await this.session.start();
|
|
32503
33082
|
} catch (error2) {
|
|
32504
|
-
console.error(
|
|
33083
|
+
console.error(chalk17__default.default.red("\n\u274C Initialization failed:"), error2);
|
|
32505
33084
|
process.exit(1);
|
|
32506
33085
|
}
|
|
32507
33086
|
}
|
|
@@ -32509,7 +33088,7 @@ var init_maria_ai = __esm({
|
|
|
32509
33088
|
if (this.session) {
|
|
32510
33089
|
await this.session.stop();
|
|
32511
33090
|
}
|
|
32512
|
-
console.log(
|
|
33091
|
+
console.log(chalk17__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
32513
33092
|
}
|
|
32514
33093
|
};
|
|
32515
33094
|
}
|
|
@@ -32538,8 +33117,8 @@ async function loadServices() {
|
|
|
32538
33117
|
try {
|
|
32539
33118
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32540
33119
|
if (commandName === "battlecard") {
|
|
32541
|
-
console.log(
|
|
32542
|
-
console.log(
|
|
33120
|
+
console.log(chalk17__default.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
33121
|
+
console.log(chalk17__default.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32543
33122
|
return {
|
|
32544
33123
|
success: false,
|
|
32545
33124
|
message: "Command not available on Free plan"
|
|
@@ -32600,7 +33179,7 @@ async function loadServices() {
|
|
|
32600
33179
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32601
33180
|
}
|
|
32602
33181
|
} catch (e2) {
|
|
32603
|
-
console.warn(
|
|
33182
|
+
console.warn(chalk17__default.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32604
33183
|
}
|
|
32605
33184
|
}
|
|
32606
33185
|
async function init() {
|
|
@@ -32714,20 +33293,20 @@ async function enforceAuth(cmd) {
|
|
|
32714
33293
|
try {
|
|
32715
33294
|
const tokens = await authManager.getValidTokens();
|
|
32716
33295
|
if (!tokens) {
|
|
32717
|
-
console.log(
|
|
33296
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32718
33297
|
process.exit(2);
|
|
32719
33298
|
return false;
|
|
32720
33299
|
}
|
|
32721
33300
|
return true;
|
|
32722
33301
|
} catch (error2) {
|
|
32723
33302
|
if (error2.code === "AUTH_REQUIRED") {
|
|
32724
|
-
console.log(
|
|
33303
|
+
console.log(chalk17__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32725
33304
|
process.exit(2);
|
|
32726
33305
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
32727
|
-
console.log(
|
|
33306
|
+
console.log(chalk17__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
32728
33307
|
process.exit(2);
|
|
32729
33308
|
} else {
|
|
32730
|
-
console.log(
|
|
33309
|
+
console.log(chalk17__default.default.red("\u{1F310} Network error, check connection"));
|
|
32731
33310
|
process.exit(1);
|
|
32732
33311
|
}
|
|
32733
33312
|
return false;
|
|
@@ -32767,7 +33346,7 @@ async function handleSlash(input3) {
|
|
|
32767
33346
|
console.log(JSON.stringify(result.data, null, 2));
|
|
32768
33347
|
}
|
|
32769
33348
|
} else {
|
|
32770
|
-
console.log(
|
|
33349
|
+
console.log(chalk17__default.default.red(`Help Error: ${result.message}`));
|
|
32771
33350
|
}
|
|
32772
33351
|
return true;
|
|
32773
33352
|
}
|
|
@@ -32775,7 +33354,7 @@ async function handleSlash(input3) {
|
|
|
32775
33354
|
if (process.env.MARIA_DEBUG === "1") {
|
|
32776
33355
|
console.error("HelpCommand error:", helpError);
|
|
32777
33356
|
}
|
|
32778
|
-
console.log(
|
|
33357
|
+
console.log(chalk17__default.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
32779
33358
|
}
|
|
32780
33359
|
const help = `
|
|
32781
33360
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -32800,7 +33379,7 @@ Chat:
|
|
|
32800
33379
|
session.length = 0;
|
|
32801
33380
|
if (ctx?.clearContext) ctx.clearContext();
|
|
32802
33381
|
console.clear();
|
|
32803
|
-
console.log(
|
|
33382
|
+
console.log(chalk17__default.default.cyan("\u2728 Session cleared"));
|
|
32804
33383
|
return true;
|
|
32805
33384
|
}
|
|
32806
33385
|
if (cmd === "code") {
|
|
@@ -32808,7 +33387,7 @@ Chat:
|
|
|
32808
33387
|
const prompt = args.join(" ").trim();
|
|
32809
33388
|
if (!prompt) {
|
|
32810
33389
|
console.log(
|
|
32811
|
-
|
|
33390
|
+
chalk17__default.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
32812
33391
|
);
|
|
32813
33392
|
return true;
|
|
32814
33393
|
}
|
|
@@ -32820,7 +33399,7 @@ Chat:
|
|
|
32820
33399
|
const prompt = args.join(" ").trim();
|
|
32821
33400
|
if (!prompt) {
|
|
32822
33401
|
console.log(
|
|
32823
|
-
|
|
33402
|
+
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
33403
|
);
|
|
32825
33404
|
return true;
|
|
32826
33405
|
}
|
|
@@ -32832,14 +33411,14 @@ Chat:
|
|
|
32832
33411
|
options: {},
|
|
32833
33412
|
logger: {
|
|
32834
33413
|
info: (msg) => console.log(msg),
|
|
32835
|
-
error: (msg) => console.error(
|
|
32836
|
-
warn: (msg) => console.warn(
|
|
33414
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33415
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32837
33416
|
}
|
|
32838
33417
|
};
|
|
32839
33418
|
await imageCommand2.execute(context2);
|
|
32840
33419
|
}
|
|
32841
33420
|
} catch (error2) {
|
|
32842
|
-
console.error(
|
|
33421
|
+
console.error(chalk17__default.default.red("Image generation failed:"), error2.message);
|
|
32843
33422
|
}
|
|
32844
33423
|
return true;
|
|
32845
33424
|
}
|
|
@@ -32848,7 +33427,7 @@ Chat:
|
|
|
32848
33427
|
const prompt = args.join(" ").trim();
|
|
32849
33428
|
if (!prompt) {
|
|
32850
33429
|
console.log(
|
|
32851
|
-
|
|
33430
|
+
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
33431
|
);
|
|
32853
33432
|
return true;
|
|
32854
33433
|
}
|
|
@@ -32860,14 +33439,14 @@ Chat:
|
|
|
32860
33439
|
options: {},
|
|
32861
33440
|
logger: {
|
|
32862
33441
|
info: (msg) => console.log(msg),
|
|
32863
|
-
error: (msg) => console.error(
|
|
32864
|
-
warn: (msg) => console.warn(
|
|
33442
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33443
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32865
33444
|
}
|
|
32866
33445
|
};
|
|
32867
33446
|
await videoCommand2.execute(context2);
|
|
32868
33447
|
}
|
|
32869
33448
|
} catch (error2) {
|
|
32870
|
-
console.error(
|
|
33449
|
+
console.error(chalk17__default.default.red("Video generation failed:"), error2.message);
|
|
32871
33450
|
}
|
|
32872
33451
|
return true;
|
|
32873
33452
|
}
|
|
@@ -32876,7 +33455,7 @@ Chat:
|
|
|
32876
33455
|
const prompt = args.join(" ").trim();
|
|
32877
33456
|
if (!prompt) {
|
|
32878
33457
|
console.log(
|
|
32879
|
-
|
|
33458
|
+
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
33459
|
);
|
|
32881
33460
|
return true;
|
|
32882
33461
|
}
|
|
@@ -32888,14 +33467,14 @@ Chat:
|
|
|
32888
33467
|
options: {},
|
|
32889
33468
|
logger: {
|
|
32890
33469
|
info: (msg) => console.log(msg),
|
|
32891
|
-
error: (msg) => console.error(
|
|
32892
|
-
warn: (msg) => console.warn(
|
|
33470
|
+
error: (msg) => console.error(chalk17__default.default.red(msg)),
|
|
33471
|
+
warn: (msg) => console.warn(chalk17__default.default.yellow(msg))
|
|
32893
33472
|
}
|
|
32894
33473
|
};
|
|
32895
33474
|
await voiceCommand2.execute(context2);
|
|
32896
33475
|
}
|
|
32897
33476
|
} catch (error2) {
|
|
32898
|
-
console.error(
|
|
33477
|
+
console.error(chalk17__default.default.red("Voice synthesis failed:"), error2.message);
|
|
32899
33478
|
}
|
|
32900
33479
|
return true;
|
|
32901
33480
|
}
|
|
@@ -32914,36 +33493,36 @@ Chat:
|
|
|
32914
33493
|
if (args.includes("status")) {
|
|
32915
33494
|
if (await authManager.isAuthenticated()) {
|
|
32916
33495
|
const user = await authManager.getCurrentUser();
|
|
32917
|
-
console.log(
|
|
32918
|
-
console.log(
|
|
32919
|
-
console.log(
|
|
33496
|
+
console.log(chalk17__default.default.green("\u2705 Authenticated"));
|
|
33497
|
+
console.log(chalk17__default.default.white(`\u{1F464} User: ${chalk17__default.default.cyan(user.email)}`));
|
|
33498
|
+
console.log(chalk17__default.default.white(`\u{1F4CA} Plan: ${chalk17__default.default.cyan(user.plan)}`));
|
|
32920
33499
|
} else {
|
|
32921
|
-
console.log(
|
|
32922
|
-
console.log(
|
|
33500
|
+
console.log(chalk17__default.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
33501
|
+
console.log(chalk17__default.default.gray("Use /login to sign in"));
|
|
32923
33502
|
}
|
|
32924
33503
|
} else {
|
|
32925
33504
|
const result = await authManager.login(options2);
|
|
32926
33505
|
if (result.success && result.user) {
|
|
32927
|
-
console.log(
|
|
32928
|
-
console.log(
|
|
32929
|
-
console.log(
|
|
33506
|
+
console.log(chalk17__default.default.green("\u2705 Successfully logged in!"));
|
|
33507
|
+
console.log(chalk17__default.default.white(`\u{1F464} User: ${chalk17__default.default.cyan(result.user.email)}`));
|
|
33508
|
+
console.log(chalk17__default.default.white(`\u{1F4CA} Plan: ${chalk17__default.default.cyan(result.user.plan)}`));
|
|
32930
33509
|
} else {
|
|
32931
|
-
console.log(
|
|
32932
|
-
if (result.error) console.log(
|
|
33510
|
+
console.log(chalk17__default.default.red("\u274C Login failed"));
|
|
33511
|
+
if (result.error) console.log(chalk17__default.default.gray(result.error));
|
|
32933
33512
|
}
|
|
32934
33513
|
}
|
|
32935
33514
|
}
|
|
32936
33515
|
} catch (error2) {
|
|
32937
|
-
console.error(
|
|
33516
|
+
console.error(chalk17__default.default.red("Login error:"), error2.message);
|
|
32938
33517
|
}
|
|
32939
33518
|
return true;
|
|
32940
33519
|
}
|
|
32941
33520
|
if (cmd === "logout" || cmd === "signout") {
|
|
32942
33521
|
try {
|
|
32943
33522
|
await authManager.logout();
|
|
32944
|
-
console.log(
|
|
33523
|
+
console.log(chalk17__default.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
32945
33524
|
} catch (error2) {
|
|
32946
|
-
console.error(
|
|
33525
|
+
console.error(chalk17__default.default.red("Logout error:"), error2.message);
|
|
32947
33526
|
}
|
|
32948
33527
|
return true;
|
|
32949
33528
|
}
|
|
@@ -33044,11 +33623,11 @@ Chat:
|
|
|
33044
33623
|
}
|
|
33045
33624
|
}
|
|
33046
33625
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33047
|
-
console.log(
|
|
33048
|
-
console.log(
|
|
33049
|
-
console.log(
|
|
33050
|
-
console.log(
|
|
33051
|
-
console.log(
|
|
33626
|
+
console.log(chalk17__default.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33627
|
+
console.log(chalk17__default.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33628
|
+
console.log(chalk17__default.default.gray(" \u2022 Type /help to see available commands"));
|
|
33629
|
+
console.log(chalk17__default.default.gray(" \u2022 Check if you need to /login first"));
|
|
33630
|
+
console.log(chalk17__default.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33052
33631
|
}
|
|
33053
33632
|
return true;
|
|
33054
33633
|
}
|
|
@@ -33316,11 +33895,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33316
33895
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33317
33896
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33318
33897
|
console.log(
|
|
33319
|
-
|
|
33320
|
-
`) +
|
|
33321
|
-
`) +
|
|
33322
|
-
`) +
|
|
33323
|
-
`) +
|
|
33898
|
+
chalk17__default.default.green("\n\u2705 **Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33899
|
+
`) + chalk17__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33900
|
+
`) + chalk17__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33901
|
+
`) + chalk17__default.default.white(` \u{1F4DD} Language: ${language}
|
|
33902
|
+
`) + chalk17__default.default.dim(`
|
|
33324
33903
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33325
33904
|
);
|
|
33326
33905
|
} else {
|
|
@@ -33329,11 +33908,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33329
33908
|
} catch (e2) {
|
|
33330
33909
|
spinner.stop();
|
|
33331
33910
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33332
|
-
console.error(
|
|
33911
|
+
console.error(chalk17__default.default.red("Code generation error:"), e2.message || e2);
|
|
33333
33912
|
}
|
|
33334
33913
|
const fallbackCode = templateFallback(prompt);
|
|
33335
33914
|
console.log(
|
|
33336
|
-
|
|
33915
|
+
chalk17__default.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33337
33916
|
);
|
|
33338
33917
|
console.log(fallbackCode);
|
|
33339
33918
|
try {
|
|
@@ -33342,14 +33921,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33342
33921
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33343
33922
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33344
33923
|
console.log(
|
|
33345
|
-
|
|
33346
|
-
`) +
|
|
33347
|
-
`) +
|
|
33348
|
-
`) +
|
|
33924
|
+
chalk17__default.default.green("\n\u2705 **Template Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33925
|
+
`) + chalk17__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33926
|
+
`) + chalk17__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33927
|
+
`) + chalk17__default.default.dim(`
|
|
33349
33928
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33350
33929
|
);
|
|
33351
33930
|
} catch (saveError) {
|
|
33352
|
-
console.error(
|
|
33931
|
+
console.error(chalk17__default.default.red("Failed to save code:"), saveError);
|
|
33353
33932
|
}
|
|
33354
33933
|
}
|
|
33355
33934
|
}
|
|
@@ -33405,7 +33984,7 @@ ${userPrompt}`;
|
|
|
33405
33984
|
(seq) => response2.includes(seq)
|
|
33406
33985
|
);
|
|
33407
33986
|
if (guidedFlowDetected) {
|
|
33408
|
-
console.log(
|
|
33987
|
+
console.log(chalk17__default.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33409
33988
|
return null;
|
|
33410
33989
|
}
|
|
33411
33990
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33573,14 +34152,14 @@ async function streamAnswer(text) {
|
|
|
33573
34152
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33574
34153
|
} else {
|
|
33575
34154
|
animation.stop();
|
|
33576
|
-
console.log(
|
|
34155
|
+
console.log(chalk17__default.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33577
34156
|
}
|
|
33578
34157
|
} catch (e2) {
|
|
33579
34158
|
animation.stop();
|
|
33580
34159
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33581
|
-
console.log(
|
|
34160
|
+
console.log(chalk17__default.default.yellow(e2.message));
|
|
33582
34161
|
} else {
|
|
33583
|
-
console.log(
|
|
34162
|
+
console.log(chalk17__default.default.red("Error generating response:"), e2.message || e2);
|
|
33584
34163
|
}
|
|
33585
34164
|
}
|
|
33586
34165
|
}
|
|
@@ -33595,9 +34174,9 @@ async function handleLine(line) {
|
|
|
33595
34174
|
if (consumed) return;
|
|
33596
34175
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33597
34176
|
if (!isAuthenticated) {
|
|
33598
|
-
console.log(
|
|
33599
|
-
console.log(
|
|
33600
|
-
console.log(
|
|
34177
|
+
console.log(chalk17__default.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
34178
|
+
console.log(chalk17__default.default.cyan("Please run: /login"));
|
|
34179
|
+
console.log(chalk17__default.default.gray("Or use slash commands like /help, /version"));
|
|
33601
34180
|
return;
|
|
33602
34181
|
}
|
|
33603
34182
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -33619,7 +34198,7 @@ async function startInteractiveSession() {
|
|
|
33619
34198
|
}
|
|
33620
34199
|
}
|
|
33621
34200
|
const stop = async () => {
|
|
33622
|
-
console.log(
|
|
34201
|
+
console.log(chalk17__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33623
34202
|
if (store?.close) await store.close().catch(() => {
|
|
33624
34203
|
});
|
|
33625
34204
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -33629,7 +34208,7 @@ async function startInteractiveSession() {
|
|
|
33629
34208
|
process.once("SIGINT", stop);
|
|
33630
34209
|
process.once("SIGTERM", stop);
|
|
33631
34210
|
if (!isTTY) {
|
|
33632
|
-
console.log(
|
|
34211
|
+
console.log(chalk17__default.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
33633
34212
|
const rl = readline5__namespace.createInterface({
|
|
33634
34213
|
input: process$1.stdin,
|
|
33635
34214
|
output: process$1.stdout,
|
|
@@ -33644,7 +34223,7 @@ async function startInteractiveSession() {
|
|
|
33644
34223
|
if (interactiveCLI) {
|
|
33645
34224
|
while (true) {
|
|
33646
34225
|
try {
|
|
33647
|
-
const prompt =
|
|
34226
|
+
const prompt = chalk17__default.default.gray("> ");
|
|
33648
34227
|
process.stdout.write(prompt);
|
|
33649
34228
|
const line = await interactiveCLI.question("");
|
|
33650
34229
|
console.log();
|
|
@@ -33659,14 +34238,14 @@ async function startInteractiveSession() {
|
|
|
33659
34238
|
await stop();
|
|
33660
34239
|
return;
|
|
33661
34240
|
}
|
|
33662
|
-
console.error(
|
|
34241
|
+
console.error(chalk17__default.default.red("Error:"), error2?.message || error2);
|
|
33663
34242
|
}
|
|
33664
34243
|
}
|
|
33665
34244
|
} else {
|
|
33666
34245
|
const rl = readline5__namespace.createInterface({ input: process$1.stdin, output: process$1.stdout });
|
|
33667
34246
|
while (true) {
|
|
33668
34247
|
try {
|
|
33669
|
-
const prompt =
|
|
34248
|
+
const prompt = chalk17__default.default.gray("> ");
|
|
33670
34249
|
const line = await rl.question(prompt);
|
|
33671
34250
|
console.log();
|
|
33672
34251
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -33680,7 +34259,7 @@ async function startInteractiveSession() {
|
|
|
33680
34259
|
await stop();
|
|
33681
34260
|
return;
|
|
33682
34261
|
}
|
|
33683
|
-
console.error(
|
|
34262
|
+
console.error(chalk17__default.default.red("Error:"), error2?.message || error2);
|
|
33684
34263
|
}
|
|
33685
34264
|
}
|
|
33686
34265
|
}
|
|
@@ -33690,7 +34269,7 @@ function createCLI2() {
|
|
|
33690
34269
|
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
34270
|
loadEnvironmentVariables();
|
|
33692
34271
|
if (options.server) {
|
|
33693
|
-
console.log(
|
|
34272
|
+
console.log(chalk17__default.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
33694
34273
|
try {
|
|
33695
34274
|
const serverPath = path8__namespace.join(process.cwd(), "server.mjs");
|
|
33696
34275
|
const { spawn } = await import('child_process');
|
|
@@ -33699,32 +34278,44 @@ function createCLI2() {
|
|
|
33699
34278
|
env: process.env
|
|
33700
34279
|
});
|
|
33701
34280
|
serverProcess.on("error", (error2) => {
|
|
33702
|
-
console.error(
|
|
34281
|
+
console.error(chalk17__default.default.red("\u274C Server process error:"), error2);
|
|
33703
34282
|
process.exit(1);
|
|
33704
34283
|
});
|
|
33705
34284
|
return;
|
|
33706
34285
|
} catch (error2) {
|
|
33707
|
-
console.error(
|
|
34286
|
+
console.error(chalk17__default.default.red("\u274C Failed to start server mode:"), error2);
|
|
33708
34287
|
process.exit(1);
|
|
33709
34288
|
}
|
|
33710
34289
|
}
|
|
34290
|
+
if (!startupDisplayed) {
|
|
34291
|
+
try {
|
|
34292
|
+
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
34293
|
+
displayStartupLogo2();
|
|
34294
|
+
startupDisplayed = true;
|
|
34295
|
+
} catch {
|
|
34296
|
+
console.log(chalk17__default.default.cyan(`
|
|
34297
|
+
\u{1F680} MARIA v${getVersion()}
|
|
34298
|
+
`));
|
|
34299
|
+
startupDisplayed = true;
|
|
34300
|
+
}
|
|
34301
|
+
}
|
|
33711
34302
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
33712
34303
|
if (useV3) {
|
|
33713
34304
|
try {
|
|
33714
|
-
console.log(
|
|
34305
|
+
console.log(chalk17__default.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
33715
34306
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
33716
34307
|
const maria = new MariaAI2();
|
|
33717
34308
|
await maria.initialize();
|
|
33718
34309
|
return;
|
|
33719
34310
|
} catch (e2) {
|
|
33720
|
-
console.warn(
|
|
34311
|
+
console.warn(chalk17__default.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
33721
34312
|
}
|
|
33722
34313
|
}
|
|
33723
34314
|
await startInteractiveSession();
|
|
33724
34315
|
});
|
|
33725
34316
|
return program2;
|
|
33726
34317
|
}
|
|
33727
|
-
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, program;
|
|
34318
|
+
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, startupDisplayed, program;
|
|
33728
34319
|
var init_cli = __esm({
|
|
33729
34320
|
"src/cli.ts"() {
|
|
33730
34321
|
init_env_loader();
|
|
@@ -33733,6 +34324,7 @@ var init_cli = __esm({
|
|
|
33733
34324
|
init_cli_auth();
|
|
33734
34325
|
session = [];
|
|
33735
34326
|
commandManager = null;
|
|
34327
|
+
startupDisplayed = false;
|
|
33736
34328
|
program = createCLI2();
|
|
33737
34329
|
program.parse(process.argv);
|
|
33738
34330
|
}
|