@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/bin/maria.cjs
CHANGED
|
@@ -32,424 +32,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
34
|
|
|
35
|
-
// src/ui/integrated-cli/responsive-width.ts
|
|
36
|
-
function getSafeTerminalWidth() {
|
|
37
|
-
if (process.env.MARIA_FIXED_WIDTH) {
|
|
38
|
-
const fixed = Number(process.env.MARIA_FIXED_WIDTH);
|
|
39
|
-
if (Number.isFinite(fixed) && fixed > 0) {
|
|
40
|
-
return fixed;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const isTTY = process.stdout && process.stdout.isTTY;
|
|
44
|
-
if (isTTY && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
|
|
45
|
-
return process.stdout.columns;
|
|
46
|
-
}
|
|
47
|
-
const envColumns = Number(process.env.COLUMNS);
|
|
48
|
-
if (Number.isFinite(envColumns) && envColumns > 0) {
|
|
49
|
-
return envColumns;
|
|
50
|
-
}
|
|
51
|
-
if (process.platform === "win32") {
|
|
52
|
-
try {
|
|
53
|
-
const { execSync } = require("child_process");
|
|
54
|
-
const result = execSync('powershell -command "$host.UI.RawUI.WindowSize.Width"', {
|
|
55
|
-
encoding: "utf8",
|
|
56
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
57
|
-
// Suppress stderr
|
|
58
|
-
});
|
|
59
|
-
const width = parseInt(result.trim());
|
|
60
|
-
if (Number.isFinite(width) && width > 0) {
|
|
61
|
-
return width;
|
|
62
|
-
}
|
|
63
|
-
} catch {
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return 80;
|
|
67
|
-
}
|
|
68
|
-
function getResponsiveWidth(config2) {
|
|
69
|
-
if (process.env.MARIA_DISABLE_RESPONSIVE === "1") {
|
|
70
|
-
return config2?.maxWidth || 120;
|
|
71
|
-
}
|
|
72
|
-
const terminalWidth = getSafeTerminalWidth();
|
|
73
|
-
const marginLeft = config2?.marginLeft ?? 5;
|
|
74
|
-
const marginRight = config2?.marginRight ?? 5;
|
|
75
|
-
const minWidth = config2?.minWidth ?? 40;
|
|
76
|
-
const maxWidth = config2?.maxWidth ?? 200;
|
|
77
|
-
const availableWidth = terminalWidth - marginLeft - marginRight;
|
|
78
|
-
return Math.max(minWidth, Math.min(availableWidth, maxWidth));
|
|
79
|
-
}
|
|
80
|
-
function disposeSharedLayoutManager() {
|
|
81
|
-
if (sharedManager) {
|
|
82
|
-
sharedManager.dispose();
|
|
83
|
-
sharedManager = null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function isCI() {
|
|
87
|
-
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);
|
|
88
|
-
}
|
|
89
|
-
function autoConfigureForEnvironment() {
|
|
90
|
-
if (isCI() || !process.stdout.isTTY) {
|
|
91
|
-
if (!process.env.MARIA_FIXED_WIDTH) {
|
|
92
|
-
process.env.MARIA_FIXED_WIDTH = "80";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
var stripAnsiModule, stringWidthModule, sharedManager;
|
|
97
|
-
var init_responsive_width = __esm({
|
|
98
|
-
"src/ui/integrated-cli/responsive-width.ts"() {
|
|
99
|
-
stripAnsiModule = __toESM(require("strip-ansi"), 1);
|
|
100
|
-
stringWidthModule = __toESM(require("string-width"), 1);
|
|
101
|
-
sharedManager = null;
|
|
102
|
-
autoConfigureForEnvironment();
|
|
103
|
-
if (process.env.NODE_ENV !== "production") {
|
|
104
|
-
process.on("exit", () => {
|
|
105
|
-
disposeSharedLayoutManager();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// src/utils/version.ts
|
|
112
|
-
function getVersion() {
|
|
113
|
-
if (_cachedVersion) {
|
|
114
|
-
return _cachedVersion;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
const packageJson = getPackageJson();
|
|
118
|
-
_cachedVersion = packageJson.version;
|
|
119
|
-
return _cachedVersion;
|
|
120
|
-
} catch (error2) {
|
|
121
|
-
_cachedVersion = "latest";
|
|
122
|
-
return _cachedVersion;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function getPackageJson() {
|
|
126
|
-
if (_cachedPackageJson) {
|
|
127
|
-
return _cachedPackageJson;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
const possiblePaths = [
|
|
131
|
-
// When running from built dist/
|
|
132
|
-
(0, import_path.join)(__dirname, "../../package.json"),
|
|
133
|
-
// When running from source
|
|
134
|
-
(0, import_path.join)(__dirname, "../../../package.json"),
|
|
135
|
-
// Current working directory
|
|
136
|
-
(0, import_path.join)(process.cwd(), "package.json"),
|
|
137
|
-
// One level up from current working directory
|
|
138
|
-
(0, import_path.join)(process.cwd(), "../package.json"),
|
|
139
|
-
// For globally installed packages
|
|
140
|
-
(0, import_path.join)(__dirname, "../../../../package.json"),
|
|
141
|
-
(0, import_path.join)(__dirname, "../../../../../package.json"),
|
|
142
|
-
// npm global install locations
|
|
143
|
-
"/usr/local/lib/node_modules/@bonginkan/maria/package.json",
|
|
144
|
-
"/usr/lib/node_modules/@bonginkan/maria/package.json",
|
|
145
|
-
// User home npm global
|
|
146
|
-
(0, import_path.join)(
|
|
147
|
-
process.env.HOME || "",
|
|
148
|
-
".npm-global/lib/node_modules/@bonginkan/maria/package.json"
|
|
149
|
-
),
|
|
150
|
-
(0, import_path.join)(
|
|
151
|
-
process.env.HOME || "",
|
|
152
|
-
".nvm/versions/node",
|
|
153
|
-
process.version,
|
|
154
|
-
"lib/node_modules/@bonginkan/maria/package.json"
|
|
155
|
-
)
|
|
156
|
-
];
|
|
157
|
-
let packageJsonPath = null;
|
|
158
|
-
for (const path12 of possiblePaths) {
|
|
159
|
-
if ((0, import_fs.existsSync)(path12)) {
|
|
160
|
-
try {
|
|
161
|
-
const content = (0, import_fs.readFileSync)(path12, "utf-8");
|
|
162
|
-
const parsed = JSON.parse(content);
|
|
163
|
-
if (parsed.name === "@bonginkan/maria") {
|
|
164
|
-
packageJsonPath = path12;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
} catch {
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (!packageJsonPath) {
|
|
173
|
-
throw new Error("package.json not found in any expected location");
|
|
174
|
-
}
|
|
175
|
-
const packageJsonContent = (0, import_fs.readFileSync)(packageJsonPath, "utf-8");
|
|
176
|
-
_cachedPackageJson = JSON.parse(packageJsonContent);
|
|
177
|
-
return _cachedPackageJson;
|
|
178
|
-
} catch (error2) {
|
|
179
|
-
throw new Error(`Failed to read package.json: ${error2}`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
var import_fs, import_path, _cachedVersion, _cachedPackageJson, VERSION;
|
|
183
|
-
var init_version = __esm({
|
|
184
|
-
"src/utils/version.ts"() {
|
|
185
|
-
import_fs = require("fs");
|
|
186
|
-
import_path = require("path");
|
|
187
|
-
_cachedVersion = null;
|
|
188
|
-
_cachedPackageJson = null;
|
|
189
|
-
VERSION = getVersion();
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
// src/services/startup-display.ts
|
|
194
|
-
var startup_display_exports = {};
|
|
195
|
-
__export(startup_display_exports, {
|
|
196
|
-
displayCompactLogo: () => displayCompactLogo,
|
|
197
|
-
displayDashboardHeader: () => displayDashboardHeader,
|
|
198
|
-
displayFinalStartupScreen: () => displayFinalStartupScreen,
|
|
199
|
-
displayLogsBox: () => displayLogsBox,
|
|
200
|
-
displayRoundedInputBox: () => displayRoundedInputBox,
|
|
201
|
-
displaySpinner: () => displaySpinner,
|
|
202
|
-
displayStartupLogo: () => displayStartupLogo
|
|
203
|
-
});
|
|
204
|
-
function displayStartupLogo() {
|
|
205
|
-
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
206
|
-
console.log("");
|
|
207
|
-
console.log(
|
|
208
|
-
import_chalk.default.magentaBright(
|
|
209
|
-
"\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"
|
|
210
|
-
)
|
|
211
|
-
);
|
|
212
|
-
console.log(
|
|
213
|
-
import_chalk.default.magentaBright(
|
|
214
|
-
"\u2551 \u2551"
|
|
215
|
-
)
|
|
216
|
-
);
|
|
217
|
-
console.log(
|
|
218
|
-
import_chalk.default.magentaBright(
|
|
219
|
-
"\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"
|
|
220
|
-
)
|
|
221
|
-
);
|
|
222
|
-
console.log(
|
|
223
|
-
import_chalk.default.magentaBright(
|
|
224
|
-
"\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"
|
|
225
|
-
)
|
|
226
|
-
);
|
|
227
|
-
console.log(
|
|
228
|
-
import_chalk.default.magentaBright(
|
|
229
|
-
"\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"
|
|
230
|
-
)
|
|
231
|
-
);
|
|
232
|
-
console.log(
|
|
233
|
-
import_chalk.default.magentaBright(
|
|
234
|
-
"\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"
|
|
235
|
-
)
|
|
236
|
-
);
|
|
237
|
-
console.log(
|
|
238
|
-
import_chalk.default.magentaBright(
|
|
239
|
-
"\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"
|
|
240
|
-
)
|
|
241
|
-
);
|
|
242
|
-
console.log(
|
|
243
|
-
import_chalk.default.magentaBright(
|
|
244
|
-
"\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"
|
|
245
|
-
)
|
|
246
|
-
);
|
|
247
|
-
console.log(
|
|
248
|
-
import_chalk.default.magentaBright(
|
|
249
|
-
"\u2551 \u2551"
|
|
250
|
-
)
|
|
251
|
-
);
|
|
252
|
-
console.log(
|
|
253
|
-
import_chalk.default.magentaBright(
|
|
254
|
-
"\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"
|
|
255
|
-
)
|
|
256
|
-
);
|
|
257
|
-
console.log(
|
|
258
|
-
import_chalk.default.magentaBright(
|
|
259
|
-
"\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"
|
|
260
|
-
)
|
|
261
|
-
);
|
|
262
|
-
console.log(
|
|
263
|
-
import_chalk.default.magentaBright(
|
|
264
|
-
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551"
|
|
265
|
-
)
|
|
266
|
-
);
|
|
267
|
-
console.log(
|
|
268
|
-
import_chalk.default.magentaBright(
|
|
269
|
-
"\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551"
|
|
270
|
-
)
|
|
271
|
-
);
|
|
272
|
-
console.log(
|
|
273
|
-
import_chalk.default.magentaBright(
|
|
274
|
-
"\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"
|
|
275
|
-
)
|
|
276
|
-
);
|
|
277
|
-
console.log(
|
|
278
|
-
import_chalk.default.magentaBright(
|
|
279
|
-
"\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"
|
|
280
|
-
)
|
|
281
|
-
);
|
|
282
|
-
console.log(
|
|
283
|
-
import_chalk.default.magentaBright(
|
|
284
|
-
"\u2551 \u2551"
|
|
285
|
-
)
|
|
286
|
-
);
|
|
287
|
-
console.log(
|
|
288
|
-
import_chalk.default.magentaBright(
|
|
289
|
-
"\u2551 AI-Powered Development Platform \u2551"
|
|
290
|
-
)
|
|
291
|
-
);
|
|
292
|
-
console.log(
|
|
293
|
-
import_chalk.default.magentaBright(
|
|
294
|
-
"\u2551 (c) 2025 Bonginkan Inc. \u2551"
|
|
295
|
-
)
|
|
296
|
-
);
|
|
297
|
-
console.log(
|
|
298
|
-
import_chalk.default.magentaBright(
|
|
299
|
-
"\u2551 \u2551"
|
|
300
|
-
)
|
|
301
|
-
);
|
|
302
|
-
console.log(
|
|
303
|
-
import_chalk.default.magentaBright(
|
|
304
|
-
"\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"
|
|
305
|
-
)
|
|
306
|
-
);
|
|
307
|
-
console.log("");
|
|
308
|
-
console.log(
|
|
309
|
-
import_chalk.default.cyan.bold(`MARIA CODE v${getVersion()}`) + import_chalk.default.gray(" \u2014 Ready")
|
|
310
|
-
);
|
|
311
|
-
console.log(
|
|
312
|
-
import_chalk.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
313
|
-
);
|
|
314
|
-
console.log("");
|
|
315
|
-
}
|
|
316
|
-
function displayCompactLogo() {
|
|
317
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
318
|
-
console.log(
|
|
319
|
-
import_chalk.default.cyan.bold(`MARIA CODE v${getVersion()}`) + import_chalk.default.gray(" \u2014 Ready")
|
|
320
|
-
);
|
|
321
|
-
console.log(
|
|
322
|
-
import_chalk.default.yellow("Type /login to get started \xB7 /help for commands")
|
|
323
|
-
);
|
|
324
|
-
console.log("");
|
|
325
|
-
}
|
|
326
|
-
function displayDashboardHeader() {
|
|
327
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
328
|
-
const version = import_chalk.default.cyan.bold(`MARIA CODE v${getVersion()}`);
|
|
329
|
-
const commands = import_chalk.default.gray(" | /help /status /model");
|
|
330
|
-
const providers = import_chalk.default.gray(
|
|
331
|
-
"Providers: 8/8 OK (openai, anthropic, google, groq, lmstudio, ollama, vllm)"
|
|
332
|
-
);
|
|
333
|
-
console.log(version + commands);
|
|
334
|
-
console.log(providers);
|
|
335
|
-
console.log("");
|
|
336
|
-
}
|
|
337
|
-
function displayLogsBox(logs) {
|
|
338
|
-
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 120 });
|
|
339
|
-
const borderColor = import_chalk.default.white;
|
|
340
|
-
const titleColor = import_chalk.default.cyan;
|
|
341
|
-
const topLeft = "\u250C";
|
|
342
|
-
const topRight = "\u2510";
|
|
343
|
-
const bottomLeft = "\u2514";
|
|
344
|
-
const bottomRight = "\u2518";
|
|
345
|
-
const horizontal = "\u2500";
|
|
346
|
-
const vertical = "\u2502";
|
|
347
|
-
const lines = [];
|
|
348
|
-
const title = " Logs ";
|
|
349
|
-
const titlePadding = width - title.length - 2;
|
|
350
|
-
const leftPadding = Math.floor(titlePadding / 2);
|
|
351
|
-
const _rightPadding = titlePadding - leftPadding;
|
|
352
|
-
lines.push(
|
|
353
|
-
borderColor(topLeft) + titleColor(title) + borderColor(horizontal.repeat(width - title.length - 2)) + borderColor(topRight)
|
|
354
|
-
);
|
|
355
|
-
logs.forEach((log) => {
|
|
356
|
-
const contentWidth = width - 4;
|
|
357
|
-
const truncatedLog = log.length > contentWidth ? log.substring(0, contentWidth - 3) + "..." : log;
|
|
358
|
-
const padding = width - truncatedLog.length - 4;
|
|
359
|
-
lines.push(
|
|
360
|
-
borderColor(vertical) + " " + truncatedLog + " ".repeat(Math.max(0, padding)) + " " + borderColor(vertical)
|
|
361
|
-
);
|
|
362
|
-
});
|
|
363
|
-
if (logs.length === 0) {
|
|
364
|
-
lines.push(
|
|
365
|
-
borderColor(vertical) + " ".repeat(width - 2) + borderColor(vertical)
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
lines.push(
|
|
369
|
-
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
370
|
-
);
|
|
371
|
-
console.log(lines.join("\n"));
|
|
372
|
-
}
|
|
373
|
-
function displaySpinner(text = "Processing") {
|
|
374
|
-
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
375
|
-
const frame = spinnerFrames[Math.floor(Date.now() / 80) % spinnerFrames.length];
|
|
376
|
-
process.stdout.write(`\r[${import_chalk.default.cyan(frame)}] ${text}...`);
|
|
377
|
-
}
|
|
378
|
-
function getCurrentPath() {
|
|
379
|
-
return process.cwd();
|
|
380
|
-
}
|
|
381
|
-
function getSystemInfo() {
|
|
382
|
-
return {
|
|
383
|
-
platform: os.platform(),
|
|
384
|
-
hostname: os.hostname(),
|
|
385
|
-
user: os.userInfo().username,
|
|
386
|
-
cwd: getCurrentPath()
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
async function displayFinalStartupScreen(_selectedProvider, _selectedModel) {
|
|
390
|
-
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
391
|
-
const version = getVersion();
|
|
392
|
-
const systemInfo = getSystemInfo();
|
|
393
|
-
console.log(
|
|
394
|
-
import_chalk.default.cyan.bold(`MARIA CODE v${version}`) + import_chalk.default.gray(" \u2014 Ready")
|
|
395
|
-
);
|
|
396
|
-
const cwd = systemInfo.cwd.replace(os.homedir(), "~");
|
|
397
|
-
console.log(import_chalk.default.gray("cwd: ") + import_chalk.default.white(cwd));
|
|
398
|
-
try {
|
|
399
|
-
const { authManager: authManager2 } = await import("../cli-auth/index.js").catch(() => ({ authManager: null }));
|
|
400
|
-
if (authManager2 && await authManager2.isAuthenticated()) {
|
|
401
|
-
try {
|
|
402
|
-
const user = await authManager2.getCurrentUser();
|
|
403
|
-
console.log(import_chalk.default.green(`Signed in: ${user.email}`));
|
|
404
|
-
console.log(import_chalk.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
405
|
-
} catch {
|
|
406
|
-
console.log(import_chalk.default.green("Signed in"));
|
|
407
|
-
console.log(import_chalk.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
|
|
408
|
-
}
|
|
409
|
-
} else {
|
|
410
|
-
console.log(import_chalk.default.gray("Not signed in"));
|
|
411
|
-
console.log(import_chalk.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
412
|
-
}
|
|
413
|
-
} catch {
|
|
414
|
-
console.log(import_chalk.default.gray("Not signed in"));
|
|
415
|
-
console.log(import_chalk.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
|
|
416
|
-
}
|
|
417
|
-
console.log("");
|
|
418
|
-
}
|
|
419
|
-
function displayRoundedInputBox() {
|
|
420
|
-
const width = getResponsiveWidth({ marginLeft: 5, marginRight: 5, maxWidth: 90 });
|
|
421
|
-
const borderColor = import_chalk.default.white;
|
|
422
|
-
const promptColor = import_chalk.default.cyan;
|
|
423
|
-
const topLeft = "\u256D";
|
|
424
|
-
const topRight = "\u256E";
|
|
425
|
-
const bottomLeft = "\u2570";
|
|
426
|
-
const bottomRight = "\u256F";
|
|
427
|
-
const horizontal = "\u2500";
|
|
428
|
-
const vertical = "\u2502";
|
|
429
|
-
const lines = [];
|
|
430
|
-
lines.push(borderColor(topLeft + horizontal.repeat(width - 2) + topRight));
|
|
431
|
-
const promptStr = promptColor("> ");
|
|
432
|
-
const placeholder = import_chalk.default.gray("");
|
|
433
|
-
const inputLine = promptStr + placeholder;
|
|
434
|
-
const padding = width - 4;
|
|
435
|
-
lines.push(
|
|
436
|
-
borderColor(vertical) + inputLine + " ".repeat(Math.max(0, padding)) + borderColor(vertical)
|
|
437
|
-
);
|
|
438
|
-
lines.push(
|
|
439
|
-
borderColor(bottomLeft + horizontal.repeat(width - 2) + bottomRight)
|
|
440
|
-
);
|
|
441
|
-
console.log(lines.join("\n"));
|
|
442
|
-
}
|
|
443
|
-
var import_chalk, os;
|
|
444
|
-
var init_startup_display = __esm({
|
|
445
|
-
"src/services/startup-display.ts"() {
|
|
446
|
-
import_chalk = __toESM(require("chalk"), 1);
|
|
447
|
-
init_responsive_width();
|
|
448
|
-
os = __toESM(require("os"), 1);
|
|
449
|
-
init_version();
|
|
450
|
-
}
|
|
451
|
-
});
|
|
452
|
-
|
|
453
35
|
// src/providers/config.ts
|
|
454
36
|
var DEFAULT_PROVIDER2, DEFAULT_MODEL2;
|
|
455
37
|
var init_config = __esm({
|
|
@@ -7305,6 +6887,7 @@ var init_groq_provider = __esm({
|
|
|
7305
6887
|
"src/providers/groq-provider.ts"() {
|
|
7306
6888
|
init_base_provider();
|
|
7307
6889
|
GroqProvider = class extends UnifiedBaseProvider {
|
|
6890
|
+
id = "groq";
|
|
7308
6891
|
name = "groq";
|
|
7309
6892
|
modelsCache;
|
|
7310
6893
|
constructor(apiKey) {
|
|
@@ -7330,6 +6913,15 @@ var init_groq_provider = __esm({
|
|
|
7330
6913
|
}
|
|
7331
6914
|
}
|
|
7332
6915
|
async getModels() {
|
|
6916
|
+
const models = [
|
|
6917
|
+
"llama-3.3-70b-versatile",
|
|
6918
|
+
"llama-3.2-90b-vision-preview",
|
|
6919
|
+
"mixtral-8x7b-32768",
|
|
6920
|
+
"gemma2-9b-it"
|
|
6921
|
+
];
|
|
6922
|
+
return models;
|
|
6923
|
+
}
|
|
6924
|
+
async getModelInfo() {
|
|
7333
6925
|
if (this.modelsCache) {
|
|
7334
6926
|
return this.modelsCache;
|
|
7335
6927
|
}
|
|
@@ -7382,33 +6974,102 @@ var init_groq_provider = __esm({
|
|
|
7382
6974
|
this.modelsCache = models;
|
|
7383
6975
|
return models;
|
|
7384
6976
|
}
|
|
6977
|
+
async complete(prompt, req) {
|
|
6978
|
+
if (!await this.isAvailable()) {
|
|
6979
|
+
throw new Error("Groq API not available");
|
|
6980
|
+
}
|
|
6981
|
+
const model = req.model || "mixtral-8x7b-32768";
|
|
6982
|
+
const payload = {
|
|
6983
|
+
model,
|
|
6984
|
+
messages: [{ role: "user", content: prompt }],
|
|
6985
|
+
temperature: req.temperature || 0.7,
|
|
6986
|
+
max_tokens: req.maxTokens || 4e3,
|
|
6987
|
+
stream: false
|
|
6988
|
+
};
|
|
6989
|
+
const response2 = await this.makeRequest(
|
|
6990
|
+
`${this.apiBase}/chat/completions`,
|
|
6991
|
+
{
|
|
6992
|
+
method: "POST",
|
|
6993
|
+
headers: {
|
|
6994
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
6995
|
+
...req.headers
|
|
6996
|
+
},
|
|
6997
|
+
body: payload,
|
|
6998
|
+
timeout: req.timeoutMs
|
|
6999
|
+
}
|
|
7000
|
+
);
|
|
7001
|
+
return {
|
|
7002
|
+
content: response2.choices[0]?.message?.content || "",
|
|
7003
|
+
model,
|
|
7004
|
+
usage: {
|
|
7005
|
+
promptTokens: response2.usage?.prompt_tokens || 0,
|
|
7006
|
+
completionTokens: response2.usage?.completion_tokens || 0,
|
|
7007
|
+
totalTokens: response2.usage?.total_tokens || 0
|
|
7008
|
+
},
|
|
7009
|
+
finishReason: response2.choices[0]?.finish_reason || "stop"
|
|
7010
|
+
};
|
|
7011
|
+
}
|
|
7012
|
+
async stream(prompt, req) {
|
|
7013
|
+
if (!await this.isAvailable()) {
|
|
7014
|
+
throw new Error("Groq API not available");
|
|
7015
|
+
}
|
|
7016
|
+
const model = req.model || "mixtral-8x7b-32768";
|
|
7017
|
+
const payload = {
|
|
7018
|
+
model,
|
|
7019
|
+
messages: [{ role: "user", content: prompt }],
|
|
7020
|
+
temperature: req.temperature || 0.7,
|
|
7021
|
+
max_tokens: req.maxTokens || 4e3,
|
|
7022
|
+
stream: true
|
|
7023
|
+
};
|
|
7024
|
+
const stream = await this.makeStreamRequest(
|
|
7025
|
+
`${this.apiBase}/chat/completions`,
|
|
7026
|
+
{
|
|
7027
|
+
method: "POST",
|
|
7028
|
+
headers: {
|
|
7029
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
7030
|
+
...req.headers
|
|
7031
|
+
},
|
|
7032
|
+
body: payload,
|
|
7033
|
+
timeout: req.timeoutMs
|
|
7034
|
+
}
|
|
7035
|
+
);
|
|
7036
|
+
async function* chunkGenerator() {
|
|
7037
|
+
for await (const chunk of stream) {
|
|
7038
|
+
yield {
|
|
7039
|
+
content: chunk,
|
|
7040
|
+
delta: chunk
|
|
7041
|
+
};
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
7044
|
+
return chunkGenerator();
|
|
7045
|
+
}
|
|
7385
7046
|
async chat(request) {
|
|
7386
7047
|
if (!await this.isAvailable()) {
|
|
7387
7048
|
throw new Error("Groq API not available");
|
|
7388
7049
|
}
|
|
7389
|
-
const
|
|
7050
|
+
const model = request.model || "mixtral-8x7b-32768";
|
|
7390
7051
|
const _startTime = Date.now();
|
|
7391
7052
|
const _payload = {
|
|
7392
|
-
|
|
7053
|
+
model,
|
|
7393
7054
|
messages: request.messages,
|
|
7394
7055
|
temperature: request.temperature || 0.7,
|
|
7395
|
-
|
|
7396
|
-
|
|
7056
|
+
max_tokens: request.maxTokens || 4e3,
|
|
7057
|
+
stream: request.stream || false
|
|
7397
7058
|
};
|
|
7398
|
-
if (request.
|
|
7399
|
-
const
|
|
7059
|
+
if (request.stream) {
|
|
7060
|
+
const stream = await this.makeStreamRequest(
|
|
7400
7061
|
`${this.apiBase}/chat/completions`,
|
|
7401
7062
|
{
|
|
7402
7063
|
method: "POST",
|
|
7403
7064
|
headers: {
|
|
7404
7065
|
Authorization: `Bearer ${this.apiKey}`
|
|
7405
7066
|
},
|
|
7406
|
-
body:
|
|
7067
|
+
body: _payload
|
|
7407
7068
|
}
|
|
7408
7069
|
);
|
|
7409
7070
|
return {
|
|
7410
|
-
|
|
7411
|
-
|
|
7071
|
+
stream,
|
|
7072
|
+
model,
|
|
7412
7073
|
provider: this.name,
|
|
7413
7074
|
responseTime: Date.now() - _startTime
|
|
7414
7075
|
};
|
|
@@ -7420,12 +7081,12 @@ var init_groq_provider = __esm({
|
|
|
7420
7081
|
headers: {
|
|
7421
7082
|
Authorization: `Bearer ${this.apiKey}`
|
|
7422
7083
|
},
|
|
7423
|
-
body:
|
|
7084
|
+
body: _payload
|
|
7424
7085
|
}
|
|
7425
7086
|
);
|
|
7426
7087
|
return {
|
|
7427
7088
|
content: _response.choices[0]?.message?.content || "",
|
|
7428
|
-
|
|
7089
|
+
model,
|
|
7429
7090
|
provider: this.name,
|
|
7430
7091
|
usage: {
|
|
7431
7092
|
promptTokens: _response.usage?.prompt_tokens || 0,
|
|
@@ -7442,7 +7103,7 @@ var init_groq_provider = __esm({
|
|
|
7442
7103
|
const _base64Image = _image.toString("base64");
|
|
7443
7104
|
const _startTime = Date.now();
|
|
7444
7105
|
const _payload = {
|
|
7445
|
-
|
|
7106
|
+
model: "llama-3.2-90b-vision-preview",
|
|
7446
7107
|
messages: [
|
|
7447
7108
|
{
|
|
7448
7109
|
role: "user",
|
|
@@ -7457,7 +7118,7 @@ var init_groq_provider = __esm({
|
|
|
7457
7118
|
]
|
|
7458
7119
|
}
|
|
7459
7120
|
],
|
|
7460
|
-
|
|
7121
|
+
max_tokens: 4e3
|
|
7461
7122
|
};
|
|
7462
7123
|
const _response = await this.makeRequest(
|
|
7463
7124
|
`${this.apiBase}/chat/completions`,
|
|
@@ -7466,12 +7127,12 @@ var init_groq_provider = __esm({
|
|
|
7466
7127
|
headers: {
|
|
7467
7128
|
Authorization: `Bearer ${this.apiKey}`
|
|
7468
7129
|
},
|
|
7469
|
-
body:
|
|
7130
|
+
body: _payload
|
|
7470
7131
|
}
|
|
7471
7132
|
);
|
|
7472
7133
|
return {
|
|
7473
7134
|
content: _response.choices[0]?.message?.content || "",
|
|
7474
|
-
|
|
7135
|
+
model: "llama-3.2-90b-vision-preview",
|
|
7475
7136
|
provider: this.name,
|
|
7476
7137
|
usage: {
|
|
7477
7138
|
promptTokens: _response.usage?.prompt_tokens || 0,
|
|
@@ -8252,10 +7913,10 @@ var init_llm_health_checker = __esm({
|
|
|
8252
7913
|
});
|
|
8253
7914
|
|
|
8254
7915
|
// src/services/provider-selector.ts
|
|
8255
|
-
var
|
|
7916
|
+
var import_chalk, ProviderSelector;
|
|
8256
7917
|
var init_provider_selector = __esm({
|
|
8257
7918
|
"src/services/provider-selector.ts"() {
|
|
8258
|
-
|
|
7919
|
+
import_chalk = __toESM(require("chalk"), 1);
|
|
8259
7920
|
init_providers();
|
|
8260
7921
|
ProviderSelector = class {
|
|
8261
7922
|
config;
|
|
@@ -8271,29 +7932,29 @@ var init_provider_selector = __esm({
|
|
|
8271
7932
|
const inquirer = await import("inquirer");
|
|
8272
7933
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
8273
7934
|
const providers = await this.getAvailableProviders();
|
|
8274
|
-
console.log(
|
|
8275
|
-
console.log(
|
|
7935
|
+
console.log(import_chalk.default.cyan("\nAvailable AI Providers:"));
|
|
7936
|
+
console.log(import_chalk.default.gray("\u2500".repeat(50)));
|
|
8276
7937
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
8277
7938
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
8278
7939
|
if (_cloudProviders.length > 0) {
|
|
8279
|
-
console.log(
|
|
7940
|
+
console.log(import_chalk.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
8280
7941
|
_cloudProviders.forEach((p) => {
|
|
8281
7942
|
if (p.available) {
|
|
8282
7943
|
console.log(
|
|
8283
|
-
` ${
|
|
7944
|
+
` ${import_chalk.default.green("*")} ${import_chalk.default.white(p.name.split(" ")[0])}`
|
|
8284
7945
|
);
|
|
8285
7946
|
} else {
|
|
8286
|
-
console.log(` ${
|
|
7947
|
+
console.log(` ${import_chalk.default.gray(p.name.split(" ")[0])}`);
|
|
8287
7948
|
}
|
|
8288
7949
|
});
|
|
8289
7950
|
}
|
|
8290
7951
|
if (_localProviders.length > 0) {
|
|
8291
|
-
console.log(
|
|
7952
|
+
console.log(import_chalk.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
8292
7953
|
_localProviders.forEach((p) => {
|
|
8293
7954
|
if (p.available) {
|
|
8294
|
-
console.log(` ${
|
|
7955
|
+
console.log(` ${import_chalk.default.green("*")} ${import_chalk.default.white(p.name)}`);
|
|
8295
7956
|
} else {
|
|
8296
|
-
console.log(` ${
|
|
7957
|
+
console.log(` ${import_chalk.default.green("*")} ${import_chalk.default.gray(p.name)}`);
|
|
8297
7958
|
}
|
|
8298
7959
|
});
|
|
8299
7960
|
}
|
|
@@ -8308,20 +7969,20 @@ var init_provider_selector = __esm({
|
|
|
8308
7969
|
});
|
|
8309
7970
|
if (selectableProviders.length === 0) {
|
|
8310
7971
|
console.log(
|
|
8311
|
-
|
|
7972
|
+
import_chalk.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
8312
7973
|
);
|
|
8313
|
-
console.log(
|
|
7974
|
+
console.log(import_chalk.default.gray("\nTo use MARIA, you need to:"));
|
|
8314
7975
|
console.log(
|
|
8315
|
-
|
|
7976
|
+
import_chalk.default.gray(
|
|
8316
7977
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
8317
7978
|
)
|
|
8318
7979
|
);
|
|
8319
|
-
console.log(
|
|
7980
|
+
console.log(import_chalk.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
8320
7981
|
console.log(
|
|
8321
|
-
|
|
7982
|
+
import_chalk.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
8322
7983
|
);
|
|
8323
|
-
console.log(
|
|
8324
|
-
console.log(
|
|
7984
|
+
console.log(import_chalk.default.gray(" Example: maria setup-ollama"));
|
|
7985
|
+
console.log(import_chalk.default.gray("\nFor more information, run: maria --help"));
|
|
8325
7986
|
process.exit(1);
|
|
8326
7987
|
}
|
|
8327
7988
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -8342,29 +8003,29 @@ var init_provider_selector = __esm({
|
|
|
8342
8003
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
8343
8004
|
if (provider && provider.type === "local" && !provider.available) {
|
|
8344
8005
|
console.log(
|
|
8345
|
-
|
|
8006
|
+
import_chalk.default.yellow(`
|
|
8346
8007
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
8347
8008
|
);
|
|
8348
|
-
console.log(
|
|
8009
|
+
console.log(import_chalk.default.gray(`
|
|
8349
8010
|
To use ${provider.name}, you need to:`));
|
|
8350
8011
|
if (selectedProvider === "ollama") {
|
|
8351
|
-
console.log(
|
|
8352
|
-
console.log(
|
|
8353
|
-
console.log(
|
|
8012
|
+
console.log(import_chalk.default.gray("1. Install Ollama: brew install ollama"));
|
|
8013
|
+
console.log(import_chalk.default.gray("2. Start Ollama: ollama serve"));
|
|
8014
|
+
console.log(import_chalk.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
8354
8015
|
console.log(
|
|
8355
|
-
|
|
8016
|
+
import_chalk.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
8356
8017
|
);
|
|
8357
8018
|
} else if (selectedProvider === "lmstudio") {
|
|
8358
8019
|
console.log(
|
|
8359
|
-
|
|
8020
|
+
import_chalk.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
8360
8021
|
);
|
|
8361
|
-
console.log(
|
|
8362
|
-
console.log(
|
|
8363
|
-
console.log(
|
|
8022
|
+
console.log(import_chalk.default.gray("2. Start LM Studio application"));
|
|
8023
|
+
console.log(import_chalk.default.gray("3. Load a model in LM Studio"));
|
|
8024
|
+
console.log(import_chalk.default.gray("4. Start the local server in LM Studio"));
|
|
8364
8025
|
} else if (selectedProvider === "vllm") {
|
|
8365
|
-
console.log(
|
|
8366
|
-
console.log(
|
|
8367
|
-
console.log(
|
|
8026
|
+
console.log(import_chalk.default.gray("1. Install vLLM: pip install vllm"));
|
|
8027
|
+
console.log(import_chalk.default.gray("2. Start vLLM server with a model"));
|
|
8028
|
+
console.log(import_chalk.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
8368
8029
|
}
|
|
8369
8030
|
process.exit(1);
|
|
8370
8031
|
}
|
|
@@ -9007,8 +8668,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
9007
8668
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
9008
8669
|
const fs12 = await importNodeBuiltin2("fs");
|
|
9009
8670
|
const _path = await importNodeBuiltin2("path");
|
|
9010
|
-
const
|
|
9011
|
-
const targetPath = configPath || _path.join(
|
|
8671
|
+
const os8 = await importNodeBuiltin2("os");
|
|
8672
|
+
const targetPath = configPath || _path.join(os8.homedir(), ".maria", "config.json");
|
|
9012
8673
|
try {
|
|
9013
8674
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
9014
8675
|
return JSON.parse(data2);
|
|
@@ -9026,8 +8687,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
9026
8687
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
9027
8688
|
const fs12 = await importNodeBuiltin2("fs");
|
|
9028
8689
|
const _path = await importNodeBuiltin2("path");
|
|
9029
|
-
const
|
|
9030
|
-
const targetPath = configPath || _path.join(
|
|
8690
|
+
const os8 = await importNodeBuiltin2("os");
|
|
8691
|
+
const targetPath = configPath || _path.join(os8.homedir(), ".maria", "config.json");
|
|
9031
8692
|
try {
|
|
9032
8693
|
if (options?.backup) {
|
|
9033
8694
|
try {
|
|
@@ -9175,6 +8836,88 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
9175
8836
|
}
|
|
9176
8837
|
});
|
|
9177
8838
|
|
|
8839
|
+
// src/utils/version.ts
|
|
8840
|
+
function getVersion() {
|
|
8841
|
+
if (_cachedVersion) {
|
|
8842
|
+
return _cachedVersion;
|
|
8843
|
+
}
|
|
8844
|
+
try {
|
|
8845
|
+
const packageJson = getPackageJson();
|
|
8846
|
+
_cachedVersion = packageJson.version;
|
|
8847
|
+
return _cachedVersion;
|
|
8848
|
+
} catch (error2) {
|
|
8849
|
+
_cachedVersion = "latest";
|
|
8850
|
+
return _cachedVersion;
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
function getPackageJson() {
|
|
8854
|
+
if (_cachedPackageJson) {
|
|
8855
|
+
return _cachedPackageJson;
|
|
8856
|
+
}
|
|
8857
|
+
try {
|
|
8858
|
+
const possiblePaths = [
|
|
8859
|
+
// When running from built dist/
|
|
8860
|
+
(0, import_path.join)(__dirname, "../../package.json"),
|
|
8861
|
+
// When running from source
|
|
8862
|
+
(0, import_path.join)(__dirname, "../../../package.json"),
|
|
8863
|
+
// Current working directory
|
|
8864
|
+
(0, import_path.join)(process.cwd(), "package.json"),
|
|
8865
|
+
// One level up from current working directory
|
|
8866
|
+
(0, import_path.join)(process.cwd(), "../package.json"),
|
|
8867
|
+
// For globally installed packages
|
|
8868
|
+
(0, import_path.join)(__dirname, "../../../../package.json"),
|
|
8869
|
+
(0, import_path.join)(__dirname, "../../../../../package.json"),
|
|
8870
|
+
// npm global install locations
|
|
8871
|
+
"/usr/local/lib/node_modules/@bonginkan/maria/package.json",
|
|
8872
|
+
"/usr/lib/node_modules/@bonginkan/maria/package.json",
|
|
8873
|
+
// User home npm global
|
|
8874
|
+
(0, import_path.join)(
|
|
8875
|
+
process.env.HOME || "",
|
|
8876
|
+
".npm-global/lib/node_modules/@bonginkan/maria/package.json"
|
|
8877
|
+
),
|
|
8878
|
+
(0, import_path.join)(
|
|
8879
|
+
process.env.HOME || "",
|
|
8880
|
+
".nvm/versions/node",
|
|
8881
|
+
process.version,
|
|
8882
|
+
"lib/node_modules/@bonginkan/maria/package.json"
|
|
8883
|
+
)
|
|
8884
|
+
];
|
|
8885
|
+
let packageJsonPath = null;
|
|
8886
|
+
for (const path12 of possiblePaths) {
|
|
8887
|
+
if ((0, import_fs.existsSync)(path12)) {
|
|
8888
|
+
try {
|
|
8889
|
+
const content = (0, import_fs.readFileSync)(path12, "utf-8");
|
|
8890
|
+
const parsed = JSON.parse(content);
|
|
8891
|
+
if (parsed.name === "@bonginkan/maria") {
|
|
8892
|
+
packageJsonPath = path12;
|
|
8893
|
+
break;
|
|
8894
|
+
}
|
|
8895
|
+
} catch {
|
|
8896
|
+
continue;
|
|
8897
|
+
}
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
8900
|
+
if (!packageJsonPath) {
|
|
8901
|
+
throw new Error("package.json not found in any expected location");
|
|
8902
|
+
}
|
|
8903
|
+
const packageJsonContent = (0, import_fs.readFileSync)(packageJsonPath, "utf-8");
|
|
8904
|
+
_cachedPackageJson = JSON.parse(packageJsonContent);
|
|
8905
|
+
return _cachedPackageJson;
|
|
8906
|
+
} catch (error2) {
|
|
8907
|
+
throw new Error(`Failed to read package.json: ${error2}`);
|
|
8908
|
+
}
|
|
8909
|
+
}
|
|
8910
|
+
var import_fs, import_path, _cachedVersion, _cachedPackageJson, VERSION;
|
|
8911
|
+
var init_version = __esm({
|
|
8912
|
+
"src/utils/version.ts"() {
|
|
8913
|
+
import_fs = require("fs");
|
|
8914
|
+
import_path = require("path");
|
|
8915
|
+
_cachedVersion = null;
|
|
8916
|
+
_cachedPackageJson = null;
|
|
8917
|
+
VERSION = getVersion();
|
|
8918
|
+
}
|
|
8919
|
+
});
|
|
8920
|
+
|
|
9178
8921
|
// src/config/defaults.ts
|
|
9179
8922
|
var parseList, DEFAULT_UI_CONFIG, DEFAULT_PROVIDER_PREFS, AI_PROVIDERS_CONFIG, APP_VERSION;
|
|
9180
8923
|
var init_defaults = __esm({
|
|
@@ -12398,7 +12141,7 @@ var init_UserPatternAnalyzer = __esm({
|
|
|
12398
12141
|
});
|
|
12399
12142
|
|
|
12400
12143
|
// src/services/intelligent-router/app/IntelligentRouterService.ts
|
|
12401
|
-
var import_node_events,
|
|
12144
|
+
var import_node_events, import_chalk2, IntelligentRouterService;
|
|
12402
12145
|
var init_IntelligentRouterService = __esm({
|
|
12403
12146
|
"src/services/intelligent-router/app/IntelligentRouterService.ts"() {
|
|
12404
12147
|
import_node_events = require("events");
|
|
@@ -12409,7 +12152,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12409
12152
|
init_LanguageDetector();
|
|
12410
12153
|
init_CommandMappings();
|
|
12411
12154
|
init_UserPatternAnalyzer();
|
|
12412
|
-
|
|
12155
|
+
import_chalk2 = __toESM(require("chalk"), 1);
|
|
12413
12156
|
IntelligentRouterService = class extends import_node_events.EventEmitter {
|
|
12414
12157
|
nlpProcessor;
|
|
12415
12158
|
intentRecognizer;
|
|
@@ -12468,7 +12211,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12468
12211
|
this.emit("initialized");
|
|
12469
12212
|
} catch (_error) {
|
|
12470
12213
|
console._error(
|
|
12471
|
-
|
|
12214
|
+
import_chalk2.default.red("Failed to initialize Intelligent Router:"),
|
|
12472
12215
|
_error
|
|
12473
12216
|
);
|
|
12474
12217
|
throw _error;
|
|
@@ -12522,7 +12265,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12522
12265
|
} catch (_error) {
|
|
12523
12266
|
this.metrics.failedRoutes++;
|
|
12524
12267
|
this.emit("route:_error", { input: input3, _error });
|
|
12525
|
-
console._error(
|
|
12268
|
+
console._error(import_chalk2.default.red("Routing _error:"), _error);
|
|
12526
12269
|
return null;
|
|
12527
12270
|
}
|
|
12528
12271
|
}
|
|
@@ -13207,38 +12950,38 @@ var init_ReadlineAdapter = __esm({
|
|
|
13207
12950
|
});
|
|
13208
12951
|
|
|
13209
12952
|
// src/services/interactive-session/adapters/ChalkAdapter.ts
|
|
13210
|
-
var
|
|
12953
|
+
var import_chalk3, import_ora, ChalkAdapter;
|
|
13211
12954
|
var init_ChalkAdapter = __esm({
|
|
13212
12955
|
"src/services/interactive-session/adapters/ChalkAdapter.ts"() {
|
|
13213
|
-
|
|
12956
|
+
import_chalk3 = __toESM(require("chalk"), 1);
|
|
13214
12957
|
import_ora = __toESM(require("ora"), 1);
|
|
13215
12958
|
ChalkAdapter = class {
|
|
13216
12959
|
spinners = /* @__PURE__ */ new Map();
|
|
13217
12960
|
spinnerId = 0;
|
|
13218
12961
|
async showWelcome() {
|
|
13219
12962
|
console.log(
|
|
13220
|
-
|
|
12963
|
+
import_chalk3.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
13221
12964
|
);
|
|
13222
|
-
console.log(
|
|
12965
|
+
console.log(import_chalk3.default.gray("Type /help for available commands\n"));
|
|
13223
12966
|
}
|
|
13224
12967
|
showGoodbye() {
|
|
13225
12968
|
this.stopAllSpinners();
|
|
13226
|
-
console.log(
|
|
12969
|
+
console.log(import_chalk3.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
13227
12970
|
}
|
|
13228
12971
|
async print(message) {
|
|
13229
12972
|
console.log(message);
|
|
13230
12973
|
}
|
|
13231
12974
|
error(message) {
|
|
13232
|
-
console.error(
|
|
12975
|
+
console.error(import_chalk3.default.red(`\u274C ${message}`));
|
|
13233
12976
|
}
|
|
13234
12977
|
success(message) {
|
|
13235
|
-
console.log(
|
|
12978
|
+
console.log(import_chalk3.default.green(`\u2705 ${message}`));
|
|
13236
12979
|
}
|
|
13237
12980
|
warning(message) {
|
|
13238
|
-
console.warn(
|
|
12981
|
+
console.warn(import_chalk3.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
13239
12982
|
}
|
|
13240
12983
|
info(message) {
|
|
13241
|
-
console.info(
|
|
12984
|
+
console.info(import_chalk3.default.blue(`\u2139\uFE0F ${message}`));
|
|
13242
12985
|
}
|
|
13243
12986
|
startSpinner(message) {
|
|
13244
12987
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -13288,12 +13031,12 @@ var init_ChalkAdapter = __esm({
|
|
|
13288
13031
|
* Format helpers for consistent styling
|
|
13289
13032
|
*/
|
|
13290
13033
|
static format = {
|
|
13291
|
-
command: (text) =>
|
|
13292
|
-
keyword: (text) =>
|
|
13293
|
-
value: (text) =>
|
|
13294
|
-
dim: (text) =>
|
|
13295
|
-
bold: (text) =>
|
|
13296
|
-
code: (text) =>
|
|
13034
|
+
command: (text) => import_chalk3.default.cyan(text),
|
|
13035
|
+
keyword: (text) => import_chalk3.default.magenta(text),
|
|
13036
|
+
value: (text) => import_chalk3.default.green(text),
|
|
13037
|
+
dim: (text) => import_chalk3.default.gray(text),
|
|
13038
|
+
bold: (text) => import_chalk3.default.bold(text),
|
|
13039
|
+
code: (text) => import_chalk3.default.bgGray.white(` ${text} `)
|
|
13297
13040
|
};
|
|
13298
13041
|
};
|
|
13299
13042
|
}
|
|
@@ -15398,10 +15141,10 @@ var init_dual_memory_engine = __esm({
|
|
|
15398
15141
|
});
|
|
15399
15142
|
|
|
15400
15143
|
// src/utils/logger.ts
|
|
15401
|
-
var
|
|
15144
|
+
var import_chalk4, LogLevel, Logger, logger, envLogLevel;
|
|
15402
15145
|
var init_logger = __esm({
|
|
15403
15146
|
"src/utils/logger.ts"() {
|
|
15404
|
-
|
|
15147
|
+
import_chalk4 = __toESM(require("chalk"), 1);
|
|
15405
15148
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
15406
15149
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
15407
15150
|
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
@@ -15419,27 +15162,27 @@ var init_logger = __esm({
|
|
|
15419
15162
|
}
|
|
15420
15163
|
debug(...args) {
|
|
15421
15164
|
if (this.level <= 0 /* DEBUG */) {
|
|
15422
|
-
console.log(
|
|
15165
|
+
console.log(import_chalk4.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
15423
15166
|
}
|
|
15424
15167
|
}
|
|
15425
15168
|
info(...args) {
|
|
15426
15169
|
if (this.level <= 1 /* INFO */) {
|
|
15427
|
-
console.log(
|
|
15170
|
+
console.log(import_chalk4.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
15428
15171
|
}
|
|
15429
15172
|
}
|
|
15430
15173
|
warn(...args) {
|
|
15431
15174
|
if (this.level <= 2 /* WARN */) {
|
|
15432
|
-
console.warn(
|
|
15175
|
+
console.warn(import_chalk4.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
15433
15176
|
}
|
|
15434
15177
|
}
|
|
15435
15178
|
error(...args) {
|
|
15436
15179
|
if (this.level <= 3 /* ERROR */) {
|
|
15437
|
-
console.error(
|
|
15180
|
+
console.error(import_chalk4.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
15438
15181
|
}
|
|
15439
15182
|
}
|
|
15440
15183
|
success(...args) {
|
|
15441
15184
|
if (this.level <= 1 /* INFO */) {
|
|
15442
|
-
console.log(
|
|
15185
|
+
console.log(import_chalk4.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
15443
15186
|
}
|
|
15444
15187
|
}
|
|
15445
15188
|
task(taskName, status, message) {
|
|
@@ -15453,10 +15196,10 @@ var init_logger = __esm({
|
|
|
15453
15196
|
error: "\u274C"
|
|
15454
15197
|
};
|
|
15455
15198
|
const statusColors = {
|
|
15456
|
-
start:
|
|
15457
|
-
progress:
|
|
15458
|
-
complete:
|
|
15459
|
-
error:
|
|
15199
|
+
start: import_chalk4.default.bold.magenta,
|
|
15200
|
+
progress: import_chalk4.default.magenta,
|
|
15201
|
+
complete: import_chalk4.default.bold.magenta,
|
|
15202
|
+
error: import_chalk4.default.bold.magenta
|
|
15460
15203
|
};
|
|
15461
15204
|
const icon = statusIcons[status];
|
|
15462
15205
|
const color = statusColors[status];
|
|
@@ -15473,14 +15216,14 @@ var init_logger = __esm({
|
|
|
15473
15216
|
if (this.level > 0 /* DEBUG */) {
|
|
15474
15217
|
return;
|
|
15475
15218
|
}
|
|
15476
|
-
console.log(
|
|
15219
|
+
console.log(import_chalk4.default.magenta(`${this.prefix} [JSON]`));
|
|
15477
15220
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
15478
15221
|
}
|
|
15479
15222
|
divider() {
|
|
15480
15223
|
if (this.level > 1 /* INFO */) {
|
|
15481
15224
|
return;
|
|
15482
15225
|
}
|
|
15483
|
-
console.log(
|
|
15226
|
+
console.log(import_chalk4.default.magenta("\u2500".repeat(60)));
|
|
15484
15227
|
}
|
|
15485
15228
|
clear() {
|
|
15486
15229
|
console.clear();
|
|
@@ -15500,7 +15243,7 @@ var init_logger = __esm({
|
|
|
15500
15243
|
const progressText = `${current}/${total}`;
|
|
15501
15244
|
const labelText = label ? ` ${label}` : "";
|
|
15502
15245
|
process.stdout.write(
|
|
15503
|
-
`\r${
|
|
15246
|
+
`\r${import_chalk4.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
15504
15247
|
);
|
|
15505
15248
|
if (current === total) {
|
|
15506
15249
|
process.stdout.write("\n");
|
|
@@ -18569,11 +18312,11 @@ var init_ApprovalEngine = __esm({
|
|
|
18569
18312
|
});
|
|
18570
18313
|
|
|
18571
18314
|
// src/services/quick-approval/QuickApprovalInterface.ts
|
|
18572
|
-
var import_node_events3,
|
|
18315
|
+
var import_node_events3, import_chalk5, QuickApprovalInterface;
|
|
18573
18316
|
var init_QuickApprovalInterface = __esm({
|
|
18574
18317
|
"src/services/quick-approval/QuickApprovalInterface.ts"() {
|
|
18575
18318
|
import_node_events3 = require("events");
|
|
18576
|
-
|
|
18319
|
+
import_chalk5 = __toESM(require("chalk"), 1);
|
|
18577
18320
|
init_ApprovalEngine();
|
|
18578
18321
|
QuickApprovalInterface = class _QuickApprovalInterface extends import_node_events3.EventEmitter {
|
|
18579
18322
|
static instance;
|
|
@@ -18655,26 +18398,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18655
18398
|
const _lang = options.language || "en";
|
|
18656
18399
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
18657
18400
|
console.log("");
|
|
18658
|
-
console.log(
|
|
18401
|
+
console.log(import_chalk5.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"));
|
|
18659
18402
|
console.log(
|
|
18660
|
-
|
|
18403
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18661
18404
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
18662
|
-
) +
|
|
18405
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18663
18406
|
);
|
|
18664
|
-
console.log(
|
|
18407
|
+
console.log(import_chalk5.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"));
|
|
18665
18408
|
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")}`;
|
|
18666
18409
|
console.log(
|
|
18667
|
-
|
|
18668
|
-
` > ${_labels.id}: ${
|
|
18669
|
-
) +
|
|
18410
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18411
|
+
` > ${_labels.id}: ${import_chalk5.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
18412
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18670
18413
|
);
|
|
18671
18414
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
18672
18415
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
18673
18416
|
const _titleLabel = ` ${_labels._title}:`;
|
|
18674
18417
|
console.log(
|
|
18675
|
-
|
|
18418
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18676
18419
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
18677
|
-
) +
|
|
18420
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18678
18421
|
);
|
|
18679
18422
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
18680
18423
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -18682,37 +18425,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18682
18425
|
const _levelLabel = ` ${_labels.level}:`;
|
|
18683
18426
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
18684
18427
|
console.log(
|
|
18685
|
-
|
|
18428
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18686
18429
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
18687
|
-
) +
|
|
18430
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18688
18431
|
);
|
|
18689
18432
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
18690
18433
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
18691
18434
|
console.log(
|
|
18692
|
-
|
|
18435
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18693
18436
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
18694
|
-
) +
|
|
18437
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18695
18438
|
);
|
|
18696
18439
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
18697
18440
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
18698
18441
|
console.log(
|
|
18699
|
-
|
|
18442
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18700
18443
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
18701
|
-
) +
|
|
18444
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18702
18445
|
);
|
|
18703
18446
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
18704
18447
|
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")}`;
|
|
18705
18448
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
18706
18449
|
console.log(
|
|
18707
|
-
|
|
18450
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18708
18451
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
18709
|
-
) +
|
|
18452
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18710
18453
|
);
|
|
18711
|
-
console.log(
|
|
18454
|
+
console.log(import_chalk5.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"));
|
|
18712
18455
|
console.log(
|
|
18713
|
-
|
|
18456
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18714
18457
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
18715
|
-
) +
|
|
18458
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18716
18459
|
);
|
|
18717
18460
|
this.menuOptions.forEach((option, _index) => {
|
|
18718
18461
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -18723,32 +18466,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18723
18466
|
switch (option) {
|
|
18724
18467
|
case "approve":
|
|
18725
18468
|
label = _labels.approve;
|
|
18726
|
-
color =
|
|
18469
|
+
color = import_chalk5.default.green;
|
|
18727
18470
|
break;
|
|
18728
18471
|
case "reject":
|
|
18729
18472
|
label = _labels.reject;
|
|
18730
|
-
color =
|
|
18473
|
+
color = import_chalk5.default.red;
|
|
18731
18474
|
break;
|
|
18732
18475
|
case "cancel":
|
|
18733
18476
|
label = _labels.cancel;
|
|
18734
|
-
color =
|
|
18477
|
+
color = import_chalk5.default.yellow;
|
|
18735
18478
|
break;
|
|
18736
18479
|
}
|
|
18737
18480
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
18738
18481
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
18739
18482
|
console.log(
|
|
18740
|
-
|
|
18483
|
+
import_chalk5.default.gray("\u2502") + _colorFunc(
|
|
18741
18484
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
18742
|
-
) +
|
|
18485
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18743
18486
|
);
|
|
18744
18487
|
});
|
|
18745
|
-
console.log(
|
|
18488
|
+
console.log(import_chalk5.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"));
|
|
18746
18489
|
console.log(
|
|
18747
|
-
|
|
18490
|
+
import_chalk5.default.gray("\u2502") + import_chalk5.default.white(
|
|
18748
18491
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
18749
|
-
) +
|
|
18492
|
+
) + import_chalk5.default.gray("\u2502")
|
|
18750
18493
|
);
|
|
18751
|
-
console.log(
|
|
18494
|
+
console.log(import_chalk5.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"));
|
|
18752
18495
|
console.log("");
|
|
18753
18496
|
}
|
|
18754
18497
|
/**
|
|
@@ -18764,13 +18507,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18764
18507
|
};
|
|
18765
18508
|
const _formatted = keyMap[_key] || _key;
|
|
18766
18509
|
const colorMap = {
|
|
18767
|
-
"shift+tab":
|
|
18768
|
-
"ctrl+y":
|
|
18769
|
-
"ctrl+n":
|
|
18770
|
-
"ctrl+t":
|
|
18771
|
-
"ctrl+r":
|
|
18510
|
+
"shift+tab": import_chalk5.default.bgGreen.black.bold,
|
|
18511
|
+
"ctrl+y": import_chalk5.default.bgBlue.white.bold,
|
|
18512
|
+
"ctrl+n": import_chalk5.default.bgRed.white.bold,
|
|
18513
|
+
"ctrl+t": import_chalk5.default.bgMagenta.white.bold,
|
|
18514
|
+
"ctrl+r": import_chalk5.default.bgYellow.black.bold
|
|
18772
18515
|
};
|
|
18773
|
-
const _colorFunc = colorMap[_key] ||
|
|
18516
|
+
const _colorFunc = colorMap[_key] || import_chalk5.default.bgCyan.black.bold;
|
|
18774
18517
|
return _colorFunc(` ${_formatted} `);
|
|
18775
18518
|
}
|
|
18776
18519
|
/**
|
|
@@ -18779,15 +18522,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18779
18522
|
formatRiskLevel(risk) {
|
|
18780
18523
|
switch (risk.toLowerCase()) {
|
|
18781
18524
|
case "critical":
|
|
18782
|
-
return
|
|
18525
|
+
return import_chalk5.default.red.bold("CRITICAL");
|
|
18783
18526
|
case "high":
|
|
18784
|
-
return
|
|
18527
|
+
return import_chalk5.default.red("HIGH");
|
|
18785
18528
|
case "medium":
|
|
18786
|
-
return
|
|
18529
|
+
return import_chalk5.default.yellow("MEDIUM");
|
|
18787
18530
|
case "low":
|
|
18788
|
-
return
|
|
18531
|
+
return import_chalk5.default.green("LOW");
|
|
18789
18532
|
default:
|
|
18790
|
-
return
|
|
18533
|
+
return import_chalk5.default.white(risk);
|
|
18791
18534
|
}
|
|
18792
18535
|
}
|
|
18793
18536
|
/**
|
|
@@ -18857,7 +18600,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18857
18600
|
}
|
|
18858
18601
|
if (_key === "") {
|
|
18859
18602
|
console.log(`
|
|
18860
|
-
${
|
|
18603
|
+
${import_chalk5.default.red("Approval cancelled by user")}`);
|
|
18861
18604
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
18862
18605
|
return;
|
|
18863
18606
|
}
|
|
@@ -18914,20 +18657,20 @@ ${import_chalk6.default.red("Approval cancelled by user")}`);
|
|
|
18914
18657
|
}
|
|
18915
18658
|
console.clear();
|
|
18916
18659
|
console.log(`
|
|
18917
|
-
${
|
|
18660
|
+
${import_chalk5.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18918
18661
|
console.log(
|
|
18919
|
-
|
|
18662
|
+
import_chalk5.default.bgGreen.black.bold("\u2502") + import_chalk5.default.bgGreen.black.bold(
|
|
18920
18663
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
18921
|
-
) +
|
|
18664
|
+
) + import_chalk5.default.bgGreen.black.bold("\u2502")
|
|
18922
18665
|
);
|
|
18923
|
-
console.log(
|
|
18666
|
+
console.log(import_chalk5.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
18924
18667
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
18925
18668
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
18926
18669
|
console.log(
|
|
18927
|
-
|
|
18670
|
+
import_chalk5.default.bgGreen.black.bold("\u2502") + import_chalk5.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + import_chalk5.default.bgGreen.black.bold("\u2502")
|
|
18928
18671
|
);
|
|
18929
|
-
console.log(
|
|
18930
|
-
console.log(
|
|
18672
|
+
console.log(import_chalk5.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
18673
|
+
console.log(import_chalk5.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
18931
18674
|
try {
|
|
18932
18675
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
18933
18676
|
this.currentRequest.id,
|
|
@@ -18937,30 +18680,30 @@ ${import_chalk6.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)
|
|
|
18937
18680
|
);
|
|
18938
18681
|
response.quickDecision = true;
|
|
18939
18682
|
console.log(`
|
|
18940
|
-
${
|
|
18683
|
+
${import_chalk5.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18941
18684
|
console.log(
|
|
18942
|
-
|
|
18685
|
+
import_chalk5.default.bgGreen.black("\u2502") + import_chalk5.default.bgGreen.black(
|
|
18943
18686
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
18944
|
-
) +
|
|
18687
|
+
) + import_chalk5.default.bgGreen.black("\u2502")
|
|
18945
18688
|
);
|
|
18946
|
-
console.log(
|
|
18689
|
+
console.log(import_chalk5.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
18947
18690
|
if (_choice.trustLevel) {
|
|
18948
18691
|
console.log(
|
|
18949
|
-
|
|
18692
|
+
import_chalk5.default.blue(`
|
|
18950
18693
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
18951
18694
|
);
|
|
18952
18695
|
}
|
|
18953
18696
|
this.emit("approval-_response", _response);
|
|
18954
18697
|
} catch (_error) {
|
|
18955
18698
|
console.log(`
|
|
18956
|
-
${
|
|
18699
|
+
${import_chalk5.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18957
18700
|
console.log(
|
|
18958
|
-
|
|
18701
|
+
import_chalk5.default.bgRed.white.bold("\u2502") + import_chalk5.default.bgRed.white.bold(
|
|
18959
18702
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
18960
|
-
) +
|
|
18703
|
+
) + import_chalk5.default.bgRed.white.bold("\u2502")
|
|
18961
18704
|
);
|
|
18962
|
-
console.log(
|
|
18963
|
-
console._error(
|
|
18705
|
+
console.log(import_chalk5.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
18706
|
+
console._error(import_chalk5.default.red("\nError details:"), _error);
|
|
18964
18707
|
this.emit("approval-_error", _error);
|
|
18965
18708
|
}
|
|
18966
18709
|
}
|
|
@@ -18974,7 +18717,7 @@ ${import_chalk6.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`
|
|
|
18974
18717
|
timeoutId = setTimeout(() => {
|
|
18975
18718
|
console.log(
|
|
18976
18719
|
`
|
|
18977
|
-
${
|
|
18720
|
+
${import_chalk5.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
18978
18721
|
);
|
|
18979
18722
|
this.handleTimeoutResponse(resolve);
|
|
18980
18723
|
}, timeout);
|
|
@@ -19018,7 +18761,7 @@ ${import_chalk6.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
19018
18761
|
response.quickDecision = true;
|
|
19019
18762
|
resolve(_response);
|
|
19020
18763
|
} catch (_error) {
|
|
19021
|
-
console._error(
|
|
18764
|
+
console._error(import_chalk5.default.red("Error processing timeout approval:"), _error);
|
|
19022
18765
|
}
|
|
19023
18766
|
}
|
|
19024
18767
|
/**
|
|
@@ -19033,11 +18776,11 @@ ${import_chalk6.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
19033
18776
|
);
|
|
19034
18777
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
19035
18778
|
console.log(
|
|
19036
|
-
|
|
18779
|
+
import_chalk5.default.blue(
|
|
19037
18780
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
19038
18781
|
)
|
|
19039
18782
|
);
|
|
19040
|
-
console.log(
|
|
18783
|
+
console.log(import_chalk5.default.gray(`Reason: ${event.reason}`));
|
|
19041
18784
|
});
|
|
19042
18785
|
}
|
|
19043
18786
|
/**
|
|
@@ -19826,22 +19569,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
19826
19569
|
}
|
|
19827
19570
|
function formatError(message, code) {
|
|
19828
19571
|
const prefix = code ? `[${code}] ` : "";
|
|
19829
|
-
return
|
|
19572
|
+
return import_chalk6.default.red(`\u274C ${prefix}${message}`);
|
|
19830
19573
|
}
|
|
19831
19574
|
function formatSuccess(message) {
|
|
19832
|
-
return
|
|
19575
|
+
return import_chalk6.default.green(`\u2705 ${message}`);
|
|
19833
19576
|
}
|
|
19834
19577
|
function formatWarning(message) {
|
|
19835
|
-
return
|
|
19578
|
+
return import_chalk6.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
19836
19579
|
}
|
|
19837
19580
|
function formatInfo(message) {
|
|
19838
|
-
return
|
|
19581
|
+
return import_chalk6.default.blue(`\u2139\uFE0F ${message}`);
|
|
19839
19582
|
}
|
|
19840
19583
|
function formatTable(headers, rows, options = {}) {
|
|
19841
19584
|
const {
|
|
19842
19585
|
columnWidths = headers.map(() => 20),
|
|
19843
19586
|
separator = " | ",
|
|
19844
|
-
headerColor =
|
|
19587
|
+
headerColor = import_chalk6.default.cyan.bold
|
|
19845
19588
|
} = options;
|
|
19846
19589
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
19847
19590
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -19853,8 +19596,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
19853
19596
|
function formatKeyValue(data2, options = {}) {
|
|
19854
19597
|
const {
|
|
19855
19598
|
keyWidth = 20,
|
|
19856
|
-
keyColor =
|
|
19857
|
-
valueColor =
|
|
19599
|
+
keyColor = import_chalk6.default.gray,
|
|
19600
|
+
valueColor = import_chalk6.default.white,
|
|
19858
19601
|
separator = ": "
|
|
19859
19602
|
} = options;
|
|
19860
19603
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -19876,19 +19619,19 @@ function formatTimestamp(date, format = "short") {
|
|
|
19876
19619
|
return d.toLocaleTimeString();
|
|
19877
19620
|
}
|
|
19878
19621
|
}
|
|
19879
|
-
var
|
|
19622
|
+
var import_chalk6;
|
|
19880
19623
|
var init_FormatUtils = __esm({
|
|
19881
19624
|
"src/services/interactive-session/display/FormatUtils.ts"() {
|
|
19882
|
-
|
|
19625
|
+
import_chalk6 = __toESM(require("chalk"), 1);
|
|
19883
19626
|
}
|
|
19884
19627
|
});
|
|
19885
19628
|
|
|
19886
19629
|
// src/services/interactive-session/display/DisplayManager.ts
|
|
19887
|
-
var
|
|
19630
|
+
var os, import_chalk7, DisplayManager;
|
|
19888
19631
|
var init_DisplayManager = __esm({
|
|
19889
19632
|
"src/services/interactive-session/display/DisplayManager.ts"() {
|
|
19890
|
-
|
|
19891
|
-
|
|
19633
|
+
os = __toESM(require("os"), 1);
|
|
19634
|
+
import_chalk7 = __toESM(require("chalk"), 1);
|
|
19892
19635
|
init_SpinnerManager();
|
|
19893
19636
|
init_FormatUtils();
|
|
19894
19637
|
DisplayManager = class {
|
|
@@ -19900,7 +19643,7 @@ var init_DisplayManager = __esm({
|
|
|
19900
19643
|
cursorState = { visible: true };
|
|
19901
19644
|
constructor(options = {}) {
|
|
19902
19645
|
this.spinnerManager = SpinnerManager.getInstance();
|
|
19903
|
-
this.platform =
|
|
19646
|
+
this.platform = os.platform();
|
|
19904
19647
|
this.isWindows = this.platform === "win32";
|
|
19905
19648
|
this.isTTY = process.stdout.isTTY || false;
|
|
19906
19649
|
this.options = {
|
|
@@ -19910,7 +19653,7 @@ var init_DisplayManager = __esm({
|
|
|
19910
19653
|
theme: options.theme ?? "auto"
|
|
19911
19654
|
};
|
|
19912
19655
|
if (!this.options.enableColors) {
|
|
19913
|
-
|
|
19656
|
+
import_chalk7.default.level = 0;
|
|
19914
19657
|
}
|
|
19915
19658
|
this.setupCleanupHandlers();
|
|
19916
19659
|
}
|
|
@@ -20027,7 +19770,7 @@ var init_DisplayManager = __esm({
|
|
|
20027
19770
|
const {
|
|
20028
19771
|
padding = 1,
|
|
20029
19772
|
borderStyle = "single",
|
|
20030
|
-
borderColor =
|
|
19773
|
+
borderColor = import_chalk7.default.gray
|
|
20031
19774
|
} = options;
|
|
20032
19775
|
const lines = content.split("\n");
|
|
20033
19776
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -20085,7 +19828,7 @@ var init_DisplayManager = __esm({
|
|
|
20085
19828
|
*/
|
|
20086
19829
|
startSpinner(text) {
|
|
20087
19830
|
if (!this.options.enableAnimations) {
|
|
20088
|
-
this.writeLine(
|
|
19831
|
+
this.writeLine(import_chalk7.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
20089
19832
|
return "no-animation";
|
|
20090
19833
|
}
|
|
20091
19834
|
return this.spinnerManager.start({ text });
|
|
@@ -20178,10 +19921,10 @@ var init_DisplayManager = __esm({
|
|
|
20178
19921
|
});
|
|
20179
19922
|
|
|
20180
19923
|
// src/services/interactive-session/display/StatusDisplay.ts
|
|
20181
|
-
var
|
|
19924
|
+
var import_chalk8, StatusDisplay;
|
|
20182
19925
|
var init_StatusDisplay = __esm({
|
|
20183
19926
|
"src/services/interactive-session/display/StatusDisplay.ts"() {
|
|
20184
|
-
|
|
19927
|
+
import_chalk8 = __toESM(require("chalk"), 1);
|
|
20185
19928
|
init_FormatUtils();
|
|
20186
19929
|
StatusDisplay = class {
|
|
20187
19930
|
/**
|
|
@@ -20192,11 +19935,11 @@ var init_StatusDisplay = __esm({
|
|
|
20192
19935
|
*/
|
|
20193
19936
|
static renderSystemStatus(status, detailed = false) {
|
|
20194
19937
|
const lines = [];
|
|
20195
|
-
lines.push(
|
|
19938
|
+
lines.push(import_chalk8.default.cyan.bold("\u{1F4CA} System Status"));
|
|
20196
19939
|
lines.push("");
|
|
20197
19940
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
20198
19941
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
20199
|
-
const statusColor = status.operational ?
|
|
19942
|
+
const statusColor = status.operational ? import_chalk8.default.green : import_chalk8.default.red;
|
|
20200
19943
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
20201
19944
|
lines.push(
|
|
20202
19945
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -20217,15 +19960,15 @@ var init_StatusDisplay = __esm({
|
|
|
20217
19960
|
if (status.errors > 0 || status.warnings > 0) {
|
|
20218
19961
|
lines.push("");
|
|
20219
19962
|
if (status.errors > 0) {
|
|
20220
|
-
lines.push(
|
|
19963
|
+
lines.push(import_chalk8.default.red(`\u274C Errors: ${status.errors}`));
|
|
20221
19964
|
}
|
|
20222
19965
|
if (status.warnings > 0) {
|
|
20223
|
-
lines.push(
|
|
19966
|
+
lines.push(import_chalk8.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
20224
19967
|
}
|
|
20225
19968
|
}
|
|
20226
19969
|
if (detailed) {
|
|
20227
19970
|
lines.push("");
|
|
20228
|
-
lines.push(
|
|
19971
|
+
lines.push(import_chalk8.default.gray("Detailed Information:"));
|
|
20229
19972
|
const details = formatKeyValue(
|
|
20230
19973
|
{
|
|
20231
19974
|
"Process ID": process.pid,
|
|
@@ -20235,8 +19978,8 @@ var init_StatusDisplay = __esm({
|
|
|
20235
19978
|
"Working Directory": process.cwd()
|
|
20236
19979
|
},
|
|
20237
19980
|
{
|
|
20238
|
-
keyColor:
|
|
20239
|
-
valueColor:
|
|
19981
|
+
keyColor: import_chalk8.default.gray,
|
|
19982
|
+
valueColor: import_chalk8.default.white
|
|
20240
19983
|
}
|
|
20241
19984
|
);
|
|
20242
19985
|
lines.push(details);
|
|
@@ -20250,9 +19993,9 @@ var init_StatusDisplay = __esm({
|
|
|
20250
19993
|
*/
|
|
20251
19994
|
static renderMemoryStatus(status) {
|
|
20252
19995
|
const lines = [];
|
|
20253
|
-
lines.push(
|
|
19996
|
+
lines.push(import_chalk8.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
20254
19997
|
lines.push("");
|
|
20255
|
-
lines.push(
|
|
19998
|
+
lines.push(import_chalk8.default.yellow("System 1 (Fast):"));
|
|
20256
19999
|
const s1NodeBar = formatProgressBar(
|
|
20257
20000
|
status.system1.nodes,
|
|
20258
20001
|
status.system1.maxNodes,
|
|
@@ -20270,7 +20013,7 @@ var init_StatusDisplay = __esm({
|
|
|
20270
20013
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
20271
20014
|
);
|
|
20272
20015
|
lines.push("");
|
|
20273
|
-
lines.push(
|
|
20016
|
+
lines.push(import_chalk8.default.blue("System 2 (Deep):"));
|
|
20274
20017
|
const s2TraceBar = formatProgressBar(
|
|
20275
20018
|
status.system2.traces,
|
|
20276
20019
|
status.system2.maxTraces,
|
|
@@ -20288,7 +20031,7 @@ var init_StatusDisplay = __esm({
|
|
|
20288
20031
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
20289
20032
|
);
|
|
20290
20033
|
lines.push("");
|
|
20291
|
-
lines.push(
|
|
20034
|
+
lines.push(import_chalk8.default.green("Total:"));
|
|
20292
20035
|
const totalBar = formatProgressBar(
|
|
20293
20036
|
status.total.tokens,
|
|
20294
20037
|
status.total.maxTokens,
|
|
@@ -20297,7 +20040,7 @@ var init_StatusDisplay = __esm({
|
|
|
20297
20040
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
20298
20041
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
20299
20042
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
20300
|
-
const usageColor = usage > 80 ?
|
|
20043
|
+
const usageColor = usage > 80 ? import_chalk8.default.red : usage > 60 ? import_chalk8.default.yellow : import_chalk8.default.green;
|
|
20301
20044
|
lines.push(
|
|
20302
20045
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
20303
20046
|
);
|
|
@@ -20310,9 +20053,9 @@ var init_StatusDisplay = __esm({
|
|
|
20310
20053
|
*/
|
|
20311
20054
|
static renderModelStatus(status) {
|
|
20312
20055
|
const lines = [];
|
|
20313
|
-
lines.push(
|
|
20056
|
+
lines.push(import_chalk8.default.cyan.bold("\u{1F916} Model Status"));
|
|
20314
20057
|
lines.push("");
|
|
20315
|
-
lines.push(
|
|
20058
|
+
lines.push(import_chalk8.default.green(`Current: ${import_chalk8.default.bold(status.current)}`));
|
|
20316
20059
|
lines.push("");
|
|
20317
20060
|
lines.push("Available Models:");
|
|
20318
20061
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -20324,7 +20067,7 @@ var init_StatusDisplay = __esm({
|
|
|
20324
20067
|
const table = formatTable(headers, rows, {
|
|
20325
20068
|
columnWidths: [20, 15, 8, 30],
|
|
20326
20069
|
separator: " \u2502 ",
|
|
20327
|
-
headerColor:
|
|
20070
|
+
headerColor: import_chalk8.default.gray
|
|
20328
20071
|
});
|
|
20329
20072
|
lines.push(table);
|
|
20330
20073
|
return lines.join("\n");
|
|
@@ -20336,19 +20079,19 @@ var init_StatusDisplay = __esm({
|
|
|
20336
20079
|
*/
|
|
20337
20080
|
static renderHealthChecks(checks) {
|
|
20338
20081
|
const lines = [];
|
|
20339
|
-
lines.push(
|
|
20082
|
+
lines.push(import_chalk8.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
20340
20083
|
lines.push("");
|
|
20341
20084
|
for (const check of checks) {
|
|
20342
20085
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
20343
|
-
const statusColor = check.status === "ok" ?
|
|
20086
|
+
const statusColor = check.status === "ok" ? import_chalk8.default.green : check.status === "warning" ? import_chalk8.default.yellow : import_chalk8.default.red;
|
|
20344
20087
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
20345
20088
|
if (check.latency !== void 0) {
|
|
20346
|
-
const latencyColor = check.latency < 100 ?
|
|
20089
|
+
const latencyColor = check.latency < 100 ? import_chalk8.default.green : check.latency < 500 ? import_chalk8.default.yellow : import_chalk8.default.red;
|
|
20347
20090
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
20348
20091
|
}
|
|
20349
20092
|
lines.push(line);
|
|
20350
20093
|
if (check.message) {
|
|
20351
|
-
lines.push(
|
|
20094
|
+
lines.push(import_chalk8.default.gray(` ${check.message}`));
|
|
20352
20095
|
}
|
|
20353
20096
|
}
|
|
20354
20097
|
lines.push("");
|
|
@@ -20357,16 +20100,16 @@ var init_StatusDisplay = __esm({
|
|
|
20357
20100
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
20358
20101
|
if (errorCount > 0) {
|
|
20359
20102
|
lines.push(
|
|
20360
|
-
|
|
20103
|
+
import_chalk8.default.red(
|
|
20361
20104
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
20362
20105
|
)
|
|
20363
20106
|
);
|
|
20364
20107
|
} else if (warningCount > 0) {
|
|
20365
20108
|
lines.push(
|
|
20366
|
-
|
|
20109
|
+
import_chalk8.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
20367
20110
|
);
|
|
20368
20111
|
} else {
|
|
20369
|
-
lines.push(
|
|
20112
|
+
lines.push(import_chalk8.default.green("\u2705 All systems operational"));
|
|
20370
20113
|
}
|
|
20371
20114
|
return lines.join("\n");
|
|
20372
20115
|
}
|
|
@@ -20377,7 +20120,7 @@ var init_StatusDisplay = __esm({
|
|
|
20377
20120
|
*/
|
|
20378
20121
|
static renderSessionStats(stats) {
|
|
20379
20122
|
const lines = [];
|
|
20380
|
-
lines.push(
|
|
20123
|
+
lines.push(import_chalk8.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
20381
20124
|
lines.push("");
|
|
20382
20125
|
const data2 = formatKeyValue(
|
|
20383
20126
|
{
|
|
@@ -20390,14 +20133,14 @@ var init_StatusDisplay = __esm({
|
|
|
20390
20133
|
},
|
|
20391
20134
|
{
|
|
20392
20135
|
keyWidth: 20,
|
|
20393
|
-
keyColor:
|
|
20394
|
-
valueColor:
|
|
20136
|
+
keyColor: import_chalk8.default.gray,
|
|
20137
|
+
valueColor: import_chalk8.default.white
|
|
20395
20138
|
}
|
|
20396
20139
|
);
|
|
20397
20140
|
lines.push(data2);
|
|
20398
20141
|
lines.push("");
|
|
20399
20142
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
20400
|
-
const perfColor = performance3 === "Excellent" ?
|
|
20143
|
+
const perfColor = performance3 === "Excellent" ? import_chalk8.default.green : performance3 === "Good" ? import_chalk8.default.blue : performance3 === "Fair" ? import_chalk8.default.yellow : import_chalk8.default.red;
|
|
20401
20144
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
20402
20145
|
return lines.join("\n");
|
|
20403
20146
|
}
|
|
@@ -20409,22 +20152,22 @@ var init_StatusDisplay = __esm({
|
|
|
20409
20152
|
static renderStatusBar(data2) {
|
|
20410
20153
|
const segments = [];
|
|
20411
20154
|
if (data2.mode) {
|
|
20412
|
-
segments.push(
|
|
20155
|
+
segments.push(import_chalk8.default.cyan(`[${data2.mode}]`));
|
|
20413
20156
|
}
|
|
20414
20157
|
if (data2.model) {
|
|
20415
|
-
segments.push(
|
|
20158
|
+
segments.push(import_chalk8.default.blue(`\u{1F916} ${data2.model}`));
|
|
20416
20159
|
}
|
|
20417
20160
|
if (data2.memory !== void 0) {
|
|
20418
|
-
const memoryColor = data2.memory > 80 ?
|
|
20161
|
+
const memoryColor = data2.memory > 80 ? import_chalk8.default.red : data2.memory > 60 ? import_chalk8.default.yellow : import_chalk8.default.green;
|
|
20419
20162
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
20420
20163
|
}
|
|
20421
20164
|
if (data2.latency !== void 0) {
|
|
20422
|
-
const latencyColor = data2.latency < 100 ?
|
|
20165
|
+
const latencyColor = data2.latency < 100 ? import_chalk8.default.green : data2.latency < 500 ? import_chalk8.default.yellow : import_chalk8.default.red;
|
|
20423
20166
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
20424
20167
|
}
|
|
20425
20168
|
if (data2.time) {
|
|
20426
20169
|
segments.push(
|
|
20427
|
-
|
|
20170
|
+
import_chalk8.default.gray(formatTimestamp(data2.time, "short"))
|
|
20428
20171
|
);
|
|
20429
20172
|
}
|
|
20430
20173
|
return segments.join(" \u2502 ");
|
|
@@ -20434,10 +20177,10 @@ var init_StatusDisplay = __esm({
|
|
|
20434
20177
|
});
|
|
20435
20178
|
|
|
20436
20179
|
// src/services/interactive-session/handlers/CoreHandlers.ts
|
|
20437
|
-
var
|
|
20180
|
+
var import_chalk9, import_perf_hooks, HelpHandler, ClearHandler, ExitHandler, VersionHandler, HistoryHandler, CoreHandlers;
|
|
20438
20181
|
var init_CoreHandlers = __esm({
|
|
20439
20182
|
"src/services/interactive-session/handlers/CoreHandlers.ts"() {
|
|
20440
|
-
|
|
20183
|
+
import_chalk9 = __toESM(require("chalk"), 1);
|
|
20441
20184
|
import_perf_hooks = require("perf_hooks");
|
|
20442
20185
|
HelpHandler = class {
|
|
20443
20186
|
registry;
|
|
@@ -20447,7 +20190,7 @@ var init_CoreHandlers = __esm({
|
|
|
20447
20190
|
async execute(args) {
|
|
20448
20191
|
const startTime = import_perf_hooks.performance.now();
|
|
20449
20192
|
const commands = this.registry.getCommands();
|
|
20450
|
-
let message =
|
|
20193
|
+
let message = import_chalk9.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
20451
20194
|
|
|
20452
20195
|
`);
|
|
20453
20196
|
const categories = {
|
|
@@ -20458,17 +20201,17 @@ var init_CoreHandlers = __esm({
|
|
|
20458
20201
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
20459
20202
|
};
|
|
20460
20203
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
20461
|
-
message +=
|
|
20204
|
+
message += import_chalk9.default.yellow(`
|
|
20462
20205
|
${category.toUpperCase()}:
|
|
20463
20206
|
`);
|
|
20464
20207
|
for (const cmd of cmds) {
|
|
20465
20208
|
if (commands.includes(cmd)) {
|
|
20466
|
-
message += ` ${
|
|
20209
|
+
message += ` ${import_chalk9.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
20467
20210
|
`;
|
|
20468
20211
|
}
|
|
20469
20212
|
}
|
|
20470
20213
|
}
|
|
20471
|
-
message +=
|
|
20214
|
+
message += import_chalk9.default.gray(
|
|
20472
20215
|
`
|
|
20473
20216
|
Type '/help <command>' for detailed information about a specific command.`
|
|
20474
20217
|
);
|
|
@@ -20516,7 +20259,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20516
20259
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20517
20260
|
return {
|
|
20518
20261
|
success: true,
|
|
20519
|
-
message:
|
|
20262
|
+
message: import_chalk9.default.gray("Terminal cleared."),
|
|
20520
20263
|
metadata: {
|
|
20521
20264
|
processingTime,
|
|
20522
20265
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -20527,7 +20270,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20527
20270
|
ExitHandler = class {
|
|
20528
20271
|
async execute(args) {
|
|
20529
20272
|
const startTime = import_perf_hooks.performance.now();
|
|
20530
|
-
const message =
|
|
20273
|
+
const message = import_chalk9.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
20531
20274
|
process.emit("SIGTERM");
|
|
20532
20275
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20533
20276
|
return {
|
|
@@ -20551,23 +20294,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20551
20294
|
platform: process.platform,
|
|
20552
20295
|
arch: process.arch
|
|
20553
20296
|
};
|
|
20554
|
-
let message =
|
|
20555
|
-
message +=
|
|
20297
|
+
let message = import_chalk9.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
20298
|
+
message += import_chalk9.default.white(` Version: ${import_chalk9.default.green(packageInfo.version)}
|
|
20556
20299
|
`);
|
|
20557
|
-
message +=
|
|
20300
|
+
message += import_chalk9.default.white(` Package: ${import_chalk9.default.green(packageInfo.name)}
|
|
20558
20301
|
`);
|
|
20559
|
-
message +=
|
|
20302
|
+
message += import_chalk9.default.white(` Node: ${import_chalk9.default.green(packageInfo.node)}
|
|
20560
20303
|
`);
|
|
20561
|
-
message +=
|
|
20562
|
-
` Platform: ${
|
|
20304
|
+
message += import_chalk9.default.white(
|
|
20305
|
+
` Platform: ${import_chalk9.default.green(packageInfo.platform)}
|
|
20563
20306
|
`
|
|
20564
20307
|
);
|
|
20565
|
-
message +=
|
|
20308
|
+
message += import_chalk9.default.white(` Arch: ${import_chalk9.default.green(packageInfo.arch)}
|
|
20566
20309
|
`);
|
|
20567
|
-
message +=
|
|
20310
|
+
message += import_chalk9.default.gray(`
|
|
20568
20311
|
Build: Production
|
|
20569
20312
|
`);
|
|
20570
|
-
message +=
|
|
20313
|
+
message += import_chalk9.default.gray(` License: MIT
|
|
20571
20314
|
`);
|
|
20572
20315
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20573
20316
|
return {
|
|
@@ -20592,15 +20335,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20592
20335
|
this.history.push("/history");
|
|
20593
20336
|
}
|
|
20594
20337
|
const recent = this.history.slice(-limit);
|
|
20595
|
-
let message =
|
|
20338
|
+
let message = import_chalk9.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
20596
20339
|
|
|
20597
20340
|
`);
|
|
20598
20341
|
recent.forEach((cmd, index) => {
|
|
20599
20342
|
const num = this.history.length - recent.length + index + 1;
|
|
20600
|
-
message +=
|
|
20343
|
+
message += import_chalk9.default.gray(` ${num.toString().padStart(3)}: `) + import_chalk9.default.white(cmd) + "\n";
|
|
20601
20344
|
});
|
|
20602
20345
|
if (recent.length === 0) {
|
|
20603
|
-
message =
|
|
20346
|
+
message = import_chalk9.default.gray("No command history available.");
|
|
20604
20347
|
}
|
|
20605
20348
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20606
20349
|
return {
|
|
@@ -20631,10 +20374,10 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20631
20374
|
});
|
|
20632
20375
|
|
|
20633
20376
|
// src/services/interactive-session/handlers/DevHandlers.ts
|
|
20634
|
-
var
|
|
20377
|
+
var import_chalk10, CodeHandler, TestHandler, ReviewHandler, BugHandler, DevHandlers;
|
|
20635
20378
|
var init_DevHandlers = __esm({
|
|
20636
20379
|
"src/services/interactive-session/handlers/DevHandlers.ts"() {
|
|
20637
|
-
|
|
20380
|
+
import_chalk10 = __toESM(require("chalk"), 1);
|
|
20638
20381
|
CodeHandler = class {
|
|
20639
20382
|
constructor(codeService) {
|
|
20640
20383
|
this.codeService = codeService;
|
|
@@ -20649,13 +20392,13 @@ var init_DevHandlers = __esm({
|
|
|
20649
20392
|
if (!prompt) {
|
|
20650
20393
|
return {
|
|
20651
20394
|
ok: false,
|
|
20652
|
-
message:
|
|
20395
|
+
message: import_chalk10.default.red("\u274C Please provide a code generation request.\n") + import_chalk10.default.gray("Usage: /code <description>\n") + import_chalk10.default.gray("Example: /code create a React button component")
|
|
20653
20396
|
};
|
|
20654
20397
|
}
|
|
20655
20398
|
if (signal?.aborted) {
|
|
20656
20399
|
return {
|
|
20657
20400
|
ok: false,
|
|
20658
|
-
message:
|
|
20401
|
+
message: import_chalk10.default.yellow("Code generation canceled")
|
|
20659
20402
|
};
|
|
20660
20403
|
}
|
|
20661
20404
|
try {
|
|
@@ -20666,9 +20409,9 @@ var init_DevHandlers = __esm({
|
|
|
20666
20409
|
if (dryRun) {
|
|
20667
20410
|
return {
|
|
20668
20411
|
ok: true,
|
|
20669
|
-
message:
|
|
20670
|
-
`) +
|
|
20671
|
-
`) +
|
|
20412
|
+
message: import_chalk10.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + import_chalk10.default.gray(`Language: ${language}
|
|
20413
|
+
`) + import_chalk10.default.gray(`Framework: ${framework || "none"}
|
|
20414
|
+
`) + import_chalk10.default.gray(`Prompt: ${cleanPrompt}`)
|
|
20672
20415
|
};
|
|
20673
20416
|
}
|
|
20674
20417
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -20680,7 +20423,7 @@ function generated() {
|
|
|
20680
20423
|
export { generated };`;
|
|
20681
20424
|
return {
|
|
20682
20425
|
ok: true,
|
|
20683
|
-
message:
|
|
20426
|
+
message: import_chalk10.default.green("\u2705 Code generated successfully:\n\n") + import_chalk10.default.gray("```" + language + "\n") + generatedCode + import_chalk10.default.gray("\n```"),
|
|
20684
20427
|
data: {
|
|
20685
20428
|
code: generatedCode,
|
|
20686
20429
|
language,
|
|
@@ -20693,7 +20436,7 @@ export { generated };`;
|
|
|
20693
20436
|
} catch (error2) {
|
|
20694
20437
|
return {
|
|
20695
20438
|
ok: false,
|
|
20696
|
-
message:
|
|
20439
|
+
message: import_chalk10.default.red(`Code generation failed: ${error2}`)
|
|
20697
20440
|
};
|
|
20698
20441
|
}
|
|
20699
20442
|
}
|
|
@@ -20707,7 +20450,7 @@ export { generated };`;
|
|
|
20707
20450
|
if (signal?.aborted) {
|
|
20708
20451
|
return {
|
|
20709
20452
|
ok: false,
|
|
20710
|
-
message:
|
|
20453
|
+
message: import_chalk10.default.yellow("Test operation canceled")
|
|
20711
20454
|
};
|
|
20712
20455
|
}
|
|
20713
20456
|
const subcommand = args[0] || "run";
|
|
@@ -20723,8 +20466,8 @@ export { generated };`;
|
|
|
20723
20466
|
default:
|
|
20724
20467
|
return {
|
|
20725
20468
|
ok: false,
|
|
20726
|
-
message:
|
|
20727
|
-
`) +
|
|
20469
|
+
message: import_chalk10.default.red(`Unknown test subcommand: ${subcommand}
|
|
20470
|
+
`) + import_chalk10.default.gray("Available: generate, run, coverage")
|
|
20728
20471
|
};
|
|
20729
20472
|
}
|
|
20730
20473
|
}
|
|
@@ -20732,7 +20475,7 @@ export { generated };`;
|
|
|
20732
20475
|
if (!target) {
|
|
20733
20476
|
return {
|
|
20734
20477
|
ok: false,
|
|
20735
|
-
message:
|
|
20478
|
+
message: import_chalk10.default.red(
|
|
20736
20479
|
"Please specify a file or function to generate tests for"
|
|
20737
20480
|
)
|
|
20738
20481
|
};
|
|
@@ -20749,9 +20492,9 @@ describe("${target}", () => {
|
|
|
20749
20492
|
});`;
|
|
20750
20493
|
return {
|
|
20751
20494
|
ok: true,
|
|
20752
|
-
message:
|
|
20495
|
+
message: import_chalk10.default.green(`\u2705 Tests generated for ${target}:
|
|
20753
20496
|
|
|
20754
|
-
`) +
|
|
20497
|
+
`) + import_chalk10.default.gray("```typescript\n") + testCode + import_chalk10.default.gray("\n```"),
|
|
20755
20498
|
data: { testCode, framework, target }
|
|
20756
20499
|
};
|
|
20757
20500
|
}
|
|
@@ -20764,23 +20507,23 @@ describe("${target}", () => {
|
|
|
20764
20507
|
if (coverage) command += " --coverage";
|
|
20765
20508
|
return {
|
|
20766
20509
|
ok: true,
|
|
20767
|
-
message:
|
|
20768
|
-
`) +
|
|
20510
|
+
message: import_chalk10.default.cyan(`\u{1F9EA} Running tests...
|
|
20511
|
+
`) + import_chalk10.default.gray(`Command: ${command}
|
|
20769
20512
|
|
|
20770
|
-
`) +
|
|
20513
|
+
`) + import_chalk10.default.green("\u2705 All tests passed!"),
|
|
20771
20514
|
data: { command, passed: true }
|
|
20772
20515
|
};
|
|
20773
20516
|
}
|
|
20774
20517
|
async showCoverage(options) {
|
|
20775
20518
|
return {
|
|
20776
20519
|
ok: true,
|
|
20777
|
-
message:
|
|
20520
|
+
message: import_chalk10.default.cyan("\u{1F4CA} Test Coverage Report:\n\n") + import_chalk10.default.gray("File".padEnd(40) + "% Stmts".padEnd(10) + "% Lines\n") + import_chalk10.default.gray("-".repeat(60) + "\n") + import_chalk10.default.green(
|
|
20778
20521
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
20779
|
-
) +
|
|
20522
|
+
) + import_chalk10.default.green(
|
|
20780
20523
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
20781
|
-
) +
|
|
20524
|
+
) + import_chalk10.default.yellow(
|
|
20782
20525
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
20783
|
-
) +
|
|
20526
|
+
) + import_chalk10.default.gray("-".repeat(60) + "\n") + import_chalk10.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
20784
20527
|
};
|
|
20785
20528
|
}
|
|
20786
20529
|
};
|
|
@@ -20794,33 +20537,33 @@ describe("${target}", () => {
|
|
|
20794
20537
|
if (!file) {
|
|
20795
20538
|
return {
|
|
20796
20539
|
ok: false,
|
|
20797
|
-
message:
|
|
20540
|
+
message: import_chalk10.default.red("Please specify a file to review\n") + import_chalk10.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
20798
20541
|
};
|
|
20799
20542
|
}
|
|
20800
20543
|
const checkSecurity = args.includes("--security");
|
|
20801
20544
|
const checkPerformance = args.includes("--performance");
|
|
20802
|
-
let message =
|
|
20545
|
+
let message = import_chalk10.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
20803
20546
|
|
|
20804
20547
|
`);
|
|
20805
|
-
message +=
|
|
20806
|
-
message +=
|
|
20807
|
-
message +=
|
|
20808
|
-
message +=
|
|
20548
|
+
message += import_chalk10.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
20549
|
+
message += import_chalk10.default.gray(" 1. Line 42: ") + import_chalk10.default.yellow("Missing error handling in async function\n");
|
|
20550
|
+
message += import_chalk10.default.gray(" 2. Line 89: ") + import_chalk10.default.yellow("Potential memory leak - event listener not removed\n");
|
|
20551
|
+
message += import_chalk10.default.gray(" 3. Line 156: ") + import_chalk10.default.yellow(
|
|
20809
20552
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
20810
20553
|
);
|
|
20811
20554
|
if (checkSecurity) {
|
|
20812
|
-
message +=
|
|
20813
|
-
message +=
|
|
20555
|
+
message += import_chalk10.default.red("\u{1F512} Security Issues (1):\n");
|
|
20556
|
+
message += import_chalk10.default.gray(" 1. Line 67: ") + import_chalk10.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
20814
20557
|
}
|
|
20815
20558
|
if (checkPerformance) {
|
|
20816
|
-
message +=
|
|
20817
|
-
message +=
|
|
20818
|
-
message +=
|
|
20819
|
-
}
|
|
20820
|
-
message +=
|
|
20821
|
-
message +=
|
|
20822
|
-
message +=
|
|
20823
|
-
message +=
|
|
20559
|
+
message += import_chalk10.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
20560
|
+
message += import_chalk10.default.gray(" 1. Line 23: ") + import_chalk10.default.blue("Consider memoization for expensive calculation\n");
|
|
20561
|
+
message += import_chalk10.default.gray(" 2. Line 145: ") + import_chalk10.default.blue("Use virtualization for large list rendering\n\n");
|
|
20562
|
+
}
|
|
20563
|
+
message += import_chalk10.default.green("\u2705 Positive Findings:\n");
|
|
20564
|
+
message += import_chalk10.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
20565
|
+
message += import_chalk10.default.gray(" \u2022 Consistent code style\n");
|
|
20566
|
+
message += import_chalk10.default.gray(" \u2022 Well-documented functions\n");
|
|
20824
20567
|
return {
|
|
20825
20568
|
ok: true,
|
|
20826
20569
|
message,
|
|
@@ -20850,8 +20593,8 @@ describe("${target}", () => {
|
|
|
20850
20593
|
default:
|
|
20851
20594
|
return {
|
|
20852
20595
|
ok: false,
|
|
20853
|
-
message:
|
|
20854
|
-
`) +
|
|
20596
|
+
message: import_chalk10.default.red(`Unknown bug subcommand: ${subcommand}
|
|
20597
|
+
`) + import_chalk10.default.gray("Available: report, list, analyze")
|
|
20855
20598
|
};
|
|
20856
20599
|
}
|
|
20857
20600
|
}
|
|
@@ -20860,18 +20603,18 @@ describe("${target}", () => {
|
|
|
20860
20603
|
if (!description) {
|
|
20861
20604
|
return {
|
|
20862
20605
|
ok: false,
|
|
20863
|
-
message:
|
|
20606
|
+
message: import_chalk10.default.red("Please provide a bug description")
|
|
20864
20607
|
};
|
|
20865
20608
|
}
|
|
20866
20609
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
20867
20610
|
return {
|
|
20868
20611
|
ok: true,
|
|
20869
|
-
message:
|
|
20612
|
+
message: import_chalk10.default.green(`\u{1F41B} Bug reported successfully!
|
|
20870
20613
|
|
|
20871
|
-
`) +
|
|
20872
|
-
`) +
|
|
20873
|
-
`) +
|
|
20874
|
-
`) +
|
|
20614
|
+
`) + import_chalk10.default.cyan(`Bug ID: ${bugId}
|
|
20615
|
+
`) + import_chalk10.default.gray(`Description: ${description}
|
|
20616
|
+
`) + import_chalk10.default.gray(`Status: Open
|
|
20617
|
+
`) + import_chalk10.default.gray(`Priority: To be determined
|
|
20875
20618
|
`),
|
|
20876
20619
|
data: { bugId, description, status: "open" }
|
|
20877
20620
|
};
|
|
@@ -20879,23 +20622,23 @@ describe("${target}", () => {
|
|
|
20879
20622
|
async listBugs() {
|
|
20880
20623
|
return {
|
|
20881
20624
|
ok: true,
|
|
20882
|
-
message:
|
|
20625
|
+
message: import_chalk10.default.cyan("\u{1F41B} Active Bugs:\n\n") + import_chalk10.default.yellow("1. BUG-A1B2C3: ") + import_chalk10.default.gray("Session timeout not handled properly\n") + import_chalk10.default.yellow("2. BUG-D4E5F6: ") + import_chalk10.default.gray("Memory leak in streaming responses\n") + import_chalk10.default.yellow("3. BUG-G7H8I9: ") + import_chalk10.default.gray("Spinner not stopping on error\n\n") + import_chalk10.default.gray("Total: 3 open bugs")
|
|
20883
20626
|
};
|
|
20884
20627
|
}
|
|
20885
20628
|
async analyzeBug(bugId) {
|
|
20886
20629
|
if (!bugId) {
|
|
20887
20630
|
return {
|
|
20888
20631
|
ok: false,
|
|
20889
|
-
message:
|
|
20632
|
+
message: import_chalk10.default.red("Please provide a bug ID to analyze")
|
|
20890
20633
|
};
|
|
20891
20634
|
}
|
|
20892
20635
|
return {
|
|
20893
20636
|
ok: true,
|
|
20894
|
-
message:
|
|
20637
|
+
message: import_chalk10.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
20895
20638
|
|
|
20896
|
-
`) +
|
|
20639
|
+
`) + import_chalk10.default.yellow("Summary: ") + import_chalk10.default.gray("Session timeout not handled properly\n") + import_chalk10.default.yellow("Severity: ") + import_chalk10.default.orange("Medium\n") + import_chalk10.default.yellow("Component: ") + import_chalk10.default.gray("SessionManager\n") + import_chalk10.default.yellow("Reported: ") + import_chalk10.default.gray("2 days ago\n\n") + import_chalk10.default.cyan("Possible Causes:\n") + import_chalk10.default.gray(
|
|
20897
20640
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
20898
|
-
) +
|
|
20641
|
+
) + import_chalk10.default.gray(" 2. Deadline timer not cleared on completion\n") + import_chalk10.default.gray(" 3. Race condition in state transitions\n\n") + import_chalk10.default.green("Suggested Fix:\n") + import_chalk10.default.gray(" Ensure all async operations respect the AbortSignal\n") + import_chalk10.default.gray(" Add finally block to clear timers\n")
|
|
20899
20642
|
};
|
|
20900
20643
|
}
|
|
20901
20644
|
};
|
|
@@ -20909,11 +20652,11 @@ describe("${target}", () => {
|
|
|
20909
20652
|
});
|
|
20910
20653
|
|
|
20911
20654
|
// src/services/interactive-session/handlers/SystemHandlers.ts
|
|
20912
|
-
var
|
|
20655
|
+
var import_chalk11, os2, StatusHandler, ModelHandler, MemoryHandler, HealthHandler, DoctorHandler, SystemHandlers;
|
|
20913
20656
|
var init_SystemHandlers = __esm({
|
|
20914
20657
|
"src/services/interactive-session/handlers/SystemHandlers.ts"() {
|
|
20915
|
-
|
|
20916
|
-
|
|
20658
|
+
import_chalk11 = __toESM(require("chalk"), 1);
|
|
20659
|
+
os2 = __toESM(require("os"), 1);
|
|
20917
20660
|
StatusHandler = class {
|
|
20918
20661
|
name = "/status";
|
|
20919
20662
|
description = "Show current system and session status";
|
|
@@ -20923,7 +20666,7 @@ var init_SystemHandlers = __esm({
|
|
|
20923
20666
|
if (signal?.aborted) {
|
|
20924
20667
|
return {
|
|
20925
20668
|
ok: false,
|
|
20926
|
-
message:
|
|
20669
|
+
message: import_chalk11.default.yellow("Status check canceled")
|
|
20927
20670
|
};
|
|
20928
20671
|
}
|
|
20929
20672
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -20931,47 +20674,47 @@ var init_SystemHandlers = __esm({
|
|
|
20931
20674
|
system: "operational",
|
|
20932
20675
|
uptime: process.uptime(),
|
|
20933
20676
|
memory: process.memoryUsage(),
|
|
20934
|
-
cpu:
|
|
20677
|
+
cpu: os2.cpus()[0],
|
|
20935
20678
|
platform: process.platform
|
|
20936
20679
|
};
|
|
20937
|
-
let message =
|
|
20938
|
-
message +=
|
|
20939
|
-
message +=
|
|
20680
|
+
let message = import_chalk11.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
20681
|
+
message += import_chalk11.default.green("\u2705 System: Operational\n");
|
|
20682
|
+
message += import_chalk11.default.gray(
|
|
20940
20683
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
20941
20684
|
`
|
|
20942
20685
|
);
|
|
20943
|
-
message +=
|
|
20686
|
+
message += import_chalk11.default.gray(
|
|
20944
20687
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20945
20688
|
`
|
|
20946
20689
|
);
|
|
20947
20690
|
if (verbose) {
|
|
20948
|
-
message +=
|
|
20949
|
-
message +=
|
|
20691
|
+
message += import_chalk11.default.gray("\nDetailed Information:\n");
|
|
20692
|
+
message += import_chalk11.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
20950
20693
|
`);
|
|
20951
|
-
message +=
|
|
20952
|
-
` \u2022 Platform: ${status.platform} (${
|
|
20694
|
+
message += import_chalk11.default.gray(
|
|
20695
|
+
` \u2022 Platform: ${status.platform} (${os2.arch()})
|
|
20953
20696
|
`
|
|
20954
20697
|
);
|
|
20955
|
-
message +=
|
|
20698
|
+
message += import_chalk11.default.gray(` \u2022 Node.js: ${process.version}
|
|
20956
20699
|
`);
|
|
20957
|
-
message +=
|
|
20700
|
+
message += import_chalk11.default.gray(` \u2022 Process ID: ${process.pid}
|
|
20958
20701
|
`);
|
|
20959
|
-
message +=
|
|
20702
|
+
message += import_chalk11.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
20960
20703
|
`);
|
|
20961
|
-
message +=
|
|
20962
|
-
message +=
|
|
20704
|
+
message += import_chalk11.default.gray("\nMemory Details:\n");
|
|
20705
|
+
message += import_chalk11.default.gray(
|
|
20963
20706
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
20964
20707
|
`
|
|
20965
20708
|
);
|
|
20966
|
-
message +=
|
|
20709
|
+
message += import_chalk11.default.gray(
|
|
20967
20710
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
20968
20711
|
`
|
|
20969
20712
|
);
|
|
20970
|
-
message +=
|
|
20713
|
+
message += import_chalk11.default.gray(
|
|
20971
20714
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20972
20715
|
`
|
|
20973
20716
|
);
|
|
20974
|
-
message +=
|
|
20717
|
+
message += import_chalk11.default.gray(
|
|
20975
20718
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
20976
20719
|
`
|
|
20977
20720
|
);
|
|
@@ -21000,7 +20743,7 @@ var init_SystemHandlers = __esm({
|
|
|
21000
20743
|
if (signal?.aborted) {
|
|
21001
20744
|
return {
|
|
21002
20745
|
ok: false,
|
|
21003
|
-
message:
|
|
20746
|
+
message: import_chalk11.default.yellow("Model operation canceled")
|
|
21004
20747
|
};
|
|
21005
20748
|
}
|
|
21006
20749
|
if (args.length === 0) {
|
|
@@ -21020,17 +20763,17 @@ var init_SystemHandlers = __esm({
|
|
|
21020
20763
|
}
|
|
21021
20764
|
}
|
|
21022
20765
|
async listModels() {
|
|
21023
|
-
let message =
|
|
21024
|
-
message +=
|
|
20766
|
+
let message = import_chalk11.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
20767
|
+
message += import_chalk11.default.green(`Current: ${this.currentModel}
|
|
21025
20768
|
|
|
21026
20769
|
`);
|
|
21027
20770
|
for (const model of this.availableModels) {
|
|
21028
|
-
const status = model.available ?
|
|
21029
|
-
const name2 = model.id === this.currentModel ?
|
|
21030
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
20771
|
+
const status = model.available ? import_chalk11.default.green("\u2705") : import_chalk11.default.red("\u274C");
|
|
20772
|
+
const name2 = model.id === this.currentModel ? import_chalk11.default.green.bold(model.id) : import_chalk11.default.cyan(model.id);
|
|
20773
|
+
message += `${status} ${name2.padEnd(20)} ${import_chalk11.default.gray(`[${model.provider}]`)}
|
|
21031
20774
|
`;
|
|
21032
20775
|
}
|
|
21033
|
-
message +=
|
|
20776
|
+
message += import_chalk11.default.gray("\nUse /model <name> to switch models");
|
|
21034
20777
|
return {
|
|
21035
20778
|
ok: true,
|
|
21036
20779
|
message,
|
|
@@ -21041,27 +20784,27 @@ var init_SystemHandlers = __esm({
|
|
|
21041
20784
|
if (!modelId) {
|
|
21042
20785
|
return {
|
|
21043
20786
|
ok: false,
|
|
21044
|
-
message:
|
|
20787
|
+
message: import_chalk11.default.red("Please specify a model to switch to")
|
|
21045
20788
|
};
|
|
21046
20789
|
}
|
|
21047
20790
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
21048
20791
|
if (!model) {
|
|
21049
20792
|
return {
|
|
21050
20793
|
ok: false,
|
|
21051
|
-
message:
|
|
21052
|
-
`) +
|
|
20794
|
+
message: import_chalk11.default.red(`Unknown model: ${modelId}
|
|
20795
|
+
`) + import_chalk11.default.gray("Use /model list to see available models")
|
|
21053
20796
|
};
|
|
21054
20797
|
}
|
|
21055
20798
|
if (!model.available) {
|
|
21056
20799
|
return {
|
|
21057
20800
|
ok: false,
|
|
21058
|
-
message:
|
|
20801
|
+
message: import_chalk11.default.yellow(`Model ${modelId} is not currently available`)
|
|
21059
20802
|
};
|
|
21060
20803
|
}
|
|
21061
20804
|
this.currentModel = modelId;
|
|
21062
20805
|
return {
|
|
21063
20806
|
ok: true,
|
|
21064
|
-
message:
|
|
20807
|
+
message: import_chalk11.default.green(`\u2705 Switched to ${modelId}`),
|
|
21065
20808
|
data: { model: modelId }
|
|
21066
20809
|
};
|
|
21067
20810
|
}
|
|
@@ -21070,27 +20813,27 @@ var init_SystemHandlers = __esm({
|
|
|
21070
20813
|
if (!model) {
|
|
21071
20814
|
return {
|
|
21072
20815
|
ok: false,
|
|
21073
|
-
message:
|
|
20816
|
+
message: import_chalk11.default.red(`Unknown model: ${modelId}`)
|
|
21074
20817
|
};
|
|
21075
20818
|
}
|
|
21076
|
-
let message =
|
|
20819
|
+
let message = import_chalk11.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
21077
20820
|
|
|
21078
20821
|
`);
|
|
21079
|
-
message +=
|
|
20822
|
+
message += import_chalk11.default.gray(`Provider: ${model.provider}
|
|
21080
20823
|
`);
|
|
21081
|
-
message +=
|
|
20824
|
+
message += import_chalk11.default.gray(
|
|
21082
20825
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
21083
20826
|
`
|
|
21084
20827
|
);
|
|
21085
|
-
message +=
|
|
20828
|
+
message += import_chalk11.default.gray(
|
|
21086
20829
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
21087
20830
|
`
|
|
21088
20831
|
);
|
|
21089
|
-
message +=
|
|
21090
|
-
message +=
|
|
21091
|
-
message +=
|
|
21092
|
-
message +=
|
|
21093
|
-
message +=
|
|
20832
|
+
message += import_chalk11.default.gray("\nCapabilities:\n");
|
|
20833
|
+
message += import_chalk11.default.gray(" \u2022 Context: 128K tokens\n");
|
|
20834
|
+
message += import_chalk11.default.gray(" \u2022 Languages: 95+\n");
|
|
20835
|
+
message += import_chalk11.default.gray(" \u2022 Code: Yes\n");
|
|
20836
|
+
message += import_chalk11.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
21094
20837
|
return {
|
|
21095
20838
|
ok: true,
|
|
21096
20839
|
message,
|
|
@@ -21122,39 +20865,39 @@ var init_SystemHandlers = __esm({
|
|
|
21122
20865
|
default:
|
|
21123
20866
|
return {
|
|
21124
20867
|
ok: false,
|
|
21125
|
-
message:
|
|
21126
|
-
`) +
|
|
20868
|
+
message: import_chalk11.default.red(`Unknown memory subcommand: ${subcommand}
|
|
20869
|
+
`) + import_chalk11.default.gray("Available: status, clear, export, compact")
|
|
21127
20870
|
};
|
|
21128
20871
|
}
|
|
21129
20872
|
}
|
|
21130
20873
|
async showStatus() {
|
|
21131
|
-
let message =
|
|
21132
|
-
message +=
|
|
21133
|
-
message +=
|
|
20874
|
+
let message = import_chalk11.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
20875
|
+
message += import_chalk11.default.yellow("System 1 (Fast):\n");
|
|
20876
|
+
message += import_chalk11.default.gray(
|
|
21134
20877
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
21135
20878
|
`
|
|
21136
20879
|
);
|
|
21137
|
-
message +=
|
|
20880
|
+
message += import_chalk11.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
21138
20881
|
|
|
21139
20882
|
`);
|
|
21140
|
-
message +=
|
|
21141
|
-
message +=
|
|
20883
|
+
message += import_chalk11.default.blue("System 2 (Deep):\n");
|
|
20884
|
+
message += import_chalk11.default.gray(
|
|
21142
20885
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
21143
20886
|
`
|
|
21144
20887
|
);
|
|
21145
|
-
message +=
|
|
20888
|
+
message += import_chalk11.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
21146
20889
|
|
|
21147
20890
|
`);
|
|
21148
|
-
message +=
|
|
21149
|
-
message +=
|
|
20891
|
+
message += import_chalk11.default.green("Total:\n");
|
|
20892
|
+
message += import_chalk11.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
21150
20893
|
`);
|
|
21151
|
-
message +=
|
|
20894
|
+
message += import_chalk11.default.gray(
|
|
21152
20895
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
21153
20896
|
`
|
|
21154
20897
|
);
|
|
21155
20898
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
21156
20899
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
21157
|
-
message +=
|
|
20900
|
+
message += import_chalk11.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
21158
20901
|
`);
|
|
21159
20902
|
return {
|
|
21160
20903
|
ok: true,
|
|
@@ -21168,14 +20911,14 @@ var init_SystemHandlers = __esm({
|
|
|
21168
20911
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
21169
20912
|
return {
|
|
21170
20913
|
ok: true,
|
|
21171
|
-
message:
|
|
20914
|
+
message: import_chalk11.default.green("\u2705 System 1 memory cleared")
|
|
21172
20915
|
};
|
|
21173
20916
|
}
|
|
21174
20917
|
if (system === "system2") {
|
|
21175
20918
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
21176
20919
|
return {
|
|
21177
20920
|
ok: true,
|
|
21178
|
-
message:
|
|
20921
|
+
message: import_chalk11.default.green("\u2705 System 2 memory cleared")
|
|
21179
20922
|
};
|
|
21180
20923
|
}
|
|
21181
20924
|
this.memoryStats = {
|
|
@@ -21185,15 +20928,15 @@ var init_SystemHandlers = __esm({
|
|
|
21185
20928
|
};
|
|
21186
20929
|
return {
|
|
21187
20930
|
ok: true,
|
|
21188
|
-
message:
|
|
20931
|
+
message: import_chalk11.default.green("\u{1F9F9} All memory cleared")
|
|
21189
20932
|
};
|
|
21190
20933
|
}
|
|
21191
20934
|
async exportMemory() {
|
|
21192
20935
|
const filename = `memory-export-${Date.now()}.json`;
|
|
21193
20936
|
return {
|
|
21194
20937
|
ok: true,
|
|
21195
|
-
message:
|
|
21196
|
-
`) +
|
|
20938
|
+
message: import_chalk11.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
20939
|
+
`) + import_chalk11.default.gray(
|
|
21197
20940
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
21198
20941
|
),
|
|
21199
20942
|
data: { filename, stats: this.memoryStats }
|
|
@@ -21211,9 +20954,9 @@ var init_SystemHandlers = __esm({
|
|
|
21211
20954
|
);
|
|
21212
20955
|
return {
|
|
21213
20956
|
ok: true,
|
|
21214
|
-
message:
|
|
21215
|
-
`) +
|
|
21216
|
-
`) +
|
|
20957
|
+
message: import_chalk11.default.green("\u2728 Memory compacted successfully\n") + import_chalk11.default.gray(`Before: ${before} tokens
|
|
20958
|
+
`) + import_chalk11.default.gray(`After: ${after} tokens
|
|
20959
|
+
`) + import_chalk11.default.gray(
|
|
21217
20960
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
21218
20961
|
),
|
|
21219
20962
|
data: { before, after, saved: before - after }
|
|
@@ -21229,11 +20972,11 @@ var init_SystemHandlers = __esm({
|
|
|
21229
20972
|
if (signal?.aborted) {
|
|
21230
20973
|
return {
|
|
21231
20974
|
ok: false,
|
|
21232
|
-
message:
|
|
20975
|
+
message: import_chalk11.default.yellow("Health check canceled")
|
|
21233
20976
|
};
|
|
21234
20977
|
}
|
|
21235
20978
|
const detailed = args.includes("--detailed");
|
|
21236
|
-
let message =
|
|
20979
|
+
let message = import_chalk11.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
21237
20980
|
const checks = [
|
|
21238
20981
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
21239
20982
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -21242,11 +20985,11 @@ var init_SystemHandlers = __esm({
|
|
|
21242
20985
|
{ name: "Network", status: "warning", latency: 250 }
|
|
21243
20986
|
];
|
|
21244
20987
|
for (const check of checks) {
|
|
21245
|
-
const icon = check.status === "ok" ?
|
|
21246
|
-
const status = check.status === "ok" ?
|
|
20988
|
+
const icon = check.status === "ok" ? import_chalk11.default.green("\u2705") : check.status === "warning" ? import_chalk11.default.yellow("\u26A0\uFE0F") : import_chalk11.default.red("\u274C");
|
|
20989
|
+
const status = check.status === "ok" ? import_chalk11.default.green("OK") : check.status === "warning" ? import_chalk11.default.yellow("WARNING") : import_chalk11.default.red("ERROR");
|
|
21247
20990
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
21248
20991
|
if (detailed) {
|
|
21249
|
-
message +=
|
|
20992
|
+
message += import_chalk11.default.gray(` (${check.latency}ms)`);
|
|
21250
20993
|
}
|
|
21251
20994
|
message += "\n";
|
|
21252
20995
|
}
|
|
@@ -21254,11 +20997,11 @@ var init_SystemHandlers = __esm({
|
|
|
21254
20997
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
21255
20998
|
message += "\n";
|
|
21256
20999
|
if (hasErrors) {
|
|
21257
|
-
message +=
|
|
21000
|
+
message += import_chalk11.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
21258
21001
|
} else if (hasWarnings) {
|
|
21259
|
-
message +=
|
|
21002
|
+
message += import_chalk11.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
21260
21003
|
} else {
|
|
21261
|
-
message +=
|
|
21004
|
+
message += import_chalk11.default.green("\u2705 All systems operational");
|
|
21262
21005
|
}
|
|
21263
21006
|
return {
|
|
21264
21007
|
ok: true,
|
|
@@ -21276,12 +21019,12 @@ var init_SystemHandlers = __esm({
|
|
|
21276
21019
|
if (signal?.aborted) {
|
|
21277
21020
|
return {
|
|
21278
21021
|
ok: false,
|
|
21279
|
-
message:
|
|
21022
|
+
message: import_chalk11.default.yellow("Doctor check canceled")
|
|
21280
21023
|
};
|
|
21281
21024
|
}
|
|
21282
21025
|
const autoFix = args.includes("--fix");
|
|
21283
|
-
let message =
|
|
21284
|
-
message +=
|
|
21026
|
+
let message = import_chalk11.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
21027
|
+
message += import_chalk11.default.gray("Running diagnostics...\n\n");
|
|
21285
21028
|
const issues = [
|
|
21286
21029
|
{
|
|
21287
21030
|
severity: "warning",
|
|
@@ -21303,20 +21046,20 @@ var init_SystemHandlers = __esm({
|
|
|
21303
21046
|
}
|
|
21304
21047
|
];
|
|
21305
21048
|
if (issues.length === 0) {
|
|
21306
|
-
message +=
|
|
21049
|
+
message += import_chalk11.default.green("\u2705 No issues found - system is healthy!");
|
|
21307
21050
|
return { ok: true, message };
|
|
21308
21051
|
}
|
|
21309
|
-
message +=
|
|
21052
|
+
message += import_chalk11.default.yellow(`Found ${issues.length} issue(s):
|
|
21310
21053
|
|
|
21311
21054
|
`);
|
|
21312
21055
|
for (const issue of issues) {
|
|
21313
|
-
const icon = issue.severity === "error" ?
|
|
21056
|
+
const icon = issue.severity === "error" ? import_chalk11.default.red("\u274C") : issue.severity === "warning" ? import_chalk11.default.yellow("\u26A0\uFE0F") : import_chalk11.default.blue("\u2139\uFE0F");
|
|
21314
21057
|
message += `${icon} ${issue.issue}
|
|
21315
21058
|
`;
|
|
21316
|
-
message +=
|
|
21059
|
+
message += import_chalk11.default.gray(` Solution: ${issue.solution}
|
|
21317
21060
|
`);
|
|
21318
21061
|
if (autoFix && issue.fixable) {
|
|
21319
|
-
message +=
|
|
21062
|
+
message += import_chalk11.default.green(` \u2705 Auto-fixed
|
|
21320
21063
|
`);
|
|
21321
21064
|
}
|
|
21322
21065
|
message += "\n";
|
|
@@ -21324,7 +21067,7 @@ var init_SystemHandlers = __esm({
|
|
|
21324
21067
|
if (!autoFix) {
|
|
21325
21068
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
21326
21069
|
if (fixableCount > 0) {
|
|
21327
|
-
message +=
|
|
21070
|
+
message += import_chalk11.default.gray(
|
|
21328
21071
|
`
|
|
21329
21072
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
21330
21073
|
);
|
|
@@ -21767,7 +21510,7 @@ var init_package = __esm({
|
|
|
21767
21510
|
"package.json"() {
|
|
21768
21511
|
package_default = {
|
|
21769
21512
|
name: "@bonginkan/maria",
|
|
21770
|
-
version: "4.2.
|
|
21513
|
+
version: "4.2.4",
|
|
21771
21514
|
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.",
|
|
21772
21515
|
keywords: [
|
|
21773
21516
|
"ai",
|
|
@@ -22319,10 +22062,10 @@ function showCodeGenerationAnimation() {
|
|
|
22319
22062
|
};
|
|
22320
22063
|
return animation;
|
|
22321
22064
|
}
|
|
22322
|
-
var
|
|
22065
|
+
var import_chalk12, ThinkingAnimation, ProcessAnimation, CodeGenerationAnimation, LoadingDots, BrainAnimation, ProgressBar, StreamingOutput;
|
|
22323
22066
|
var init_animations = __esm({
|
|
22324
22067
|
"src/utils/animations.ts"() {
|
|
22325
|
-
|
|
22068
|
+
import_chalk12 = __toESM(require("chalk"), 1);
|
|
22326
22069
|
ThinkingAnimation = class {
|
|
22327
22070
|
frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
22328
22071
|
currentFrame = 0;
|
|
@@ -22334,7 +22077,7 @@ var init_animations = __esm({
|
|
|
22334
22077
|
start() {
|
|
22335
22078
|
this.interval = setInterval(() => {
|
|
22336
22079
|
process.stdout.write(
|
|
22337
|
-
`\r${
|
|
22080
|
+
`\r${import_chalk12.default.cyan(this.frames[this.currentFrame])} ${import_chalk12.default.gray(this.message)}...`
|
|
22338
22081
|
);
|
|
22339
22082
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22340
22083
|
}, 80);
|
|
@@ -22372,7 +22115,7 @@ var init_animations = __esm({
|
|
|
22372
22115
|
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
22373
22116
|
const stage = this.stages[this.currentStage];
|
|
22374
22117
|
process.stdout.write(
|
|
22375
|
-
`\r${
|
|
22118
|
+
`\r${import_chalk12.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage.icon} ${import_chalk12.default.gray(stage.message)}... ${import_chalk12.default.dim(`[${elapsed}s]`)}`
|
|
22376
22119
|
);
|
|
22377
22120
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
22378
22121
|
}, 80);
|
|
@@ -22434,11 +22177,11 @@ var init_animations = __esm({
|
|
|
22434
22177
|
const stage = stages[this.currentStage];
|
|
22435
22178
|
if (this.isComplex) {
|
|
22436
22179
|
process.stdout.write(
|
|
22437
|
-
`\r${
|
|
22180
|
+
`\r${import_chalk12.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage} ${import_chalk12.default.dim(`[${elapsed}s]`)}`
|
|
22438
22181
|
);
|
|
22439
22182
|
} else {
|
|
22440
22183
|
process.stdout.write(
|
|
22441
|
-
`\r${
|
|
22184
|
+
`\r${import_chalk12.default.cyan(this.spinnerFrames[this.currentFrame])} ${import_chalk12.default.gray(stage)}...`
|
|
22442
22185
|
);
|
|
22443
22186
|
}
|
|
22444
22187
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
@@ -22481,7 +22224,7 @@ var init_animations = __esm({
|
|
|
22481
22224
|
start() {
|
|
22482
22225
|
this.interval = setInterval(() => {
|
|
22483
22226
|
process.stdout.write(
|
|
22484
|
-
`\r${
|
|
22227
|
+
`\r${import_chalk12.default.cyan(this.message)}${this.dots[this.currentDot]}`
|
|
22485
22228
|
);
|
|
22486
22229
|
this.currentDot = (this.currentDot + 1) % this.dots.length;
|
|
22487
22230
|
}, 300);
|
|
@@ -22510,7 +22253,7 @@ var init_animations = __esm({
|
|
|
22510
22253
|
const frame = this.frames[this.currentFrame];
|
|
22511
22254
|
const message = this.messages[this.currentFrame];
|
|
22512
22255
|
process.stdout.write(
|
|
22513
|
-
`\r${frame} ${
|
|
22256
|
+
`\r${frame} ${import_chalk12.default.cyan(message)}...`
|
|
22514
22257
|
);
|
|
22515
22258
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22516
22259
|
}, 1e3);
|
|
@@ -22538,7 +22281,7 @@ var init_animations = __esm({
|
|
|
22538
22281
|
const percentage = Math.floor(this.current / this.total * 100);
|
|
22539
22282
|
const filled = Math.floor(this.current / this.total * this.width);
|
|
22540
22283
|
const empty = this.width - filled;
|
|
22541
|
-
const bar =
|
|
22284
|
+
const bar = import_chalk12.default.green("\u2588").repeat(filled) + import_chalk12.default.gray("\u2591").repeat(empty);
|
|
22542
22285
|
process.stdout.write(`\r${this.label}: [${bar}] ${percentage}%`);
|
|
22543
22286
|
if (this.current >= this.total) {
|
|
22544
22287
|
process.stdout.write("\n");
|
|
@@ -23298,7 +23041,7 @@ function withAuth(fn) {
|
|
|
23298
23041
|
try {
|
|
23299
23042
|
const tokens = await authManager.getValidTokens();
|
|
23300
23043
|
if (!tokens) {
|
|
23301
|
-
console.log(
|
|
23044
|
+
console.log(import_chalk13.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23302
23045
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23303
23046
|
}
|
|
23304
23047
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -23307,39 +23050,39 @@ function withAuth(fn) {
|
|
|
23307
23050
|
return await fn(...args);
|
|
23308
23051
|
} catch (error2) {
|
|
23309
23052
|
if (error2.code === "AUTH_REQUIRED") {
|
|
23310
|
-
console.log(
|
|
23053
|
+
console.log(import_chalk13.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23311
23054
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23312
23055
|
}
|
|
23313
23056
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
23314
|
-
console.log(
|
|
23057
|
+
console.log(import_chalk13.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
23315
23058
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
23316
23059
|
}
|
|
23317
23060
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
23318
|
-
console.log(
|
|
23061
|
+
console.log(import_chalk13.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
23319
23062
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
23320
23063
|
}
|
|
23321
23064
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
23322
|
-
console.log(
|
|
23065
|
+
console.log(import_chalk13.default.yellow("\u{1F512} Not available in current plan"));
|
|
23323
23066
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
23324
23067
|
}
|
|
23325
23068
|
if (error2.code === "RATE_LIMITED") {
|
|
23326
23069
|
const retryAfter = error2.retryAfter || 5;
|
|
23327
|
-
console.log(
|
|
23070
|
+
console.log(import_chalk13.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
23328
23071
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
23329
23072
|
}
|
|
23330
23073
|
if (error2.code === "NETWORK_ERROR") {
|
|
23331
|
-
console.log(
|
|
23074
|
+
console.log(import_chalk13.default.red("\u{1F310} Network error, check connection"));
|
|
23332
23075
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
23333
23076
|
}
|
|
23334
23077
|
throw error2;
|
|
23335
23078
|
}
|
|
23336
23079
|
};
|
|
23337
23080
|
}
|
|
23338
|
-
var
|
|
23081
|
+
var import_chalk13, AUTH_EXIT_CODES, AUTH_EXEMPT_COMMANDS;
|
|
23339
23082
|
var init_withAuth = __esm({
|
|
23340
23083
|
"src/services/cli-auth/withAuth.ts"() {
|
|
23341
23084
|
init_AuthenticationManager();
|
|
23342
|
-
|
|
23085
|
+
import_chalk13 = __toESM(require("chalk"), 1);
|
|
23343
23086
|
AUTH_EXIT_CODES = {
|
|
23344
23087
|
AUTH_REQUIRED: 2,
|
|
23345
23088
|
REAUTH_REQUIRED: 2,
|
|
@@ -23562,19 +23305,19 @@ var conversation_persistence_exports = {};
|
|
|
23562
23305
|
__export(conversation_persistence_exports, {
|
|
23563
23306
|
ConversationPersistence: () => ConversationPersistence
|
|
23564
23307
|
});
|
|
23565
|
-
var import_fs3, path6,
|
|
23308
|
+
var import_fs3, path6, os4, ConversationPersistence;
|
|
23566
23309
|
var init_conversation_persistence = __esm({
|
|
23567
23310
|
"src/services/conversation-persistence.ts"() {
|
|
23568
23311
|
import_fs3 = require("fs");
|
|
23569
23312
|
path6 = __toESM(require("path"), 1);
|
|
23570
|
-
|
|
23313
|
+
os4 = __toESM(require("os"), 1);
|
|
23571
23314
|
ConversationPersistence = class {
|
|
23572
23315
|
sessionFile;
|
|
23573
23316
|
maxHistorySize;
|
|
23574
23317
|
autoSaveInterval = null;
|
|
23575
23318
|
pendingWrites = [];
|
|
23576
23319
|
constructor(maxHistorySize = 100) {
|
|
23577
|
-
const configDir = path6.join(
|
|
23320
|
+
const configDir = path6.join(os4.homedir(), ".maria");
|
|
23578
23321
|
this.sessionFile = path6.join(configDir, "conversation-history.json");
|
|
23579
23322
|
this.maxHistorySize = maxHistorySize;
|
|
23580
23323
|
this.ensureConfigDir();
|
|
@@ -26763,10 +26506,10 @@ var init_command_groups = __esm({
|
|
|
26763
26506
|
});
|
|
26764
26507
|
|
|
26765
26508
|
// src/services/autocomplete-dropdown.ts
|
|
26766
|
-
var
|
|
26509
|
+
var import_chalk14, AutocompleteDropdown;
|
|
26767
26510
|
var init_autocomplete_dropdown = __esm({
|
|
26768
26511
|
"src/services/autocomplete-dropdown.ts"() {
|
|
26769
|
-
|
|
26512
|
+
import_chalk14 = __toESM(require("chalk"), 1);
|
|
26770
26513
|
AutocompleteDropdown = class {
|
|
26771
26514
|
suggestions = [];
|
|
26772
26515
|
selectedIndex = 0;
|
|
@@ -26846,21 +26589,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
26846
26589
|
process.stdout.write("\x1B[s");
|
|
26847
26590
|
process.stdout.write("\n");
|
|
26848
26591
|
process.stdout.write(
|
|
26849
|
-
"\x1B[K" +
|
|
26592
|
+
"\x1B[K" + import_chalk14.default.white(
|
|
26850
26593
|
"\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"
|
|
26851
26594
|
) + "\n"
|
|
26852
26595
|
);
|
|
26853
26596
|
this.suggestions.forEach((suggestion, index) => {
|
|
26854
26597
|
const isSelected = index === this.selectedIndex;
|
|
26855
|
-
const prefix = isSelected ?
|
|
26856
|
-
const nameStyle = isSelected ?
|
|
26598
|
+
const prefix = isSelected ? import_chalk14.default.cyan("\u25BA ") : " ";
|
|
26599
|
+
const nameStyle = isSelected ? import_chalk14.default.inverse : (s2) => s2;
|
|
26857
26600
|
const displayName = suggestion.name.padEnd(20);
|
|
26858
26601
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
26859
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
26602
|
+
const line = `\u2502${prefix}${nameStyle(import_chalk14.default.white(displayName) + " " + import_chalk14.default.gray(displayDesc))} \u2502`;
|
|
26860
26603
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
26861
26604
|
});
|
|
26862
26605
|
process.stdout.write(
|
|
26863
|
-
"\x1B[K" +
|
|
26606
|
+
"\x1B[K" + import_chalk14.default.white(
|
|
26864
26607
|
"\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"
|
|
26865
26608
|
) + "\n"
|
|
26866
26609
|
);
|
|
@@ -26898,11 +26641,11 @@ var interactive_cli_exports = {};
|
|
|
26898
26641
|
__export(interactive_cli_exports, {
|
|
26899
26642
|
InteractiveCLI: () => InteractiveCLI
|
|
26900
26643
|
});
|
|
26901
|
-
var readline3,
|
|
26644
|
+
var readline3, import_chalk15, import_promises2, import_path3, import_os2, InteractiveCLI;
|
|
26902
26645
|
var init_interactive_cli = __esm({
|
|
26903
26646
|
"src/services/interactive-cli.ts"() {
|
|
26904
26647
|
readline3 = __toESM(require("readline"), 1);
|
|
26905
|
-
|
|
26648
|
+
import_chalk15 = __toESM(require("chalk"), 1);
|
|
26906
26649
|
init_command_groups();
|
|
26907
26650
|
init_autocomplete_dropdown();
|
|
26908
26651
|
init_defaults();
|
|
@@ -27201,7 +26944,7 @@ var init_interactive_cli = __esm({
|
|
|
27201
26944
|
}
|
|
27202
26945
|
readline3.cursorTo(process.stdout, 0);
|
|
27203
26946
|
readline3.clearLine(process.stdout, 0);
|
|
27204
|
-
const prompt =
|
|
26947
|
+
const prompt = import_chalk15.default.cyan("> ");
|
|
27205
26948
|
const displayInput = this.currentInput;
|
|
27206
26949
|
process.stdout.write(prompt + displayInput);
|
|
27207
26950
|
const promptLength = 2;
|
|
@@ -27221,9 +26964,9 @@ var init_interactive_cli = __esm({
|
|
|
27221
26964
|
readline3.moveCursor(process.stdout, 0, 2);
|
|
27222
26965
|
this.suggestions.forEach((suggestion, index) => {
|
|
27223
26966
|
const isSelected = index === this.selectedIndex;
|
|
27224
|
-
const prefix = isSelected ?
|
|
27225
|
-
const nameStyle = isSelected ?
|
|
27226
|
-
const descStyle = isSelected ?
|
|
26967
|
+
const prefix = isSelected ? import_chalk15.default.cyan("\u25BA ") : " ";
|
|
26968
|
+
const nameStyle = isSelected ? import_chalk15.default.inverse.white : import_chalk15.default.white;
|
|
26969
|
+
const descStyle = isSelected ? import_chalk15.default.inverse.gray : import_chalk15.default.gray;
|
|
27227
26970
|
const name2 = suggestion.name.padEnd(15);
|
|
27228
26971
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
27229
26972
|
readline3.cursorTo(process.stdout, 0);
|
|
@@ -27244,20 +26987,20 @@ var init_interactive_cli = __esm({
|
|
|
27244
26987
|
const promptLength = 2;
|
|
27245
26988
|
const savedX = this.cursorPosition + promptLength;
|
|
27246
26989
|
process.stdout.write("\n");
|
|
27247
|
-
process.stdout.write(
|
|
26990
|
+
process.stdout.write(import_chalk15.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
27248
26991
|
this.suggestions.forEach((suggestion, index) => {
|
|
27249
26992
|
const isSelected = index === this.selectedIndex;
|
|
27250
|
-
const prefix = isSelected ?
|
|
27251
|
-
const nameStyle = isSelected ?
|
|
27252
|
-
const descStyle = isSelected ?
|
|
26993
|
+
const prefix = isSelected ? import_chalk15.default.cyan("\u25BA ") : " ";
|
|
26994
|
+
const nameStyle = isSelected ? import_chalk15.default.inverse.white : import_chalk15.default.white;
|
|
26995
|
+
const descStyle = isSelected ? import_chalk15.default.inverse.gray : import_chalk15.default.gray;
|
|
27253
26996
|
const name2 = suggestion.name.padEnd(15);
|
|
27254
26997
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
27255
26998
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
27256
26999
|
`);
|
|
27257
27000
|
});
|
|
27258
|
-
process.stdout.write(
|
|
27001
|
+
process.stdout.write(import_chalk15.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"));
|
|
27259
27002
|
process.stdout.write(
|
|
27260
|
-
|
|
27003
|
+
import_chalk15.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
27261
27004
|
);
|
|
27262
27005
|
const totalLines = this.suggestions.length + 4;
|
|
27263
27006
|
readline3.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -27720,15 +27463,15 @@ ${this.description}
|
|
|
27720
27463
|
});
|
|
27721
27464
|
|
|
27722
27465
|
// src/services/memory-system/quick-persistence.ts
|
|
27723
|
-
var fs8, fsp,
|
|
27466
|
+
var fs8, fsp, os6, path8, import_crypto5, DIR, FILE, QuickPersistence;
|
|
27724
27467
|
var init_quick_persistence = __esm({
|
|
27725
27468
|
"src/services/memory-system/quick-persistence.ts"() {
|
|
27726
27469
|
fs8 = __toESM(require("fs"), 1);
|
|
27727
27470
|
fsp = __toESM(require("fs/promises"), 1);
|
|
27728
|
-
|
|
27471
|
+
os6 = __toESM(require("os"), 1);
|
|
27729
27472
|
path8 = __toESM(require("path"), 1);
|
|
27730
27473
|
import_crypto5 = require("crypto");
|
|
27731
|
-
DIR = path8.join(
|
|
27474
|
+
DIR = path8.join(os6.homedir(), ".maria", "memory");
|
|
27732
27475
|
FILE = path8.join(DIR, "memories.jsonl");
|
|
27733
27476
|
QuickPersistence = class {
|
|
27734
27477
|
static async init() {
|
|
@@ -27851,7 +27594,7 @@ var init_quick_persistence = __esm({
|
|
|
27851
27594
|
const mine = rows.filter((r2) => r2.userId === userId);
|
|
27852
27595
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
27853
27596
|
const filename = `maria-memory-export-${timestamp}.${format}`;
|
|
27854
|
-
const exportDir = path8.join(
|
|
27597
|
+
const exportDir = path8.join(os6.homedir(), ".maria", "exports");
|
|
27855
27598
|
const exportPath = path8.join(exportDir, filename);
|
|
27856
27599
|
await fsp.mkdir(exportDir, { recursive: true });
|
|
27857
27600
|
if (format === "jsonl") {
|
|
@@ -27969,7 +27712,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
27969
27712
|
this.httpEndpoint = process.env.TELEMETRY_ENDPOINT || null;
|
|
27970
27713
|
if (this.isEnabled) {
|
|
27971
27714
|
this.initialize().catch((error2) => {
|
|
27972
|
-
console.error("[Telemetry] Initialization error:", error2);
|
|
27973
27715
|
});
|
|
27974
27716
|
}
|
|
27975
27717
|
}
|
|
@@ -27993,9 +27735,7 @@ var init_bigquery_telemetry = __esm({
|
|
|
27993
27735
|
projectId: this.config.projectId,
|
|
27994
27736
|
keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS
|
|
27995
27737
|
});
|
|
27996
|
-
console.log("[Telemetry] BigQuery client initialized");
|
|
27997
27738
|
} catch (error2) {
|
|
27998
|
-
console.error("[Telemetry] Failed to initialize BigQuery:", error2);
|
|
27999
27739
|
}
|
|
28000
27740
|
}
|
|
28001
27741
|
this.startFlushTimer();
|
|
@@ -28035,10 +27775,8 @@ var init_bigquery_telemetry = __esm({
|
|
|
28035
27775
|
} else if (this.httpEndpoint) {
|
|
28036
27776
|
await this.flushToHttpEndpoint(dataToFlush);
|
|
28037
27777
|
} else {
|
|
28038
|
-
console.debug(`[Telemetry] Discarding ${dataToFlush.length} events (no backend)`);
|
|
28039
27778
|
}
|
|
28040
27779
|
} catch (error2) {
|
|
28041
|
-
console.error("[Telemetry] Flush failed:", error2);
|
|
28042
27780
|
if (this.telemetryQueue.length < this.config.batchSize * 2) {
|
|
28043
27781
|
this.telemetryQueue = [...dataToFlush, ...this.telemetryQueue];
|
|
28044
27782
|
}
|
|
@@ -28072,7 +27810,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
28072
27810
|
ignoreUnknownValues: true,
|
|
28073
27811
|
skipInvalidRows: false
|
|
28074
27812
|
});
|
|
28075
|
-
console.log(`[Telemetry] Flushed ${rows.length} events to BigQuery`);
|
|
28076
27813
|
return;
|
|
28077
27814
|
} catch (error2) {
|
|
28078
27815
|
retries++;
|
|
@@ -28103,13 +27840,11 @@ var init_bigquery_telemetry = __esm({
|
|
|
28103
27840
|
}
|
|
28104
27841
|
})
|
|
28105
27842
|
}).catch((error2) => {
|
|
28106
|
-
console.error("[Telemetry] HTTP flush failed:", error2);
|
|
28107
27843
|
throw error2;
|
|
28108
27844
|
});
|
|
28109
27845
|
if (!response2.ok) {
|
|
28110
27846
|
throw new Error(`HTTP flush failed: ${response2.status}`);
|
|
28111
27847
|
}
|
|
28112
|
-
console.log(`[Telemetry] Flushed ${data2.length} events via HTTP`);
|
|
28113
27848
|
}
|
|
28114
27849
|
/**
|
|
28115
27850
|
* Start flush timer
|
|
@@ -28118,7 +27853,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
28118
27853
|
if (this.flushTimer) return;
|
|
28119
27854
|
this.flushTimer = setInterval(() => {
|
|
28120
27855
|
this.flush().catch((error2) => {
|
|
28121
|
-
console.error("[Telemetry] Timer flush failed:", error2);
|
|
28122
27856
|
});
|
|
28123
27857
|
}, this.config.flushIntervalMs);
|
|
28124
27858
|
}
|
|
@@ -28136,7 +27870,6 @@ var init_bigquery_telemetry = __esm({
|
|
|
28136
27870
|
*/
|
|
28137
27871
|
setupGracefulShutdown() {
|
|
28138
27872
|
const shutdown = async () => {
|
|
28139
|
-
console.log("[Telemetry] Shutting down...");
|
|
28140
27873
|
this.stopFlushTimer();
|
|
28141
27874
|
await this.flush();
|
|
28142
27875
|
process.exit(0);
|
|
@@ -29901,14 +29634,14 @@ __export(HelpCommand_exports, {
|
|
|
29901
29634
|
HelpCommand: () => HelpCommand,
|
|
29902
29635
|
meta: () => meta
|
|
29903
29636
|
});
|
|
29904
|
-
var
|
|
29637
|
+
var import_chalk16, HelpCommand, meta;
|
|
29905
29638
|
var init_HelpCommand = __esm({
|
|
29906
29639
|
"src/slash-commands/categories/core/handlers/HelpCommand.ts"() {
|
|
29907
29640
|
init_base_command();
|
|
29908
29641
|
init_ReadyCommandsService();
|
|
29909
29642
|
init_telemetry_helper();
|
|
29910
29643
|
init_subscription_manager();
|
|
29911
|
-
|
|
29644
|
+
import_chalk16 = __toESM(require("chalk"), 1);
|
|
29912
29645
|
HelpCommand = class extends BaseCommand {
|
|
29913
29646
|
name = "help";
|
|
29914
29647
|
category = "core";
|
|
@@ -30023,9 +29756,9 @@ var init_HelpCommand = __esm({
|
|
|
30023
29756
|
const stats = await this.readyService.getStatistics();
|
|
30024
29757
|
const lines = [];
|
|
30025
29758
|
lines.push("\u2550".repeat(60));
|
|
30026
|
-
lines.push(
|
|
29759
|
+
lines.push(import_chalk16.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
30027
29760
|
lines.push("");
|
|
30028
|
-
lines.push(
|
|
29761
|
+
lines.push(import_chalk16.default.bold("Quick Access:"));
|
|
30029
29762
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
30030
29763
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
30031
29764
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -30040,7 +29773,7 @@ var init_HelpCommand = __esm({
|
|
|
30040
29773
|
}
|
|
30041
29774
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
30042
29775
|
for (const category of categories) {
|
|
30043
|
-
lines.push(
|
|
29776
|
+
lines.push(import_chalk16.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
30044
29777
|
const showCommands = category.commands.slice(0, 4);
|
|
30045
29778
|
for (const cmd of showCommands) {
|
|
30046
29779
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -30060,7 +29793,7 @@ var init_HelpCommand = __esm({
|
|
|
30060
29793
|
}
|
|
30061
29794
|
lines.push("");
|
|
30062
29795
|
}
|
|
30063
|
-
lines.push(
|
|
29796
|
+
lines.push(import_chalk16.default.bold("Pro Tips:"));
|
|
30064
29797
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
30065
29798
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
30066
29799
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -30099,33 +29832,33 @@ var init_HelpCommand = __esm({
|
|
|
30099
29832
|
formatCommandHelp(command) {
|
|
30100
29833
|
const lines = [];
|
|
30101
29834
|
lines.push("");
|
|
30102
|
-
lines.push(`\u{1F4D6} ${
|
|
29835
|
+
lines.push(`\u{1F4D6} ${import_chalk16.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
30103
29836
|
lines.push("\u2550".repeat(50));
|
|
30104
29837
|
lines.push("");
|
|
30105
|
-
lines.push(
|
|
29838
|
+
lines.push(import_chalk16.default.bold("\u2139\uFE0F Information:"));
|
|
30106
29839
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
30107
29840
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
30108
29841
|
if (command.aliases && command.aliases.length > 0) {
|
|
30109
29842
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
30110
29843
|
}
|
|
30111
29844
|
lines.push("");
|
|
30112
|
-
lines.push(
|
|
29845
|
+
lines.push(import_chalk16.default.bold("\u{1F3AF} Usage:"));
|
|
30113
29846
|
lines.push(` ${command.usage}`);
|
|
30114
29847
|
lines.push("");
|
|
30115
|
-
lines.push(
|
|
29848
|
+
lines.push(import_chalk16.default.bold("\u{1F4CB} Contract Validation:"));
|
|
30116
29849
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
30117
29850
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
30118
29851
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
30119
29852
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
30120
29853
|
lines.push("");
|
|
30121
29854
|
if (command.examples && command.examples.length > 0) {
|
|
30122
|
-
lines.push(
|
|
29855
|
+
lines.push(import_chalk16.default.bold("\u{1F4DD} Examples:"));
|
|
30123
29856
|
for (const example of command.examples) {
|
|
30124
29857
|
lines.push(` ${example}`);
|
|
30125
29858
|
}
|
|
30126
29859
|
lines.push("");
|
|
30127
29860
|
}
|
|
30128
|
-
lines.push(
|
|
29861
|
+
lines.push(import_chalk16.default.bold("\u{1F4A1} Quick Tips:"));
|
|
30129
29862
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
30130
29863
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
30131
29864
|
if (command.category !== "core") {
|
|
@@ -30176,7 +29909,7 @@ var init_HelpCommand = __esm({
|
|
|
30176
29909
|
};
|
|
30177
29910
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
30178
29911
|
lines.push("");
|
|
30179
|
-
lines.push(`${emoji} ${
|
|
29912
|
+
lines.push(`${emoji} ${import_chalk16.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
30180
29913
|
lines.push("\u2550".repeat(50));
|
|
30181
29914
|
lines.push("");
|
|
30182
29915
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -30210,7 +29943,7 @@ var init_HelpCommand = __esm({
|
|
|
30210
29943
|
formatSearchResults(searchTerm, results) {
|
|
30211
29944
|
const lines = [];
|
|
30212
29945
|
lines.push("");
|
|
30213
|
-
lines.push(`\u{1F50D} ${
|
|
29946
|
+
lines.push(`\u{1F50D} ${import_chalk16.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
30214
29947
|
lines.push("\u2550".repeat(50));
|
|
30215
29948
|
lines.push("");
|
|
30216
29949
|
for (const result of results) {
|
|
@@ -30223,7 +29956,7 @@ var init_HelpCommand = __esm({
|
|
|
30223
29956
|
}
|
|
30224
29957
|
lines.push("");
|
|
30225
29958
|
}
|
|
30226
|
-
lines.push(
|
|
29959
|
+
lines.push(import_chalk16.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
30227
29960
|
lines.push("");
|
|
30228
29961
|
return lines.join("\n");
|
|
30229
29962
|
}
|
|
@@ -30234,38 +29967,38 @@ var init_HelpCommand = __esm({
|
|
|
30234
29967
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
30235
29968
|
const lines = [];
|
|
30236
29969
|
lines.push("");
|
|
30237
|
-
lines.push(`\u{1F680} ${
|
|
29970
|
+
lines.push(`\u{1F680} ${import_chalk16.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
30238
29971
|
lines.push("\u2550".repeat(50));
|
|
30239
29972
|
lines.push("");
|
|
30240
|
-
lines.push(
|
|
29973
|
+
lines.push(import_chalk16.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
30241
29974
|
lines.push("");
|
|
30242
|
-
lines.push(
|
|
29975
|
+
lines.push(import_chalk16.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
30243
29976
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
30244
29977
|
if (modelCmd) {
|
|
30245
29978
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
30246
29979
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
30247
29980
|
}
|
|
30248
29981
|
lines.push("");
|
|
30249
|
-
lines.push(
|
|
29982
|
+
lines.push(import_chalk16.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
30250
29983
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
30251
29984
|
if (statusCmd) {
|
|
30252
29985
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
30253
29986
|
lines.push(` Try: /status`);
|
|
30254
29987
|
}
|
|
30255
29988
|
lines.push("");
|
|
30256
|
-
lines.push(
|
|
29989
|
+
lines.push(import_chalk16.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
30257
29990
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
30258
29991
|
if (codeCmd) {
|
|
30259
29992
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
30260
29993
|
lines.push(` Try: /code create a hello world function`);
|
|
30261
29994
|
}
|
|
30262
29995
|
lines.push("");
|
|
30263
|
-
lines.push(
|
|
29996
|
+
lines.push(import_chalk16.default.bold("\u{1F527} Essential Commands:"));
|
|
30264
29997
|
for (const cmd of quickCommands) {
|
|
30265
29998
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
30266
29999
|
}
|
|
30267
30000
|
lines.push("");
|
|
30268
|
-
lines.push(
|
|
30001
|
+
lines.push(import_chalk16.default.bold("\u{1F4A1} Next Steps:"));
|
|
30269
30002
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
30270
30003
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
30271
30004
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -30280,20 +30013,20 @@ var init_HelpCommand = __esm({
|
|
|
30280
30013
|
const categories = await this.readyService.getCategories();
|
|
30281
30014
|
const lines = [];
|
|
30282
30015
|
lines.push("");
|
|
30283
|
-
lines.push(`\u{1F4CA} ${
|
|
30016
|
+
lines.push(`\u{1F4CA} ${import_chalk16.default.bold("READY COMMANDS STATISTICS")}`);
|
|
30284
30017
|
lines.push("\u2550".repeat(40));
|
|
30285
30018
|
lines.push("");
|
|
30286
|
-
lines.push(
|
|
30019
|
+
lines.push(import_chalk16.default.bold("\u{1F3AF} Overall:"));
|
|
30287
30020
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
30288
30021
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
30289
30022
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
30290
30023
|
lines.push("");
|
|
30291
|
-
lines.push(
|
|
30024
|
+
lines.push(import_chalk16.default.bold("\u26A1 Performance:"));
|
|
30292
30025
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
30293
30026
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
30294
30027
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
30295
30028
|
lines.push("");
|
|
30296
|
-
lines.push(
|
|
30029
|
+
lines.push(import_chalk16.default.bold("\u{1F4CB} By Category:"));
|
|
30297
30030
|
for (const category of categories) {
|
|
30298
30031
|
const avgTime = Math.round(
|
|
30299
30032
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -30301,7 +30034,7 @@ var init_HelpCommand = __esm({
|
|
|
30301
30034
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
30302
30035
|
}
|
|
30303
30036
|
lines.push("");
|
|
30304
|
-
lines.push(
|
|
30037
|
+
lines.push(import_chalk16.default.bold("\u2705 Contract Validation:"));
|
|
30305
30038
|
lines.push(" All commands tested for:");
|
|
30306
30039
|
lines.push(" \u2022 Basic execution without crashes");
|
|
30307
30040
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -30475,10 +30208,10 @@ var init_LoginCommand = __esm({
|
|
|
30475
30208
|
if (!authResult.success) {
|
|
30476
30209
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
30477
30210
|
}
|
|
30478
|
-
const
|
|
30479
|
-
const plan =
|
|
30480
|
-
const quotaLeft =
|
|
30481
|
-
const email =
|
|
30211
|
+
const userInfo = authResult.user;
|
|
30212
|
+
const plan = userInfo?.plan || "Free";
|
|
30213
|
+
const quotaLeft = userInfo?.usage?.requestsRemaining || 100;
|
|
30214
|
+
const email = userInfo?.email || "user";
|
|
30482
30215
|
await trackCommand({
|
|
30483
30216
|
cmd: "login",
|
|
30484
30217
|
status: "success",
|
|
@@ -30518,11 +30251,11 @@ var init_LoginCommand = __esm({
|
|
|
30518
30251
|
});
|
|
30519
30252
|
|
|
30520
30253
|
// src/services/model-selector-ui.ts
|
|
30521
|
-
var readline4,
|
|
30254
|
+
var readline4, import_chalk17, ModelSelectorUI;
|
|
30522
30255
|
var init_model_selector_ui = __esm({
|
|
30523
30256
|
"src/services/model-selector-ui.ts"() {
|
|
30524
30257
|
readline4 = __toESM(require("readline"), 1);
|
|
30525
|
-
|
|
30258
|
+
import_chalk17 = __toESM(require("chalk"), 1);
|
|
30526
30259
|
ModelSelectorUI = class {
|
|
30527
30260
|
models = [];
|
|
30528
30261
|
selectedIndex = 0;
|
|
@@ -30549,7 +30282,7 @@ var init_model_selector_ui = __esm({
|
|
|
30549
30282
|
output: process.stdout,
|
|
30550
30283
|
terminal: true
|
|
30551
30284
|
});
|
|
30552
|
-
console.log(
|
|
30285
|
+
console.log(import_chalk17.default.green(
|
|
30553
30286
|
"\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"
|
|
30554
30287
|
));
|
|
30555
30288
|
process.stdout.write("\x1B7");
|
|
@@ -30617,14 +30350,14 @@ var init_model_selector_ui = __esm({
|
|
|
30617
30350
|
}
|
|
30618
30351
|
renderFromSavedPosition() {
|
|
30619
30352
|
if (this.isDestroyed) return;
|
|
30620
|
-
console.log(
|
|
30621
|
-
"\u2502 " +
|
|
30353
|
+
console.log(import_chalk17.default.green(
|
|
30354
|
+
"\u2502 " + import_chalk17.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
30622
30355
|
));
|
|
30623
30356
|
this.renderContent();
|
|
30624
30357
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
30625
30358
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
30626
|
-
console.log(
|
|
30627
|
-
console.log(
|
|
30359
|
+
console.log(import_chalk17.default.green("\u2502 ") + import_chalk17.default.dim.green(helpText.padEnd(76)) + import_chalk17.default.green(" \u2502"));
|
|
30360
|
+
console.log(import_chalk17.default.green(
|
|
30628
30361
|
"\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"
|
|
30629
30362
|
));
|
|
30630
30363
|
}
|
|
@@ -30665,19 +30398,19 @@ var init_model_selector_ui = __esm({
|
|
|
30665
30398
|
const item = displayItems[i2];
|
|
30666
30399
|
if (item.type === "group") {
|
|
30667
30400
|
console.log(
|
|
30668
|
-
|
|
30401
|
+
import_chalk17.default.green("\u2502") + import_chalk17.default.dim.green(" \u2501\u2501\u2501 ") + import_chalk17.default.greenBright(item.content.substring(2, item.content.indexOf(" \u2500"))) + import_chalk17.default.dim.green(" " + "\u2501".repeat(71 - item.content.indexOf(" \u2500"))) + import_chalk17.default.green("\u2502")
|
|
30669
30402
|
);
|
|
30670
30403
|
} else {
|
|
30671
30404
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
30672
|
-
const prefix = isSelected ?
|
|
30405
|
+
const prefix = isSelected ? import_chalk17.default.greenBright("\u25B6 ") : " ";
|
|
30673
30406
|
const modelText = item.content;
|
|
30674
30407
|
if (isSelected) {
|
|
30675
30408
|
console.log(
|
|
30676
|
-
|
|
30409
|
+
import_chalk17.default.green("\u2502") + prefix + import_chalk17.default.black.bgGreen(modelText.padEnd(75)) + import_chalk17.default.green("\u2502")
|
|
30677
30410
|
);
|
|
30678
30411
|
} else {
|
|
30679
30412
|
console.log(
|
|
30680
|
-
|
|
30413
|
+
import_chalk17.default.green("\u2502") + prefix + import_chalk17.default.green(modelText.substring(0, 75).padEnd(75)) + import_chalk17.default.green("\u2502")
|
|
30681
30414
|
);
|
|
30682
30415
|
}
|
|
30683
30416
|
}
|
|
@@ -32929,8 +32662,8 @@ async function loadServices() {
|
|
|
32929
32662
|
try {
|
|
32930
32663
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32931
32664
|
if (commandName === "battlecard") {
|
|
32932
|
-
console.log(
|
|
32933
|
-
console.log(
|
|
32665
|
+
console.log(import_chalk18.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
32666
|
+
console.log(import_chalk18.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32934
32667
|
return {
|
|
32935
32668
|
success: false,
|
|
32936
32669
|
message: "Command not available on Free plan"
|
|
@@ -32991,7 +32724,7 @@ async function loadServices() {
|
|
|
32991
32724
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32992
32725
|
}
|
|
32993
32726
|
} catch (e2) {
|
|
32994
|
-
console.warn(
|
|
32727
|
+
console.warn(import_chalk18.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32995
32728
|
}
|
|
32996
32729
|
}
|
|
32997
32730
|
async function init() {
|
|
@@ -33105,20 +32838,20 @@ async function enforceAuth(cmd) {
|
|
|
33105
32838
|
try {
|
|
33106
32839
|
const tokens = await authManager.getValidTokens();
|
|
33107
32840
|
if (!tokens) {
|
|
33108
|
-
console.log(
|
|
32841
|
+
console.log(import_chalk18.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
33109
32842
|
process.exit(2);
|
|
33110
32843
|
return false;
|
|
33111
32844
|
}
|
|
33112
32845
|
return true;
|
|
33113
32846
|
} catch (error2) {
|
|
33114
32847
|
if (error2.code === "AUTH_REQUIRED") {
|
|
33115
|
-
console.log(
|
|
32848
|
+
console.log(import_chalk18.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
33116
32849
|
process.exit(2);
|
|
33117
32850
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
33118
|
-
console.log(
|
|
32851
|
+
console.log(import_chalk18.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
33119
32852
|
process.exit(2);
|
|
33120
32853
|
} else {
|
|
33121
|
-
console.log(
|
|
32854
|
+
console.log(import_chalk18.default.red("\u{1F310} Network error, check connection"));
|
|
33122
32855
|
process.exit(1);
|
|
33123
32856
|
}
|
|
33124
32857
|
return false;
|
|
@@ -33158,7 +32891,7 @@ async function handleSlash(input3) {
|
|
|
33158
32891
|
console.log(JSON.stringify(result.data, null, 2));
|
|
33159
32892
|
}
|
|
33160
32893
|
} else {
|
|
33161
|
-
console.log(
|
|
32894
|
+
console.log(import_chalk18.default.red(`Help Error: ${result.message}`));
|
|
33162
32895
|
}
|
|
33163
32896
|
return true;
|
|
33164
32897
|
}
|
|
@@ -33166,7 +32899,7 @@ async function handleSlash(input3) {
|
|
|
33166
32899
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33167
32900
|
console.error("HelpCommand error:", helpError);
|
|
33168
32901
|
}
|
|
33169
|
-
console.log(
|
|
32902
|
+
console.log(import_chalk18.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
33170
32903
|
}
|
|
33171
32904
|
const help = `
|
|
33172
32905
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -33191,7 +32924,7 @@ Chat:
|
|
|
33191
32924
|
session.length = 0;
|
|
33192
32925
|
if (ctx?.clearContext) ctx.clearContext();
|
|
33193
32926
|
console.clear();
|
|
33194
|
-
console.log(
|
|
32927
|
+
console.log(import_chalk18.default.cyan("\u2728 Session cleared"));
|
|
33195
32928
|
return true;
|
|
33196
32929
|
}
|
|
33197
32930
|
if (cmd === "code") {
|
|
@@ -33199,7 +32932,7 @@ Chat:
|
|
|
33199
32932
|
const prompt = args.join(" ").trim();
|
|
33200
32933
|
if (!prompt) {
|
|
33201
32934
|
console.log(
|
|
33202
|
-
|
|
32935
|
+
import_chalk18.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
33203
32936
|
);
|
|
33204
32937
|
return true;
|
|
33205
32938
|
}
|
|
@@ -33211,7 +32944,7 @@ Chat:
|
|
|
33211
32944
|
const prompt = args.join(" ").trim();
|
|
33212
32945
|
if (!prompt) {
|
|
33213
32946
|
console.log(
|
|
33214
|
-
|
|
32947
|
+
import_chalk18.default.cyan("\u{1F3A8} **Image Generation**\n") + import_chalk18.default.white("Usage: /image <prompt>\n") + import_chalk18.default.gray("Example: /image \u5BCC\u58EB\u5C71\u306E\u65E5\u306E\u51FA")
|
|
33215
32948
|
);
|
|
33216
32949
|
return true;
|
|
33217
32950
|
}
|
|
@@ -33223,14 +32956,14 @@ Chat:
|
|
|
33223
32956
|
options: {},
|
|
33224
32957
|
logger: {
|
|
33225
32958
|
info: (msg) => console.log(msg),
|
|
33226
|
-
error: (msg) => console.error(
|
|
33227
|
-
warn: (msg) => console.warn(
|
|
32959
|
+
error: (msg) => console.error(import_chalk18.default.red(msg)),
|
|
32960
|
+
warn: (msg) => console.warn(import_chalk18.default.yellow(msg))
|
|
33228
32961
|
}
|
|
33229
32962
|
};
|
|
33230
32963
|
await imageCommand2.execute(context2);
|
|
33231
32964
|
}
|
|
33232
32965
|
} catch (error2) {
|
|
33233
|
-
console.error(
|
|
32966
|
+
console.error(import_chalk18.default.red("Image generation failed:"), error2.message);
|
|
33234
32967
|
}
|
|
33235
32968
|
return true;
|
|
33236
32969
|
}
|
|
@@ -33239,7 +32972,7 @@ Chat:
|
|
|
33239
32972
|
const prompt = args.join(" ").trim();
|
|
33240
32973
|
if (!prompt) {
|
|
33241
32974
|
console.log(
|
|
33242
|
-
|
|
32975
|
+
import_chalk18.default.cyan("\u{1F3AC} **Video Generation**\n") + import_chalk18.default.white("Usage: /video <prompt>\n") + import_chalk18.default.gray("Example: /video \u6D77\u306E\u6CE2\u304C\u6253\u3061\u5BC4\u305B\u308B\u69D8\u5B50")
|
|
33243
32976
|
);
|
|
33244
32977
|
return true;
|
|
33245
32978
|
}
|
|
@@ -33251,14 +32984,14 @@ Chat:
|
|
|
33251
32984
|
options: {},
|
|
33252
32985
|
logger: {
|
|
33253
32986
|
info: (msg) => console.log(msg),
|
|
33254
|
-
error: (msg) => console.error(
|
|
33255
|
-
warn: (msg) => console.warn(
|
|
32987
|
+
error: (msg) => console.error(import_chalk18.default.red(msg)),
|
|
32988
|
+
warn: (msg) => console.warn(import_chalk18.default.yellow(msg))
|
|
33256
32989
|
}
|
|
33257
32990
|
};
|
|
33258
32991
|
await videoCommand2.execute(context2);
|
|
33259
32992
|
}
|
|
33260
32993
|
} catch (error2) {
|
|
33261
|
-
console.error(
|
|
32994
|
+
console.error(import_chalk18.default.red("Video generation failed:"), error2.message);
|
|
33262
32995
|
}
|
|
33263
32996
|
return true;
|
|
33264
32997
|
}
|
|
@@ -33267,7 +33000,7 @@ Chat:
|
|
|
33267
33000
|
const prompt = args.join(" ").trim();
|
|
33268
33001
|
if (!prompt) {
|
|
33269
33002
|
console.log(
|
|
33270
|
-
|
|
33003
|
+
import_chalk18.default.cyan("\u{1F399}\uFE0F **Voice Synthesis**\n") + import_chalk18.default.white("Usage: /voice <text>\n") + import_chalk18.default.gray("Example: /voice \u3053\u3093\u306B\u3061\u306F\u3001\u5143\u6C17\u3067\u3059\u304B\uFF1F")
|
|
33271
33004
|
);
|
|
33272
33005
|
return true;
|
|
33273
33006
|
}
|
|
@@ -33279,14 +33012,14 @@ Chat:
|
|
|
33279
33012
|
options: {},
|
|
33280
33013
|
logger: {
|
|
33281
33014
|
info: (msg) => console.log(msg),
|
|
33282
|
-
error: (msg) => console.error(
|
|
33283
|
-
warn: (msg) => console.warn(
|
|
33015
|
+
error: (msg) => console.error(import_chalk18.default.red(msg)),
|
|
33016
|
+
warn: (msg) => console.warn(import_chalk18.default.yellow(msg))
|
|
33284
33017
|
}
|
|
33285
33018
|
};
|
|
33286
33019
|
await voiceCommand2.execute(context2);
|
|
33287
33020
|
}
|
|
33288
33021
|
} catch (error2) {
|
|
33289
|
-
console.error(
|
|
33022
|
+
console.error(import_chalk18.default.red("Voice synthesis failed:"), error2.message);
|
|
33290
33023
|
}
|
|
33291
33024
|
return true;
|
|
33292
33025
|
}
|
|
@@ -33305,36 +33038,36 @@ Chat:
|
|
|
33305
33038
|
if (args.includes("status")) {
|
|
33306
33039
|
if (await authManager.isAuthenticated()) {
|
|
33307
33040
|
const user = await authManager.getCurrentUser();
|
|
33308
|
-
console.log(
|
|
33309
|
-
console.log(
|
|
33310
|
-
console.log(
|
|
33041
|
+
console.log(import_chalk18.default.green("\u2705 Authenticated"));
|
|
33042
|
+
console.log(import_chalk18.default.white(`\u{1F464} User: ${import_chalk18.default.cyan(user.email)}`));
|
|
33043
|
+
console.log(import_chalk18.default.white(`\u{1F4CA} Plan: ${import_chalk18.default.cyan(user.plan)}`));
|
|
33311
33044
|
} else {
|
|
33312
|
-
console.log(
|
|
33313
|
-
console.log(
|
|
33045
|
+
console.log(import_chalk18.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
33046
|
+
console.log(import_chalk18.default.gray("Use /login to sign in"));
|
|
33314
33047
|
}
|
|
33315
33048
|
} else {
|
|
33316
33049
|
const result = await authManager.login(options2);
|
|
33317
33050
|
if (result.success && result.user) {
|
|
33318
|
-
console.log(
|
|
33319
|
-
console.log(
|
|
33320
|
-
console.log(
|
|
33051
|
+
console.log(import_chalk18.default.green("\u2705 Successfully logged in!"));
|
|
33052
|
+
console.log(import_chalk18.default.white(`\u{1F464} User: ${import_chalk18.default.cyan(result.user.email)}`));
|
|
33053
|
+
console.log(import_chalk18.default.white(`\u{1F4CA} Plan: ${import_chalk18.default.cyan(result.user.plan)}`));
|
|
33321
33054
|
} else {
|
|
33322
|
-
console.log(
|
|
33323
|
-
if (result.error) console.log(
|
|
33055
|
+
console.log(import_chalk18.default.red("\u274C Login failed"));
|
|
33056
|
+
if (result.error) console.log(import_chalk18.default.gray(result.error));
|
|
33324
33057
|
}
|
|
33325
33058
|
}
|
|
33326
33059
|
}
|
|
33327
33060
|
} catch (error2) {
|
|
33328
|
-
console.error(
|
|
33061
|
+
console.error(import_chalk18.default.red("Login error:"), error2.message);
|
|
33329
33062
|
}
|
|
33330
33063
|
return true;
|
|
33331
33064
|
}
|
|
33332
33065
|
if (cmd === "logout" || cmd === "signout") {
|
|
33333
33066
|
try {
|
|
33334
33067
|
await authManager.logout();
|
|
33335
|
-
console.log(
|
|
33068
|
+
console.log(import_chalk18.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
33336
33069
|
} catch (error2) {
|
|
33337
|
-
console.error(
|
|
33070
|
+
console.error(import_chalk18.default.red("Logout error:"), error2.message);
|
|
33338
33071
|
}
|
|
33339
33072
|
return true;
|
|
33340
33073
|
}
|
|
@@ -33435,11 +33168,11 @@ Chat:
|
|
|
33435
33168
|
}
|
|
33436
33169
|
}
|
|
33437
33170
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33438
|
-
console.log(
|
|
33439
|
-
console.log(
|
|
33440
|
-
console.log(
|
|
33441
|
-
console.log(
|
|
33442
|
-
console.log(
|
|
33171
|
+
console.log(import_chalk18.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33172
|
+
console.log(import_chalk18.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33173
|
+
console.log(import_chalk18.default.gray(" \u2022 Type /help to see available commands"));
|
|
33174
|
+
console.log(import_chalk18.default.gray(" \u2022 Check if you need to /login first"));
|
|
33175
|
+
console.log(import_chalk18.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33443
33176
|
}
|
|
33444
33177
|
return true;
|
|
33445
33178
|
}
|
|
@@ -33707,11 +33440,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33707
33440
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33708
33441
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33709
33442
|
console.log(
|
|
33710
|
-
|
|
33711
|
-
`) +
|
|
33712
|
-
`) +
|
|
33713
|
-
`) +
|
|
33714
|
-
`) +
|
|
33443
|
+
import_chalk18.default.green("\n\u2705 **Code Saved**\n") + import_chalk18.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33444
|
+
`) + import_chalk18.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33445
|
+
`) + import_chalk18.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33446
|
+
`) + import_chalk18.default.white(` \u{1F4DD} Language: ${language}
|
|
33447
|
+
`) + import_chalk18.default.dim(`
|
|
33715
33448
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33716
33449
|
);
|
|
33717
33450
|
} else {
|
|
@@ -33720,11 +33453,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33720
33453
|
} catch (e2) {
|
|
33721
33454
|
spinner.stop();
|
|
33722
33455
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33723
|
-
console.error(
|
|
33456
|
+
console.error(import_chalk18.default.red("Code generation error:"), e2.message || e2);
|
|
33724
33457
|
}
|
|
33725
33458
|
const fallbackCode = templateFallback(prompt);
|
|
33726
33459
|
console.log(
|
|
33727
|
-
|
|
33460
|
+
import_chalk18.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33728
33461
|
);
|
|
33729
33462
|
console.log(fallbackCode);
|
|
33730
33463
|
try {
|
|
@@ -33733,14 +33466,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33733
33466
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33734
33467
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33735
33468
|
console.log(
|
|
33736
|
-
|
|
33737
|
-
`) +
|
|
33738
|
-
`) +
|
|
33739
|
-
`) +
|
|
33469
|
+
import_chalk18.default.green("\n\u2705 **Template Code Saved**\n") + import_chalk18.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33470
|
+
`) + import_chalk18.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33471
|
+
`) + import_chalk18.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33472
|
+
`) + import_chalk18.default.dim(`
|
|
33740
33473
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33741
33474
|
);
|
|
33742
33475
|
} catch (saveError) {
|
|
33743
|
-
console.error(
|
|
33476
|
+
console.error(import_chalk18.default.red("Failed to save code:"), saveError);
|
|
33744
33477
|
}
|
|
33745
33478
|
}
|
|
33746
33479
|
}
|
|
@@ -33796,7 +33529,7 @@ ${userPrompt}`;
|
|
|
33796
33529
|
(seq) => response2.includes(seq)
|
|
33797
33530
|
);
|
|
33798
33531
|
if (guidedFlowDetected) {
|
|
33799
|
-
console.log(
|
|
33532
|
+
console.log(import_chalk18.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33800
33533
|
return null;
|
|
33801
33534
|
}
|
|
33802
33535
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33964,14 +33697,14 @@ async function streamAnswer(text) {
|
|
|
33964
33697
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33965
33698
|
} else {
|
|
33966
33699
|
animation.stop();
|
|
33967
|
-
console.log(
|
|
33700
|
+
console.log(import_chalk18.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33968
33701
|
}
|
|
33969
33702
|
} catch (e2) {
|
|
33970
33703
|
animation.stop();
|
|
33971
33704
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33972
|
-
console.log(
|
|
33705
|
+
console.log(import_chalk18.default.yellow(e2.message));
|
|
33973
33706
|
} else {
|
|
33974
|
-
console.log(
|
|
33707
|
+
console.log(import_chalk18.default.red("Error generating response:"), e2.message || e2);
|
|
33975
33708
|
}
|
|
33976
33709
|
}
|
|
33977
33710
|
}
|
|
@@ -33986,9 +33719,9 @@ async function handleLine(line) {
|
|
|
33986
33719
|
if (consumed) return;
|
|
33987
33720
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33988
33721
|
if (!isAuthenticated) {
|
|
33989
|
-
console.log(
|
|
33990
|
-
console.log(
|
|
33991
|
-
console.log(
|
|
33722
|
+
console.log(import_chalk18.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
33723
|
+
console.log(import_chalk18.default.cyan("Please run: /login"));
|
|
33724
|
+
console.log(import_chalk18.default.gray("Or use slash commands like /help, /version"));
|
|
33992
33725
|
return;
|
|
33993
33726
|
}
|
|
33994
33727
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -34010,7 +33743,7 @@ async function startInteractiveSession() {
|
|
|
34010
33743
|
}
|
|
34011
33744
|
}
|
|
34012
33745
|
const stop = async () => {
|
|
34013
|
-
console.log(
|
|
33746
|
+
console.log(import_chalk18.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
34014
33747
|
if (store?.close) await store.close().catch(() => {
|
|
34015
33748
|
});
|
|
34016
33749
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -34020,7 +33753,7 @@ async function startInteractiveSession() {
|
|
|
34020
33753
|
process.once("SIGINT", stop);
|
|
34021
33754
|
process.once("SIGTERM", stop);
|
|
34022
33755
|
if (!isTTY) {
|
|
34023
|
-
console.log(
|
|
33756
|
+
console.log(import_chalk18.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
34024
33757
|
const rl = readline5.createInterface({
|
|
34025
33758
|
input: import_node_process3.stdin,
|
|
34026
33759
|
output: import_node_process3.stdout,
|
|
@@ -34035,7 +33768,7 @@ async function startInteractiveSession() {
|
|
|
34035
33768
|
if (interactiveCLI) {
|
|
34036
33769
|
while (true) {
|
|
34037
33770
|
try {
|
|
34038
|
-
const prompt =
|
|
33771
|
+
const prompt = import_chalk18.default.gray("> ");
|
|
34039
33772
|
process.stdout.write(prompt);
|
|
34040
33773
|
const line = await interactiveCLI.question("");
|
|
34041
33774
|
console.log();
|
|
@@ -34050,14 +33783,14 @@ async function startInteractiveSession() {
|
|
|
34050
33783
|
await stop();
|
|
34051
33784
|
return;
|
|
34052
33785
|
}
|
|
34053
|
-
console.error(
|
|
33786
|
+
console.error(import_chalk18.default.red("Error:"), error2?.message || error2);
|
|
34054
33787
|
}
|
|
34055
33788
|
}
|
|
34056
33789
|
} else {
|
|
34057
33790
|
const rl = readline5.createInterface({ input: import_node_process3.stdin, output: import_node_process3.stdout });
|
|
34058
33791
|
while (true) {
|
|
34059
33792
|
try {
|
|
34060
|
-
const prompt =
|
|
33793
|
+
const prompt = import_chalk18.default.gray("> ");
|
|
34061
33794
|
const line = await rl.question(prompt);
|
|
34062
33795
|
console.log();
|
|
34063
33796
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -34071,7 +33804,7 @@ async function startInteractiveSession() {
|
|
|
34071
33804
|
await stop();
|
|
34072
33805
|
return;
|
|
34073
33806
|
}
|
|
34074
|
-
console.error(
|
|
33807
|
+
console.error(import_chalk18.default.red("Error:"), error2?.message || error2);
|
|
34075
33808
|
}
|
|
34076
33809
|
}
|
|
34077
33810
|
}
|
|
@@ -34081,7 +33814,7 @@ function createCLI() {
|
|
|
34081
33814
|
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) => {
|
|
34082
33815
|
loadEnvironmentVariables();
|
|
34083
33816
|
if (options.server) {
|
|
34084
|
-
console.log(
|
|
33817
|
+
console.log(import_chalk18.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
34085
33818
|
try {
|
|
34086
33819
|
const serverPath = path11.join(process.cwd(), "server.mjs");
|
|
34087
33820
|
const { spawn } = await import("child_process");
|
|
@@ -34090,48 +33823,37 @@ function createCLI() {
|
|
|
34090
33823
|
env: process.env
|
|
34091
33824
|
});
|
|
34092
33825
|
serverProcess.on("error", (error2) => {
|
|
34093
|
-
console.error(
|
|
33826
|
+
console.error(import_chalk18.default.red("\u274C Server process error:"), error2);
|
|
34094
33827
|
process.exit(1);
|
|
34095
33828
|
});
|
|
34096
33829
|
return;
|
|
34097
33830
|
} catch (error2) {
|
|
34098
|
-
console.error(
|
|
33831
|
+
console.error(import_chalk18.default.red("\u274C Failed to start server mode:"), error2);
|
|
34099
33832
|
process.exit(1);
|
|
34100
33833
|
}
|
|
34101
33834
|
}
|
|
34102
|
-
|
|
34103
|
-
try {
|
|
34104
|
-
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
34105
|
-
displayStartupLogo2();
|
|
34106
|
-
startupDisplayed = true;
|
|
34107
|
-
} catch {
|
|
34108
|
-
console.log(import_chalk19.default.cyan(`
|
|
34109
|
-
\u{1F680} MARIA v${getVersion()}
|
|
34110
|
-
`));
|
|
34111
|
-
startupDisplayed = true;
|
|
34112
|
-
}
|
|
34113
|
-
}
|
|
33835
|
+
startupDisplayed = true;
|
|
34114
33836
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
34115
33837
|
if (useV3) {
|
|
34116
33838
|
try {
|
|
34117
|
-
console.log(
|
|
33839
|
+
console.log(import_chalk18.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
34118
33840
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
34119
33841
|
const maria = new MariaAI2();
|
|
34120
33842
|
await maria.initialize();
|
|
34121
33843
|
return;
|
|
34122
33844
|
} catch (e2) {
|
|
34123
|
-
console.warn(
|
|
33845
|
+
console.warn(import_chalk18.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
34124
33846
|
}
|
|
34125
33847
|
}
|
|
34126
33848
|
await startInteractiveSession();
|
|
34127
33849
|
});
|
|
34128
33850
|
return program2;
|
|
34129
33851
|
}
|
|
34130
|
-
var import_commander,
|
|
33852
|
+
var import_commander, import_chalk18, readline5, import_node_process3, path11, fs11, AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, startupDisplayed, program;
|
|
34131
33853
|
var init_cli = __esm({
|
|
34132
33854
|
"src/cli.ts"() {
|
|
34133
33855
|
import_commander = require("commander");
|
|
34134
|
-
|
|
33856
|
+
import_chalk18 = __toESM(require("chalk"), 1);
|
|
34135
33857
|
readline5 = __toESM(require("readline/promises"), 1);
|
|
34136
33858
|
import_node_process3 = require("process");
|
|
34137
33859
|
path11 = __toESM(require("path"), 1);
|
|
@@ -34174,23 +33896,22 @@ function createCLI2() {
|
|
|
34174
33896
|
}
|
|
34175
33897
|
});
|
|
34176
33898
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
34177
|
-
console.log(
|
|
33899
|
+
console.log(import_chalk19.default.cyan("Setting up Ollama..."));
|
|
34178
33900
|
console.log(
|
|
34179
|
-
|
|
33901
|
+
import_chalk19.default.yellow("Please run: brew install ollama && ollama serve")
|
|
34180
33902
|
);
|
|
34181
33903
|
});
|
|
34182
33904
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
34183
|
-
console.log(
|
|
34184
|
-
console.log(
|
|
33905
|
+
console.log(import_chalk19.default.cyan("Setting up vLLM..."));
|
|
33906
|
+
console.log(import_chalk19.default.yellow("Please run: pip install vllm"));
|
|
34185
33907
|
});
|
|
34186
33908
|
return program2;
|
|
34187
33909
|
}
|
|
34188
|
-
var
|
|
33910
|
+
var import_chalk19, import_commander2, MariaAI;
|
|
34189
33911
|
var init_maria_ai = __esm({
|
|
34190
33912
|
"src/maria-ai.ts"() {
|
|
34191
|
-
|
|
33913
|
+
import_chalk19 = __toESM(require("chalk"), 1);
|
|
34192
33914
|
import_commander2 = require("commander");
|
|
34193
|
-
init_startup_display();
|
|
34194
33915
|
init_provider_selector();
|
|
34195
33916
|
init_config2();
|
|
34196
33917
|
init_IntelligentRouterService();
|
|
@@ -34207,17 +33928,16 @@ var init_maria_ai = __esm({
|
|
|
34207
33928
|
}
|
|
34208
33929
|
async initialize() {
|
|
34209
33930
|
try {
|
|
34210
|
-
displayStartupLogo();
|
|
34211
33931
|
await this.providerSelector.initialize();
|
|
34212
33932
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
34213
33933
|
console.log(
|
|
34214
|
-
|
|
33934
|
+
import_chalk19.default.green(`
|
|
34215
33935
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
34216
33936
|
);
|
|
34217
33937
|
this.config.set("currentProvider", provider);
|
|
34218
33938
|
this.config.set("currentModel", model);
|
|
34219
33939
|
await this.config.save();
|
|
34220
|
-
console.log(
|
|
33940
|
+
console.log(import_chalk19.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
34221
33941
|
this.router = new IntelligentRouterService({
|
|
34222
33942
|
confidenceThreshold: 0.85,
|
|
34223
33943
|
enableLearning: true,
|
|
@@ -34225,12 +33945,12 @@ var init_maria_ai = __esm({
|
|
|
34225
33945
|
});
|
|
34226
33946
|
await this.router.initialize();
|
|
34227
33947
|
console.log(
|
|
34228
|
-
|
|
33948
|
+
import_chalk19.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
34229
33949
|
);
|
|
34230
33950
|
this.session = createInteractiveSession(this);
|
|
34231
33951
|
await this.session.start();
|
|
34232
33952
|
} catch (error2) {
|
|
34233
|
-
console.error(
|
|
33953
|
+
console.error(import_chalk19.default.red("\n\u274C Initialization failed:"), error2);
|
|
34234
33954
|
process.exit(1);
|
|
34235
33955
|
}
|
|
34236
33956
|
}
|
|
@@ -34238,7 +33958,7 @@ var init_maria_ai = __esm({
|
|
|
34238
33958
|
if (this.session) {
|
|
34239
33959
|
await this.session.stop();
|
|
34240
33960
|
}
|
|
34241
|
-
console.log(
|
|
33961
|
+
console.log(import_chalk19.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
34242
33962
|
}
|
|
34243
33963
|
};
|
|
34244
33964
|
}
|
|
@@ -34248,7 +33968,7 @@ var init_maria_ai = __esm({
|
|
|
34248
33968
|
init_maria_ai();
|
|
34249
33969
|
|
|
34250
33970
|
// src/utils/version-check.ts
|
|
34251
|
-
var
|
|
33971
|
+
var import_chalk20 = __toESM(require("chalk"), 1);
|
|
34252
33972
|
var import_semver = __toESM(require("semver"), 1);
|
|
34253
33973
|
var MINIMUM_NODE_VERSION = "18.0.0";
|
|
34254
33974
|
var RECOMMENDED_NODE_VERSION = "20.0.0";
|
|
@@ -34256,25 +33976,25 @@ function checkNodeVersion() {
|
|
|
34256
33976
|
const currentVersion = process.version;
|
|
34257
33977
|
if (!import_semver.default.satisfies(currentVersion, `>=${MINIMUM_NODE_VERSION}`)) {
|
|
34258
33978
|
console.error(
|
|
34259
|
-
|
|
33979
|
+
import_chalk20.default.red(`
|
|
34260
33980
|
\u274C Node.js version ${currentVersion} is not supported.`)
|
|
34261
33981
|
);
|
|
34262
33982
|
console.error(
|
|
34263
|
-
|
|
33983
|
+
import_chalk20.default.yellow(`Minimum required version: ${MINIMUM_NODE_VERSION}`)
|
|
34264
33984
|
);
|
|
34265
33985
|
console.error(
|
|
34266
|
-
|
|
33986
|
+
import_chalk20.default.yellow(
|
|
34267
33987
|
`Recommended version: ${RECOMMENDED_NODE_VERSION} or higher`
|
|
34268
33988
|
)
|
|
34269
33989
|
);
|
|
34270
|
-
console.error(
|
|
34271
|
-
console.error(
|
|
33990
|
+
console.error(import_chalk20.default.cyan("\nPlease upgrade Node.js:"));
|
|
33991
|
+
console.error(import_chalk20.default.gray(" \u2022 Using nvm: nvm install 20 && nvm use 20"));
|
|
34272
33992
|
console.error(
|
|
34273
|
-
|
|
33993
|
+
import_chalk20.default.gray(
|
|
34274
33994
|
" \u2022 Using nodenv: nodenv install 20.0.0 && nodenv global 20.0.0"
|
|
34275
33995
|
)
|
|
34276
33996
|
);
|
|
34277
|
-
console.error(
|
|
33997
|
+
console.error(import_chalk20.default.gray(" \u2022 Download from: https://nodejs.org/"));
|
|
34278
33998
|
process.exit(1);
|
|
34279
33999
|
}
|
|
34280
34000
|
}
|