@bonginkan/maria 4.2.2 → 4.2.4
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 +688 -968
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +550 -824
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var path8 = require('path');
|
|
6
6
|
var dotenv = require('dotenv');
|
|
7
|
-
var
|
|
7
|
+
var chalk16 = require('chalk');
|
|
8
8
|
var os = require('os');
|
|
9
9
|
var fsp = require('fs/promises');
|
|
10
10
|
var crypto = require('crypto');
|
|
@@ -21,8 +21,6 @@ var zlib = require('zlib');
|
|
|
21
21
|
var secretManager = require('@google-cloud/secret-manager');
|
|
22
22
|
var readline = require('readline');
|
|
23
23
|
var zod = require('zod');
|
|
24
|
-
require('strip-ansi');
|
|
25
|
-
require('string-width');
|
|
26
24
|
var process$1 = require('process');
|
|
27
25
|
var ora = require('ora');
|
|
28
26
|
var perf_hooks = require('perf_hooks');
|
|
@@ -52,7 +50,7 @@ function _interopNamespace(e) {
|
|
|
52
50
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
53
51
|
var path8__namespace = /*#__PURE__*/_interopNamespace(path8);
|
|
54
52
|
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
55
|
-
var
|
|
53
|
+
var chalk16__default = /*#__PURE__*/_interopDefault(chalk16);
|
|
56
54
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
57
55
|
var fsp__namespace = /*#__PURE__*/_interopNamespace(fsp);
|
|
58
56
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
@@ -252,7 +250,7 @@ var init_animations = __esm({
|
|
|
252
250
|
start() {
|
|
253
251
|
this.interval = setInterval(() => {
|
|
254
252
|
process.stdout.write(
|
|
255
|
-
`\r${
|
|
253
|
+
`\r${chalk16__default.default.cyan(this.frames[this.currentFrame])} ${chalk16__default.default.gray(this.message)}...`
|
|
256
254
|
);
|
|
257
255
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
258
256
|
}, 80);
|
|
@@ -290,7 +288,7 @@ var init_animations = __esm({
|
|
|
290
288
|
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
291
289
|
const stage = this.stages[this.currentStage];
|
|
292
290
|
process.stdout.write(
|
|
293
|
-
`\r${
|
|
291
|
+
`\r${chalk16__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage.icon} ${chalk16__default.default.gray(stage.message)}... ${chalk16__default.default.dim(`[${elapsed}s]`)}`
|
|
294
292
|
);
|
|
295
293
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
296
294
|
}, 80);
|
|
@@ -352,11 +350,11 @@ var init_animations = __esm({
|
|
|
352
350
|
const stage = stages[this.currentStage];
|
|
353
351
|
if (this.isComplex) {
|
|
354
352
|
process.stdout.write(
|
|
355
|
-
`\r${
|
|
353
|
+
`\r${chalk16__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage} ${chalk16__default.default.dim(`[${elapsed}s]`)}`
|
|
356
354
|
);
|
|
357
355
|
} else {
|
|
358
356
|
process.stdout.write(
|
|
359
|
-
`\r${
|
|
357
|
+
`\r${chalk16__default.default.cyan(this.spinnerFrames[this.currentFrame])} ${chalk16__default.default.gray(stage)}...`
|
|
360
358
|
);
|
|
361
359
|
}
|
|
362
360
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
@@ -399,7 +397,7 @@ var init_animations = __esm({
|
|
|
399
397
|
start() {
|
|
400
398
|
this.interval = setInterval(() => {
|
|
401
399
|
process.stdout.write(
|
|
402
|
-
`\r${
|
|
400
|
+
`\r${chalk16__default.default.cyan(this.message)}${this.dots[this.currentDot]}`
|
|
403
401
|
);
|
|
404
402
|
this.currentDot = (this.currentDot + 1) % this.dots.length;
|
|
405
403
|
}, 300);
|
|
@@ -428,7 +426,7 @@ var init_animations = __esm({
|
|
|
428
426
|
const frame = this.frames[this.currentFrame];
|
|
429
427
|
const message = this.messages[this.currentFrame];
|
|
430
428
|
process.stdout.write(
|
|
431
|
-
`\r${frame} ${
|
|
429
|
+
`\r${frame} ${chalk16__default.default.cyan(message)}...`
|
|
432
430
|
);
|
|
433
431
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
434
432
|
}, 1e3);
|
|
@@ -456,7 +454,7 @@ var init_animations = __esm({
|
|
|
456
454
|
const percentage = Math.floor(this.current / this.total * 100);
|
|
457
455
|
const filled = Math.floor(this.current / this.total * this.width);
|
|
458
456
|
const empty = this.width - filled;
|
|
459
|
-
const bar =
|
|
457
|
+
const bar = chalk16__default.default.green("\u2588").repeat(filled) + chalk16__default.default.gray("\u2591").repeat(empty);
|
|
460
458
|
process.stdout.write(`\r${this.label}: [${bar}] ${percentage}%`);
|
|
461
459
|
if (this.current >= this.total) {
|
|
462
460
|
process.stdout.write("\n");
|
|
@@ -1200,7 +1198,7 @@ function withAuth(fn) {
|
|
|
1200
1198
|
try {
|
|
1201
1199
|
const tokens = await authManager.getValidTokens();
|
|
1202
1200
|
if (!tokens) {
|
|
1203
|
-
console.log(
|
|
1201
|
+
console.log(chalk16__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1204
1202
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1205
1203
|
}
|
|
1206
1204
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -1209,28 +1207,28 @@ function withAuth(fn) {
|
|
|
1209
1207
|
return await fn(...args);
|
|
1210
1208
|
} catch (error2) {
|
|
1211
1209
|
if (error2.code === "AUTH_REQUIRED") {
|
|
1212
|
-
console.log(
|
|
1210
|
+
console.log(chalk16__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
1213
1211
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
1214
1212
|
}
|
|
1215
1213
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
1216
|
-
console.log(
|
|
1214
|
+
console.log(chalk16__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
1217
1215
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
1218
1216
|
}
|
|
1219
1217
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
1220
|
-
console.log(
|
|
1218
|
+
console.log(chalk16__default.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
1221
1219
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
1222
1220
|
}
|
|
1223
1221
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
1224
|
-
console.log(
|
|
1222
|
+
console.log(chalk16__default.default.yellow("\u{1F512} Not available in current plan"));
|
|
1225
1223
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
1226
1224
|
}
|
|
1227
1225
|
if (error2.code === "RATE_LIMITED") {
|
|
1228
1226
|
const retryAfter = error2.retryAfter || 5;
|
|
1229
|
-
console.log(
|
|
1227
|
+
console.log(chalk16__default.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
1230
1228
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
1231
1229
|
}
|
|
1232
1230
|
if (error2.code === "NETWORK_ERROR") {
|
|
1233
|
-
console.log(
|
|
1231
|
+
console.log(chalk16__default.default.red("\u{1F310} Network error, check connection"));
|
|
1234
1232
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
1235
1233
|
}
|
|
1236
1234
|
throw error2;
|
|
@@ -9387,6 +9385,7 @@ var init_groq_provider = __esm({
|
|
|
9387
9385
|
"src/providers/groq-provider.ts"() {
|
|
9388
9386
|
init_base_provider();
|
|
9389
9387
|
GroqProvider = class extends UnifiedBaseProvider {
|
|
9388
|
+
id = "groq";
|
|
9390
9389
|
name = "groq";
|
|
9391
9390
|
modelsCache;
|
|
9392
9391
|
constructor(apiKey) {
|
|
@@ -9412,6 +9411,15 @@ var init_groq_provider = __esm({
|
|
|
9412
9411
|
}
|
|
9413
9412
|
}
|
|
9414
9413
|
async getModels() {
|
|
9414
|
+
const models = [
|
|
9415
|
+
"llama-3.3-70b-versatile",
|
|
9416
|
+
"llama-3.2-90b-vision-preview",
|
|
9417
|
+
"mixtral-8x7b-32768",
|
|
9418
|
+
"gemma2-9b-it"
|
|
9419
|
+
];
|
|
9420
|
+
return models;
|
|
9421
|
+
}
|
|
9422
|
+
async getModelInfo() {
|
|
9415
9423
|
if (this.modelsCache) {
|
|
9416
9424
|
return this.modelsCache;
|
|
9417
9425
|
}
|
|
@@ -9464,33 +9472,102 @@ var init_groq_provider = __esm({
|
|
|
9464
9472
|
this.modelsCache = models;
|
|
9465
9473
|
return models;
|
|
9466
9474
|
}
|
|
9475
|
+
async complete(prompt, req) {
|
|
9476
|
+
if (!await this.isAvailable()) {
|
|
9477
|
+
throw new Error("Groq API not available");
|
|
9478
|
+
}
|
|
9479
|
+
const model = req.model || "mixtral-8x7b-32768";
|
|
9480
|
+
const payload = {
|
|
9481
|
+
model,
|
|
9482
|
+
messages: [{ role: "user", content: prompt }],
|
|
9483
|
+
temperature: req.temperature || 0.7,
|
|
9484
|
+
max_tokens: req.maxTokens || 4e3,
|
|
9485
|
+
stream: false
|
|
9486
|
+
};
|
|
9487
|
+
const response2 = await this.makeRequest(
|
|
9488
|
+
`${this.apiBase}/chat/completions`,
|
|
9489
|
+
{
|
|
9490
|
+
method: "POST",
|
|
9491
|
+
headers: {
|
|
9492
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
9493
|
+
...req.headers
|
|
9494
|
+
},
|
|
9495
|
+
body: payload,
|
|
9496
|
+
timeout: req.timeoutMs
|
|
9497
|
+
}
|
|
9498
|
+
);
|
|
9499
|
+
return {
|
|
9500
|
+
content: response2.choices[0]?.message?.content || "",
|
|
9501
|
+
model,
|
|
9502
|
+
usage: {
|
|
9503
|
+
promptTokens: response2.usage?.prompt_tokens || 0,
|
|
9504
|
+
completionTokens: response2.usage?.completion_tokens || 0,
|
|
9505
|
+
totalTokens: response2.usage?.total_tokens || 0
|
|
9506
|
+
},
|
|
9507
|
+
finishReason: response2.choices[0]?.finish_reason || "stop"
|
|
9508
|
+
};
|
|
9509
|
+
}
|
|
9510
|
+
async stream(prompt, req) {
|
|
9511
|
+
if (!await this.isAvailable()) {
|
|
9512
|
+
throw new Error("Groq API not available");
|
|
9513
|
+
}
|
|
9514
|
+
const model = req.model || "mixtral-8x7b-32768";
|
|
9515
|
+
const payload = {
|
|
9516
|
+
model,
|
|
9517
|
+
messages: [{ role: "user", content: prompt }],
|
|
9518
|
+
temperature: req.temperature || 0.7,
|
|
9519
|
+
max_tokens: req.maxTokens || 4e3,
|
|
9520
|
+
stream: true
|
|
9521
|
+
};
|
|
9522
|
+
const stream = await this.makeStreamRequest(
|
|
9523
|
+
`${this.apiBase}/chat/completions`,
|
|
9524
|
+
{
|
|
9525
|
+
method: "POST",
|
|
9526
|
+
headers: {
|
|
9527
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
9528
|
+
...req.headers
|
|
9529
|
+
},
|
|
9530
|
+
body: payload,
|
|
9531
|
+
timeout: req.timeoutMs
|
|
9532
|
+
}
|
|
9533
|
+
);
|
|
9534
|
+
async function* chunkGenerator() {
|
|
9535
|
+
for await (const chunk of stream) {
|
|
9536
|
+
yield {
|
|
9537
|
+
content: chunk,
|
|
9538
|
+
delta: chunk
|
|
9539
|
+
};
|
|
9540
|
+
}
|
|
9541
|
+
}
|
|
9542
|
+
return chunkGenerator();
|
|
9543
|
+
}
|
|
9467
9544
|
async chat(request) {
|
|
9468
9545
|
if (!await this.isAvailable()) {
|
|
9469
9546
|
throw new Error("Groq API not available");
|
|
9470
9547
|
}
|
|
9471
|
-
const
|
|
9548
|
+
const model = request.model || "mixtral-8x7b-32768";
|
|
9472
9549
|
const _startTime = Date.now();
|
|
9473
9550
|
const _payload = {
|
|
9474
|
-
|
|
9551
|
+
model,
|
|
9475
9552
|
messages: request.messages,
|
|
9476
9553
|
temperature: request.temperature || 0.7,
|
|
9477
|
-
|
|
9478
|
-
|
|
9554
|
+
max_tokens: request.maxTokens || 4e3,
|
|
9555
|
+
stream: request.stream || false
|
|
9479
9556
|
};
|
|
9480
|
-
if (request.
|
|
9481
|
-
const
|
|
9557
|
+
if (request.stream) {
|
|
9558
|
+
const stream = await this.makeStreamRequest(
|
|
9482
9559
|
`${this.apiBase}/chat/completions`,
|
|
9483
9560
|
{
|
|
9484
9561
|
method: "POST",
|
|
9485
9562
|
headers: {
|
|
9486
9563
|
Authorization: `Bearer ${this.apiKey}`
|
|
9487
9564
|
},
|
|
9488
|
-
body:
|
|
9565
|
+
body: _payload
|
|
9489
9566
|
}
|
|
9490
9567
|
);
|
|
9491
9568
|
return {
|
|
9492
|
-
|
|
9493
|
-
|
|
9569
|
+
stream,
|
|
9570
|
+
model,
|
|
9494
9571
|
provider: this.name,
|
|
9495
9572
|
responseTime: Date.now() - _startTime
|
|
9496
9573
|
};
|
|
@@ -9502,12 +9579,12 @@ var init_groq_provider = __esm({
|
|
|
9502
9579
|
headers: {
|
|
9503
9580
|
Authorization: `Bearer ${this.apiKey}`
|
|
9504
9581
|
},
|
|
9505
|
-
body:
|
|
9582
|
+
body: _payload
|
|
9506
9583
|
}
|
|
9507
9584
|
);
|
|
9508
9585
|
return {
|
|
9509
9586
|
content: _response.choices[0]?.message?.content || "",
|
|
9510
|
-
|
|
9587
|
+
model,
|
|
9511
9588
|
provider: this.name,
|
|
9512
9589
|
usage: {
|
|
9513
9590
|
promptTokens: _response.usage?.prompt_tokens || 0,
|
|
@@ -9524,7 +9601,7 @@ var init_groq_provider = __esm({
|
|
|
9524
9601
|
const _base64Image = _image.toString("base64");
|
|
9525
9602
|
const _startTime = Date.now();
|
|
9526
9603
|
const _payload = {
|
|
9527
|
-
|
|
9604
|
+
model: "llama-3.2-90b-vision-preview",
|
|
9528
9605
|
messages: [
|
|
9529
9606
|
{
|
|
9530
9607
|
role: "user",
|
|
@@ -9539,7 +9616,7 @@ var init_groq_provider = __esm({
|
|
|
9539
9616
|
]
|
|
9540
9617
|
}
|
|
9541
9618
|
],
|
|
9542
|
-
|
|
9619
|
+
max_tokens: 4e3
|
|
9543
9620
|
};
|
|
9544
9621
|
const _response = await this.makeRequest(
|
|
9545
9622
|
`${this.apiBase}/chat/completions`,
|
|
@@ -9548,12 +9625,12 @@ var init_groq_provider = __esm({
|
|
|
9548
9625
|
headers: {
|
|
9549
9626
|
Authorization: `Bearer ${this.apiKey}`
|
|
9550
9627
|
},
|
|
9551
|
-
body:
|
|
9628
|
+
body: _payload
|
|
9552
9629
|
}
|
|
9553
9630
|
);
|
|
9554
9631
|
return {
|
|
9555
9632
|
content: _response.choices[0]?.message?.content || "",
|
|
9556
|
-
|
|
9633
|
+
model: "llama-3.2-90b-vision-preview",
|
|
9557
9634
|
provider: this.name,
|
|
9558
9635
|
usage: {
|
|
9559
9636
|
promptTokens: _response.usage?.prompt_tokens || 0,
|
|
@@ -12460,21 +12537,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
12460
12537
|
process.stdout.write("\x1B[s");
|
|
12461
12538
|
process.stdout.write("\n");
|
|
12462
12539
|
process.stdout.write(
|
|
12463
|
-
"\x1B[K" +
|
|
12540
|
+
"\x1B[K" + chalk16__default.default.white(
|
|
12464
12541
|
"\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"
|
|
12465
12542
|
) + "\n"
|
|
12466
12543
|
);
|
|
12467
12544
|
this.suggestions.forEach((suggestion, index) => {
|
|
12468
12545
|
const isSelected = index === this.selectedIndex;
|
|
12469
|
-
const prefix = isSelected ?
|
|
12470
|
-
const nameStyle = isSelected ?
|
|
12546
|
+
const prefix = isSelected ? chalk16__default.default.cyan("\u25BA ") : " ";
|
|
12547
|
+
const nameStyle = isSelected ? chalk16__default.default.inverse : (s2) => s2;
|
|
12471
12548
|
const displayName = suggestion.name.padEnd(20);
|
|
12472
12549
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
12473
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
12550
|
+
const line = `\u2502${prefix}${nameStyle(chalk16__default.default.white(displayName) + " " + chalk16__default.default.gray(displayDesc))} \u2502`;
|
|
12474
12551
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
12475
12552
|
});
|
|
12476
12553
|
process.stdout.write(
|
|
12477
|
-
"\x1B[K" +
|
|
12554
|
+
"\x1B[K" + chalk16__default.default.white(
|
|
12478
12555
|
"\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"
|
|
12479
12556
|
) + "\n"
|
|
12480
12557
|
);
|
|
@@ -12888,7 +12965,7 @@ var init_interactive_cli = __esm({
|
|
|
12888
12965
|
}
|
|
12889
12966
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
12890
12967
|
readline__namespace.clearLine(process.stdout, 0);
|
|
12891
|
-
const prompt =
|
|
12968
|
+
const prompt = chalk16__default.default.cyan("> ");
|
|
12892
12969
|
const displayInput = this.currentInput;
|
|
12893
12970
|
process.stdout.write(prompt + displayInput);
|
|
12894
12971
|
const promptLength = 2;
|
|
@@ -12908,9 +12985,9 @@ var init_interactive_cli = __esm({
|
|
|
12908
12985
|
readline__namespace.moveCursor(process.stdout, 0, 2);
|
|
12909
12986
|
this.suggestions.forEach((suggestion, index) => {
|
|
12910
12987
|
const isSelected = index === this.selectedIndex;
|
|
12911
|
-
const prefix = isSelected ?
|
|
12912
|
-
const nameStyle = isSelected ?
|
|
12913
|
-
const descStyle = isSelected ?
|
|
12988
|
+
const prefix = isSelected ? chalk16__default.default.cyan("\u25BA ") : " ";
|
|
12989
|
+
const nameStyle = isSelected ? chalk16__default.default.inverse.white : chalk16__default.default.white;
|
|
12990
|
+
const descStyle = isSelected ? chalk16__default.default.inverse.gray : chalk16__default.default.gray;
|
|
12914
12991
|
const name2 = suggestion.name.padEnd(15);
|
|
12915
12992
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
12916
12993
|
readline__namespace.cursorTo(process.stdout, 0);
|
|
@@ -12931,20 +13008,20 @@ var init_interactive_cli = __esm({
|
|
|
12931
13008
|
const promptLength = 2;
|
|
12932
13009
|
const savedX = this.cursorPosition + promptLength;
|
|
12933
13010
|
process.stdout.write("\n");
|
|
12934
|
-
process.stdout.write(
|
|
13011
|
+
process.stdout.write(chalk16__default.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
12935
13012
|
this.suggestions.forEach((suggestion, index) => {
|
|
12936
13013
|
const isSelected = index === this.selectedIndex;
|
|
12937
|
-
const prefix = isSelected ?
|
|
12938
|
-
const nameStyle = isSelected ?
|
|
12939
|
-
const descStyle = isSelected ?
|
|
13014
|
+
const prefix = isSelected ? chalk16__default.default.cyan("\u25BA ") : " ";
|
|
13015
|
+
const nameStyle = isSelected ? chalk16__default.default.inverse.white : chalk16__default.default.white;
|
|
13016
|
+
const descStyle = isSelected ? chalk16__default.default.inverse.gray : chalk16__default.default.gray;
|
|
12940
13017
|
const name2 = suggestion.name.padEnd(15);
|
|
12941
13018
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
12942
13019
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
12943
13020
|
`);
|
|
12944
13021
|
});
|
|
12945
|
-
process.stdout.write(
|
|
13022
|
+
process.stdout.write(chalk16__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"));
|
|
12946
13023
|
process.stdout.write(
|
|
12947
|
-
|
|
13024
|
+
chalk16__default.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
12948
13025
|
);
|
|
12949
13026
|
const totalLines = this.suggestions.length + 4;
|
|
12950
13027
|
readline__namespace.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -13044,27 +13121,27 @@ var init_logger = __esm({
|
|
|
13044
13121
|
}
|
|
13045
13122
|
debug(...args) {
|
|
13046
13123
|
if (this.level <= 0 /* DEBUG */) {
|
|
13047
|
-
console.log(
|
|
13124
|
+
console.log(chalk16__default.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
13048
13125
|
}
|
|
13049
13126
|
}
|
|
13050
13127
|
info(...args) {
|
|
13051
13128
|
if (this.level <= 1 /* INFO */) {
|
|
13052
|
-
console.log(
|
|
13129
|
+
console.log(chalk16__default.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
13053
13130
|
}
|
|
13054
13131
|
}
|
|
13055
13132
|
warn(...args) {
|
|
13056
13133
|
if (this.level <= 2 /* WARN */) {
|
|
13057
|
-
console.warn(
|
|
13134
|
+
console.warn(chalk16__default.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
13058
13135
|
}
|
|
13059
13136
|
}
|
|
13060
13137
|
error(...args) {
|
|
13061
13138
|
if (this.level <= 3 /* ERROR */) {
|
|
13062
|
-
console.error(
|
|
13139
|
+
console.error(chalk16__default.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
13063
13140
|
}
|
|
13064
13141
|
}
|
|
13065
13142
|
success(...args) {
|
|
13066
13143
|
if (this.level <= 1 /* INFO */) {
|
|
13067
|
-
console.log(
|
|
13144
|
+
console.log(chalk16__default.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
13068
13145
|
}
|
|
13069
13146
|
}
|
|
13070
13147
|
task(taskName, status, message) {
|
|
@@ -13078,10 +13155,10 @@ var init_logger = __esm({
|
|
|
13078
13155
|
error: "\u274C"
|
|
13079
13156
|
};
|
|
13080
13157
|
const statusColors = {
|
|
13081
|
-
start:
|
|
13082
|
-
progress:
|
|
13083
|
-
complete:
|
|
13084
|
-
error:
|
|
13158
|
+
start: chalk16__default.default.bold.magenta,
|
|
13159
|
+
progress: chalk16__default.default.magenta,
|
|
13160
|
+
complete: chalk16__default.default.bold.magenta,
|
|
13161
|
+
error: chalk16__default.default.bold.magenta
|
|
13085
13162
|
};
|
|
13086
13163
|
const icon = statusIcons[status];
|
|
13087
13164
|
const color = statusColors[status];
|
|
@@ -13098,14 +13175,14 @@ var init_logger = __esm({
|
|
|
13098
13175
|
if (this.level > 0 /* DEBUG */) {
|
|
13099
13176
|
return;
|
|
13100
13177
|
}
|
|
13101
|
-
console.log(
|
|
13178
|
+
console.log(chalk16__default.default.magenta(`${this.prefix} [JSON]`));
|
|
13102
13179
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
13103
13180
|
}
|
|
13104
13181
|
divider() {
|
|
13105
13182
|
if (this.level > 1 /* INFO */) {
|
|
13106
13183
|
return;
|
|
13107
13184
|
}
|
|
13108
|
-
console.log(
|
|
13185
|
+
console.log(chalk16__default.default.magenta("\u2500".repeat(60)));
|
|
13109
13186
|
}
|
|
13110
13187
|
clear() {
|
|
13111
13188
|
console.clear();
|
|
@@ -13125,7 +13202,7 @@ var init_logger = __esm({
|
|
|
13125
13202
|
const progressText = `${current}/${total}`;
|
|
13126
13203
|
const labelText = label ? ` ${label}` : "";
|
|
13127
13204
|
process.stdout.write(
|
|
13128
|
-
`\r${
|
|
13205
|
+
`\r${chalk16__default.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
13129
13206
|
);
|
|
13130
13207
|
if (current === total) {
|
|
13131
13208
|
process.stdout.write("\n");
|
|
@@ -13761,7 +13838,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
13761
13838
|
this.httpEndpoint = process.env.TELEMETRY_ENDPOINT || null;
|
|
13762
13839
|
if (this.isEnabled) {
|
|
13763
13840
|
this.initialize().catch((error2) => {
|
|
13764
|
-
console.error("[Telemetry] Initialization error:", error2);
|
|
13765
13841
|
});
|
|
13766
13842
|
}
|
|
13767
13843
|
}
|
|
@@ -13785,9 +13861,7 @@ var init_bigquery_telemetry = __esm({
|
|
|
13785
13861
|
projectId: this.config.projectId,
|
|
13786
13862
|
keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS
|
|
13787
13863
|
});
|
|
13788
|
-
console.log("[Telemetry] BigQuery client initialized");
|
|
13789
13864
|
} catch (error2) {
|
|
13790
|
-
console.error("[Telemetry] Failed to initialize BigQuery:", error2);
|
|
13791
13865
|
}
|
|
13792
13866
|
}
|
|
13793
13867
|
this.startFlushTimer();
|
|
@@ -13827,10 +13901,8 @@ var init_bigquery_telemetry = __esm({
|
|
|
13827
13901
|
} else if (this.httpEndpoint) {
|
|
13828
13902
|
await this.flushToHttpEndpoint(dataToFlush);
|
|
13829
13903
|
} else {
|
|
13830
|
-
console.debug(`[Telemetry] Discarding ${dataToFlush.length} events (no backend)`);
|
|
13831
13904
|
}
|
|
13832
13905
|
} catch (error2) {
|
|
13833
|
-
console.error("[Telemetry] Flush failed:", error2);
|
|
13834
13906
|
if (this.telemetryQueue.length < this.config.batchSize * 2) {
|
|
13835
13907
|
this.telemetryQueue = [...dataToFlush, ...this.telemetryQueue];
|
|
13836
13908
|
}
|
|
@@ -13864,7 +13936,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
13864
13936
|
ignoreUnknownValues: true,
|
|
13865
13937
|
skipInvalidRows: false
|
|
13866
13938
|
});
|
|
13867
|
-
console.log(`[Telemetry] Flushed ${rows.length} events to BigQuery`);
|
|
13868
13939
|
return;
|
|
13869
13940
|
} catch (error2) {
|
|
13870
13941
|
retries++;
|
|
@@ -13895,13 +13966,11 @@ var init_bigquery_telemetry = __esm({
|
|
|
13895
13966
|
}
|
|
13896
13967
|
})
|
|
13897
13968
|
}).catch((error2) => {
|
|
13898
|
-
console.error("[Telemetry] HTTP flush failed:", error2);
|
|
13899
13969
|
throw error2;
|
|
13900
13970
|
});
|
|
13901
13971
|
if (!response2.ok) {
|
|
13902
13972
|
throw new Error(`HTTP flush failed: ${response2.status}`);
|
|
13903
13973
|
}
|
|
13904
|
-
console.log(`[Telemetry] Flushed ${data2.length} events via HTTP`);
|
|
13905
13974
|
}
|
|
13906
13975
|
/**
|
|
13907
13976
|
* Start flush timer
|
|
@@ -13910,7 +13979,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
13910
13979
|
if (this.flushTimer) return;
|
|
13911
13980
|
this.flushTimer = setInterval(() => {
|
|
13912
13981
|
this.flush().catch((error2) => {
|
|
13913
|
-
console.error("[Telemetry] Timer flush failed:", error2);
|
|
13914
13982
|
});
|
|
13915
13983
|
}, this.config.flushIntervalMs);
|
|
13916
13984
|
}
|
|
@@ -13928,7 +13996,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
13928
13996
|
*/
|
|
13929
13997
|
setupGracefulShutdown() {
|
|
13930
13998
|
const shutdown = async () => {
|
|
13931
|
-
console.log("[Telemetry] Shutting down...");
|
|
13932
13999
|
this.stopFlushTimer();
|
|
13933
14000
|
await this.flush();
|
|
13934
14001
|
process.exit(0);
|
|
@@ -15810,9 +15877,9 @@ var init_HelpCommand = __esm({
|
|
|
15810
15877
|
const stats = await this.readyService.getStatistics();
|
|
15811
15878
|
const lines = [];
|
|
15812
15879
|
lines.push("\u2550".repeat(60));
|
|
15813
|
-
lines.push(
|
|
15880
|
+
lines.push(chalk16__default.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
15814
15881
|
lines.push("");
|
|
15815
|
-
lines.push(
|
|
15882
|
+
lines.push(chalk16__default.default.bold("Quick Access:"));
|
|
15816
15883
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
15817
15884
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
15818
15885
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -15827,7 +15894,7 @@ var init_HelpCommand = __esm({
|
|
|
15827
15894
|
}
|
|
15828
15895
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
15829
15896
|
for (const category of categories) {
|
|
15830
|
-
lines.push(
|
|
15897
|
+
lines.push(chalk16__default.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
15831
15898
|
const showCommands = category.commands.slice(0, 4);
|
|
15832
15899
|
for (const cmd of showCommands) {
|
|
15833
15900
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -15847,7 +15914,7 @@ var init_HelpCommand = __esm({
|
|
|
15847
15914
|
}
|
|
15848
15915
|
lines.push("");
|
|
15849
15916
|
}
|
|
15850
|
-
lines.push(
|
|
15917
|
+
lines.push(chalk16__default.default.bold("Pro Tips:"));
|
|
15851
15918
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
15852
15919
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
15853
15920
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -15886,33 +15953,33 @@ var init_HelpCommand = __esm({
|
|
|
15886
15953
|
formatCommandHelp(command) {
|
|
15887
15954
|
const lines = [];
|
|
15888
15955
|
lines.push("");
|
|
15889
|
-
lines.push(`\u{1F4D6} ${
|
|
15956
|
+
lines.push(`\u{1F4D6} ${chalk16__default.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
15890
15957
|
lines.push("\u2550".repeat(50));
|
|
15891
15958
|
lines.push("");
|
|
15892
|
-
lines.push(
|
|
15959
|
+
lines.push(chalk16__default.default.bold("\u2139\uFE0F Information:"));
|
|
15893
15960
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
15894
15961
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
15895
15962
|
if (command.aliases && command.aliases.length > 0) {
|
|
15896
15963
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
15897
15964
|
}
|
|
15898
15965
|
lines.push("");
|
|
15899
|
-
lines.push(
|
|
15966
|
+
lines.push(chalk16__default.default.bold("\u{1F3AF} Usage:"));
|
|
15900
15967
|
lines.push(` ${command.usage}`);
|
|
15901
15968
|
lines.push("");
|
|
15902
|
-
lines.push(
|
|
15969
|
+
lines.push(chalk16__default.default.bold("\u{1F4CB} Contract Validation:"));
|
|
15903
15970
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
15904
15971
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15905
15972
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15906
15973
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
15907
15974
|
lines.push("");
|
|
15908
15975
|
if (command.examples && command.examples.length > 0) {
|
|
15909
|
-
lines.push(
|
|
15976
|
+
lines.push(chalk16__default.default.bold("\u{1F4DD} Examples:"));
|
|
15910
15977
|
for (const example of command.examples) {
|
|
15911
15978
|
lines.push(` ${example}`);
|
|
15912
15979
|
}
|
|
15913
15980
|
lines.push("");
|
|
15914
15981
|
}
|
|
15915
|
-
lines.push(
|
|
15982
|
+
lines.push(chalk16__default.default.bold("\u{1F4A1} Quick Tips:"));
|
|
15916
15983
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
15917
15984
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
15918
15985
|
if (command.category !== "core") {
|
|
@@ -15963,7 +16030,7 @@ var init_HelpCommand = __esm({
|
|
|
15963
16030
|
};
|
|
15964
16031
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
15965
16032
|
lines.push("");
|
|
15966
|
-
lines.push(`${emoji} ${
|
|
16033
|
+
lines.push(`${emoji} ${chalk16__default.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
15967
16034
|
lines.push("\u2550".repeat(50));
|
|
15968
16035
|
lines.push("");
|
|
15969
16036
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -15997,7 +16064,7 @@ var init_HelpCommand = __esm({
|
|
|
15997
16064
|
formatSearchResults(searchTerm, results) {
|
|
15998
16065
|
const lines = [];
|
|
15999
16066
|
lines.push("");
|
|
16000
|
-
lines.push(`\u{1F50D} ${
|
|
16067
|
+
lines.push(`\u{1F50D} ${chalk16__default.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
16001
16068
|
lines.push("\u2550".repeat(50));
|
|
16002
16069
|
lines.push("");
|
|
16003
16070
|
for (const result of results) {
|
|
@@ -16010,7 +16077,7 @@ var init_HelpCommand = __esm({
|
|
|
16010
16077
|
}
|
|
16011
16078
|
lines.push("");
|
|
16012
16079
|
}
|
|
16013
|
-
lines.push(
|
|
16080
|
+
lines.push(chalk16__default.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
16014
16081
|
lines.push("");
|
|
16015
16082
|
return lines.join("\n");
|
|
16016
16083
|
}
|
|
@@ -16021,38 +16088,38 @@ var init_HelpCommand = __esm({
|
|
|
16021
16088
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
16022
16089
|
const lines = [];
|
|
16023
16090
|
lines.push("");
|
|
16024
|
-
lines.push(`\u{1F680} ${
|
|
16091
|
+
lines.push(`\u{1F680} ${chalk16__default.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
16025
16092
|
lines.push("\u2550".repeat(50));
|
|
16026
16093
|
lines.push("");
|
|
16027
|
-
lines.push(
|
|
16094
|
+
lines.push(chalk16__default.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
16028
16095
|
lines.push("");
|
|
16029
|
-
lines.push(
|
|
16096
|
+
lines.push(chalk16__default.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
16030
16097
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
16031
16098
|
if (modelCmd) {
|
|
16032
16099
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
16033
16100
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
16034
16101
|
}
|
|
16035
16102
|
lines.push("");
|
|
16036
|
-
lines.push(
|
|
16103
|
+
lines.push(chalk16__default.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
16037
16104
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
16038
16105
|
if (statusCmd) {
|
|
16039
16106
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
16040
16107
|
lines.push(` Try: /status`);
|
|
16041
16108
|
}
|
|
16042
16109
|
lines.push("");
|
|
16043
|
-
lines.push(
|
|
16110
|
+
lines.push(chalk16__default.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
16044
16111
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
16045
16112
|
if (codeCmd) {
|
|
16046
16113
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
16047
16114
|
lines.push(` Try: /code create a hello world function`);
|
|
16048
16115
|
}
|
|
16049
16116
|
lines.push("");
|
|
16050
|
-
lines.push(
|
|
16117
|
+
lines.push(chalk16__default.default.bold("\u{1F527} Essential Commands:"));
|
|
16051
16118
|
for (const cmd of quickCommands) {
|
|
16052
16119
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
16053
16120
|
}
|
|
16054
16121
|
lines.push("");
|
|
16055
|
-
lines.push(
|
|
16122
|
+
lines.push(chalk16__default.default.bold("\u{1F4A1} Next Steps:"));
|
|
16056
16123
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
16057
16124
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
16058
16125
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -16067,20 +16134,20 @@ var init_HelpCommand = __esm({
|
|
|
16067
16134
|
const categories = await this.readyService.getCategories();
|
|
16068
16135
|
const lines = [];
|
|
16069
16136
|
lines.push("");
|
|
16070
|
-
lines.push(`\u{1F4CA} ${
|
|
16137
|
+
lines.push(`\u{1F4CA} ${chalk16__default.default.bold("READY COMMANDS STATISTICS")}`);
|
|
16071
16138
|
lines.push("\u2550".repeat(40));
|
|
16072
16139
|
lines.push("");
|
|
16073
|
-
lines.push(
|
|
16140
|
+
lines.push(chalk16__default.default.bold("\u{1F3AF} Overall:"));
|
|
16074
16141
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
16075
16142
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
16076
16143
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
16077
16144
|
lines.push("");
|
|
16078
|
-
lines.push(
|
|
16145
|
+
lines.push(chalk16__default.default.bold("\u26A1 Performance:"));
|
|
16079
16146
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
16080
16147
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
16081
16148
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
16082
16149
|
lines.push("");
|
|
16083
|
-
lines.push(
|
|
16150
|
+
lines.push(chalk16__default.default.bold("\u{1F4CB} By Category:"));
|
|
16084
16151
|
for (const category of categories) {
|
|
16085
16152
|
const avgTime = Math.round(
|
|
16086
16153
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -16088,7 +16155,7 @@ var init_HelpCommand = __esm({
|
|
|
16088
16155
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
16089
16156
|
}
|
|
16090
16157
|
lines.push("");
|
|
16091
|
-
lines.push(
|
|
16158
|
+
lines.push(chalk16__default.default.bold("\u2705 Contract Validation:"));
|
|
16092
16159
|
lines.push(" All commands tested for:");
|
|
16093
16160
|
lines.push(" \u2022 Basic execution without crashes");
|
|
16094
16161
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -16262,10 +16329,10 @@ var init_LoginCommand = __esm({
|
|
|
16262
16329
|
if (!authResult.success) {
|
|
16263
16330
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
16264
16331
|
}
|
|
16265
|
-
const
|
|
16266
|
-
const plan =
|
|
16267
|
-
const quotaLeft =
|
|
16268
|
-
const email =
|
|
16332
|
+
const userInfo = authResult.user;
|
|
16333
|
+
const plan = userInfo?.plan || "Free";
|
|
16334
|
+
const quotaLeft = userInfo?.usage?.requestsRemaining || 100;
|
|
16335
|
+
const email = userInfo?.email || "user";
|
|
16269
16336
|
await trackCommand({
|
|
16270
16337
|
cmd: "login",
|
|
16271
16338
|
status: "success",
|
|
@@ -16782,8 +16849,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16782
16849
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16783
16850
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16784
16851
|
const _path = await importNodeBuiltin2("path");
|
|
16785
|
-
const
|
|
16786
|
-
const targetPath = configPath || _path.join(
|
|
16852
|
+
const os8 = await importNodeBuiltin2("os");
|
|
16853
|
+
const targetPath = configPath || _path.join(os8.homedir(), ".maria", "config.json");
|
|
16787
16854
|
try {
|
|
16788
16855
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
16789
16856
|
return JSON.parse(data2);
|
|
@@ -16801,8 +16868,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
16801
16868
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
16802
16869
|
const fs12 = await importNodeBuiltin2("fs");
|
|
16803
16870
|
const _path = await importNodeBuiltin2("path");
|
|
16804
|
-
const
|
|
16805
|
-
const targetPath = configPath || _path.join(
|
|
16871
|
+
const os8 = await importNodeBuiltin2("os");
|
|
16872
|
+
const targetPath = configPath || _path.join(os8.homedir(), ".maria", "config.json");
|
|
16806
16873
|
try {
|
|
16807
16874
|
if (options?.backup) {
|
|
16808
16875
|
try {
|
|
@@ -16978,7 +17045,7 @@ var init_model_selector_ui = __esm({
|
|
|
16978
17045
|
output: process.stdout,
|
|
16979
17046
|
terminal: true
|
|
16980
17047
|
});
|
|
16981
|
-
console.log(
|
|
17048
|
+
console.log(chalk16__default.default.green(
|
|
16982
17049
|
"\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"
|
|
16983
17050
|
));
|
|
16984
17051
|
process.stdout.write("\x1B7");
|
|
@@ -17046,14 +17113,14 @@ var init_model_selector_ui = __esm({
|
|
|
17046
17113
|
}
|
|
17047
17114
|
renderFromSavedPosition() {
|
|
17048
17115
|
if (this.isDestroyed) return;
|
|
17049
|
-
console.log(
|
|
17050
|
-
"\u2502 " +
|
|
17116
|
+
console.log(chalk16__default.default.green(
|
|
17117
|
+
"\u2502 " + chalk16__default.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
17051
17118
|
));
|
|
17052
17119
|
this.renderContent();
|
|
17053
17120
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
17054
17121
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
17055
|
-
console.log(
|
|
17056
|
-
console.log(
|
|
17122
|
+
console.log(chalk16__default.default.green("\u2502 ") + chalk16__default.default.dim.green(helpText.padEnd(76)) + chalk16__default.default.green(" \u2502"));
|
|
17123
|
+
console.log(chalk16__default.default.green(
|
|
17057
17124
|
"\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"
|
|
17058
17125
|
));
|
|
17059
17126
|
}
|
|
@@ -17094,19 +17161,19 @@ var init_model_selector_ui = __esm({
|
|
|
17094
17161
|
const item = displayItems[i2];
|
|
17095
17162
|
if (item.type === "group") {
|
|
17096
17163
|
console.log(
|
|
17097
|
-
|
|
17164
|
+
chalk16__default.default.green("\u2502") + chalk16__default.default.dim.green(" \u2501\u2501\u2501 ") + chalk16__default.default.greenBright(item.content.substring(2, item.content.indexOf(" \u2500"))) + chalk16__default.default.dim.green(" " + "\u2501".repeat(71 - item.content.indexOf(" \u2500"))) + chalk16__default.default.green("\u2502")
|
|
17098
17165
|
);
|
|
17099
17166
|
} else {
|
|
17100
17167
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
17101
|
-
const prefix = isSelected ?
|
|
17168
|
+
const prefix = isSelected ? chalk16__default.default.greenBright("\u25B6 ") : " ";
|
|
17102
17169
|
const modelText = item.content;
|
|
17103
17170
|
if (isSelected) {
|
|
17104
17171
|
console.log(
|
|
17105
|
-
|
|
17172
|
+
chalk16__default.default.green("\u2502") + prefix + chalk16__default.default.black.bgGreen(modelText.padEnd(75)) + chalk16__default.default.green("\u2502")
|
|
17106
17173
|
);
|
|
17107
17174
|
} else {
|
|
17108
17175
|
console.log(
|
|
17109
|
-
|
|
17176
|
+
chalk16__default.default.green("\u2502") + prefix + chalk16__default.default.green(modelText.substring(0, 75).padEnd(75)) + chalk16__default.default.green("\u2502")
|
|
17110
17177
|
);
|
|
17111
17178
|
}
|
|
17112
17179
|
}
|
|
@@ -19331,332 +19398,6 @@ var init_ConfigCommand = __esm({
|
|
|
19331
19398
|
};
|
|
19332
19399
|
}
|
|
19333
19400
|
});
|
|
19334
|
-
function getSafeTerminalWidth() {
|
|
19335
|
-
if (process.env.MARIA_FIXED_WIDTH) {
|
|
19336
|
-
const fixed = Number(process.env.MARIA_FIXED_WIDTH);
|
|
19337
|
-
if (Number.isFinite(fixed) && fixed > 0) {
|
|
19338
|
-
return fixed;
|
|
19339
|
-
}
|
|
19340
|
-
}
|
|
19341
|
-
const isTTY = process.stdout && process.stdout.isTTY;
|
|
19342
|
-
if (isTTY && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
|
|
19343
|
-
return process.stdout.columns;
|
|
19344
|
-
}
|
|
19345
|
-
const envColumns = Number(process.env.COLUMNS);
|
|
19346
|
-
if (Number.isFinite(envColumns) && envColumns > 0) {
|
|
19347
|
-
return envColumns;
|
|
19348
|
-
}
|
|
19349
|
-
if (process.platform === "win32") {
|
|
19350
|
-
try {
|
|
19351
|
-
const { execSync } = __require("child_process");
|
|
19352
|
-
const result = execSync('powershell -command "$host.UI.RawUI.WindowSize.Width"', {
|
|
19353
|
-
encoding: "utf8",
|
|
19354
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
19355
|
-
// Suppress stderr
|
|
19356
|
-
});
|
|
19357
|
-
const width = parseInt(result.trim());
|
|
19358
|
-
if (Number.isFinite(width) && width > 0) {
|
|
19359
|
-
return width;
|
|
19360
|
-
}
|
|
19361
|
-
} catch {
|
|
19362
|
-
}
|
|
19363
|
-
}
|
|
19364
|
-
return 80;
|
|
19365
|
-
}
|
|
19366
|
-
function getResponsiveWidth(config2) {
|
|
19367
|
-
if (process.env.MARIA_DISABLE_RESPONSIVE === "1") {
|
|
19368
|
-
return config2?.maxWidth || 120;
|
|
19369
|
-
}
|
|
19370
|
-
const terminalWidth = getSafeTerminalWidth();
|
|
19371
|
-
const marginLeft = config2?.marginLeft ?? 5;
|
|
19372
|
-
const marginRight = config2?.marginRight ?? 5;
|
|
19373
|
-
const minWidth = config2?.minWidth ?? 40;
|
|
19374
|
-
const maxWidth = config2?.maxWidth ?? 200;
|
|
19375
|
-
const availableWidth = terminalWidth - marginLeft - marginRight;
|
|
19376
|
-
return Math.max(minWidth, Math.min(availableWidth, maxWidth));
|
|
19377
|
-
}
|
|
19378
|
-
function disposeSharedLayoutManager() {
|
|
19379
|
-
if (sharedManager) {
|
|
19380
|
-
sharedManager.dispose();
|
|
19381
|
-
sharedManager = null;
|
|
19382
|
-
}
|
|
19383
|
-
}
|
|
19384
|
-
function isCI() {
|
|
19385
|
-
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);
|
|
19386
|
-
}
|
|
19387
|
-
function autoConfigureForEnvironment() {
|
|
19388
|
-
if (isCI() || !process.stdout.isTTY) {
|
|
19389
|
-
if (!process.env.MARIA_FIXED_WIDTH) {
|
|
19390
|
-
process.env.MARIA_FIXED_WIDTH = "80";
|
|
19391
|
-
}
|
|
19392
|
-
}
|
|
19393
|
-
}
|
|
19394
|
-
var sharedManager;
|
|
19395
|
-
var init_responsive_width = __esm({
|
|
19396
|
-
"src/ui/integrated-cli/responsive-width.ts"() {
|
|
19397
|
-
sharedManager = null;
|
|
19398
|
-
autoConfigureForEnvironment();
|
|
19399
|
-
if (process.env.NODE_ENV !== "production") {
|
|
19400
|
-
process.on("exit", () => {
|
|
19401
|
-
disposeSharedLayoutManager();
|
|
19402
|
-
});
|
|
19403
|
-
}
|
|
19404
|
-
}
|
|
19405
|
-
});
|
|
19406
|
-
|
|
19407
|
-
// src/services/startup-display.ts
|
|
19408
|
-
var startup_display_exports = {};
|
|
19409
|
-
__export(startup_display_exports, {
|
|
19410
|
-
displayCompactLogo: () => displayCompactLogo,
|
|
19411
|
-
displayDashboardHeader: () => displayDashboardHeader,
|
|
19412
|
-
displayFinalStartupScreen: () => displayFinalStartupScreen,
|
|
19413
|
-
displayLogsBox: () => displayLogsBox,
|
|
19414
|
-
displayRoundedInputBox: () => displayRoundedInputBox,
|
|
19415
|
-
displaySpinner: () => displaySpinner,
|
|
19416
|
-
displayStartupLogo: () => displayStartupLogo
|
|
19417
|
-
});
|
|
19418
|
-
function displayStartupLogo() {
|
|
19419
|
-
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19420
|
-
console.log("");
|
|
19421
|
-
console.log(
|
|
19422
|
-
chalk17__default.default.magentaBright(
|
|
19423
|
-
"\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"
|
|
19424
|
-
)
|
|
19425
|
-
);
|
|
19426
|
-
console.log(
|
|
19427
|
-
chalk17__default.default.magentaBright(
|
|
19428
|
-
"\u2551 \u2551"
|
|
19429
|
-
)
|
|
19430
|
-
);
|
|
19431
|
-
console.log(
|
|
19432
|
-
chalk17__default.default.magentaBright(
|
|
19433
|
-
"\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"
|
|
19434
|
-
)
|
|
19435
|
-
);
|
|
19436
|
-
console.log(
|
|
19437
|
-
chalk17__default.default.magentaBright(
|
|
19438
|
-
"\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"
|
|
19439
|
-
)
|
|
19440
|
-
);
|
|
19441
|
-
console.log(
|
|
19442
|
-
chalk17__default.default.magentaBright(
|
|
19443
|
-
"\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"
|
|
19444
|
-
)
|
|
19445
|
-
);
|
|
19446
|
-
console.log(
|
|
19447
|
-
chalk17__default.default.magentaBright(
|
|
19448
|
-
"\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"
|
|
19449
|
-
)
|
|
19450
|
-
);
|
|
19451
|
-
console.log(
|
|
19452
|
-
chalk17__default.default.magentaBright(
|
|
19453
|
-
"\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"
|
|
19454
|
-
)
|
|
19455
|
-
);
|
|
19456
|
-
console.log(
|
|
19457
|
-
chalk17__default.default.magentaBright(
|
|
19458
|
-
"\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"
|
|
19459
|
-
)
|
|
19460
|
-
);
|
|
19461
|
-
console.log(
|
|
19462
|
-
chalk17__default.default.magentaBright(
|
|
19463
|
-
"\u2551 \u2551"
|
|
19464
|
-
)
|
|
19465
|
-
);
|
|
19466
|
-
console.log(
|
|
19467
|
-
chalk17__default.default.magentaBright(
|
|
19468
|
-
"\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"
|
|
19469
|
-
)
|
|
19470
|
-
);
|
|
19471
|
-
console.log(
|
|
19472
|
-
chalk17__default.default.magentaBright(
|
|
19473
|
-
"\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"
|
|
19474
|
-
)
|
|
19475
|
-
);
|
|
19476
|
-
console.log(
|
|
19477
|
-
chalk17__default.default.magentaBright(
|
|
19478
|
-
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
19479
|
-
)
|
|
19480
|
-
);
|
|
19481
|
-
console.log(
|
|
19482
|
-
chalk17__default.default.magentaBright(
|
|
19483
|
-
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551"
|
|
19484
|
-
)
|
|
19485
|
-
);
|
|
19486
|
-
console.log(
|
|
19487
|
-
chalk17__default.default.magentaBright(
|
|
19488
|
-
"\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"
|
|
19489
|
-
)
|
|
19490
|
-
);
|
|
19491
|
-
console.log(
|
|
19492
|
-
chalk17__default.default.magentaBright(
|
|
19493
|
-
"\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"
|
|
19494
|
-
)
|
|
19495
|
-
);
|
|
19496
|
-
console.log(
|
|
19497
|
-
chalk17__default.default.magentaBright(
|
|
19498
|
-
"\u2551 \u2551"
|
|
19499
|
-
)
|
|
19500
|
-
);
|
|
19501
|
-
console.log(
|
|
19502
|
-
chalk17__default.default.magentaBright(
|
|
19503
|
-
"\u2551 AI-Powered Development Platform \u2551"
|
|
19504
|
-
)
|
|
19505
|
-
);
|
|
19506
|
-
console.log(
|
|
19507
|
-
chalk17__default.default.magentaBright(
|
|
19508
|
-
"\u2551 (c) 2025 Bonginkan Inc. \u2551"
|
|
19509
|
-
)
|
|
19510
|
-
);
|
|
19511
|
-
console.log(
|
|
19512
|
-
chalk17__default.default.magentaBright(
|
|
19513
|
-
"\u2551 \u2551"
|
|
19514
|
-
)
|
|
19515
|
-
);
|
|
19516
|
-
console.log(
|
|
19517
|
-
chalk17__default.default.magentaBright(
|
|
19518
|
-
"\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"
|
|
19519
|
-
)
|
|
19520
|
-
);
|
|
19521
|
-
console.log("");
|
|
19522
|
-
console.log(
|
|
19523
|
-
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19524
|
-
);
|
|
19525
|
-
console.log(
|
|
19526
|
-
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19527
|
-
);
|
|
19528
|
-
console.log("");
|
|
19529
|
-
}
|
|
19530
|
-
function displayCompactLogo() {
|
|
19531
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
19532
|
-
console.log(
|
|
19533
|
-
chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19534
|
-
);
|
|
19535
|
-
console.log(
|
|
19536
|
-
chalk17__default.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
19537
|
-
);
|
|
19538
|
-
console.log("");
|
|
19539
|
-
}
|
|
19540
|
-
function displayDashboardHeader() {
|
|
19541
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
19542
|
-
const version = chalk17__default.default.cyan.bold(`MARIA CODE v${getVersion()}`);
|
|
19543
|
-
const commands = chalk17__default.default.gray(" | /help /status /model");
|
|
19544
|
-
const providers = chalk17__default.default.gray(
|
|
19545
|
-
"Providers: 8/8 OK (openai, anthropic, google, groq, lmstudio, ollama, vllm)"
|
|
19546
|
-
);
|
|
19547
|
-
console.log(version + commands);
|
|
19548
|
-
console.log(providers);
|
|
19549
|
-
console.log("");
|
|
19550
|
-
}
|
|
19551
|
-
function displayLogsBox(logs) {
|
|
19552
|
-
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 120 });
|
|
19553
|
-
const borderColor = chalk17__default.default.white;
|
|
19554
|
-
const titleColor = chalk17__default.default.cyan;
|
|
19555
|
-
const topLeft = "\u250C";
|
|
19556
|
-
const topRight = "\u2510";
|
|
19557
|
-
const bottomLeft = "\u2514";
|
|
19558
|
-
const bottomRight = "\u2518";
|
|
19559
|
-
const horizontal = "\u2500";
|
|
19560
|
-
const vertical = "\u2502";
|
|
19561
|
-
const lines = [];
|
|
19562
|
-
const title = " Logs ";
|
|
19563
|
-
lines.push(
|
|
19564
|
-
borderColor(topLeft) + titleColor(title) + borderColor(horizontal.repeat(width - title.length - 2)) + borderColor(topRight)
|
|
19565
|
-
);
|
|
19566
|
-
logs.forEach((log) => {
|
|
19567
|
-
const contentWidth = width - 4;
|
|
19568
|
-
const truncatedLog = log.length > contentWidth ? log.substring(0, contentWidth - 3) + "..." : log;
|
|
19569
|
-
const padding = width - truncatedLog.length - 4;
|
|
19570
|
-
lines.push(
|
|
19571
|
-
borderColor(vertical) + " " + truncatedLog + " ".repeat(Math.max(0, padding)) + " " + borderColor(vertical)
|
|
19572
|
-
);
|
|
19573
|
-
});
|
|
19574
|
-
if (logs.length === 0) {
|
|
19575
|
-
lines.push(
|
|
19576
|
-
borderColor(vertical) + " ".repeat(width - 2) + borderColor(vertical)
|
|
19577
|
-
);
|
|
19578
|
-
}
|
|
19579
|
-
lines.push(
|
|
19580
|
-
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19581
|
-
);
|
|
19582
|
-
console.log(lines.join("\n"));
|
|
19583
|
-
}
|
|
19584
|
-
function displaySpinner(text = "Processing") {
|
|
19585
|
-
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
19586
|
-
const frame = spinnerFrames[Math.floor(Date.now() / 80) % spinnerFrames.length];
|
|
19587
|
-
process.stdout.write(`\r[${chalk17__default.default.cyan(frame)}] ${text}...`);
|
|
19588
|
-
}
|
|
19589
|
-
function getCurrentPath() {
|
|
19590
|
-
return process.cwd();
|
|
19591
|
-
}
|
|
19592
|
-
function getSystemInfo() {
|
|
19593
|
-
return {
|
|
19594
|
-
platform: os__namespace.platform(),
|
|
19595
|
-
hostname: os__namespace.hostname(),
|
|
19596
|
-
user: os__namespace.userInfo().username,
|
|
19597
|
-
cwd: getCurrentPath()
|
|
19598
|
-
};
|
|
19599
|
-
}
|
|
19600
|
-
async function displayFinalStartupScreen(_selectedProvider, _selectedModel) {
|
|
19601
|
-
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
19602
|
-
const version = getVersion();
|
|
19603
|
-
const systemInfo = getSystemInfo();
|
|
19604
|
-
console.log(
|
|
19605
|
-
chalk17__default.default.cyan.bold(`MARIA CODE v${version}`) + chalk17__default.default.gray(" \u2014 Ready")
|
|
19606
|
-
);
|
|
19607
|
-
const cwd = systemInfo.cwd.replace(os__namespace.homedir(), "~");
|
|
19608
|
-
console.log(chalk17__default.default.gray("cwd: ") + chalk17__default.default.white(cwd));
|
|
19609
|
-
try {
|
|
19610
|
-
const { authManager: authManager2 } = await import('../cli-auth/index.js').catch(() => ({ authManager: null }));
|
|
19611
|
-
if (authManager2 && await authManager2.isAuthenticated()) {
|
|
19612
|
-
try {
|
|
19613
|
-
const user = await authManager2.getCurrentUser();
|
|
19614
|
-
console.log(chalk17__default.default.green(`Signed in: ${user.email}`));
|
|
19615
|
-
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19616
|
-
} catch {
|
|
19617
|
-
console.log(chalk17__default.default.green("Signed in"));
|
|
19618
|
-
console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
19619
|
-
}
|
|
19620
|
-
} else {
|
|
19621
|
-
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19622
|
-
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19623
|
-
}
|
|
19624
|
-
} catch {
|
|
19625
|
-
console.log(chalk17__default.default.gray("Not signed in"));
|
|
19626
|
-
console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
19627
|
-
}
|
|
19628
|
-
console.log("");
|
|
19629
|
-
}
|
|
19630
|
-
function displayRoundedInputBox() {
|
|
19631
|
-
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 90 });
|
|
19632
|
-
const borderColor = chalk17__default.default.white;
|
|
19633
|
-
const promptColor = chalk17__default.default.cyan;
|
|
19634
|
-
const topLeft = "\u256D";
|
|
19635
|
-
const topRight = "\u256E";
|
|
19636
|
-
const bottomLeft = "\u2570";
|
|
19637
|
-
const bottomRight = "\u256F";
|
|
19638
|
-
const horizontal = "\u2500";
|
|
19639
|
-
const vertical = "\u2502";
|
|
19640
|
-
const lines = [];
|
|
19641
|
-
lines.push(borderColor(topLeft + horizontal.repeat(width - 2) + topRight));
|
|
19642
|
-
const promptStr = promptColor("> ");
|
|
19643
|
-
const placeholder = chalk17__default.default.gray("");
|
|
19644
|
-
const inputLine = promptStr + placeholder;
|
|
19645
|
-
const padding = width - 4;
|
|
19646
|
-
lines.push(
|
|
19647
|
-
borderColor(vertical) + inputLine + " ".repeat(Math.max(0, padding)) + borderColor(vertical)
|
|
19648
|
-
);
|
|
19649
|
-
lines.push(
|
|
19650
|
-
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
19651
|
-
);
|
|
19652
|
-
console.log(lines.join("\n"));
|
|
19653
|
-
}
|
|
19654
|
-
var init_startup_display = __esm({
|
|
19655
|
-
"src/services/startup-display.ts"() {
|
|
19656
|
-
init_responsive_width();
|
|
19657
|
-
init_version();
|
|
19658
|
-
}
|
|
19659
|
-
});
|
|
19660
19401
|
|
|
19661
19402
|
// src/services/llm-health-checker.ts
|
|
19662
19403
|
var llm_health_checker_exports = {};
|
|
@@ -19794,29 +19535,29 @@ var init_provider_selector = __esm({
|
|
|
19794
19535
|
const inquirer = await import('inquirer');
|
|
19795
19536
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
19796
19537
|
const providers = await this.getAvailableProviders();
|
|
19797
|
-
console.log(
|
|
19798
|
-
console.log(
|
|
19538
|
+
console.log(chalk16__default.default.cyan("\nAvailable AI Providers:"));
|
|
19539
|
+
console.log(chalk16__default.default.gray("\u2500".repeat(50)));
|
|
19799
19540
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
19800
19541
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
19801
19542
|
if (_cloudProviders.length > 0) {
|
|
19802
|
-
console.log(
|
|
19543
|
+
console.log(chalk16__default.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
19803
19544
|
_cloudProviders.forEach((p) => {
|
|
19804
19545
|
if (p.available) {
|
|
19805
19546
|
console.log(
|
|
19806
|
-
` ${
|
|
19547
|
+
` ${chalk16__default.default.green("*")} ${chalk16__default.default.white(p.name.split(" ")[0])}`
|
|
19807
19548
|
);
|
|
19808
19549
|
} else {
|
|
19809
|
-
console.log(` ${
|
|
19550
|
+
console.log(` ${chalk16__default.default.gray(p.name.split(" ")[0])}`);
|
|
19810
19551
|
}
|
|
19811
19552
|
});
|
|
19812
19553
|
}
|
|
19813
19554
|
if (_localProviders.length > 0) {
|
|
19814
|
-
console.log(
|
|
19555
|
+
console.log(chalk16__default.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
19815
19556
|
_localProviders.forEach((p) => {
|
|
19816
19557
|
if (p.available) {
|
|
19817
|
-
console.log(` ${
|
|
19558
|
+
console.log(` ${chalk16__default.default.green("*")} ${chalk16__default.default.white(p.name)}`);
|
|
19818
19559
|
} else {
|
|
19819
|
-
console.log(` ${
|
|
19560
|
+
console.log(` ${chalk16__default.default.green("*")} ${chalk16__default.default.gray(p.name)}`);
|
|
19820
19561
|
}
|
|
19821
19562
|
});
|
|
19822
19563
|
}
|
|
@@ -19831,20 +19572,20 @@ var init_provider_selector = __esm({
|
|
|
19831
19572
|
});
|
|
19832
19573
|
if (selectableProviders.length === 0) {
|
|
19833
19574
|
console.log(
|
|
19834
|
-
|
|
19575
|
+
chalk16__default.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
19835
19576
|
);
|
|
19836
|
-
console.log(
|
|
19577
|
+
console.log(chalk16__default.default.gray("\nTo use MARIA, you need to:"));
|
|
19837
19578
|
console.log(
|
|
19838
|
-
|
|
19579
|
+
chalk16__default.default.gray(
|
|
19839
19580
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
19840
19581
|
)
|
|
19841
19582
|
);
|
|
19842
|
-
console.log(
|
|
19583
|
+
console.log(chalk16__default.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
19843
19584
|
console.log(
|
|
19844
|
-
|
|
19585
|
+
chalk16__default.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
19845
19586
|
);
|
|
19846
|
-
console.log(
|
|
19847
|
-
console.log(
|
|
19587
|
+
console.log(chalk16__default.default.gray(" Example: maria setup-ollama"));
|
|
19588
|
+
console.log(chalk16__default.default.gray("\nFor more information, run: maria --help"));
|
|
19848
19589
|
process.exit(1);
|
|
19849
19590
|
}
|
|
19850
19591
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -19865,29 +19606,29 @@ var init_provider_selector = __esm({
|
|
|
19865
19606
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
19866
19607
|
if (provider && provider.type === "local" && !provider.available) {
|
|
19867
19608
|
console.log(
|
|
19868
|
-
|
|
19609
|
+
chalk16__default.default.yellow(`
|
|
19869
19610
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
19870
19611
|
);
|
|
19871
|
-
console.log(
|
|
19612
|
+
console.log(chalk16__default.default.gray(`
|
|
19872
19613
|
To use ${provider.name}, you need to:`));
|
|
19873
19614
|
if (selectedProvider === "ollama") {
|
|
19874
|
-
console.log(
|
|
19875
|
-
console.log(
|
|
19876
|
-
console.log(
|
|
19615
|
+
console.log(chalk16__default.default.gray("1. Install Ollama: brew install ollama"));
|
|
19616
|
+
console.log(chalk16__default.default.gray("2. Start Ollama: ollama serve"));
|
|
19617
|
+
console.log(chalk16__default.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
19877
19618
|
console.log(
|
|
19878
|
-
|
|
19619
|
+
chalk16__default.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
19879
19620
|
);
|
|
19880
19621
|
} else if (selectedProvider === "lmstudio") {
|
|
19881
19622
|
console.log(
|
|
19882
|
-
|
|
19623
|
+
chalk16__default.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
19883
19624
|
);
|
|
19884
|
-
console.log(
|
|
19885
|
-
console.log(
|
|
19886
|
-
console.log(
|
|
19625
|
+
console.log(chalk16__default.default.gray("2. Start LM Studio application"));
|
|
19626
|
+
console.log(chalk16__default.default.gray("3. Load a model in LM Studio"));
|
|
19627
|
+
console.log(chalk16__default.default.gray("4. Start the local server in LM Studio"));
|
|
19887
19628
|
} else if (selectedProvider === "vllm") {
|
|
19888
|
-
console.log(
|
|
19889
|
-
console.log(
|
|
19890
|
-
console.log(
|
|
19629
|
+
console.log(chalk16__default.default.gray("1. Install vLLM: pip install vllm"));
|
|
19630
|
+
console.log(chalk16__default.default.gray("2. Start vLLM server with a model"));
|
|
19631
|
+
console.log(chalk16__default.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
19891
19632
|
}
|
|
19892
19633
|
process.exit(1);
|
|
19893
19634
|
}
|
|
@@ -23142,7 +22883,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
23142
22883
|
this.emit("initialized");
|
|
23143
22884
|
} catch (_error) {
|
|
23144
22885
|
console._error(
|
|
23145
|
-
|
|
22886
|
+
chalk16__default.default.red("Failed to initialize Intelligent Router:"),
|
|
23146
22887
|
_error
|
|
23147
22888
|
);
|
|
23148
22889
|
throw _error;
|
|
@@ -23196,7 +22937,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
23196
22937
|
} catch (_error) {
|
|
23197
22938
|
this.metrics.failedRoutes++;
|
|
23198
22939
|
this.emit("route:_error", { input: input3, _error });
|
|
23199
|
-
console._error(
|
|
22940
|
+
console._error(chalk16__default.default.red("Routing _error:"), _error);
|
|
23200
22941
|
return null;
|
|
23201
22942
|
}
|
|
23202
22943
|
}
|
|
@@ -23879,28 +23620,28 @@ var init_ChalkAdapter = __esm({
|
|
|
23879
23620
|
spinnerId = 0;
|
|
23880
23621
|
async showWelcome() {
|
|
23881
23622
|
console.log(
|
|
23882
|
-
|
|
23623
|
+
chalk16__default.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
23883
23624
|
);
|
|
23884
|
-
console.log(
|
|
23625
|
+
console.log(chalk16__default.default.gray("Type /help for available commands\n"));
|
|
23885
23626
|
}
|
|
23886
23627
|
showGoodbye() {
|
|
23887
23628
|
this.stopAllSpinners();
|
|
23888
|
-
console.log(
|
|
23629
|
+
console.log(chalk16__default.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
23889
23630
|
}
|
|
23890
23631
|
async print(message) {
|
|
23891
23632
|
console.log(message);
|
|
23892
23633
|
}
|
|
23893
23634
|
error(message) {
|
|
23894
|
-
console.error(
|
|
23635
|
+
console.error(chalk16__default.default.red(`\u274C ${message}`));
|
|
23895
23636
|
}
|
|
23896
23637
|
success(message) {
|
|
23897
|
-
console.log(
|
|
23638
|
+
console.log(chalk16__default.default.green(`\u2705 ${message}`));
|
|
23898
23639
|
}
|
|
23899
23640
|
warning(message) {
|
|
23900
|
-
console.warn(
|
|
23641
|
+
console.warn(chalk16__default.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
23901
23642
|
}
|
|
23902
23643
|
info(message) {
|
|
23903
|
-
console.info(
|
|
23644
|
+
console.info(chalk16__default.default.blue(`\u2139\uFE0F ${message}`));
|
|
23904
23645
|
}
|
|
23905
23646
|
startSpinner(message) {
|
|
23906
23647
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -23950,12 +23691,12 @@ var init_ChalkAdapter = __esm({
|
|
|
23950
23691
|
* Format helpers for consistent styling
|
|
23951
23692
|
*/
|
|
23952
23693
|
static format = {
|
|
23953
|
-
command: (text) =>
|
|
23954
|
-
keyword: (text) =>
|
|
23955
|
-
value: (text) =>
|
|
23956
|
-
dim: (text) =>
|
|
23957
|
-
bold: (text) =>
|
|
23958
|
-
code: (text) =>
|
|
23694
|
+
command: (text) => chalk16__default.default.cyan(text),
|
|
23695
|
+
keyword: (text) => chalk16__default.default.magenta(text),
|
|
23696
|
+
value: (text) => chalk16__default.default.green(text),
|
|
23697
|
+
dim: (text) => chalk16__default.default.gray(text),
|
|
23698
|
+
bold: (text) => chalk16__default.default.bold(text),
|
|
23699
|
+
code: (text) => chalk16__default.default.bgGray.white(` ${text} `)
|
|
23959
23700
|
};
|
|
23960
23701
|
};
|
|
23961
23702
|
}
|
|
@@ -29105,26 +28846,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29105
28846
|
const _lang = options.language || "en";
|
|
29106
28847
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
29107
28848
|
console.log("");
|
|
29108
|
-
console.log(
|
|
28849
|
+
console.log(chalk16__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"));
|
|
29109
28850
|
console.log(
|
|
29110
|
-
|
|
28851
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29111
28852
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
29112
|
-
) +
|
|
28853
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29113
28854
|
);
|
|
29114
|
-
console.log(
|
|
28855
|
+
console.log(chalk16__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"));
|
|
29115
28856
|
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")}`;
|
|
29116
28857
|
console.log(
|
|
29117
|
-
|
|
29118
|
-
` > ${_labels.id}: ${
|
|
29119
|
-
) +
|
|
28858
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
28859
|
+
` > ${_labels.id}: ${chalk16__default.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
28860
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29120
28861
|
);
|
|
29121
28862
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
29122
28863
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
29123
28864
|
const _titleLabel = ` ${_labels._title}:`;
|
|
29124
28865
|
console.log(
|
|
29125
|
-
|
|
28866
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29126
28867
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
29127
|
-
) +
|
|
28868
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29128
28869
|
);
|
|
29129
28870
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
29130
28871
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -29132,37 +28873,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29132
28873
|
const _levelLabel = ` ${_labels.level}:`;
|
|
29133
28874
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
29134
28875
|
console.log(
|
|
29135
|
-
|
|
28876
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29136
28877
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
29137
|
-
) +
|
|
28878
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29138
28879
|
);
|
|
29139
28880
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
29140
28881
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
29141
28882
|
console.log(
|
|
29142
|
-
|
|
28883
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29143
28884
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
29144
|
-
) +
|
|
28885
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29145
28886
|
);
|
|
29146
28887
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
29147
28888
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
29148
28889
|
console.log(
|
|
29149
|
-
|
|
28890
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29150
28891
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
29151
|
-
) +
|
|
28892
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29152
28893
|
);
|
|
29153
28894
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
29154
28895
|
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")}`;
|
|
29155
28896
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
29156
28897
|
console.log(
|
|
29157
|
-
|
|
28898
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29158
28899
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
29159
|
-
) +
|
|
28900
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29160
28901
|
);
|
|
29161
|
-
console.log(
|
|
28902
|
+
console.log(chalk16__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"));
|
|
29162
28903
|
console.log(
|
|
29163
|
-
|
|
28904
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29164
28905
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
29165
|
-
) +
|
|
28906
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29166
28907
|
);
|
|
29167
28908
|
this.menuOptions.forEach((option, _index) => {
|
|
29168
28909
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -29173,32 +28914,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29173
28914
|
switch (option) {
|
|
29174
28915
|
case "approve":
|
|
29175
28916
|
label = _labels.approve;
|
|
29176
|
-
color =
|
|
28917
|
+
color = chalk16__default.default.green;
|
|
29177
28918
|
break;
|
|
29178
28919
|
case "reject":
|
|
29179
28920
|
label = _labels.reject;
|
|
29180
|
-
color =
|
|
28921
|
+
color = chalk16__default.default.red;
|
|
29181
28922
|
break;
|
|
29182
28923
|
case "cancel":
|
|
29183
28924
|
label = _labels.cancel;
|
|
29184
|
-
color =
|
|
28925
|
+
color = chalk16__default.default.yellow;
|
|
29185
28926
|
break;
|
|
29186
28927
|
}
|
|
29187
28928
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
29188
28929
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
29189
28930
|
console.log(
|
|
29190
|
-
|
|
28931
|
+
chalk16__default.default.gray("\u2502") + _colorFunc(
|
|
29191
28932
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
29192
|
-
) +
|
|
28933
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29193
28934
|
);
|
|
29194
28935
|
});
|
|
29195
|
-
console.log(
|
|
28936
|
+
console.log(chalk16__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"));
|
|
29196
28937
|
console.log(
|
|
29197
|
-
|
|
28938
|
+
chalk16__default.default.gray("\u2502") + chalk16__default.default.white(
|
|
29198
28939
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
29199
|
-
) +
|
|
28940
|
+
) + chalk16__default.default.gray("\u2502")
|
|
29200
28941
|
);
|
|
29201
|
-
console.log(
|
|
28942
|
+
console.log(chalk16__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"));
|
|
29202
28943
|
console.log("");
|
|
29203
28944
|
}
|
|
29204
28945
|
/**
|
|
@@ -29214,13 +28955,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29214
28955
|
};
|
|
29215
28956
|
const _formatted = keyMap[_key] || _key;
|
|
29216
28957
|
const colorMap = {
|
|
29217
|
-
"shift+tab":
|
|
29218
|
-
"ctrl+y":
|
|
29219
|
-
"ctrl+n":
|
|
29220
|
-
"ctrl+t":
|
|
29221
|
-
"ctrl+r":
|
|
28958
|
+
"shift+tab": chalk16__default.default.bgGreen.black.bold,
|
|
28959
|
+
"ctrl+y": chalk16__default.default.bgBlue.white.bold,
|
|
28960
|
+
"ctrl+n": chalk16__default.default.bgRed.white.bold,
|
|
28961
|
+
"ctrl+t": chalk16__default.default.bgMagenta.white.bold,
|
|
28962
|
+
"ctrl+r": chalk16__default.default.bgYellow.black.bold
|
|
29222
28963
|
};
|
|
29223
|
-
const _colorFunc = colorMap[_key] ||
|
|
28964
|
+
const _colorFunc = colorMap[_key] || chalk16__default.default.bgCyan.black.bold;
|
|
29224
28965
|
return _colorFunc(` ${_formatted} `);
|
|
29225
28966
|
}
|
|
29226
28967
|
/**
|
|
@@ -29229,15 +28970,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29229
28970
|
formatRiskLevel(risk) {
|
|
29230
28971
|
switch (risk.toLowerCase()) {
|
|
29231
28972
|
case "critical":
|
|
29232
|
-
return
|
|
28973
|
+
return chalk16__default.default.red.bold("CRITICAL");
|
|
29233
28974
|
case "high":
|
|
29234
|
-
return
|
|
28975
|
+
return chalk16__default.default.red("HIGH");
|
|
29235
28976
|
case "medium":
|
|
29236
|
-
return
|
|
28977
|
+
return chalk16__default.default.yellow("MEDIUM");
|
|
29237
28978
|
case "low":
|
|
29238
|
-
return
|
|
28979
|
+
return chalk16__default.default.green("LOW");
|
|
29239
28980
|
default:
|
|
29240
|
-
return
|
|
28981
|
+
return chalk16__default.default.white(risk);
|
|
29241
28982
|
}
|
|
29242
28983
|
}
|
|
29243
28984
|
/**
|
|
@@ -29307,7 +29048,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
29307
29048
|
}
|
|
29308
29049
|
if (_key === "") {
|
|
29309
29050
|
console.log(`
|
|
29310
|
-
${
|
|
29051
|
+
${chalk16__default.default.red("Approval cancelled by user")}`);
|
|
29311
29052
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
29312
29053
|
return;
|
|
29313
29054
|
}
|
|
@@ -29364,20 +29105,20 @@ ${chalk17__default.default.red("Approval cancelled by user")}`);
|
|
|
29364
29105
|
}
|
|
29365
29106
|
console.clear();
|
|
29366
29107
|
console.log(`
|
|
29367
|
-
${
|
|
29108
|
+
${chalk16__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29368
29109
|
console.log(
|
|
29369
|
-
|
|
29110
|
+
chalk16__default.default.bgGreen.black.bold("\u2502") + chalk16__default.default.bgGreen.black.bold(
|
|
29370
29111
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
29371
|
-
) +
|
|
29112
|
+
) + chalk16__default.default.bgGreen.black.bold("\u2502")
|
|
29372
29113
|
);
|
|
29373
|
-
console.log(
|
|
29114
|
+
console.log(chalk16__default.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
29374
29115
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
29375
29116
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
29376
29117
|
console.log(
|
|
29377
|
-
|
|
29118
|
+
chalk16__default.default.bgGreen.black.bold("\u2502") + chalk16__default.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + chalk16__default.default.bgGreen.black.bold("\u2502")
|
|
29378
29119
|
);
|
|
29379
|
-
console.log(
|
|
29380
|
-
console.log(
|
|
29120
|
+
console.log(chalk16__default.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29121
|
+
console.log(chalk16__default.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
29381
29122
|
try {
|
|
29382
29123
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
29383
29124
|
this.currentRequest.id,
|
|
@@ -29387,30 +29128,30 @@ ${chalk17__default.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u251
|
|
|
29387
29128
|
);
|
|
29388
29129
|
response.quickDecision = true;
|
|
29389
29130
|
console.log(`
|
|
29390
|
-
${
|
|
29131
|
+
${chalk16__default.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29391
29132
|
console.log(
|
|
29392
|
-
|
|
29133
|
+
chalk16__default.default.bgGreen.black("\u2502") + chalk16__default.default.bgGreen.black(
|
|
29393
29134
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
29394
|
-
) +
|
|
29135
|
+
) + chalk16__default.default.bgGreen.black("\u2502")
|
|
29395
29136
|
);
|
|
29396
|
-
console.log(
|
|
29137
|
+
console.log(chalk16__default.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29397
29138
|
if (_choice.trustLevel) {
|
|
29398
29139
|
console.log(
|
|
29399
|
-
|
|
29140
|
+
chalk16__default.default.blue(`
|
|
29400
29141
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
29401
29142
|
);
|
|
29402
29143
|
}
|
|
29403
29144
|
this.emit("approval-_response", _response);
|
|
29404
29145
|
} catch (_error) {
|
|
29405
29146
|
console.log(`
|
|
29406
|
-
${
|
|
29147
|
+
${chalk16__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
29407
29148
|
console.log(
|
|
29408
|
-
|
|
29149
|
+
chalk16__default.default.bgRed.white.bold("\u2502") + chalk16__default.default.bgRed.white.bold(
|
|
29409
29150
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
29410
|
-
) +
|
|
29151
|
+
) + chalk16__default.default.bgRed.white.bold("\u2502")
|
|
29411
29152
|
);
|
|
29412
|
-
console.log(
|
|
29413
|
-
console._error(
|
|
29153
|
+
console.log(chalk16__default.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
29154
|
+
console._error(chalk16__default.default.red("\nError details:"), _error);
|
|
29414
29155
|
this.emit("approval-_error", _error);
|
|
29415
29156
|
}
|
|
29416
29157
|
}
|
|
@@ -29424,7 +29165,7 @@ ${chalk17__default.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`
|
|
|
29424
29165
|
timeoutId = setTimeout(() => {
|
|
29425
29166
|
console.log(
|
|
29426
29167
|
`
|
|
29427
|
-
${
|
|
29168
|
+
${chalk16__default.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
29428
29169
|
);
|
|
29429
29170
|
this.handleTimeoutResponse(resolve);
|
|
29430
29171
|
}, timeout);
|
|
@@ -29468,7 +29209,7 @@ ${chalk17__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29468
29209
|
response.quickDecision = true;
|
|
29469
29210
|
resolve(_response);
|
|
29470
29211
|
} catch (_error) {
|
|
29471
|
-
console._error(
|
|
29212
|
+
console._error(chalk16__default.default.red("Error processing timeout approval:"), _error);
|
|
29472
29213
|
}
|
|
29473
29214
|
}
|
|
29474
29215
|
/**
|
|
@@ -29483,11 +29224,11 @@ ${chalk17__default.default.yellow("\u23F0 Approval request timed out - auto-appr
|
|
|
29483
29224
|
);
|
|
29484
29225
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
29485
29226
|
console.log(
|
|
29486
|
-
|
|
29227
|
+
chalk16__default.default.blue(
|
|
29487
29228
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
29488
29229
|
)
|
|
29489
29230
|
);
|
|
29490
|
-
console.log(
|
|
29231
|
+
console.log(chalk16__default.default.gray(`Reason: ${event.reason}`));
|
|
29491
29232
|
});
|
|
29492
29233
|
}
|
|
29493
29234
|
/**
|
|
@@ -30271,22 +30012,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
30271
30012
|
}
|
|
30272
30013
|
function formatError(message, code) {
|
|
30273
30014
|
const prefix = "";
|
|
30274
|
-
return
|
|
30015
|
+
return chalk16__default.default.red(`\u274C ${prefix}${message}`);
|
|
30275
30016
|
}
|
|
30276
30017
|
function formatSuccess(message) {
|
|
30277
|
-
return
|
|
30018
|
+
return chalk16__default.default.green(`\u2705 ${message}`);
|
|
30278
30019
|
}
|
|
30279
30020
|
function formatWarning(message) {
|
|
30280
|
-
return
|
|
30021
|
+
return chalk16__default.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
30281
30022
|
}
|
|
30282
30023
|
function formatInfo(message) {
|
|
30283
|
-
return
|
|
30024
|
+
return chalk16__default.default.blue(`\u2139\uFE0F ${message}`);
|
|
30284
30025
|
}
|
|
30285
30026
|
function formatTable(headers, rows, options = {}) {
|
|
30286
30027
|
const {
|
|
30287
30028
|
columnWidths = headers.map(() => 20),
|
|
30288
30029
|
separator = " | ",
|
|
30289
|
-
headerColor =
|
|
30030
|
+
headerColor = chalk16__default.default.cyan.bold
|
|
30290
30031
|
} = options;
|
|
30291
30032
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
30292
30033
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -30298,8 +30039,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
30298
30039
|
function formatKeyValue(data2, options = {}) {
|
|
30299
30040
|
const {
|
|
30300
30041
|
keyWidth = 20,
|
|
30301
|
-
keyColor =
|
|
30302
|
-
valueColor =
|
|
30042
|
+
keyColor = chalk16__default.default.gray,
|
|
30043
|
+
valueColor = chalk16__default.default.white,
|
|
30303
30044
|
separator = ": "
|
|
30304
30045
|
} = options;
|
|
30305
30046
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -30349,7 +30090,7 @@ var init_DisplayManager = __esm({
|
|
|
30349
30090
|
theme: options.theme ?? "auto"
|
|
30350
30091
|
};
|
|
30351
30092
|
if (!this.options.enableColors) {
|
|
30352
|
-
|
|
30093
|
+
chalk16__default.default.level = 0;
|
|
30353
30094
|
}
|
|
30354
30095
|
this.setupCleanupHandlers();
|
|
30355
30096
|
}
|
|
@@ -30466,7 +30207,7 @@ var init_DisplayManager = __esm({
|
|
|
30466
30207
|
const {
|
|
30467
30208
|
padding = 1,
|
|
30468
30209
|
borderStyle = "single",
|
|
30469
|
-
borderColor =
|
|
30210
|
+
borderColor = chalk16__default.default.gray
|
|
30470
30211
|
} = options;
|
|
30471
30212
|
const lines = content.split("\n");
|
|
30472
30213
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -30524,7 +30265,7 @@ var init_DisplayManager = __esm({
|
|
|
30524
30265
|
*/
|
|
30525
30266
|
startSpinner(text) {
|
|
30526
30267
|
if (!this.options.enableAnimations) {
|
|
30527
|
-
this.writeLine(
|
|
30268
|
+
this.writeLine(chalk16__default.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
30528
30269
|
return "no-animation";
|
|
30529
30270
|
}
|
|
30530
30271
|
return this.spinnerManager.start({ text });
|
|
@@ -30628,11 +30369,11 @@ var init_StatusDisplay = __esm({
|
|
|
30628
30369
|
*/
|
|
30629
30370
|
static renderSystemStatus(status, detailed = false) {
|
|
30630
30371
|
const lines = [];
|
|
30631
|
-
lines.push(
|
|
30372
|
+
lines.push(chalk16__default.default.cyan.bold("\u{1F4CA} System Status"));
|
|
30632
30373
|
lines.push("");
|
|
30633
30374
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
30634
30375
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
30635
|
-
const statusColor = status.operational ?
|
|
30376
|
+
const statusColor = status.operational ? chalk16__default.default.green : chalk16__default.default.red;
|
|
30636
30377
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
30637
30378
|
lines.push(
|
|
30638
30379
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -30653,15 +30394,15 @@ var init_StatusDisplay = __esm({
|
|
|
30653
30394
|
if (status.errors > 0 || status.warnings > 0) {
|
|
30654
30395
|
lines.push("");
|
|
30655
30396
|
if (status.errors > 0) {
|
|
30656
|
-
lines.push(
|
|
30397
|
+
lines.push(chalk16__default.default.red(`\u274C Errors: ${status.errors}`));
|
|
30657
30398
|
}
|
|
30658
30399
|
if (status.warnings > 0) {
|
|
30659
|
-
lines.push(
|
|
30400
|
+
lines.push(chalk16__default.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
30660
30401
|
}
|
|
30661
30402
|
}
|
|
30662
30403
|
if (detailed) {
|
|
30663
30404
|
lines.push("");
|
|
30664
|
-
lines.push(
|
|
30405
|
+
lines.push(chalk16__default.default.gray("Detailed Information:"));
|
|
30665
30406
|
const details = formatKeyValue(
|
|
30666
30407
|
{
|
|
30667
30408
|
"Process ID": process.pid,
|
|
@@ -30671,8 +30412,8 @@ var init_StatusDisplay = __esm({
|
|
|
30671
30412
|
"Working Directory": process.cwd()
|
|
30672
30413
|
},
|
|
30673
30414
|
{
|
|
30674
|
-
keyColor:
|
|
30675
|
-
valueColor:
|
|
30415
|
+
keyColor: chalk16__default.default.gray,
|
|
30416
|
+
valueColor: chalk16__default.default.white
|
|
30676
30417
|
}
|
|
30677
30418
|
);
|
|
30678
30419
|
lines.push(details);
|
|
@@ -30686,9 +30427,9 @@ var init_StatusDisplay = __esm({
|
|
|
30686
30427
|
*/
|
|
30687
30428
|
static renderMemoryStatus(status) {
|
|
30688
30429
|
const lines = [];
|
|
30689
|
-
lines.push(
|
|
30430
|
+
lines.push(chalk16__default.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
30690
30431
|
lines.push("");
|
|
30691
|
-
lines.push(
|
|
30432
|
+
lines.push(chalk16__default.default.yellow("System 1 (Fast):"));
|
|
30692
30433
|
const s1NodeBar = formatProgressBar(
|
|
30693
30434
|
status.system1.nodes,
|
|
30694
30435
|
status.system1.maxNodes,
|
|
@@ -30706,7 +30447,7 @@ var init_StatusDisplay = __esm({
|
|
|
30706
30447
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
30707
30448
|
);
|
|
30708
30449
|
lines.push("");
|
|
30709
|
-
lines.push(
|
|
30450
|
+
lines.push(chalk16__default.default.blue("System 2 (Deep):"));
|
|
30710
30451
|
const s2TraceBar = formatProgressBar(
|
|
30711
30452
|
status.system2.traces,
|
|
30712
30453
|
status.system2.maxTraces,
|
|
@@ -30724,7 +30465,7 @@ var init_StatusDisplay = __esm({
|
|
|
30724
30465
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
30725
30466
|
);
|
|
30726
30467
|
lines.push("");
|
|
30727
|
-
lines.push(
|
|
30468
|
+
lines.push(chalk16__default.default.green("Total:"));
|
|
30728
30469
|
const totalBar = formatProgressBar(
|
|
30729
30470
|
status.total.tokens,
|
|
30730
30471
|
status.total.maxTokens,
|
|
@@ -30733,7 +30474,7 @@ var init_StatusDisplay = __esm({
|
|
|
30733
30474
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
30734
30475
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
30735
30476
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
30736
|
-
const usageColor = usage > 80 ?
|
|
30477
|
+
const usageColor = usage > 80 ? chalk16__default.default.red : usage > 60 ? chalk16__default.default.yellow : chalk16__default.default.green;
|
|
30737
30478
|
lines.push(
|
|
30738
30479
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
30739
30480
|
);
|
|
@@ -30746,9 +30487,9 @@ var init_StatusDisplay = __esm({
|
|
|
30746
30487
|
*/
|
|
30747
30488
|
static renderModelStatus(status) {
|
|
30748
30489
|
const lines = [];
|
|
30749
|
-
lines.push(
|
|
30490
|
+
lines.push(chalk16__default.default.cyan.bold("\u{1F916} Model Status"));
|
|
30750
30491
|
lines.push("");
|
|
30751
|
-
lines.push(
|
|
30492
|
+
lines.push(chalk16__default.default.green(`Current: ${chalk16__default.default.bold(status.current)}`));
|
|
30752
30493
|
lines.push("");
|
|
30753
30494
|
lines.push("Available Models:");
|
|
30754
30495
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -30760,7 +30501,7 @@ var init_StatusDisplay = __esm({
|
|
|
30760
30501
|
const table = formatTable(headers, rows, {
|
|
30761
30502
|
columnWidths: [20, 15, 8, 30],
|
|
30762
30503
|
separator: " \u2502 ",
|
|
30763
|
-
headerColor:
|
|
30504
|
+
headerColor: chalk16__default.default.gray
|
|
30764
30505
|
});
|
|
30765
30506
|
lines.push(table);
|
|
30766
30507
|
return lines.join("\n");
|
|
@@ -30772,19 +30513,19 @@ var init_StatusDisplay = __esm({
|
|
|
30772
30513
|
*/
|
|
30773
30514
|
static renderHealthChecks(checks) {
|
|
30774
30515
|
const lines = [];
|
|
30775
|
-
lines.push(
|
|
30516
|
+
lines.push(chalk16__default.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
30776
30517
|
lines.push("");
|
|
30777
30518
|
for (const check of checks) {
|
|
30778
30519
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
30779
|
-
const statusColor = check.status === "ok" ?
|
|
30520
|
+
const statusColor = check.status === "ok" ? chalk16__default.default.green : check.status === "warning" ? chalk16__default.default.yellow : chalk16__default.default.red;
|
|
30780
30521
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
30781
30522
|
if (check.latency !== void 0) {
|
|
30782
|
-
const latencyColor = check.latency < 100 ?
|
|
30523
|
+
const latencyColor = check.latency < 100 ? chalk16__default.default.green : check.latency < 500 ? chalk16__default.default.yellow : chalk16__default.default.red;
|
|
30783
30524
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
30784
30525
|
}
|
|
30785
30526
|
lines.push(line);
|
|
30786
30527
|
if (check.message) {
|
|
30787
|
-
lines.push(
|
|
30528
|
+
lines.push(chalk16__default.default.gray(` ${check.message}`));
|
|
30788
30529
|
}
|
|
30789
30530
|
}
|
|
30790
30531
|
lines.push("");
|
|
@@ -30793,16 +30534,16 @@ var init_StatusDisplay = __esm({
|
|
|
30793
30534
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
30794
30535
|
if (errorCount > 0) {
|
|
30795
30536
|
lines.push(
|
|
30796
|
-
|
|
30537
|
+
chalk16__default.default.red(
|
|
30797
30538
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
30798
30539
|
)
|
|
30799
30540
|
);
|
|
30800
30541
|
} else if (warningCount > 0) {
|
|
30801
30542
|
lines.push(
|
|
30802
|
-
|
|
30543
|
+
chalk16__default.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
30803
30544
|
);
|
|
30804
30545
|
} else {
|
|
30805
|
-
lines.push(
|
|
30546
|
+
lines.push(chalk16__default.default.green("\u2705 All systems operational"));
|
|
30806
30547
|
}
|
|
30807
30548
|
return lines.join("\n");
|
|
30808
30549
|
}
|
|
@@ -30813,7 +30554,7 @@ var init_StatusDisplay = __esm({
|
|
|
30813
30554
|
*/
|
|
30814
30555
|
static renderSessionStats(stats) {
|
|
30815
30556
|
const lines = [];
|
|
30816
|
-
lines.push(
|
|
30557
|
+
lines.push(chalk16__default.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
30817
30558
|
lines.push("");
|
|
30818
30559
|
const data2 = formatKeyValue(
|
|
30819
30560
|
{
|
|
@@ -30826,14 +30567,14 @@ var init_StatusDisplay = __esm({
|
|
|
30826
30567
|
},
|
|
30827
30568
|
{
|
|
30828
30569
|
keyWidth: 20,
|
|
30829
|
-
keyColor:
|
|
30830
|
-
valueColor:
|
|
30570
|
+
keyColor: chalk16__default.default.gray,
|
|
30571
|
+
valueColor: chalk16__default.default.white
|
|
30831
30572
|
}
|
|
30832
30573
|
);
|
|
30833
30574
|
lines.push(data2);
|
|
30834
30575
|
lines.push("");
|
|
30835
30576
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
30836
|
-
const perfColor = performance3 === "Excellent" ?
|
|
30577
|
+
const perfColor = performance3 === "Excellent" ? chalk16__default.default.green : performance3 === "Good" ? chalk16__default.default.blue : performance3 === "Fair" ? chalk16__default.default.yellow : chalk16__default.default.red;
|
|
30837
30578
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
30838
30579
|
return lines.join("\n");
|
|
30839
30580
|
}
|
|
@@ -30845,22 +30586,22 @@ var init_StatusDisplay = __esm({
|
|
|
30845
30586
|
static renderStatusBar(data2) {
|
|
30846
30587
|
const segments = [];
|
|
30847
30588
|
if (data2.mode) {
|
|
30848
|
-
segments.push(
|
|
30589
|
+
segments.push(chalk16__default.default.cyan(`[${data2.mode}]`));
|
|
30849
30590
|
}
|
|
30850
30591
|
if (data2.model) {
|
|
30851
|
-
segments.push(
|
|
30592
|
+
segments.push(chalk16__default.default.blue(`\u{1F916} ${data2.model}`));
|
|
30852
30593
|
}
|
|
30853
30594
|
if (data2.memory !== void 0) {
|
|
30854
|
-
const memoryColor = data2.memory > 80 ?
|
|
30595
|
+
const memoryColor = data2.memory > 80 ? chalk16__default.default.red : data2.memory > 60 ? chalk16__default.default.yellow : chalk16__default.default.green;
|
|
30855
30596
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
30856
30597
|
}
|
|
30857
30598
|
if (data2.latency !== void 0) {
|
|
30858
|
-
const latencyColor = data2.latency < 100 ?
|
|
30599
|
+
const latencyColor = data2.latency < 100 ? chalk16__default.default.green : data2.latency < 500 ? chalk16__default.default.yellow : chalk16__default.default.red;
|
|
30859
30600
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
30860
30601
|
}
|
|
30861
30602
|
if (data2.time) {
|
|
30862
30603
|
segments.push(
|
|
30863
|
-
|
|
30604
|
+
chalk16__default.default.gray(formatTimestamp(data2.time, "short"))
|
|
30864
30605
|
);
|
|
30865
30606
|
}
|
|
30866
30607
|
return segments.join(" \u2502 ");
|
|
@@ -30879,7 +30620,7 @@ var init_CoreHandlers = __esm({
|
|
|
30879
30620
|
async execute(args) {
|
|
30880
30621
|
const startTime = perf_hooks.performance.now();
|
|
30881
30622
|
const commands = this.registry.getCommands();
|
|
30882
|
-
let message =
|
|
30623
|
+
let message = chalk16__default.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
30883
30624
|
|
|
30884
30625
|
`);
|
|
30885
30626
|
const categories = {
|
|
@@ -30890,17 +30631,17 @@ var init_CoreHandlers = __esm({
|
|
|
30890
30631
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
30891
30632
|
};
|
|
30892
30633
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
30893
|
-
message +=
|
|
30634
|
+
message += chalk16__default.default.yellow(`
|
|
30894
30635
|
${category.toUpperCase()}:
|
|
30895
30636
|
`);
|
|
30896
30637
|
for (const cmd of cmds) {
|
|
30897
30638
|
if (commands.includes(cmd)) {
|
|
30898
|
-
message += ` ${
|
|
30639
|
+
message += ` ${chalk16__default.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
30899
30640
|
`;
|
|
30900
30641
|
}
|
|
30901
30642
|
}
|
|
30902
30643
|
}
|
|
30903
|
-
message +=
|
|
30644
|
+
message += chalk16__default.default.gray(
|
|
30904
30645
|
`
|
|
30905
30646
|
Type '/help <command>' for detailed information about a specific command.`
|
|
30906
30647
|
);
|
|
@@ -30948,7 +30689,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30948
30689
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30949
30690
|
return {
|
|
30950
30691
|
success: true,
|
|
30951
|
-
message:
|
|
30692
|
+
message: chalk16__default.default.gray("Terminal cleared."),
|
|
30952
30693
|
metadata: {
|
|
30953
30694
|
processingTime,
|
|
30954
30695
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -30959,7 +30700,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30959
30700
|
ExitHandler = class {
|
|
30960
30701
|
async execute(args) {
|
|
30961
30702
|
const startTime = perf_hooks.performance.now();
|
|
30962
|
-
const message =
|
|
30703
|
+
const message = chalk16__default.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
30963
30704
|
process.emit("SIGTERM");
|
|
30964
30705
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
30965
30706
|
return {
|
|
@@ -30983,23 +30724,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
30983
30724
|
platform: process.platform,
|
|
30984
30725
|
arch: process.arch
|
|
30985
30726
|
};
|
|
30986
|
-
let message =
|
|
30987
|
-
message +=
|
|
30727
|
+
let message = chalk16__default.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
30728
|
+
message += chalk16__default.default.white(` Version: ${chalk16__default.default.green(packageInfo.version)}
|
|
30988
30729
|
`);
|
|
30989
|
-
message +=
|
|
30730
|
+
message += chalk16__default.default.white(` Package: ${chalk16__default.default.green(packageInfo.name)}
|
|
30990
30731
|
`);
|
|
30991
|
-
message +=
|
|
30732
|
+
message += chalk16__default.default.white(` Node: ${chalk16__default.default.green(packageInfo.node)}
|
|
30992
30733
|
`);
|
|
30993
|
-
message +=
|
|
30994
|
-
` Platform: ${
|
|
30734
|
+
message += chalk16__default.default.white(
|
|
30735
|
+
` Platform: ${chalk16__default.default.green(packageInfo.platform)}
|
|
30995
30736
|
`
|
|
30996
30737
|
);
|
|
30997
|
-
message +=
|
|
30738
|
+
message += chalk16__default.default.white(` Arch: ${chalk16__default.default.green(packageInfo.arch)}
|
|
30998
30739
|
`);
|
|
30999
|
-
message +=
|
|
30740
|
+
message += chalk16__default.default.gray(`
|
|
31000
30741
|
Build: Production
|
|
31001
30742
|
`);
|
|
31002
|
-
message +=
|
|
30743
|
+
message += chalk16__default.default.gray(` License: MIT
|
|
31003
30744
|
`);
|
|
31004
30745
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
31005
30746
|
return {
|
|
@@ -31024,15 +30765,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
31024
30765
|
this.history.push("/history");
|
|
31025
30766
|
}
|
|
31026
30767
|
const recent = this.history.slice(-limit);
|
|
31027
|
-
let message =
|
|
30768
|
+
let message = chalk16__default.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
31028
30769
|
|
|
31029
30770
|
`);
|
|
31030
30771
|
recent.forEach((cmd, index) => {
|
|
31031
30772
|
const num = this.history.length - recent.length + index + 1;
|
|
31032
|
-
message +=
|
|
30773
|
+
message += chalk16__default.default.gray(` ${num.toString().padStart(3)}: `) + chalk16__default.default.white(cmd) + "\n";
|
|
31033
30774
|
});
|
|
31034
30775
|
if (recent.length === 0) {
|
|
31035
|
-
message =
|
|
30776
|
+
message = chalk16__default.default.gray("No command history available.");
|
|
31036
30777
|
}
|
|
31037
30778
|
const processingTime = perf_hooks.performance.now() - startTime;
|
|
31038
30779
|
return {
|
|
@@ -31078,13 +30819,13 @@ var init_DevHandlers = __esm({
|
|
|
31078
30819
|
if (!prompt) {
|
|
31079
30820
|
return {
|
|
31080
30821
|
ok: false,
|
|
31081
|
-
message:
|
|
30822
|
+
message: chalk16__default.default.red("\u274C Please provide a code generation request.\n") + chalk16__default.default.gray("Usage: /code <description>\n") + chalk16__default.default.gray("Example: /code create a React button component")
|
|
31082
30823
|
};
|
|
31083
30824
|
}
|
|
31084
30825
|
if (signal?.aborted) {
|
|
31085
30826
|
return {
|
|
31086
30827
|
ok: false,
|
|
31087
|
-
message:
|
|
30828
|
+
message: chalk16__default.default.yellow("Code generation canceled")
|
|
31088
30829
|
};
|
|
31089
30830
|
}
|
|
31090
30831
|
try {
|
|
@@ -31095,9 +30836,9 @@ var init_DevHandlers = __esm({
|
|
|
31095
30836
|
if (dryRun) {
|
|
31096
30837
|
return {
|
|
31097
30838
|
ok: true,
|
|
31098
|
-
message:
|
|
31099
|
-
`) +
|
|
31100
|
-
`) +
|
|
30839
|
+
message: chalk16__default.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + chalk16__default.default.gray(`Language: ${language}
|
|
30840
|
+
`) + chalk16__default.default.gray(`Framework: ${framework || "none"}
|
|
30841
|
+
`) + chalk16__default.default.gray(`Prompt: ${cleanPrompt}`)
|
|
31101
30842
|
};
|
|
31102
30843
|
}
|
|
31103
30844
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -31109,7 +30850,7 @@ function generated() {
|
|
|
31109
30850
|
export { generated };`;
|
|
31110
30851
|
return {
|
|
31111
30852
|
ok: true,
|
|
31112
|
-
message:
|
|
30853
|
+
message: chalk16__default.default.green("\u2705 Code generated successfully:\n\n") + chalk16__default.default.gray("```" + language + "\n") + generatedCode + chalk16__default.default.gray("\n```"),
|
|
31113
30854
|
data: {
|
|
31114
30855
|
code: generatedCode,
|
|
31115
30856
|
language,
|
|
@@ -31122,7 +30863,7 @@ export { generated };`;
|
|
|
31122
30863
|
} catch (error2) {
|
|
31123
30864
|
return {
|
|
31124
30865
|
ok: false,
|
|
31125
|
-
message:
|
|
30866
|
+
message: chalk16__default.default.red(`Code generation failed: ${error2}`)
|
|
31126
30867
|
};
|
|
31127
30868
|
}
|
|
31128
30869
|
}
|
|
@@ -31136,7 +30877,7 @@ export { generated };`;
|
|
|
31136
30877
|
if (signal?.aborted) {
|
|
31137
30878
|
return {
|
|
31138
30879
|
ok: false,
|
|
31139
|
-
message:
|
|
30880
|
+
message: chalk16__default.default.yellow("Test operation canceled")
|
|
31140
30881
|
};
|
|
31141
30882
|
}
|
|
31142
30883
|
const subcommand = args[0] || "run";
|
|
@@ -31152,8 +30893,8 @@ export { generated };`;
|
|
|
31152
30893
|
default:
|
|
31153
30894
|
return {
|
|
31154
30895
|
ok: false,
|
|
31155
|
-
message:
|
|
31156
|
-
`) +
|
|
30896
|
+
message: chalk16__default.default.red(`Unknown test subcommand: ${subcommand}
|
|
30897
|
+
`) + chalk16__default.default.gray("Available: generate, run, coverage")
|
|
31157
30898
|
};
|
|
31158
30899
|
}
|
|
31159
30900
|
}
|
|
@@ -31161,7 +30902,7 @@ export { generated };`;
|
|
|
31161
30902
|
if (!target) {
|
|
31162
30903
|
return {
|
|
31163
30904
|
ok: false,
|
|
31164
|
-
message:
|
|
30905
|
+
message: chalk16__default.default.red(
|
|
31165
30906
|
"Please specify a file or function to generate tests for"
|
|
31166
30907
|
)
|
|
31167
30908
|
};
|
|
@@ -31178,9 +30919,9 @@ describe("${target}", () => {
|
|
|
31178
30919
|
});`;
|
|
31179
30920
|
return {
|
|
31180
30921
|
ok: true,
|
|
31181
|
-
message:
|
|
30922
|
+
message: chalk16__default.default.green(`\u2705 Tests generated for ${target}:
|
|
31182
30923
|
|
|
31183
|
-
`) +
|
|
30924
|
+
`) + chalk16__default.default.gray("```typescript\n") + testCode + chalk16__default.default.gray("\n```"),
|
|
31184
30925
|
data: { testCode, framework, target }
|
|
31185
30926
|
};
|
|
31186
30927
|
}
|
|
@@ -31193,23 +30934,23 @@ describe("${target}", () => {
|
|
|
31193
30934
|
if (coverage) command += " --coverage";
|
|
31194
30935
|
return {
|
|
31195
30936
|
ok: true,
|
|
31196
|
-
message:
|
|
31197
|
-
`) +
|
|
30937
|
+
message: chalk16__default.default.cyan(`\u{1F9EA} Running tests...
|
|
30938
|
+
`) + chalk16__default.default.gray(`Command: ${command}
|
|
31198
30939
|
|
|
31199
|
-
`) +
|
|
30940
|
+
`) + chalk16__default.default.green("\u2705 All tests passed!"),
|
|
31200
30941
|
data: { command, passed: true }
|
|
31201
30942
|
};
|
|
31202
30943
|
}
|
|
31203
30944
|
async showCoverage(options) {
|
|
31204
30945
|
return {
|
|
31205
30946
|
ok: true,
|
|
31206
|
-
message:
|
|
30947
|
+
message: chalk16__default.default.cyan("\u{1F4CA} Test Coverage Report:\n\n") + chalk16__default.default.gray("File".padEnd(40) + "% Stmts".padEnd(10) + "% Lines\n") + chalk16__default.default.gray("-".repeat(60) + "\n") + chalk16__default.default.green(
|
|
31207
30948
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
31208
|
-
) +
|
|
30949
|
+
) + chalk16__default.default.green(
|
|
31209
30950
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
31210
|
-
) +
|
|
30951
|
+
) + chalk16__default.default.yellow(
|
|
31211
30952
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
31212
|
-
) +
|
|
30953
|
+
) + chalk16__default.default.gray("-".repeat(60) + "\n") + chalk16__default.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
31213
30954
|
};
|
|
31214
30955
|
}
|
|
31215
30956
|
};
|
|
@@ -31223,33 +30964,33 @@ describe("${target}", () => {
|
|
|
31223
30964
|
if (!file) {
|
|
31224
30965
|
return {
|
|
31225
30966
|
ok: false,
|
|
31226
|
-
message:
|
|
30967
|
+
message: chalk16__default.default.red("Please specify a file to review\n") + chalk16__default.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
31227
30968
|
};
|
|
31228
30969
|
}
|
|
31229
30970
|
const checkSecurity = args.includes("--security");
|
|
31230
30971
|
const checkPerformance = args.includes("--performance");
|
|
31231
|
-
let message =
|
|
30972
|
+
let message = chalk16__default.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
31232
30973
|
|
|
31233
30974
|
`);
|
|
31234
|
-
message +=
|
|
31235
|
-
message +=
|
|
31236
|
-
message +=
|
|
31237
|
-
message +=
|
|
30975
|
+
message += chalk16__default.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
30976
|
+
message += chalk16__default.default.gray(" 1. Line 42: ") + chalk16__default.default.yellow("Missing error handling in async function\n");
|
|
30977
|
+
message += chalk16__default.default.gray(" 2. Line 89: ") + chalk16__default.default.yellow("Potential memory leak - event listener not removed\n");
|
|
30978
|
+
message += chalk16__default.default.gray(" 3. Line 156: ") + chalk16__default.default.yellow(
|
|
31238
30979
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
31239
30980
|
);
|
|
31240
30981
|
if (checkSecurity) {
|
|
31241
|
-
message +=
|
|
31242
|
-
message +=
|
|
30982
|
+
message += chalk16__default.default.red("\u{1F512} Security Issues (1):\n");
|
|
30983
|
+
message += chalk16__default.default.gray(" 1. Line 67: ") + chalk16__default.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
31243
30984
|
}
|
|
31244
30985
|
if (checkPerformance) {
|
|
31245
|
-
message +=
|
|
31246
|
-
message +=
|
|
31247
|
-
message +=
|
|
31248
|
-
}
|
|
31249
|
-
message +=
|
|
31250
|
-
message +=
|
|
31251
|
-
message +=
|
|
31252
|
-
message +=
|
|
30986
|
+
message += chalk16__default.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
30987
|
+
message += chalk16__default.default.gray(" 1. Line 23: ") + chalk16__default.default.blue("Consider memoization for expensive calculation\n");
|
|
30988
|
+
message += chalk16__default.default.gray(" 2. Line 145: ") + chalk16__default.default.blue("Use virtualization for large list rendering\n\n");
|
|
30989
|
+
}
|
|
30990
|
+
message += chalk16__default.default.green("\u2705 Positive Findings:\n");
|
|
30991
|
+
message += chalk16__default.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
30992
|
+
message += chalk16__default.default.gray(" \u2022 Consistent code style\n");
|
|
30993
|
+
message += chalk16__default.default.gray(" \u2022 Well-documented functions\n");
|
|
31253
30994
|
return {
|
|
31254
30995
|
ok: true,
|
|
31255
30996
|
message,
|
|
@@ -31279,8 +31020,8 @@ describe("${target}", () => {
|
|
|
31279
31020
|
default:
|
|
31280
31021
|
return {
|
|
31281
31022
|
ok: false,
|
|
31282
|
-
message:
|
|
31283
|
-
`) +
|
|
31023
|
+
message: chalk16__default.default.red(`Unknown bug subcommand: ${subcommand}
|
|
31024
|
+
`) + chalk16__default.default.gray("Available: report, list, analyze")
|
|
31284
31025
|
};
|
|
31285
31026
|
}
|
|
31286
31027
|
}
|
|
@@ -31289,18 +31030,18 @@ describe("${target}", () => {
|
|
|
31289
31030
|
if (!description) {
|
|
31290
31031
|
return {
|
|
31291
31032
|
ok: false,
|
|
31292
|
-
message:
|
|
31033
|
+
message: chalk16__default.default.red("Please provide a bug description")
|
|
31293
31034
|
};
|
|
31294
31035
|
}
|
|
31295
31036
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
31296
31037
|
return {
|
|
31297
31038
|
ok: true,
|
|
31298
|
-
message:
|
|
31039
|
+
message: chalk16__default.default.green(`\u{1F41B} Bug reported successfully!
|
|
31299
31040
|
|
|
31300
|
-
`) +
|
|
31301
|
-
`) +
|
|
31302
|
-
`) +
|
|
31303
|
-
`) +
|
|
31041
|
+
`) + chalk16__default.default.cyan(`Bug ID: ${bugId}
|
|
31042
|
+
`) + chalk16__default.default.gray(`Description: ${description}
|
|
31043
|
+
`) + chalk16__default.default.gray(`Status: Open
|
|
31044
|
+
`) + chalk16__default.default.gray(`Priority: To be determined
|
|
31304
31045
|
`),
|
|
31305
31046
|
data: { bugId, description, status: "open" }
|
|
31306
31047
|
};
|
|
@@ -31308,23 +31049,23 @@ describe("${target}", () => {
|
|
|
31308
31049
|
async listBugs() {
|
|
31309
31050
|
return {
|
|
31310
31051
|
ok: true,
|
|
31311
|
-
message:
|
|
31052
|
+
message: chalk16__default.default.cyan("\u{1F41B} Active Bugs:\n\n") + chalk16__default.default.yellow("1. BUG-A1B2C3: ") + chalk16__default.default.gray("Session timeout not handled properly\n") + chalk16__default.default.yellow("2. BUG-D4E5F6: ") + chalk16__default.default.gray("Memory leak in streaming responses\n") + chalk16__default.default.yellow("3. BUG-G7H8I9: ") + chalk16__default.default.gray("Spinner not stopping on error\n\n") + chalk16__default.default.gray("Total: 3 open bugs")
|
|
31312
31053
|
};
|
|
31313
31054
|
}
|
|
31314
31055
|
async analyzeBug(bugId) {
|
|
31315
31056
|
if (!bugId) {
|
|
31316
31057
|
return {
|
|
31317
31058
|
ok: false,
|
|
31318
|
-
message:
|
|
31059
|
+
message: chalk16__default.default.red("Please provide a bug ID to analyze")
|
|
31319
31060
|
};
|
|
31320
31061
|
}
|
|
31321
31062
|
return {
|
|
31322
31063
|
ok: true,
|
|
31323
|
-
message:
|
|
31064
|
+
message: chalk16__default.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
31324
31065
|
|
|
31325
|
-
`) +
|
|
31066
|
+
`) + chalk16__default.default.yellow("Summary: ") + chalk16__default.default.gray("Session timeout not handled properly\n") + chalk16__default.default.yellow("Severity: ") + chalk16__default.default.orange("Medium\n") + chalk16__default.default.yellow("Component: ") + chalk16__default.default.gray("SessionManager\n") + chalk16__default.default.yellow("Reported: ") + chalk16__default.default.gray("2 days ago\n\n") + chalk16__default.default.cyan("Possible Causes:\n") + chalk16__default.default.gray(
|
|
31326
31067
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
31327
|
-
) +
|
|
31068
|
+
) + chalk16__default.default.gray(" 2. Deadline timer not cleared on completion\n") + chalk16__default.default.gray(" 3. Race condition in state transitions\n\n") + chalk16__default.default.green("Suggested Fix:\n") + chalk16__default.default.gray(" Ensure all async operations respect the AbortSignal\n") + chalk16__default.default.gray(" Add finally block to clear timers\n")
|
|
31328
31069
|
};
|
|
31329
31070
|
}
|
|
31330
31071
|
};
|
|
@@ -31348,7 +31089,7 @@ var init_SystemHandlers = __esm({
|
|
|
31348
31089
|
if (signal?.aborted) {
|
|
31349
31090
|
return {
|
|
31350
31091
|
ok: false,
|
|
31351
|
-
message:
|
|
31092
|
+
message: chalk16__default.default.yellow("Status check canceled")
|
|
31352
31093
|
};
|
|
31353
31094
|
}
|
|
31354
31095
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -31359,44 +31100,44 @@ var init_SystemHandlers = __esm({
|
|
|
31359
31100
|
cpu: os__namespace.cpus()[0],
|
|
31360
31101
|
platform: process.platform
|
|
31361
31102
|
};
|
|
31362
|
-
let message =
|
|
31363
|
-
message +=
|
|
31364
|
-
message +=
|
|
31103
|
+
let message = chalk16__default.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
31104
|
+
message += chalk16__default.default.green("\u2705 System: Operational\n");
|
|
31105
|
+
message += chalk16__default.default.gray(
|
|
31365
31106
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
31366
31107
|
`
|
|
31367
31108
|
);
|
|
31368
|
-
message +=
|
|
31109
|
+
message += chalk16__default.default.gray(
|
|
31369
31110
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31370
31111
|
`
|
|
31371
31112
|
);
|
|
31372
31113
|
if (verbose) {
|
|
31373
|
-
message +=
|
|
31374
|
-
message +=
|
|
31114
|
+
message += chalk16__default.default.gray("\nDetailed Information:\n");
|
|
31115
|
+
message += chalk16__default.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
31375
31116
|
`);
|
|
31376
|
-
message +=
|
|
31117
|
+
message += chalk16__default.default.gray(
|
|
31377
31118
|
` \u2022 Platform: ${status.platform} (${os__namespace.arch()})
|
|
31378
31119
|
`
|
|
31379
31120
|
);
|
|
31380
|
-
message +=
|
|
31121
|
+
message += chalk16__default.default.gray(` \u2022 Node.js: ${process.version}
|
|
31381
31122
|
`);
|
|
31382
|
-
message +=
|
|
31123
|
+
message += chalk16__default.default.gray(` \u2022 Process ID: ${process.pid}
|
|
31383
31124
|
`);
|
|
31384
|
-
message +=
|
|
31125
|
+
message += chalk16__default.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
31385
31126
|
`);
|
|
31386
|
-
message +=
|
|
31387
|
-
message +=
|
|
31127
|
+
message += chalk16__default.default.gray("\nMemory Details:\n");
|
|
31128
|
+
message += chalk16__default.default.gray(
|
|
31388
31129
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
31389
31130
|
`
|
|
31390
31131
|
);
|
|
31391
|
-
message +=
|
|
31132
|
+
message += chalk16__default.default.gray(
|
|
31392
31133
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
31393
31134
|
`
|
|
31394
31135
|
);
|
|
31395
|
-
message +=
|
|
31136
|
+
message += chalk16__default.default.gray(
|
|
31396
31137
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
31397
31138
|
`
|
|
31398
31139
|
);
|
|
31399
|
-
message +=
|
|
31140
|
+
message += chalk16__default.default.gray(
|
|
31400
31141
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
31401
31142
|
`
|
|
31402
31143
|
);
|
|
@@ -31425,7 +31166,7 @@ var init_SystemHandlers = __esm({
|
|
|
31425
31166
|
if (signal?.aborted) {
|
|
31426
31167
|
return {
|
|
31427
31168
|
ok: false,
|
|
31428
|
-
message:
|
|
31169
|
+
message: chalk16__default.default.yellow("Model operation canceled")
|
|
31429
31170
|
};
|
|
31430
31171
|
}
|
|
31431
31172
|
if (args.length === 0) {
|
|
@@ -31445,17 +31186,17 @@ var init_SystemHandlers = __esm({
|
|
|
31445
31186
|
}
|
|
31446
31187
|
}
|
|
31447
31188
|
async listModels() {
|
|
31448
|
-
let message =
|
|
31449
|
-
message +=
|
|
31189
|
+
let message = chalk16__default.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
31190
|
+
message += chalk16__default.default.green(`Current: ${this.currentModel}
|
|
31450
31191
|
|
|
31451
31192
|
`);
|
|
31452
31193
|
for (const model of this.availableModels) {
|
|
31453
|
-
const status = model.available ?
|
|
31454
|
-
const name2 = model.id === this.currentModel ?
|
|
31455
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
31194
|
+
const status = model.available ? chalk16__default.default.green("\u2705") : chalk16__default.default.red("\u274C");
|
|
31195
|
+
const name2 = model.id === this.currentModel ? chalk16__default.default.green.bold(model.id) : chalk16__default.default.cyan(model.id);
|
|
31196
|
+
message += `${status} ${name2.padEnd(20)} ${chalk16__default.default.gray(`[${model.provider}]`)}
|
|
31456
31197
|
`;
|
|
31457
31198
|
}
|
|
31458
|
-
message +=
|
|
31199
|
+
message += chalk16__default.default.gray("\nUse /model <name> to switch models");
|
|
31459
31200
|
return {
|
|
31460
31201
|
ok: true,
|
|
31461
31202
|
message,
|
|
@@ -31466,27 +31207,27 @@ var init_SystemHandlers = __esm({
|
|
|
31466
31207
|
if (!modelId) {
|
|
31467
31208
|
return {
|
|
31468
31209
|
ok: false,
|
|
31469
|
-
message:
|
|
31210
|
+
message: chalk16__default.default.red("Please specify a model to switch to")
|
|
31470
31211
|
};
|
|
31471
31212
|
}
|
|
31472
31213
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
31473
31214
|
if (!model) {
|
|
31474
31215
|
return {
|
|
31475
31216
|
ok: false,
|
|
31476
|
-
message:
|
|
31477
|
-
`) +
|
|
31217
|
+
message: chalk16__default.default.red(`Unknown model: ${modelId}
|
|
31218
|
+
`) + chalk16__default.default.gray("Use /model list to see available models")
|
|
31478
31219
|
};
|
|
31479
31220
|
}
|
|
31480
31221
|
if (!model.available) {
|
|
31481
31222
|
return {
|
|
31482
31223
|
ok: false,
|
|
31483
|
-
message:
|
|
31224
|
+
message: chalk16__default.default.yellow(`Model ${modelId} is not currently available`)
|
|
31484
31225
|
};
|
|
31485
31226
|
}
|
|
31486
31227
|
this.currentModel = modelId;
|
|
31487
31228
|
return {
|
|
31488
31229
|
ok: true,
|
|
31489
|
-
message:
|
|
31230
|
+
message: chalk16__default.default.green(`\u2705 Switched to ${modelId}`),
|
|
31490
31231
|
data: { model: modelId }
|
|
31491
31232
|
};
|
|
31492
31233
|
}
|
|
@@ -31495,27 +31236,27 @@ var init_SystemHandlers = __esm({
|
|
|
31495
31236
|
if (!model) {
|
|
31496
31237
|
return {
|
|
31497
31238
|
ok: false,
|
|
31498
|
-
message:
|
|
31239
|
+
message: chalk16__default.default.red(`Unknown model: ${modelId}`)
|
|
31499
31240
|
};
|
|
31500
31241
|
}
|
|
31501
|
-
let message =
|
|
31242
|
+
let message = chalk16__default.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
31502
31243
|
|
|
31503
31244
|
`);
|
|
31504
|
-
message +=
|
|
31245
|
+
message += chalk16__default.default.gray(`Provider: ${model.provider}
|
|
31505
31246
|
`);
|
|
31506
|
-
message +=
|
|
31247
|
+
message += chalk16__default.default.gray(
|
|
31507
31248
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
31508
31249
|
`
|
|
31509
31250
|
);
|
|
31510
|
-
message +=
|
|
31251
|
+
message += chalk16__default.default.gray(
|
|
31511
31252
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
31512
31253
|
`
|
|
31513
31254
|
);
|
|
31514
|
-
message +=
|
|
31515
|
-
message +=
|
|
31516
|
-
message +=
|
|
31517
|
-
message +=
|
|
31518
|
-
message +=
|
|
31255
|
+
message += chalk16__default.default.gray("\nCapabilities:\n");
|
|
31256
|
+
message += chalk16__default.default.gray(" \u2022 Context: 128K tokens\n");
|
|
31257
|
+
message += chalk16__default.default.gray(" \u2022 Languages: 95+\n");
|
|
31258
|
+
message += chalk16__default.default.gray(" \u2022 Code: Yes\n");
|
|
31259
|
+
message += chalk16__default.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
31519
31260
|
return {
|
|
31520
31261
|
ok: true,
|
|
31521
31262
|
message,
|
|
@@ -31547,39 +31288,39 @@ var init_SystemHandlers = __esm({
|
|
|
31547
31288
|
default:
|
|
31548
31289
|
return {
|
|
31549
31290
|
ok: false,
|
|
31550
|
-
message:
|
|
31551
|
-
`) +
|
|
31291
|
+
message: chalk16__default.default.red(`Unknown memory subcommand: ${subcommand}
|
|
31292
|
+
`) + chalk16__default.default.gray("Available: status, clear, export, compact")
|
|
31552
31293
|
};
|
|
31553
31294
|
}
|
|
31554
31295
|
}
|
|
31555
31296
|
async showStatus() {
|
|
31556
|
-
let message =
|
|
31557
|
-
message +=
|
|
31558
|
-
message +=
|
|
31297
|
+
let message = chalk16__default.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
31298
|
+
message += chalk16__default.default.yellow("System 1 (Fast):\n");
|
|
31299
|
+
message += chalk16__default.default.gray(
|
|
31559
31300
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
31560
31301
|
`
|
|
31561
31302
|
);
|
|
31562
|
-
message +=
|
|
31303
|
+
message += chalk16__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
31563
31304
|
|
|
31564
31305
|
`);
|
|
31565
|
-
message +=
|
|
31566
|
-
message +=
|
|
31306
|
+
message += chalk16__default.default.blue("System 2 (Deep):\n");
|
|
31307
|
+
message += chalk16__default.default.gray(
|
|
31567
31308
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
31568
31309
|
`
|
|
31569
31310
|
);
|
|
31570
|
-
message +=
|
|
31311
|
+
message += chalk16__default.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
31571
31312
|
|
|
31572
31313
|
`);
|
|
31573
|
-
message +=
|
|
31574
|
-
message +=
|
|
31314
|
+
message += chalk16__default.default.green("Total:\n");
|
|
31315
|
+
message += chalk16__default.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
31575
31316
|
`);
|
|
31576
|
-
message +=
|
|
31317
|
+
message += chalk16__default.default.gray(
|
|
31577
31318
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
31578
31319
|
`
|
|
31579
31320
|
);
|
|
31580
31321
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
31581
31322
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
31582
|
-
message +=
|
|
31323
|
+
message += chalk16__default.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
31583
31324
|
`);
|
|
31584
31325
|
return {
|
|
31585
31326
|
ok: true,
|
|
@@ -31593,14 +31334,14 @@ var init_SystemHandlers = __esm({
|
|
|
31593
31334
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
31594
31335
|
return {
|
|
31595
31336
|
ok: true,
|
|
31596
|
-
message:
|
|
31337
|
+
message: chalk16__default.default.green("\u2705 System 1 memory cleared")
|
|
31597
31338
|
};
|
|
31598
31339
|
}
|
|
31599
31340
|
if (system === "system2") {
|
|
31600
31341
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
31601
31342
|
return {
|
|
31602
31343
|
ok: true,
|
|
31603
|
-
message:
|
|
31344
|
+
message: chalk16__default.default.green("\u2705 System 2 memory cleared")
|
|
31604
31345
|
};
|
|
31605
31346
|
}
|
|
31606
31347
|
this.memoryStats = {
|
|
@@ -31610,15 +31351,15 @@ var init_SystemHandlers = __esm({
|
|
|
31610
31351
|
};
|
|
31611
31352
|
return {
|
|
31612
31353
|
ok: true,
|
|
31613
|
-
message:
|
|
31354
|
+
message: chalk16__default.default.green("\u{1F9F9} All memory cleared")
|
|
31614
31355
|
};
|
|
31615
31356
|
}
|
|
31616
31357
|
async exportMemory() {
|
|
31617
31358
|
const filename = `memory-export-${Date.now()}.json`;
|
|
31618
31359
|
return {
|
|
31619
31360
|
ok: true,
|
|
31620
|
-
message:
|
|
31621
|
-
`) +
|
|
31361
|
+
message: chalk16__default.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
31362
|
+
`) + chalk16__default.default.gray(
|
|
31622
31363
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
31623
31364
|
),
|
|
31624
31365
|
data: { filename, stats: this.memoryStats }
|
|
@@ -31636,9 +31377,9 @@ var init_SystemHandlers = __esm({
|
|
|
31636
31377
|
);
|
|
31637
31378
|
return {
|
|
31638
31379
|
ok: true,
|
|
31639
|
-
message:
|
|
31640
|
-
`) +
|
|
31641
|
-
`) +
|
|
31380
|
+
message: chalk16__default.default.green("\u2728 Memory compacted successfully\n") + chalk16__default.default.gray(`Before: ${before} tokens
|
|
31381
|
+
`) + chalk16__default.default.gray(`After: ${after} tokens
|
|
31382
|
+
`) + chalk16__default.default.gray(
|
|
31642
31383
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
31643
31384
|
),
|
|
31644
31385
|
data: { before, after, saved: before - after }
|
|
@@ -31654,11 +31395,11 @@ var init_SystemHandlers = __esm({
|
|
|
31654
31395
|
if (signal?.aborted) {
|
|
31655
31396
|
return {
|
|
31656
31397
|
ok: false,
|
|
31657
|
-
message:
|
|
31398
|
+
message: chalk16__default.default.yellow("Health check canceled")
|
|
31658
31399
|
};
|
|
31659
31400
|
}
|
|
31660
31401
|
const detailed = args.includes("--detailed");
|
|
31661
|
-
let message =
|
|
31402
|
+
let message = chalk16__default.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
31662
31403
|
const checks = [
|
|
31663
31404
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
31664
31405
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -31667,11 +31408,11 @@ var init_SystemHandlers = __esm({
|
|
|
31667
31408
|
{ name: "Network", status: "warning", latency: 250 }
|
|
31668
31409
|
];
|
|
31669
31410
|
for (const check of checks) {
|
|
31670
|
-
const icon = check.status === "ok" ?
|
|
31671
|
-
const status = check.status === "ok" ?
|
|
31411
|
+
const icon = check.status === "ok" ? chalk16__default.default.green("\u2705") : check.status === "warning" ? chalk16__default.default.yellow("\u26A0\uFE0F") : chalk16__default.default.red("\u274C");
|
|
31412
|
+
const status = check.status === "ok" ? chalk16__default.default.green("OK") : check.status === "warning" ? chalk16__default.default.yellow("WARNING") : chalk16__default.default.red("ERROR");
|
|
31672
31413
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
31673
31414
|
if (detailed) {
|
|
31674
|
-
message +=
|
|
31415
|
+
message += chalk16__default.default.gray(` (${check.latency}ms)`);
|
|
31675
31416
|
}
|
|
31676
31417
|
message += "\n";
|
|
31677
31418
|
}
|
|
@@ -31679,11 +31420,11 @@ var init_SystemHandlers = __esm({
|
|
|
31679
31420
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
31680
31421
|
message += "\n";
|
|
31681
31422
|
if (hasErrors) {
|
|
31682
|
-
message +=
|
|
31423
|
+
message += chalk16__default.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
31683
31424
|
} else if (hasWarnings) {
|
|
31684
|
-
message +=
|
|
31425
|
+
message += chalk16__default.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
31685
31426
|
} else {
|
|
31686
|
-
message +=
|
|
31427
|
+
message += chalk16__default.default.green("\u2705 All systems operational");
|
|
31687
31428
|
}
|
|
31688
31429
|
return {
|
|
31689
31430
|
ok: true,
|
|
@@ -31701,12 +31442,12 @@ var init_SystemHandlers = __esm({
|
|
|
31701
31442
|
if (signal?.aborted) {
|
|
31702
31443
|
return {
|
|
31703
31444
|
ok: false,
|
|
31704
|
-
message:
|
|
31445
|
+
message: chalk16__default.default.yellow("Doctor check canceled")
|
|
31705
31446
|
};
|
|
31706
31447
|
}
|
|
31707
31448
|
const autoFix = args.includes("--fix");
|
|
31708
|
-
let message =
|
|
31709
|
-
message +=
|
|
31449
|
+
let message = chalk16__default.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
31450
|
+
message += chalk16__default.default.gray("Running diagnostics...\n\n");
|
|
31710
31451
|
const issues = [
|
|
31711
31452
|
{
|
|
31712
31453
|
severity: "warning",
|
|
@@ -31728,20 +31469,20 @@ var init_SystemHandlers = __esm({
|
|
|
31728
31469
|
}
|
|
31729
31470
|
];
|
|
31730
31471
|
if (issues.length === 0) {
|
|
31731
|
-
message +=
|
|
31472
|
+
message += chalk16__default.default.green("\u2705 No issues found - system is healthy!");
|
|
31732
31473
|
return { ok: true, message };
|
|
31733
31474
|
}
|
|
31734
|
-
message +=
|
|
31475
|
+
message += chalk16__default.default.yellow(`Found ${issues.length} issue(s):
|
|
31735
31476
|
|
|
31736
31477
|
`);
|
|
31737
31478
|
for (const issue of issues) {
|
|
31738
|
-
const icon = issue.severity === "error" ?
|
|
31479
|
+
const icon = issue.severity === "error" ? chalk16__default.default.red("\u274C") : issue.severity === "warning" ? chalk16__default.default.yellow("\u26A0\uFE0F") : chalk16__default.default.blue("\u2139\uFE0F");
|
|
31739
31480
|
message += `${icon} ${issue.issue}
|
|
31740
31481
|
`;
|
|
31741
|
-
message +=
|
|
31482
|
+
message += chalk16__default.default.gray(` Solution: ${issue.solution}
|
|
31742
31483
|
`);
|
|
31743
31484
|
if (autoFix && issue.fixable) {
|
|
31744
|
-
message +=
|
|
31485
|
+
message += chalk16__default.default.green(` \u2705 Auto-fixed
|
|
31745
31486
|
`);
|
|
31746
31487
|
}
|
|
31747
31488
|
message += "\n";
|
|
@@ -31749,7 +31490,7 @@ var init_SystemHandlers = __esm({
|
|
|
31749
31490
|
if (!autoFix) {
|
|
31750
31491
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
31751
31492
|
if (fixableCount > 0) {
|
|
31752
|
-
message +=
|
|
31493
|
+
message += chalk16__default.default.gray(
|
|
31753
31494
|
`
|
|
31754
31495
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
31755
31496
|
);
|
|
@@ -32192,7 +31933,7 @@ var init_package = __esm({
|
|
|
32192
31933
|
"package.json"() {
|
|
32193
31934
|
package_default = {
|
|
32194
31935
|
name: "@bonginkan/maria",
|
|
32195
|
-
version: "4.2.
|
|
31936
|
+
version: "4.2.4",
|
|
32196
31937
|
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.",
|
|
32197
31938
|
keywords: [
|
|
32198
31939
|
"ai",
|
|
@@ -32708,21 +32449,20 @@ function createCLI() {
|
|
|
32708
32449
|
}
|
|
32709
32450
|
});
|
|
32710
32451
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
32711
|
-
console.log(
|
|
32452
|
+
console.log(chalk16__default.default.cyan("Setting up Ollama..."));
|
|
32712
32453
|
console.log(
|
|
32713
|
-
|
|
32454
|
+
chalk16__default.default.yellow("Please run: brew install ollama && ollama serve")
|
|
32714
32455
|
);
|
|
32715
32456
|
});
|
|
32716
32457
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
32717
|
-
console.log(
|
|
32718
|
-
console.log(
|
|
32458
|
+
console.log(chalk16__default.default.cyan("Setting up vLLM..."));
|
|
32459
|
+
console.log(chalk16__default.default.yellow("Please run: pip install vllm"));
|
|
32719
32460
|
});
|
|
32720
32461
|
return program2;
|
|
32721
32462
|
}
|
|
32722
32463
|
var MariaAI;
|
|
32723
32464
|
var init_maria_ai = __esm({
|
|
32724
32465
|
"src/maria-ai.ts"() {
|
|
32725
|
-
init_startup_display();
|
|
32726
32466
|
init_provider_selector();
|
|
32727
32467
|
init_config2();
|
|
32728
32468
|
init_IntelligentRouterService();
|
|
@@ -32739,17 +32479,16 @@ var init_maria_ai = __esm({
|
|
|
32739
32479
|
}
|
|
32740
32480
|
async initialize() {
|
|
32741
32481
|
try {
|
|
32742
|
-
displayStartupLogo();
|
|
32743
32482
|
await this.providerSelector.initialize();
|
|
32744
32483
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
32745
32484
|
console.log(
|
|
32746
|
-
|
|
32485
|
+
chalk16__default.default.green(`
|
|
32747
32486
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
32748
32487
|
);
|
|
32749
32488
|
this.config.set("currentProvider", provider);
|
|
32750
32489
|
this.config.set("currentModel", model);
|
|
32751
32490
|
await this.config.save();
|
|
32752
|
-
console.log(
|
|
32491
|
+
console.log(chalk16__default.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
32753
32492
|
this.router = new IntelligentRouterService({
|
|
32754
32493
|
confidenceThreshold: 0.85,
|
|
32755
32494
|
enableLearning: true,
|
|
@@ -32757,12 +32496,12 @@ var init_maria_ai = __esm({
|
|
|
32757
32496
|
});
|
|
32758
32497
|
await this.router.initialize();
|
|
32759
32498
|
console.log(
|
|
32760
|
-
|
|
32499
|
+
chalk16__default.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
32761
32500
|
);
|
|
32762
32501
|
this.session = createInteractiveSession(this);
|
|
32763
32502
|
await this.session.start();
|
|
32764
32503
|
} catch (error2) {
|
|
32765
|
-
console.error(
|
|
32504
|
+
console.error(chalk16__default.default.red("\n\u274C Initialization failed:"), error2);
|
|
32766
32505
|
process.exit(1);
|
|
32767
32506
|
}
|
|
32768
32507
|
}
|
|
@@ -32770,7 +32509,7 @@ var init_maria_ai = __esm({
|
|
|
32770
32509
|
if (this.session) {
|
|
32771
32510
|
await this.session.stop();
|
|
32772
32511
|
}
|
|
32773
|
-
console.log(
|
|
32512
|
+
console.log(chalk16__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
32774
32513
|
}
|
|
32775
32514
|
};
|
|
32776
32515
|
}
|
|
@@ -32799,8 +32538,8 @@ async function loadServices() {
|
|
|
32799
32538
|
try {
|
|
32800
32539
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32801
32540
|
if (commandName === "battlecard") {
|
|
32802
|
-
console.log(
|
|
32803
|
-
console.log(
|
|
32541
|
+
console.log(chalk16__default.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
32542
|
+
console.log(chalk16__default.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32804
32543
|
return {
|
|
32805
32544
|
success: false,
|
|
32806
32545
|
message: "Command not available on Free plan"
|
|
@@ -32861,7 +32600,7 @@ async function loadServices() {
|
|
|
32861
32600
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32862
32601
|
}
|
|
32863
32602
|
} catch (e2) {
|
|
32864
|
-
console.warn(
|
|
32603
|
+
console.warn(chalk16__default.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32865
32604
|
}
|
|
32866
32605
|
}
|
|
32867
32606
|
async function init() {
|
|
@@ -32975,20 +32714,20 @@ async function enforceAuth(cmd) {
|
|
|
32975
32714
|
try {
|
|
32976
32715
|
const tokens = await authManager.getValidTokens();
|
|
32977
32716
|
if (!tokens) {
|
|
32978
|
-
console.log(
|
|
32717
|
+
console.log(chalk16__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32979
32718
|
process.exit(2);
|
|
32980
32719
|
return false;
|
|
32981
32720
|
}
|
|
32982
32721
|
return true;
|
|
32983
32722
|
} catch (error2) {
|
|
32984
32723
|
if (error2.code === "AUTH_REQUIRED") {
|
|
32985
|
-
console.log(
|
|
32724
|
+
console.log(chalk16__default.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32986
32725
|
process.exit(2);
|
|
32987
32726
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
32988
|
-
console.log(
|
|
32727
|
+
console.log(chalk16__default.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
32989
32728
|
process.exit(2);
|
|
32990
32729
|
} else {
|
|
32991
|
-
console.log(
|
|
32730
|
+
console.log(chalk16__default.default.red("\u{1F310} Network error, check connection"));
|
|
32992
32731
|
process.exit(1);
|
|
32993
32732
|
}
|
|
32994
32733
|
return false;
|
|
@@ -33028,7 +32767,7 @@ async function handleSlash(input3) {
|
|
|
33028
32767
|
console.log(JSON.stringify(result.data, null, 2));
|
|
33029
32768
|
}
|
|
33030
32769
|
} else {
|
|
33031
|
-
console.log(
|
|
32770
|
+
console.log(chalk16__default.default.red(`Help Error: ${result.message}`));
|
|
33032
32771
|
}
|
|
33033
32772
|
return true;
|
|
33034
32773
|
}
|
|
@@ -33036,7 +32775,7 @@ async function handleSlash(input3) {
|
|
|
33036
32775
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33037
32776
|
console.error("HelpCommand error:", helpError);
|
|
33038
32777
|
}
|
|
33039
|
-
console.log(
|
|
32778
|
+
console.log(chalk16__default.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
33040
32779
|
}
|
|
33041
32780
|
const help = `
|
|
33042
32781
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -33061,7 +32800,7 @@ Chat:
|
|
|
33061
32800
|
session.length = 0;
|
|
33062
32801
|
if (ctx?.clearContext) ctx.clearContext();
|
|
33063
32802
|
console.clear();
|
|
33064
|
-
console.log(
|
|
32803
|
+
console.log(chalk16__default.default.cyan("\u2728 Session cleared"));
|
|
33065
32804
|
return true;
|
|
33066
32805
|
}
|
|
33067
32806
|
if (cmd === "code") {
|
|
@@ -33069,7 +32808,7 @@ Chat:
|
|
|
33069
32808
|
const prompt = args.join(" ").trim();
|
|
33070
32809
|
if (!prompt) {
|
|
33071
32810
|
console.log(
|
|
33072
|
-
|
|
32811
|
+
chalk16__default.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
33073
32812
|
);
|
|
33074
32813
|
return true;
|
|
33075
32814
|
}
|
|
@@ -33081,7 +32820,7 @@ Chat:
|
|
|
33081
32820
|
const prompt = args.join(" ").trim();
|
|
33082
32821
|
if (!prompt) {
|
|
33083
32822
|
console.log(
|
|
33084
|
-
|
|
32823
|
+
chalk16__default.default.cyan("\u{1F3A8} **Image Generation**\n") + chalk16__default.default.white("Usage: /image <prompt>\n") + chalk16__default.default.gray("Example: /image \u5BCC\u58EB\u5C71\u306E\u65E5\u306E\u51FA")
|
|
33085
32824
|
);
|
|
33086
32825
|
return true;
|
|
33087
32826
|
}
|
|
@@ -33093,14 +32832,14 @@ Chat:
|
|
|
33093
32832
|
options: {},
|
|
33094
32833
|
logger: {
|
|
33095
32834
|
info: (msg) => console.log(msg),
|
|
33096
|
-
error: (msg) => console.error(
|
|
33097
|
-
warn: (msg) => console.warn(
|
|
32835
|
+
error: (msg) => console.error(chalk16__default.default.red(msg)),
|
|
32836
|
+
warn: (msg) => console.warn(chalk16__default.default.yellow(msg))
|
|
33098
32837
|
}
|
|
33099
32838
|
};
|
|
33100
32839
|
await imageCommand2.execute(context2);
|
|
33101
32840
|
}
|
|
33102
32841
|
} catch (error2) {
|
|
33103
|
-
console.error(
|
|
32842
|
+
console.error(chalk16__default.default.red("Image generation failed:"), error2.message);
|
|
33104
32843
|
}
|
|
33105
32844
|
return true;
|
|
33106
32845
|
}
|
|
@@ -33109,7 +32848,7 @@ Chat:
|
|
|
33109
32848
|
const prompt = args.join(" ").trim();
|
|
33110
32849
|
if (!prompt) {
|
|
33111
32850
|
console.log(
|
|
33112
|
-
|
|
32851
|
+
chalk16__default.default.cyan("\u{1F3AC} **Video Generation**\n") + chalk16__default.default.white("Usage: /video <prompt>\n") + chalk16__default.default.gray("Example: /video \u6D77\u306E\u6CE2\u304C\u6253\u3061\u5BC4\u305B\u308B\u69D8\u5B50")
|
|
33113
32852
|
);
|
|
33114
32853
|
return true;
|
|
33115
32854
|
}
|
|
@@ -33121,14 +32860,14 @@ Chat:
|
|
|
33121
32860
|
options: {},
|
|
33122
32861
|
logger: {
|
|
33123
32862
|
info: (msg) => console.log(msg),
|
|
33124
|
-
error: (msg) => console.error(
|
|
33125
|
-
warn: (msg) => console.warn(
|
|
32863
|
+
error: (msg) => console.error(chalk16__default.default.red(msg)),
|
|
32864
|
+
warn: (msg) => console.warn(chalk16__default.default.yellow(msg))
|
|
33126
32865
|
}
|
|
33127
32866
|
};
|
|
33128
32867
|
await videoCommand2.execute(context2);
|
|
33129
32868
|
}
|
|
33130
32869
|
} catch (error2) {
|
|
33131
|
-
console.error(
|
|
32870
|
+
console.error(chalk16__default.default.red("Video generation failed:"), error2.message);
|
|
33132
32871
|
}
|
|
33133
32872
|
return true;
|
|
33134
32873
|
}
|
|
@@ -33137,7 +32876,7 @@ Chat:
|
|
|
33137
32876
|
const prompt = args.join(" ").trim();
|
|
33138
32877
|
if (!prompt) {
|
|
33139
32878
|
console.log(
|
|
33140
|
-
|
|
32879
|
+
chalk16__default.default.cyan("\u{1F399}\uFE0F **Voice Synthesis**\n") + chalk16__default.default.white("Usage: /voice <text>\n") + chalk16__default.default.gray("Example: /voice \u3053\u3093\u306B\u3061\u306F\u3001\u5143\u6C17\u3067\u3059\u304B\uFF1F")
|
|
33141
32880
|
);
|
|
33142
32881
|
return true;
|
|
33143
32882
|
}
|
|
@@ -33149,14 +32888,14 @@ Chat:
|
|
|
33149
32888
|
options: {},
|
|
33150
32889
|
logger: {
|
|
33151
32890
|
info: (msg) => console.log(msg),
|
|
33152
|
-
error: (msg) => console.error(
|
|
33153
|
-
warn: (msg) => console.warn(
|
|
32891
|
+
error: (msg) => console.error(chalk16__default.default.red(msg)),
|
|
32892
|
+
warn: (msg) => console.warn(chalk16__default.default.yellow(msg))
|
|
33154
32893
|
}
|
|
33155
32894
|
};
|
|
33156
32895
|
await voiceCommand2.execute(context2);
|
|
33157
32896
|
}
|
|
33158
32897
|
} catch (error2) {
|
|
33159
|
-
console.error(
|
|
32898
|
+
console.error(chalk16__default.default.red("Voice synthesis failed:"), error2.message);
|
|
33160
32899
|
}
|
|
33161
32900
|
return true;
|
|
33162
32901
|
}
|
|
@@ -33175,36 +32914,36 @@ Chat:
|
|
|
33175
32914
|
if (args.includes("status")) {
|
|
33176
32915
|
if (await authManager.isAuthenticated()) {
|
|
33177
32916
|
const user = await authManager.getCurrentUser();
|
|
33178
|
-
console.log(
|
|
33179
|
-
console.log(
|
|
33180
|
-
console.log(
|
|
32917
|
+
console.log(chalk16__default.default.green("\u2705 Authenticated"));
|
|
32918
|
+
console.log(chalk16__default.default.white(`\u{1F464} User: ${chalk16__default.default.cyan(user.email)}`));
|
|
32919
|
+
console.log(chalk16__default.default.white(`\u{1F4CA} Plan: ${chalk16__default.default.cyan(user.plan)}`));
|
|
33181
32920
|
} else {
|
|
33182
|
-
console.log(
|
|
33183
|
-
console.log(
|
|
32921
|
+
console.log(chalk16__default.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
32922
|
+
console.log(chalk16__default.default.gray("Use /login to sign in"));
|
|
33184
32923
|
}
|
|
33185
32924
|
} else {
|
|
33186
32925
|
const result = await authManager.login(options2);
|
|
33187
32926
|
if (result.success && result.user) {
|
|
33188
|
-
console.log(
|
|
33189
|
-
console.log(
|
|
33190
|
-
console.log(
|
|
32927
|
+
console.log(chalk16__default.default.green("\u2705 Successfully logged in!"));
|
|
32928
|
+
console.log(chalk16__default.default.white(`\u{1F464} User: ${chalk16__default.default.cyan(result.user.email)}`));
|
|
32929
|
+
console.log(chalk16__default.default.white(`\u{1F4CA} Plan: ${chalk16__default.default.cyan(result.user.plan)}`));
|
|
33191
32930
|
} else {
|
|
33192
|
-
console.log(
|
|
33193
|
-
if (result.error) console.log(
|
|
32931
|
+
console.log(chalk16__default.default.red("\u274C Login failed"));
|
|
32932
|
+
if (result.error) console.log(chalk16__default.default.gray(result.error));
|
|
33194
32933
|
}
|
|
33195
32934
|
}
|
|
33196
32935
|
}
|
|
33197
32936
|
} catch (error2) {
|
|
33198
|
-
console.error(
|
|
32937
|
+
console.error(chalk16__default.default.red("Login error:"), error2.message);
|
|
33199
32938
|
}
|
|
33200
32939
|
return true;
|
|
33201
32940
|
}
|
|
33202
32941
|
if (cmd === "logout" || cmd === "signout") {
|
|
33203
32942
|
try {
|
|
33204
32943
|
await authManager.logout();
|
|
33205
|
-
console.log(
|
|
32944
|
+
console.log(chalk16__default.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
33206
32945
|
} catch (error2) {
|
|
33207
|
-
console.error(
|
|
32946
|
+
console.error(chalk16__default.default.red("Logout error:"), error2.message);
|
|
33208
32947
|
}
|
|
33209
32948
|
return true;
|
|
33210
32949
|
}
|
|
@@ -33305,11 +33044,11 @@ Chat:
|
|
|
33305
33044
|
}
|
|
33306
33045
|
}
|
|
33307
33046
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33308
|
-
console.log(
|
|
33309
|
-
console.log(
|
|
33310
|
-
console.log(
|
|
33311
|
-
console.log(
|
|
33312
|
-
console.log(
|
|
33047
|
+
console.log(chalk16__default.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33048
|
+
console.log(chalk16__default.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33049
|
+
console.log(chalk16__default.default.gray(" \u2022 Type /help to see available commands"));
|
|
33050
|
+
console.log(chalk16__default.default.gray(" \u2022 Check if you need to /login first"));
|
|
33051
|
+
console.log(chalk16__default.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33313
33052
|
}
|
|
33314
33053
|
return true;
|
|
33315
33054
|
}
|
|
@@ -33577,11 +33316,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33577
33316
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33578
33317
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33579
33318
|
console.log(
|
|
33580
|
-
|
|
33581
|
-
`) +
|
|
33582
|
-
`) +
|
|
33583
|
-
`) +
|
|
33584
|
-
`) +
|
|
33319
|
+
chalk16__default.default.green("\n\u2705 **Code Saved**\n") + chalk16__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33320
|
+
`) + chalk16__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33321
|
+
`) + chalk16__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33322
|
+
`) + chalk16__default.default.white(` \u{1F4DD} Language: ${language}
|
|
33323
|
+
`) + chalk16__default.default.dim(`
|
|
33585
33324
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33586
33325
|
);
|
|
33587
33326
|
} else {
|
|
@@ -33590,11 +33329,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33590
33329
|
} catch (e2) {
|
|
33591
33330
|
spinner.stop();
|
|
33592
33331
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33593
|
-
console.error(
|
|
33332
|
+
console.error(chalk16__default.default.red("Code generation error:"), e2.message || e2);
|
|
33594
33333
|
}
|
|
33595
33334
|
const fallbackCode = templateFallback(prompt);
|
|
33596
33335
|
console.log(
|
|
33597
|
-
|
|
33336
|
+
chalk16__default.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33598
33337
|
);
|
|
33599
33338
|
console.log(fallbackCode);
|
|
33600
33339
|
try {
|
|
@@ -33603,14 +33342,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33603
33342
|
const filepath = path8__namespace.resolve(process.cwd(), filename);
|
|
33604
33343
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
33605
33344
|
console.log(
|
|
33606
|
-
|
|
33607
|
-
`) +
|
|
33608
|
-
`) +
|
|
33609
|
-
`) +
|
|
33345
|
+
chalk16__default.default.green("\n\u2705 **Template Code Saved**\n") + chalk16__default.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33346
|
+
`) + chalk16__default.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33347
|
+
`) + chalk16__default.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33348
|
+
`) + chalk16__default.default.dim(`
|
|
33610
33349
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33611
33350
|
);
|
|
33612
33351
|
} catch (saveError) {
|
|
33613
|
-
console.error(
|
|
33352
|
+
console.error(chalk16__default.default.red("Failed to save code:"), saveError);
|
|
33614
33353
|
}
|
|
33615
33354
|
}
|
|
33616
33355
|
}
|
|
@@ -33666,7 +33405,7 @@ ${userPrompt}`;
|
|
|
33666
33405
|
(seq) => response2.includes(seq)
|
|
33667
33406
|
);
|
|
33668
33407
|
if (guidedFlowDetected) {
|
|
33669
|
-
console.log(
|
|
33408
|
+
console.log(chalk16__default.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33670
33409
|
return null;
|
|
33671
33410
|
}
|
|
33672
33411
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33834,14 +33573,14 @@ async function streamAnswer(text) {
|
|
|
33834
33573
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33835
33574
|
} else {
|
|
33836
33575
|
animation.stop();
|
|
33837
|
-
console.log(
|
|
33576
|
+
console.log(chalk16__default.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33838
33577
|
}
|
|
33839
33578
|
} catch (e2) {
|
|
33840
33579
|
animation.stop();
|
|
33841
33580
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33842
|
-
console.log(
|
|
33581
|
+
console.log(chalk16__default.default.yellow(e2.message));
|
|
33843
33582
|
} else {
|
|
33844
|
-
console.log(
|
|
33583
|
+
console.log(chalk16__default.default.red("Error generating response:"), e2.message || e2);
|
|
33845
33584
|
}
|
|
33846
33585
|
}
|
|
33847
33586
|
}
|
|
@@ -33856,9 +33595,9 @@ async function handleLine(line) {
|
|
|
33856
33595
|
if (consumed) return;
|
|
33857
33596
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33858
33597
|
if (!isAuthenticated) {
|
|
33859
|
-
console.log(
|
|
33860
|
-
console.log(
|
|
33861
|
-
console.log(
|
|
33598
|
+
console.log(chalk16__default.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
33599
|
+
console.log(chalk16__default.default.cyan("Please run: /login"));
|
|
33600
|
+
console.log(chalk16__default.default.gray("Or use slash commands like /help, /version"));
|
|
33862
33601
|
return;
|
|
33863
33602
|
}
|
|
33864
33603
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -33880,7 +33619,7 @@ async function startInteractiveSession() {
|
|
|
33880
33619
|
}
|
|
33881
33620
|
}
|
|
33882
33621
|
const stop = async () => {
|
|
33883
|
-
console.log(
|
|
33622
|
+
console.log(chalk16__default.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33884
33623
|
if (store?.close) await store.close().catch(() => {
|
|
33885
33624
|
});
|
|
33886
33625
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -33890,7 +33629,7 @@ async function startInteractiveSession() {
|
|
|
33890
33629
|
process.once("SIGINT", stop);
|
|
33891
33630
|
process.once("SIGTERM", stop);
|
|
33892
33631
|
if (!isTTY) {
|
|
33893
|
-
console.log(
|
|
33632
|
+
console.log(chalk16__default.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
33894
33633
|
const rl = readline5__namespace.createInterface({
|
|
33895
33634
|
input: process$1.stdin,
|
|
33896
33635
|
output: process$1.stdout,
|
|
@@ -33905,7 +33644,7 @@ async function startInteractiveSession() {
|
|
|
33905
33644
|
if (interactiveCLI) {
|
|
33906
33645
|
while (true) {
|
|
33907
33646
|
try {
|
|
33908
|
-
const prompt =
|
|
33647
|
+
const prompt = chalk16__default.default.gray("> ");
|
|
33909
33648
|
process.stdout.write(prompt);
|
|
33910
33649
|
const line = await interactiveCLI.question("");
|
|
33911
33650
|
console.log();
|
|
@@ -33920,14 +33659,14 @@ async function startInteractiveSession() {
|
|
|
33920
33659
|
await stop();
|
|
33921
33660
|
return;
|
|
33922
33661
|
}
|
|
33923
|
-
console.error(
|
|
33662
|
+
console.error(chalk16__default.default.red("Error:"), error2?.message || error2);
|
|
33924
33663
|
}
|
|
33925
33664
|
}
|
|
33926
33665
|
} else {
|
|
33927
33666
|
const rl = readline5__namespace.createInterface({ input: process$1.stdin, output: process$1.stdout });
|
|
33928
33667
|
while (true) {
|
|
33929
33668
|
try {
|
|
33930
|
-
const prompt =
|
|
33669
|
+
const prompt = chalk16__default.default.gray("> ");
|
|
33931
33670
|
const line = await rl.question(prompt);
|
|
33932
33671
|
console.log();
|
|
33933
33672
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -33941,7 +33680,7 @@ async function startInteractiveSession() {
|
|
|
33941
33680
|
await stop();
|
|
33942
33681
|
return;
|
|
33943
33682
|
}
|
|
33944
|
-
console.error(
|
|
33683
|
+
console.error(chalk16__default.default.red("Error:"), error2?.message || error2);
|
|
33945
33684
|
}
|
|
33946
33685
|
}
|
|
33947
33686
|
}
|
|
@@ -33951,7 +33690,7 @@ function createCLI2() {
|
|
|
33951
33690
|
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) => {
|
|
33952
33691
|
loadEnvironmentVariables();
|
|
33953
33692
|
if (options.server) {
|
|
33954
|
-
console.log(
|
|
33693
|
+
console.log(chalk16__default.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
33955
33694
|
try {
|
|
33956
33695
|
const serverPath = path8__namespace.join(process.cwd(), "server.mjs");
|
|
33957
33696
|
const { spawn } = await import('child_process');
|
|
@@ -33960,44 +33699,32 @@ function createCLI2() {
|
|
|
33960
33699
|
env: process.env
|
|
33961
33700
|
});
|
|
33962
33701
|
serverProcess.on("error", (error2) => {
|
|
33963
|
-
console.error(
|
|
33702
|
+
console.error(chalk16__default.default.red("\u274C Server process error:"), error2);
|
|
33964
33703
|
process.exit(1);
|
|
33965
33704
|
});
|
|
33966
33705
|
return;
|
|
33967
33706
|
} catch (error2) {
|
|
33968
|
-
console.error(
|
|
33707
|
+
console.error(chalk16__default.default.red("\u274C Failed to start server mode:"), error2);
|
|
33969
33708
|
process.exit(1);
|
|
33970
33709
|
}
|
|
33971
33710
|
}
|
|
33972
|
-
if (!startupDisplayed) {
|
|
33973
|
-
try {
|
|
33974
|
-
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
33975
|
-
displayStartupLogo2();
|
|
33976
|
-
startupDisplayed = true;
|
|
33977
|
-
} catch {
|
|
33978
|
-
console.log(chalk17__default.default.cyan(`
|
|
33979
|
-
\u{1F680} MARIA v${getVersion()}
|
|
33980
|
-
`));
|
|
33981
|
-
startupDisplayed = true;
|
|
33982
|
-
}
|
|
33983
|
-
}
|
|
33984
33711
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
33985
33712
|
if (useV3) {
|
|
33986
33713
|
try {
|
|
33987
|
-
console.log(
|
|
33714
|
+
console.log(chalk16__default.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
33988
33715
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
33989
33716
|
const maria = new MariaAI2();
|
|
33990
33717
|
await maria.initialize();
|
|
33991
33718
|
return;
|
|
33992
33719
|
} catch (e2) {
|
|
33993
|
-
console.warn(
|
|
33720
|
+
console.warn(chalk16__default.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
33994
33721
|
}
|
|
33995
33722
|
}
|
|
33996
33723
|
await startInteractiveSession();
|
|
33997
33724
|
});
|
|
33998
33725
|
return program2;
|
|
33999
33726
|
}
|
|
34000
|
-
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager,
|
|
33727
|
+
var AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, program;
|
|
34001
33728
|
var init_cli = __esm({
|
|
34002
33729
|
"src/cli.ts"() {
|
|
34003
33730
|
init_env_loader();
|
|
@@ -34006,7 +33733,6 @@ var init_cli = __esm({
|
|
|
34006
33733
|
init_cli_auth();
|
|
34007
33734
|
session = [];
|
|
34008
33735
|
commandManager = null;
|
|
34009
|
-
startupDisplayed = false;
|
|
34010
33736
|
program = createCLI2();
|
|
34011
33737
|
program.parse(process.argv);
|
|
34012
33738
|
}
|