@bonginkan/maria 4.2.4 → 4.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/maria.cjs +1042 -600
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +912 -476
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/bin/maria.cjs
CHANGED
|
@@ -32,6 +32,424 @@ 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
|
+
|
|
35
453
|
// src/providers/config.ts
|
|
36
454
|
var DEFAULT_PROVIDER2, DEFAULT_MODEL2;
|
|
37
455
|
var init_config = __esm({
|
|
@@ -7913,10 +8331,10 @@ var init_llm_health_checker = __esm({
|
|
|
7913
8331
|
});
|
|
7914
8332
|
|
|
7915
8333
|
// src/services/provider-selector.ts
|
|
7916
|
-
var
|
|
8334
|
+
var import_chalk2, ProviderSelector;
|
|
7917
8335
|
var init_provider_selector = __esm({
|
|
7918
8336
|
"src/services/provider-selector.ts"() {
|
|
7919
|
-
|
|
8337
|
+
import_chalk2 = __toESM(require("chalk"), 1);
|
|
7920
8338
|
init_providers();
|
|
7921
8339
|
ProviderSelector = class {
|
|
7922
8340
|
config;
|
|
@@ -7932,29 +8350,29 @@ var init_provider_selector = __esm({
|
|
|
7932
8350
|
const inquirer = await import("inquirer");
|
|
7933
8351
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
7934
8352
|
const providers = await this.getAvailableProviders();
|
|
7935
|
-
console.log(
|
|
7936
|
-
console.log(
|
|
8353
|
+
console.log(import_chalk2.default.cyan("\nAvailable AI Providers:"));
|
|
8354
|
+
console.log(import_chalk2.default.gray("\u2500".repeat(50)));
|
|
7937
8355
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
7938
8356
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
7939
8357
|
if (_cloudProviders.length > 0) {
|
|
7940
|
-
console.log(
|
|
8358
|
+
console.log(import_chalk2.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
7941
8359
|
_cloudProviders.forEach((p) => {
|
|
7942
8360
|
if (p.available) {
|
|
7943
8361
|
console.log(
|
|
7944
|
-
` ${
|
|
8362
|
+
` ${import_chalk2.default.green("*")} ${import_chalk2.default.white(p.name.split(" ")[0])}`
|
|
7945
8363
|
);
|
|
7946
8364
|
} else {
|
|
7947
|
-
console.log(` ${
|
|
8365
|
+
console.log(` ${import_chalk2.default.gray(p.name.split(" ")[0])}`);
|
|
7948
8366
|
}
|
|
7949
8367
|
});
|
|
7950
8368
|
}
|
|
7951
8369
|
if (_localProviders.length > 0) {
|
|
7952
|
-
console.log(
|
|
8370
|
+
console.log(import_chalk2.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
7953
8371
|
_localProviders.forEach((p) => {
|
|
7954
8372
|
if (p.available) {
|
|
7955
|
-
console.log(` ${
|
|
8373
|
+
console.log(` ${import_chalk2.default.green("*")} ${import_chalk2.default.white(p.name)}`);
|
|
7956
8374
|
} else {
|
|
7957
|
-
console.log(` ${
|
|
8375
|
+
console.log(` ${import_chalk2.default.green("*")} ${import_chalk2.default.gray(p.name)}`);
|
|
7958
8376
|
}
|
|
7959
8377
|
});
|
|
7960
8378
|
}
|
|
@@ -7969,20 +8387,20 @@ var init_provider_selector = __esm({
|
|
|
7969
8387
|
});
|
|
7970
8388
|
if (selectableProviders.length === 0) {
|
|
7971
8389
|
console.log(
|
|
7972
|
-
|
|
8390
|
+
import_chalk2.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
7973
8391
|
);
|
|
7974
|
-
console.log(
|
|
8392
|
+
console.log(import_chalk2.default.gray("\nTo use MARIA, you need to:"));
|
|
7975
8393
|
console.log(
|
|
7976
|
-
|
|
8394
|
+
import_chalk2.default.gray(
|
|
7977
8395
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
7978
8396
|
)
|
|
7979
8397
|
);
|
|
7980
|
-
console.log(
|
|
8398
|
+
console.log(import_chalk2.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
7981
8399
|
console.log(
|
|
7982
|
-
|
|
8400
|
+
import_chalk2.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
7983
8401
|
);
|
|
7984
|
-
console.log(
|
|
7985
|
-
console.log(
|
|
8402
|
+
console.log(import_chalk2.default.gray(" Example: maria setup-ollama"));
|
|
8403
|
+
console.log(import_chalk2.default.gray("\nFor more information, run: maria --help"));
|
|
7986
8404
|
process.exit(1);
|
|
7987
8405
|
}
|
|
7988
8406
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -8003,29 +8421,29 @@ var init_provider_selector = __esm({
|
|
|
8003
8421
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
8004
8422
|
if (provider && provider.type === "local" && !provider.available) {
|
|
8005
8423
|
console.log(
|
|
8006
|
-
|
|
8424
|
+
import_chalk2.default.yellow(`
|
|
8007
8425
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
8008
8426
|
);
|
|
8009
|
-
console.log(
|
|
8427
|
+
console.log(import_chalk2.default.gray(`
|
|
8010
8428
|
To use ${provider.name}, you need to:`));
|
|
8011
8429
|
if (selectedProvider === "ollama") {
|
|
8012
|
-
console.log(
|
|
8013
|
-
console.log(
|
|
8014
|
-
console.log(
|
|
8430
|
+
console.log(import_chalk2.default.gray("1. Install Ollama: brew install ollama"));
|
|
8431
|
+
console.log(import_chalk2.default.gray("2. Start Ollama: ollama serve"));
|
|
8432
|
+
console.log(import_chalk2.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
8015
8433
|
console.log(
|
|
8016
|
-
|
|
8434
|
+
import_chalk2.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
8017
8435
|
);
|
|
8018
8436
|
} else if (selectedProvider === "lmstudio") {
|
|
8019
8437
|
console.log(
|
|
8020
|
-
|
|
8438
|
+
import_chalk2.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
8021
8439
|
);
|
|
8022
|
-
console.log(
|
|
8023
|
-
console.log(
|
|
8024
|
-
console.log(
|
|
8440
|
+
console.log(import_chalk2.default.gray("2. Start LM Studio application"));
|
|
8441
|
+
console.log(import_chalk2.default.gray("3. Load a model in LM Studio"));
|
|
8442
|
+
console.log(import_chalk2.default.gray("4. Start the local server in LM Studio"));
|
|
8025
8443
|
} else if (selectedProvider === "vllm") {
|
|
8026
|
-
console.log(
|
|
8027
|
-
console.log(
|
|
8028
|
-
console.log(
|
|
8444
|
+
console.log(import_chalk2.default.gray("1. Install vLLM: pip install vllm"));
|
|
8445
|
+
console.log(import_chalk2.default.gray("2. Start vLLM server with a model"));
|
|
8446
|
+
console.log(import_chalk2.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
8029
8447
|
}
|
|
8030
8448
|
process.exit(1);
|
|
8031
8449
|
}
|
|
@@ -8668,8 +9086,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8668
9086
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
8669
9087
|
const fs12 = await importNodeBuiltin2("fs");
|
|
8670
9088
|
const _path = await importNodeBuiltin2("path");
|
|
8671
|
-
const
|
|
8672
|
-
const targetPath = configPath || _path.join(
|
|
9089
|
+
const os9 = await importNodeBuiltin2("os");
|
|
9090
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
8673
9091
|
try {
|
|
8674
9092
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
8675
9093
|
return JSON.parse(data2);
|
|
@@ -8687,8 +9105,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8687
9105
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
8688
9106
|
const fs12 = await importNodeBuiltin2("fs");
|
|
8689
9107
|
const _path = await importNodeBuiltin2("path");
|
|
8690
|
-
const
|
|
8691
|
-
const targetPath = configPath || _path.join(
|
|
9108
|
+
const os9 = await importNodeBuiltin2("os");
|
|
9109
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
8692
9110
|
try {
|
|
8693
9111
|
if (options?.backup) {
|
|
8694
9112
|
try {
|
|
@@ -8836,88 +9254,6 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8836
9254
|
}
|
|
8837
9255
|
});
|
|
8838
9256
|
|
|
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
|
-
|
|
8921
9257
|
// src/config/defaults.ts
|
|
8922
9258
|
var parseList, DEFAULT_UI_CONFIG, DEFAULT_PROVIDER_PREFS, AI_PROVIDERS_CONFIG, APP_VERSION;
|
|
8923
9259
|
var init_defaults = __esm({
|
|
@@ -12141,7 +12477,7 @@ var init_UserPatternAnalyzer = __esm({
|
|
|
12141
12477
|
});
|
|
12142
12478
|
|
|
12143
12479
|
// src/services/intelligent-router/app/IntelligentRouterService.ts
|
|
12144
|
-
var import_node_events,
|
|
12480
|
+
var import_node_events, import_chalk3, IntelligentRouterService;
|
|
12145
12481
|
var init_IntelligentRouterService = __esm({
|
|
12146
12482
|
"src/services/intelligent-router/app/IntelligentRouterService.ts"() {
|
|
12147
12483
|
import_node_events = require("events");
|
|
@@ -12152,7 +12488,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12152
12488
|
init_LanguageDetector();
|
|
12153
12489
|
init_CommandMappings();
|
|
12154
12490
|
init_UserPatternAnalyzer();
|
|
12155
|
-
|
|
12491
|
+
import_chalk3 = __toESM(require("chalk"), 1);
|
|
12156
12492
|
IntelligentRouterService = class extends import_node_events.EventEmitter {
|
|
12157
12493
|
nlpProcessor;
|
|
12158
12494
|
intentRecognizer;
|
|
@@ -12211,7 +12547,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12211
12547
|
this.emit("initialized");
|
|
12212
12548
|
} catch (_error) {
|
|
12213
12549
|
console._error(
|
|
12214
|
-
|
|
12550
|
+
import_chalk3.default.red("Failed to initialize Intelligent Router:"),
|
|
12215
12551
|
_error
|
|
12216
12552
|
);
|
|
12217
12553
|
throw _error;
|
|
@@ -12265,7 +12601,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12265
12601
|
} catch (_error) {
|
|
12266
12602
|
this.metrics.failedRoutes++;
|
|
12267
12603
|
this.emit("route:_error", { input: input3, _error });
|
|
12268
|
-
console._error(
|
|
12604
|
+
console._error(import_chalk3.default.red("Routing _error:"), _error);
|
|
12269
12605
|
return null;
|
|
12270
12606
|
}
|
|
12271
12607
|
}
|
|
@@ -12950,38 +13286,38 @@ var init_ReadlineAdapter = __esm({
|
|
|
12950
13286
|
});
|
|
12951
13287
|
|
|
12952
13288
|
// src/services/interactive-session/adapters/ChalkAdapter.ts
|
|
12953
|
-
var
|
|
13289
|
+
var import_chalk4, import_ora, ChalkAdapter;
|
|
12954
13290
|
var init_ChalkAdapter = __esm({
|
|
12955
13291
|
"src/services/interactive-session/adapters/ChalkAdapter.ts"() {
|
|
12956
|
-
|
|
13292
|
+
import_chalk4 = __toESM(require("chalk"), 1);
|
|
12957
13293
|
import_ora = __toESM(require("ora"), 1);
|
|
12958
13294
|
ChalkAdapter = class {
|
|
12959
13295
|
spinners = /* @__PURE__ */ new Map();
|
|
12960
13296
|
spinnerId = 0;
|
|
12961
13297
|
async showWelcome() {
|
|
12962
13298
|
console.log(
|
|
12963
|
-
|
|
13299
|
+
import_chalk4.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
12964
13300
|
);
|
|
12965
|
-
console.log(
|
|
13301
|
+
console.log(import_chalk4.default.gray("Type /help for available commands\n"));
|
|
12966
13302
|
}
|
|
12967
13303
|
showGoodbye() {
|
|
12968
13304
|
this.stopAllSpinners();
|
|
12969
|
-
console.log(
|
|
13305
|
+
console.log(import_chalk4.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
12970
13306
|
}
|
|
12971
13307
|
async print(message) {
|
|
12972
13308
|
console.log(message);
|
|
12973
13309
|
}
|
|
12974
13310
|
error(message) {
|
|
12975
|
-
console.error(
|
|
13311
|
+
console.error(import_chalk4.default.red(`\u274C ${message}`));
|
|
12976
13312
|
}
|
|
12977
13313
|
success(message) {
|
|
12978
|
-
console.log(
|
|
13314
|
+
console.log(import_chalk4.default.green(`\u2705 ${message}`));
|
|
12979
13315
|
}
|
|
12980
13316
|
warning(message) {
|
|
12981
|
-
console.warn(
|
|
13317
|
+
console.warn(import_chalk4.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
12982
13318
|
}
|
|
12983
13319
|
info(message) {
|
|
12984
|
-
console.info(
|
|
13320
|
+
console.info(import_chalk4.default.blue(`\u2139\uFE0F ${message}`));
|
|
12985
13321
|
}
|
|
12986
13322
|
startSpinner(message) {
|
|
12987
13323
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -13031,12 +13367,12 @@ var init_ChalkAdapter = __esm({
|
|
|
13031
13367
|
* Format helpers for consistent styling
|
|
13032
13368
|
*/
|
|
13033
13369
|
static format = {
|
|
13034
|
-
command: (text) =>
|
|
13035
|
-
keyword: (text) =>
|
|
13036
|
-
value: (text) =>
|
|
13037
|
-
dim: (text) =>
|
|
13038
|
-
bold: (text) =>
|
|
13039
|
-
code: (text) =>
|
|
13370
|
+
command: (text) => import_chalk4.default.cyan(text),
|
|
13371
|
+
keyword: (text) => import_chalk4.default.magenta(text),
|
|
13372
|
+
value: (text) => import_chalk4.default.green(text),
|
|
13373
|
+
dim: (text) => import_chalk4.default.gray(text),
|
|
13374
|
+
bold: (text) => import_chalk4.default.bold(text),
|
|
13375
|
+
code: (text) => import_chalk4.default.bgGray.white(` ${text} `)
|
|
13040
13376
|
};
|
|
13041
13377
|
};
|
|
13042
13378
|
}
|
|
@@ -15141,10 +15477,10 @@ var init_dual_memory_engine = __esm({
|
|
|
15141
15477
|
});
|
|
15142
15478
|
|
|
15143
15479
|
// src/utils/logger.ts
|
|
15144
|
-
var
|
|
15480
|
+
var import_chalk5, LogLevel, Logger, logger, envLogLevel;
|
|
15145
15481
|
var init_logger = __esm({
|
|
15146
15482
|
"src/utils/logger.ts"() {
|
|
15147
|
-
|
|
15483
|
+
import_chalk5 = __toESM(require("chalk"), 1);
|
|
15148
15484
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
15149
15485
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
15150
15486
|
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
@@ -15162,27 +15498,27 @@ var init_logger = __esm({
|
|
|
15162
15498
|
}
|
|
15163
15499
|
debug(...args) {
|
|
15164
15500
|
if (this.level <= 0 /* DEBUG */) {
|
|
15165
|
-
console.log(
|
|
15501
|
+
console.log(import_chalk5.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
15166
15502
|
}
|
|
15167
15503
|
}
|
|
15168
15504
|
info(...args) {
|
|
15169
15505
|
if (this.level <= 1 /* INFO */) {
|
|
15170
|
-
console.log(
|
|
15506
|
+
console.log(import_chalk5.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
15171
15507
|
}
|
|
15172
15508
|
}
|
|
15173
15509
|
warn(...args) {
|
|
15174
15510
|
if (this.level <= 2 /* WARN */) {
|
|
15175
|
-
console.warn(
|
|
15511
|
+
console.warn(import_chalk5.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
15176
15512
|
}
|
|
15177
15513
|
}
|
|
15178
15514
|
error(...args) {
|
|
15179
15515
|
if (this.level <= 3 /* ERROR */) {
|
|
15180
|
-
console.error(
|
|
15516
|
+
console.error(import_chalk5.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
15181
15517
|
}
|
|
15182
15518
|
}
|
|
15183
15519
|
success(...args) {
|
|
15184
15520
|
if (this.level <= 1 /* INFO */) {
|
|
15185
|
-
console.log(
|
|
15521
|
+
console.log(import_chalk5.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
15186
15522
|
}
|
|
15187
15523
|
}
|
|
15188
15524
|
task(taskName, status, message) {
|
|
@@ -15196,10 +15532,10 @@ var init_logger = __esm({
|
|
|
15196
15532
|
error: "\u274C"
|
|
15197
15533
|
};
|
|
15198
15534
|
const statusColors = {
|
|
15199
|
-
start:
|
|
15200
|
-
progress:
|
|
15201
|
-
complete:
|
|
15202
|
-
error:
|
|
15535
|
+
start: import_chalk5.default.bold.magenta,
|
|
15536
|
+
progress: import_chalk5.default.magenta,
|
|
15537
|
+
complete: import_chalk5.default.bold.magenta,
|
|
15538
|
+
error: import_chalk5.default.bold.magenta
|
|
15203
15539
|
};
|
|
15204
15540
|
const icon = statusIcons[status];
|
|
15205
15541
|
const color = statusColors[status];
|
|
@@ -15216,14 +15552,14 @@ var init_logger = __esm({
|
|
|
15216
15552
|
if (this.level > 0 /* DEBUG */) {
|
|
15217
15553
|
return;
|
|
15218
15554
|
}
|
|
15219
|
-
console.log(
|
|
15555
|
+
console.log(import_chalk5.default.magenta(`${this.prefix} [JSON]`));
|
|
15220
15556
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
15221
15557
|
}
|
|
15222
15558
|
divider() {
|
|
15223
15559
|
if (this.level > 1 /* INFO */) {
|
|
15224
15560
|
return;
|
|
15225
15561
|
}
|
|
15226
|
-
console.log(
|
|
15562
|
+
console.log(import_chalk5.default.magenta("\u2500".repeat(60)));
|
|
15227
15563
|
}
|
|
15228
15564
|
clear() {
|
|
15229
15565
|
console.clear();
|
|
@@ -15243,7 +15579,7 @@ var init_logger = __esm({
|
|
|
15243
15579
|
const progressText = `${current}/${total}`;
|
|
15244
15580
|
const labelText = label ? ` ${label}` : "";
|
|
15245
15581
|
process.stdout.write(
|
|
15246
|
-
`\r${
|
|
15582
|
+
`\r${import_chalk5.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
15247
15583
|
);
|
|
15248
15584
|
if (current === total) {
|
|
15249
15585
|
process.stdout.write("\n");
|
|
@@ -18312,11 +18648,11 @@ var init_ApprovalEngine = __esm({
|
|
|
18312
18648
|
});
|
|
18313
18649
|
|
|
18314
18650
|
// src/services/quick-approval/QuickApprovalInterface.ts
|
|
18315
|
-
var import_node_events3,
|
|
18651
|
+
var import_node_events3, import_chalk6, QuickApprovalInterface;
|
|
18316
18652
|
var init_QuickApprovalInterface = __esm({
|
|
18317
18653
|
"src/services/quick-approval/QuickApprovalInterface.ts"() {
|
|
18318
18654
|
import_node_events3 = require("events");
|
|
18319
|
-
|
|
18655
|
+
import_chalk6 = __toESM(require("chalk"), 1);
|
|
18320
18656
|
init_ApprovalEngine();
|
|
18321
18657
|
QuickApprovalInterface = class _QuickApprovalInterface extends import_node_events3.EventEmitter {
|
|
18322
18658
|
static instance;
|
|
@@ -18398,26 +18734,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18398
18734
|
const _lang = options.language || "en";
|
|
18399
18735
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
18400
18736
|
console.log("");
|
|
18401
|
-
console.log(
|
|
18737
|
+
console.log(import_chalk6.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"));
|
|
18402
18738
|
console.log(
|
|
18403
|
-
|
|
18739
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18404
18740
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
18405
|
-
) +
|
|
18741
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18406
18742
|
);
|
|
18407
|
-
console.log(
|
|
18743
|
+
console.log(import_chalk6.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"));
|
|
18408
18744
|
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")}`;
|
|
18409
18745
|
console.log(
|
|
18410
|
-
|
|
18411
|
-
` > ${_labels.id}: ${
|
|
18412
|
-
) +
|
|
18746
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18747
|
+
` > ${_labels.id}: ${import_chalk6.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
18748
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18413
18749
|
);
|
|
18414
18750
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
18415
18751
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
18416
18752
|
const _titleLabel = ` ${_labels._title}:`;
|
|
18417
18753
|
console.log(
|
|
18418
|
-
|
|
18754
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18419
18755
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
18420
|
-
) +
|
|
18756
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18421
18757
|
);
|
|
18422
18758
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
18423
18759
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -18425,37 +18761,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18425
18761
|
const _levelLabel = ` ${_labels.level}:`;
|
|
18426
18762
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
18427
18763
|
console.log(
|
|
18428
|
-
|
|
18764
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18429
18765
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
18430
|
-
) +
|
|
18766
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18431
18767
|
);
|
|
18432
18768
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
18433
18769
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
18434
18770
|
console.log(
|
|
18435
|
-
|
|
18771
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18436
18772
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
18437
|
-
) +
|
|
18773
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18438
18774
|
);
|
|
18439
18775
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
18440
18776
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
18441
18777
|
console.log(
|
|
18442
|
-
|
|
18778
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18443
18779
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
18444
|
-
) +
|
|
18780
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18445
18781
|
);
|
|
18446
18782
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
18447
18783
|
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")}`;
|
|
18448
18784
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
18449
18785
|
console.log(
|
|
18450
|
-
|
|
18786
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18451
18787
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
18452
|
-
) +
|
|
18788
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18453
18789
|
);
|
|
18454
|
-
console.log(
|
|
18790
|
+
console.log(import_chalk6.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"));
|
|
18455
18791
|
console.log(
|
|
18456
|
-
|
|
18792
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18457
18793
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
18458
|
-
) +
|
|
18794
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18459
18795
|
);
|
|
18460
18796
|
this.menuOptions.forEach((option, _index) => {
|
|
18461
18797
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -18466,32 +18802,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18466
18802
|
switch (option) {
|
|
18467
18803
|
case "approve":
|
|
18468
18804
|
label = _labels.approve;
|
|
18469
|
-
color =
|
|
18805
|
+
color = import_chalk6.default.green;
|
|
18470
18806
|
break;
|
|
18471
18807
|
case "reject":
|
|
18472
18808
|
label = _labels.reject;
|
|
18473
|
-
color =
|
|
18809
|
+
color = import_chalk6.default.red;
|
|
18474
18810
|
break;
|
|
18475
18811
|
case "cancel":
|
|
18476
18812
|
label = _labels.cancel;
|
|
18477
|
-
color =
|
|
18813
|
+
color = import_chalk6.default.yellow;
|
|
18478
18814
|
break;
|
|
18479
18815
|
}
|
|
18480
18816
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
18481
18817
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
18482
18818
|
console.log(
|
|
18483
|
-
|
|
18819
|
+
import_chalk6.default.gray("\u2502") + _colorFunc(
|
|
18484
18820
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
18485
|
-
) +
|
|
18821
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18486
18822
|
);
|
|
18487
18823
|
});
|
|
18488
|
-
console.log(
|
|
18824
|
+
console.log(import_chalk6.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"));
|
|
18489
18825
|
console.log(
|
|
18490
|
-
|
|
18826
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18491
18827
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
18492
|
-
) +
|
|
18828
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18493
18829
|
);
|
|
18494
|
-
console.log(
|
|
18830
|
+
console.log(import_chalk6.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"));
|
|
18495
18831
|
console.log("");
|
|
18496
18832
|
}
|
|
18497
18833
|
/**
|
|
@@ -18507,13 +18843,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18507
18843
|
};
|
|
18508
18844
|
const _formatted = keyMap[_key] || _key;
|
|
18509
18845
|
const colorMap = {
|
|
18510
|
-
"shift+tab":
|
|
18511
|
-
"ctrl+y":
|
|
18512
|
-
"ctrl+n":
|
|
18513
|
-
"ctrl+t":
|
|
18514
|
-
"ctrl+r":
|
|
18846
|
+
"shift+tab": import_chalk6.default.bgGreen.black.bold,
|
|
18847
|
+
"ctrl+y": import_chalk6.default.bgBlue.white.bold,
|
|
18848
|
+
"ctrl+n": import_chalk6.default.bgRed.white.bold,
|
|
18849
|
+
"ctrl+t": import_chalk6.default.bgMagenta.white.bold,
|
|
18850
|
+
"ctrl+r": import_chalk6.default.bgYellow.black.bold
|
|
18515
18851
|
};
|
|
18516
|
-
const _colorFunc = colorMap[_key] ||
|
|
18852
|
+
const _colorFunc = colorMap[_key] || import_chalk6.default.bgCyan.black.bold;
|
|
18517
18853
|
return _colorFunc(` ${_formatted} `);
|
|
18518
18854
|
}
|
|
18519
18855
|
/**
|
|
@@ -18522,15 +18858,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18522
18858
|
formatRiskLevel(risk) {
|
|
18523
18859
|
switch (risk.toLowerCase()) {
|
|
18524
18860
|
case "critical":
|
|
18525
|
-
return
|
|
18861
|
+
return import_chalk6.default.red.bold("CRITICAL");
|
|
18526
18862
|
case "high":
|
|
18527
|
-
return
|
|
18863
|
+
return import_chalk6.default.red("HIGH");
|
|
18528
18864
|
case "medium":
|
|
18529
|
-
return
|
|
18865
|
+
return import_chalk6.default.yellow("MEDIUM");
|
|
18530
18866
|
case "low":
|
|
18531
|
-
return
|
|
18867
|
+
return import_chalk6.default.green("LOW");
|
|
18532
18868
|
default:
|
|
18533
|
-
return
|
|
18869
|
+
return import_chalk6.default.white(risk);
|
|
18534
18870
|
}
|
|
18535
18871
|
}
|
|
18536
18872
|
/**
|
|
@@ -18600,7 +18936,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18600
18936
|
}
|
|
18601
18937
|
if (_key === "") {
|
|
18602
18938
|
console.log(`
|
|
18603
|
-
${
|
|
18939
|
+
${import_chalk6.default.red("Approval cancelled by user")}`);
|
|
18604
18940
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
18605
18941
|
return;
|
|
18606
18942
|
}
|
|
@@ -18657,20 +18993,20 @@ ${import_chalk5.default.red("Approval cancelled by user")}`);
|
|
|
18657
18993
|
}
|
|
18658
18994
|
console.clear();
|
|
18659
18995
|
console.log(`
|
|
18660
|
-
${
|
|
18996
|
+
${import_chalk6.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18661
18997
|
console.log(
|
|
18662
|
-
|
|
18998
|
+
import_chalk6.default.bgGreen.black.bold("\u2502") + import_chalk6.default.bgGreen.black.bold(
|
|
18663
18999
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
18664
|
-
) +
|
|
19000
|
+
) + import_chalk6.default.bgGreen.black.bold("\u2502")
|
|
18665
19001
|
);
|
|
18666
|
-
console.log(
|
|
19002
|
+
console.log(import_chalk6.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
18667
19003
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
18668
19004
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
18669
19005
|
console.log(
|
|
18670
|
-
|
|
19006
|
+
import_chalk6.default.bgGreen.black.bold("\u2502") + import_chalk6.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + import_chalk6.default.bgGreen.black.bold("\u2502")
|
|
18671
19007
|
);
|
|
18672
|
-
console.log(
|
|
18673
|
-
console.log(
|
|
19008
|
+
console.log(import_chalk6.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
19009
|
+
console.log(import_chalk6.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
18674
19010
|
try {
|
|
18675
19011
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
18676
19012
|
this.currentRequest.id,
|
|
@@ -18680,30 +19016,30 @@ ${import_chalk5.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)
|
|
|
18680
19016
|
);
|
|
18681
19017
|
response.quickDecision = true;
|
|
18682
19018
|
console.log(`
|
|
18683
|
-
${
|
|
19019
|
+
${import_chalk6.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18684
19020
|
console.log(
|
|
18685
|
-
|
|
19021
|
+
import_chalk6.default.bgGreen.black("\u2502") + import_chalk6.default.bgGreen.black(
|
|
18686
19022
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
18687
|
-
) +
|
|
19023
|
+
) + import_chalk6.default.bgGreen.black("\u2502")
|
|
18688
19024
|
);
|
|
18689
|
-
console.log(
|
|
19025
|
+
console.log(import_chalk6.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
18690
19026
|
if (_choice.trustLevel) {
|
|
18691
19027
|
console.log(
|
|
18692
|
-
|
|
19028
|
+
import_chalk6.default.blue(`
|
|
18693
19029
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
18694
19030
|
);
|
|
18695
19031
|
}
|
|
18696
19032
|
this.emit("approval-_response", _response);
|
|
18697
19033
|
} catch (_error) {
|
|
18698
19034
|
console.log(`
|
|
18699
|
-
${
|
|
19035
|
+
${import_chalk6.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18700
19036
|
console.log(
|
|
18701
|
-
|
|
19037
|
+
import_chalk6.default.bgRed.white.bold("\u2502") + import_chalk6.default.bgRed.white.bold(
|
|
18702
19038
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
18703
|
-
) +
|
|
19039
|
+
) + import_chalk6.default.bgRed.white.bold("\u2502")
|
|
18704
19040
|
);
|
|
18705
|
-
console.log(
|
|
18706
|
-
console._error(
|
|
19041
|
+
console.log(import_chalk6.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
19042
|
+
console._error(import_chalk6.default.red("\nError details:"), _error);
|
|
18707
19043
|
this.emit("approval-_error", _error);
|
|
18708
19044
|
}
|
|
18709
19045
|
}
|
|
@@ -18717,7 +19053,7 @@ ${import_chalk5.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`
|
|
|
18717
19053
|
timeoutId = setTimeout(() => {
|
|
18718
19054
|
console.log(
|
|
18719
19055
|
`
|
|
18720
|
-
${
|
|
19056
|
+
${import_chalk6.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
18721
19057
|
);
|
|
18722
19058
|
this.handleTimeoutResponse(resolve);
|
|
18723
19059
|
}, timeout);
|
|
@@ -18761,7 +19097,7 @@ ${import_chalk5.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
18761
19097
|
response.quickDecision = true;
|
|
18762
19098
|
resolve(_response);
|
|
18763
19099
|
} catch (_error) {
|
|
18764
|
-
console._error(
|
|
19100
|
+
console._error(import_chalk6.default.red("Error processing timeout approval:"), _error);
|
|
18765
19101
|
}
|
|
18766
19102
|
}
|
|
18767
19103
|
/**
|
|
@@ -18776,11 +19112,11 @@ ${import_chalk5.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
18776
19112
|
);
|
|
18777
19113
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
18778
19114
|
console.log(
|
|
18779
|
-
|
|
19115
|
+
import_chalk6.default.blue(
|
|
18780
19116
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
18781
19117
|
)
|
|
18782
19118
|
);
|
|
18783
|
-
console.log(
|
|
19119
|
+
console.log(import_chalk6.default.gray(`Reason: ${event.reason}`));
|
|
18784
19120
|
});
|
|
18785
19121
|
}
|
|
18786
19122
|
/**
|
|
@@ -19569,22 +19905,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
19569
19905
|
}
|
|
19570
19906
|
function formatError(message, code) {
|
|
19571
19907
|
const prefix = code ? `[${code}] ` : "";
|
|
19572
|
-
return
|
|
19908
|
+
return import_chalk7.default.red(`\u274C ${prefix}${message}`);
|
|
19573
19909
|
}
|
|
19574
19910
|
function formatSuccess(message) {
|
|
19575
|
-
return
|
|
19911
|
+
return import_chalk7.default.green(`\u2705 ${message}`);
|
|
19576
19912
|
}
|
|
19577
19913
|
function formatWarning(message) {
|
|
19578
|
-
return
|
|
19914
|
+
return import_chalk7.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
19579
19915
|
}
|
|
19580
19916
|
function formatInfo(message) {
|
|
19581
|
-
return
|
|
19917
|
+
return import_chalk7.default.blue(`\u2139\uFE0F ${message}`);
|
|
19582
19918
|
}
|
|
19583
19919
|
function formatTable(headers, rows, options = {}) {
|
|
19584
19920
|
const {
|
|
19585
19921
|
columnWidths = headers.map(() => 20),
|
|
19586
19922
|
separator = " | ",
|
|
19587
|
-
headerColor =
|
|
19923
|
+
headerColor = import_chalk7.default.cyan.bold
|
|
19588
19924
|
} = options;
|
|
19589
19925
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
19590
19926
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -19596,8 +19932,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
19596
19932
|
function formatKeyValue(data2, options = {}) {
|
|
19597
19933
|
const {
|
|
19598
19934
|
keyWidth = 20,
|
|
19599
|
-
keyColor =
|
|
19600
|
-
valueColor =
|
|
19935
|
+
keyColor = import_chalk7.default.gray,
|
|
19936
|
+
valueColor = import_chalk7.default.white,
|
|
19601
19937
|
separator = ": "
|
|
19602
19938
|
} = options;
|
|
19603
19939
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -19619,19 +19955,19 @@ function formatTimestamp(date, format = "short") {
|
|
|
19619
19955
|
return d.toLocaleTimeString();
|
|
19620
19956
|
}
|
|
19621
19957
|
}
|
|
19622
|
-
var
|
|
19958
|
+
var import_chalk7;
|
|
19623
19959
|
var init_FormatUtils = __esm({
|
|
19624
19960
|
"src/services/interactive-session/display/FormatUtils.ts"() {
|
|
19625
|
-
|
|
19961
|
+
import_chalk7 = __toESM(require("chalk"), 1);
|
|
19626
19962
|
}
|
|
19627
19963
|
});
|
|
19628
19964
|
|
|
19629
19965
|
// src/services/interactive-session/display/DisplayManager.ts
|
|
19630
|
-
var
|
|
19966
|
+
var os2, import_chalk8, DisplayManager;
|
|
19631
19967
|
var init_DisplayManager = __esm({
|
|
19632
19968
|
"src/services/interactive-session/display/DisplayManager.ts"() {
|
|
19633
|
-
|
|
19634
|
-
|
|
19969
|
+
os2 = __toESM(require("os"), 1);
|
|
19970
|
+
import_chalk8 = __toESM(require("chalk"), 1);
|
|
19635
19971
|
init_SpinnerManager();
|
|
19636
19972
|
init_FormatUtils();
|
|
19637
19973
|
DisplayManager = class {
|
|
@@ -19643,7 +19979,7 @@ var init_DisplayManager = __esm({
|
|
|
19643
19979
|
cursorState = { visible: true };
|
|
19644
19980
|
constructor(options = {}) {
|
|
19645
19981
|
this.spinnerManager = SpinnerManager.getInstance();
|
|
19646
|
-
this.platform =
|
|
19982
|
+
this.platform = os2.platform();
|
|
19647
19983
|
this.isWindows = this.platform === "win32";
|
|
19648
19984
|
this.isTTY = process.stdout.isTTY || false;
|
|
19649
19985
|
this.options = {
|
|
@@ -19653,7 +19989,7 @@ var init_DisplayManager = __esm({
|
|
|
19653
19989
|
theme: options.theme ?? "auto"
|
|
19654
19990
|
};
|
|
19655
19991
|
if (!this.options.enableColors) {
|
|
19656
|
-
|
|
19992
|
+
import_chalk8.default.level = 0;
|
|
19657
19993
|
}
|
|
19658
19994
|
this.setupCleanupHandlers();
|
|
19659
19995
|
}
|
|
@@ -19770,7 +20106,7 @@ var init_DisplayManager = __esm({
|
|
|
19770
20106
|
const {
|
|
19771
20107
|
padding = 1,
|
|
19772
20108
|
borderStyle = "single",
|
|
19773
|
-
borderColor =
|
|
20109
|
+
borderColor = import_chalk8.default.gray
|
|
19774
20110
|
} = options;
|
|
19775
20111
|
const lines = content.split("\n");
|
|
19776
20112
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -19828,7 +20164,7 @@ var init_DisplayManager = __esm({
|
|
|
19828
20164
|
*/
|
|
19829
20165
|
startSpinner(text) {
|
|
19830
20166
|
if (!this.options.enableAnimations) {
|
|
19831
|
-
this.writeLine(
|
|
20167
|
+
this.writeLine(import_chalk8.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
19832
20168
|
return "no-animation";
|
|
19833
20169
|
}
|
|
19834
20170
|
return this.spinnerManager.start({ text });
|
|
@@ -19921,10 +20257,10 @@ var init_DisplayManager = __esm({
|
|
|
19921
20257
|
});
|
|
19922
20258
|
|
|
19923
20259
|
// src/services/interactive-session/display/StatusDisplay.ts
|
|
19924
|
-
var
|
|
20260
|
+
var import_chalk9, StatusDisplay;
|
|
19925
20261
|
var init_StatusDisplay = __esm({
|
|
19926
20262
|
"src/services/interactive-session/display/StatusDisplay.ts"() {
|
|
19927
|
-
|
|
20263
|
+
import_chalk9 = __toESM(require("chalk"), 1);
|
|
19928
20264
|
init_FormatUtils();
|
|
19929
20265
|
StatusDisplay = class {
|
|
19930
20266
|
/**
|
|
@@ -19935,11 +20271,11 @@ var init_StatusDisplay = __esm({
|
|
|
19935
20271
|
*/
|
|
19936
20272
|
static renderSystemStatus(status, detailed = false) {
|
|
19937
20273
|
const lines = [];
|
|
19938
|
-
lines.push(
|
|
20274
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F4CA} System Status"));
|
|
19939
20275
|
lines.push("");
|
|
19940
20276
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
19941
20277
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
19942
|
-
const statusColor = status.operational ?
|
|
20278
|
+
const statusColor = status.operational ? import_chalk9.default.green : import_chalk9.default.red;
|
|
19943
20279
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
19944
20280
|
lines.push(
|
|
19945
20281
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -19960,15 +20296,15 @@ var init_StatusDisplay = __esm({
|
|
|
19960
20296
|
if (status.errors > 0 || status.warnings > 0) {
|
|
19961
20297
|
lines.push("");
|
|
19962
20298
|
if (status.errors > 0) {
|
|
19963
|
-
lines.push(
|
|
20299
|
+
lines.push(import_chalk9.default.red(`\u274C Errors: ${status.errors}`));
|
|
19964
20300
|
}
|
|
19965
20301
|
if (status.warnings > 0) {
|
|
19966
|
-
lines.push(
|
|
20302
|
+
lines.push(import_chalk9.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
19967
20303
|
}
|
|
19968
20304
|
}
|
|
19969
20305
|
if (detailed) {
|
|
19970
20306
|
lines.push("");
|
|
19971
|
-
lines.push(
|
|
20307
|
+
lines.push(import_chalk9.default.gray("Detailed Information:"));
|
|
19972
20308
|
const details = formatKeyValue(
|
|
19973
20309
|
{
|
|
19974
20310
|
"Process ID": process.pid,
|
|
@@ -19978,8 +20314,8 @@ var init_StatusDisplay = __esm({
|
|
|
19978
20314
|
"Working Directory": process.cwd()
|
|
19979
20315
|
},
|
|
19980
20316
|
{
|
|
19981
|
-
keyColor:
|
|
19982
|
-
valueColor:
|
|
20317
|
+
keyColor: import_chalk9.default.gray,
|
|
20318
|
+
valueColor: import_chalk9.default.white
|
|
19983
20319
|
}
|
|
19984
20320
|
);
|
|
19985
20321
|
lines.push(details);
|
|
@@ -19993,9 +20329,9 @@ var init_StatusDisplay = __esm({
|
|
|
19993
20329
|
*/
|
|
19994
20330
|
static renderMemoryStatus(status) {
|
|
19995
20331
|
const lines = [];
|
|
19996
|
-
lines.push(
|
|
20332
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
19997
20333
|
lines.push("");
|
|
19998
|
-
lines.push(
|
|
20334
|
+
lines.push(import_chalk9.default.yellow("System 1 (Fast):"));
|
|
19999
20335
|
const s1NodeBar = formatProgressBar(
|
|
20000
20336
|
status.system1.nodes,
|
|
20001
20337
|
status.system1.maxNodes,
|
|
@@ -20013,7 +20349,7 @@ var init_StatusDisplay = __esm({
|
|
|
20013
20349
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
20014
20350
|
);
|
|
20015
20351
|
lines.push("");
|
|
20016
|
-
lines.push(
|
|
20352
|
+
lines.push(import_chalk9.default.blue("System 2 (Deep):"));
|
|
20017
20353
|
const s2TraceBar = formatProgressBar(
|
|
20018
20354
|
status.system2.traces,
|
|
20019
20355
|
status.system2.maxTraces,
|
|
@@ -20031,7 +20367,7 @@ var init_StatusDisplay = __esm({
|
|
|
20031
20367
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
20032
20368
|
);
|
|
20033
20369
|
lines.push("");
|
|
20034
|
-
lines.push(
|
|
20370
|
+
lines.push(import_chalk9.default.green("Total:"));
|
|
20035
20371
|
const totalBar = formatProgressBar(
|
|
20036
20372
|
status.total.tokens,
|
|
20037
20373
|
status.total.maxTokens,
|
|
@@ -20040,7 +20376,7 @@ var init_StatusDisplay = __esm({
|
|
|
20040
20376
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
20041
20377
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
20042
20378
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
20043
|
-
const usageColor = usage > 80 ?
|
|
20379
|
+
const usageColor = usage > 80 ? import_chalk9.default.red : usage > 60 ? import_chalk9.default.yellow : import_chalk9.default.green;
|
|
20044
20380
|
lines.push(
|
|
20045
20381
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
20046
20382
|
);
|
|
@@ -20053,9 +20389,9 @@ var init_StatusDisplay = __esm({
|
|
|
20053
20389
|
*/
|
|
20054
20390
|
static renderModelStatus(status) {
|
|
20055
20391
|
const lines = [];
|
|
20056
|
-
lines.push(
|
|
20392
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F916} Model Status"));
|
|
20057
20393
|
lines.push("");
|
|
20058
|
-
lines.push(
|
|
20394
|
+
lines.push(import_chalk9.default.green(`Current: ${import_chalk9.default.bold(status.current)}`));
|
|
20059
20395
|
lines.push("");
|
|
20060
20396
|
lines.push("Available Models:");
|
|
20061
20397
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -20067,7 +20403,7 @@ var init_StatusDisplay = __esm({
|
|
|
20067
20403
|
const table = formatTable(headers, rows, {
|
|
20068
20404
|
columnWidths: [20, 15, 8, 30],
|
|
20069
20405
|
separator: " \u2502 ",
|
|
20070
|
-
headerColor:
|
|
20406
|
+
headerColor: import_chalk9.default.gray
|
|
20071
20407
|
});
|
|
20072
20408
|
lines.push(table);
|
|
20073
20409
|
return lines.join("\n");
|
|
@@ -20079,19 +20415,19 @@ var init_StatusDisplay = __esm({
|
|
|
20079
20415
|
*/
|
|
20080
20416
|
static renderHealthChecks(checks) {
|
|
20081
20417
|
const lines = [];
|
|
20082
|
-
lines.push(
|
|
20418
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
20083
20419
|
lines.push("");
|
|
20084
20420
|
for (const check of checks) {
|
|
20085
20421
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
20086
|
-
const statusColor = check.status === "ok" ?
|
|
20422
|
+
const statusColor = check.status === "ok" ? import_chalk9.default.green : check.status === "warning" ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20087
20423
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
20088
20424
|
if (check.latency !== void 0) {
|
|
20089
|
-
const latencyColor = check.latency < 100 ?
|
|
20425
|
+
const latencyColor = check.latency < 100 ? import_chalk9.default.green : check.latency < 500 ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20090
20426
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
20091
20427
|
}
|
|
20092
20428
|
lines.push(line);
|
|
20093
20429
|
if (check.message) {
|
|
20094
|
-
lines.push(
|
|
20430
|
+
lines.push(import_chalk9.default.gray(` ${check.message}`));
|
|
20095
20431
|
}
|
|
20096
20432
|
}
|
|
20097
20433
|
lines.push("");
|
|
@@ -20100,16 +20436,16 @@ var init_StatusDisplay = __esm({
|
|
|
20100
20436
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
20101
20437
|
if (errorCount > 0) {
|
|
20102
20438
|
lines.push(
|
|
20103
|
-
|
|
20439
|
+
import_chalk9.default.red(
|
|
20104
20440
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
20105
20441
|
)
|
|
20106
20442
|
);
|
|
20107
20443
|
} else if (warningCount > 0) {
|
|
20108
20444
|
lines.push(
|
|
20109
|
-
|
|
20445
|
+
import_chalk9.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
20110
20446
|
);
|
|
20111
20447
|
} else {
|
|
20112
|
-
lines.push(
|
|
20448
|
+
lines.push(import_chalk9.default.green("\u2705 All systems operational"));
|
|
20113
20449
|
}
|
|
20114
20450
|
return lines.join("\n");
|
|
20115
20451
|
}
|
|
@@ -20120,7 +20456,7 @@ var init_StatusDisplay = __esm({
|
|
|
20120
20456
|
*/
|
|
20121
20457
|
static renderSessionStats(stats) {
|
|
20122
20458
|
const lines = [];
|
|
20123
|
-
lines.push(
|
|
20459
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
20124
20460
|
lines.push("");
|
|
20125
20461
|
const data2 = formatKeyValue(
|
|
20126
20462
|
{
|
|
@@ -20133,14 +20469,14 @@ var init_StatusDisplay = __esm({
|
|
|
20133
20469
|
},
|
|
20134
20470
|
{
|
|
20135
20471
|
keyWidth: 20,
|
|
20136
|
-
keyColor:
|
|
20137
|
-
valueColor:
|
|
20472
|
+
keyColor: import_chalk9.default.gray,
|
|
20473
|
+
valueColor: import_chalk9.default.white
|
|
20138
20474
|
}
|
|
20139
20475
|
);
|
|
20140
20476
|
lines.push(data2);
|
|
20141
20477
|
lines.push("");
|
|
20142
20478
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
20143
|
-
const perfColor = performance3 === "Excellent" ?
|
|
20479
|
+
const perfColor = performance3 === "Excellent" ? import_chalk9.default.green : performance3 === "Good" ? import_chalk9.default.blue : performance3 === "Fair" ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20144
20480
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
20145
20481
|
return lines.join("\n");
|
|
20146
20482
|
}
|
|
@@ -20152,22 +20488,22 @@ var init_StatusDisplay = __esm({
|
|
|
20152
20488
|
static renderStatusBar(data2) {
|
|
20153
20489
|
const segments = [];
|
|
20154
20490
|
if (data2.mode) {
|
|
20155
|
-
segments.push(
|
|
20491
|
+
segments.push(import_chalk9.default.cyan(`[${data2.mode}]`));
|
|
20156
20492
|
}
|
|
20157
20493
|
if (data2.model) {
|
|
20158
|
-
segments.push(
|
|
20494
|
+
segments.push(import_chalk9.default.blue(`\u{1F916} ${data2.model}`));
|
|
20159
20495
|
}
|
|
20160
20496
|
if (data2.memory !== void 0) {
|
|
20161
|
-
const memoryColor = data2.memory > 80 ?
|
|
20497
|
+
const memoryColor = data2.memory > 80 ? import_chalk9.default.red : data2.memory > 60 ? import_chalk9.default.yellow : import_chalk9.default.green;
|
|
20162
20498
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
20163
20499
|
}
|
|
20164
20500
|
if (data2.latency !== void 0) {
|
|
20165
|
-
const latencyColor = data2.latency < 100 ?
|
|
20501
|
+
const latencyColor = data2.latency < 100 ? import_chalk9.default.green : data2.latency < 500 ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20166
20502
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
20167
20503
|
}
|
|
20168
20504
|
if (data2.time) {
|
|
20169
20505
|
segments.push(
|
|
20170
|
-
|
|
20506
|
+
import_chalk9.default.gray(formatTimestamp(data2.time, "short"))
|
|
20171
20507
|
);
|
|
20172
20508
|
}
|
|
20173
20509
|
return segments.join(" \u2502 ");
|
|
@@ -20177,10 +20513,10 @@ var init_StatusDisplay = __esm({
|
|
|
20177
20513
|
});
|
|
20178
20514
|
|
|
20179
20515
|
// src/services/interactive-session/handlers/CoreHandlers.ts
|
|
20180
|
-
var
|
|
20516
|
+
var import_chalk10, import_perf_hooks, HelpHandler, ClearHandler, ExitHandler, VersionHandler, HistoryHandler, CoreHandlers;
|
|
20181
20517
|
var init_CoreHandlers = __esm({
|
|
20182
20518
|
"src/services/interactive-session/handlers/CoreHandlers.ts"() {
|
|
20183
|
-
|
|
20519
|
+
import_chalk10 = __toESM(require("chalk"), 1);
|
|
20184
20520
|
import_perf_hooks = require("perf_hooks");
|
|
20185
20521
|
HelpHandler = class {
|
|
20186
20522
|
registry;
|
|
@@ -20190,7 +20526,7 @@ var init_CoreHandlers = __esm({
|
|
|
20190
20526
|
async execute(args) {
|
|
20191
20527
|
const startTime = import_perf_hooks.performance.now();
|
|
20192
20528
|
const commands = this.registry.getCommands();
|
|
20193
|
-
let message =
|
|
20529
|
+
let message = import_chalk10.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
20194
20530
|
|
|
20195
20531
|
`);
|
|
20196
20532
|
const categories = {
|
|
@@ -20201,17 +20537,17 @@ var init_CoreHandlers = __esm({
|
|
|
20201
20537
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
20202
20538
|
};
|
|
20203
20539
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
20204
|
-
message +=
|
|
20540
|
+
message += import_chalk10.default.yellow(`
|
|
20205
20541
|
${category.toUpperCase()}:
|
|
20206
20542
|
`);
|
|
20207
20543
|
for (const cmd of cmds) {
|
|
20208
20544
|
if (commands.includes(cmd)) {
|
|
20209
|
-
message += ` ${
|
|
20545
|
+
message += ` ${import_chalk10.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
20210
20546
|
`;
|
|
20211
20547
|
}
|
|
20212
20548
|
}
|
|
20213
20549
|
}
|
|
20214
|
-
message +=
|
|
20550
|
+
message += import_chalk10.default.gray(
|
|
20215
20551
|
`
|
|
20216
20552
|
Type '/help <command>' for detailed information about a specific command.`
|
|
20217
20553
|
);
|
|
@@ -20259,7 +20595,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20259
20595
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20260
20596
|
return {
|
|
20261
20597
|
success: true,
|
|
20262
|
-
message:
|
|
20598
|
+
message: import_chalk10.default.gray("Terminal cleared."),
|
|
20263
20599
|
metadata: {
|
|
20264
20600
|
processingTime,
|
|
20265
20601
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -20270,7 +20606,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20270
20606
|
ExitHandler = class {
|
|
20271
20607
|
async execute(args) {
|
|
20272
20608
|
const startTime = import_perf_hooks.performance.now();
|
|
20273
|
-
const message =
|
|
20609
|
+
const message = import_chalk10.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
20274
20610
|
process.emit("SIGTERM");
|
|
20275
20611
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20276
20612
|
return {
|
|
@@ -20294,23 +20630,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20294
20630
|
platform: process.platform,
|
|
20295
20631
|
arch: process.arch
|
|
20296
20632
|
};
|
|
20297
|
-
let message =
|
|
20298
|
-
message +=
|
|
20633
|
+
let message = import_chalk10.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
20634
|
+
message += import_chalk10.default.white(` Version: ${import_chalk10.default.green(packageInfo.version)}
|
|
20299
20635
|
`);
|
|
20300
|
-
message +=
|
|
20636
|
+
message += import_chalk10.default.white(` Package: ${import_chalk10.default.green(packageInfo.name)}
|
|
20301
20637
|
`);
|
|
20302
|
-
message +=
|
|
20638
|
+
message += import_chalk10.default.white(` Node: ${import_chalk10.default.green(packageInfo.node)}
|
|
20303
20639
|
`);
|
|
20304
|
-
message +=
|
|
20305
|
-
` Platform: ${
|
|
20640
|
+
message += import_chalk10.default.white(
|
|
20641
|
+
` Platform: ${import_chalk10.default.green(packageInfo.platform)}
|
|
20306
20642
|
`
|
|
20307
20643
|
);
|
|
20308
|
-
message +=
|
|
20644
|
+
message += import_chalk10.default.white(` Arch: ${import_chalk10.default.green(packageInfo.arch)}
|
|
20309
20645
|
`);
|
|
20310
|
-
message +=
|
|
20646
|
+
message += import_chalk10.default.gray(`
|
|
20311
20647
|
Build: Production
|
|
20312
20648
|
`);
|
|
20313
|
-
message +=
|
|
20649
|
+
message += import_chalk10.default.gray(` License: MIT
|
|
20314
20650
|
`);
|
|
20315
20651
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20316
20652
|
return {
|
|
@@ -20335,15 +20671,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20335
20671
|
this.history.push("/history");
|
|
20336
20672
|
}
|
|
20337
20673
|
const recent = this.history.slice(-limit);
|
|
20338
|
-
let message =
|
|
20674
|
+
let message = import_chalk10.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
20339
20675
|
|
|
20340
20676
|
`);
|
|
20341
20677
|
recent.forEach((cmd, index) => {
|
|
20342
20678
|
const num = this.history.length - recent.length + index + 1;
|
|
20343
|
-
message +=
|
|
20679
|
+
message += import_chalk10.default.gray(` ${num.toString().padStart(3)}: `) + import_chalk10.default.white(cmd) + "\n";
|
|
20344
20680
|
});
|
|
20345
20681
|
if (recent.length === 0) {
|
|
20346
|
-
message =
|
|
20682
|
+
message = import_chalk10.default.gray("No command history available.");
|
|
20347
20683
|
}
|
|
20348
20684
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20349
20685
|
return {
|
|
@@ -20374,10 +20710,10 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20374
20710
|
});
|
|
20375
20711
|
|
|
20376
20712
|
// src/services/interactive-session/handlers/DevHandlers.ts
|
|
20377
|
-
var
|
|
20713
|
+
var import_chalk11, CodeHandler, TestHandler, ReviewHandler, BugHandler, DevHandlers;
|
|
20378
20714
|
var init_DevHandlers = __esm({
|
|
20379
20715
|
"src/services/interactive-session/handlers/DevHandlers.ts"() {
|
|
20380
|
-
|
|
20716
|
+
import_chalk11 = __toESM(require("chalk"), 1);
|
|
20381
20717
|
CodeHandler = class {
|
|
20382
20718
|
constructor(codeService) {
|
|
20383
20719
|
this.codeService = codeService;
|
|
@@ -20392,13 +20728,13 @@ var init_DevHandlers = __esm({
|
|
|
20392
20728
|
if (!prompt) {
|
|
20393
20729
|
return {
|
|
20394
20730
|
ok: false,
|
|
20395
|
-
message:
|
|
20731
|
+
message: import_chalk11.default.red("\u274C Please provide a code generation request.\n") + import_chalk11.default.gray("Usage: /code <description>\n") + import_chalk11.default.gray("Example: /code create a React button component")
|
|
20396
20732
|
};
|
|
20397
20733
|
}
|
|
20398
20734
|
if (signal?.aborted) {
|
|
20399
20735
|
return {
|
|
20400
20736
|
ok: false,
|
|
20401
|
-
message:
|
|
20737
|
+
message: import_chalk11.default.yellow("Code generation canceled")
|
|
20402
20738
|
};
|
|
20403
20739
|
}
|
|
20404
20740
|
try {
|
|
@@ -20409,9 +20745,9 @@ var init_DevHandlers = __esm({
|
|
|
20409
20745
|
if (dryRun) {
|
|
20410
20746
|
return {
|
|
20411
20747
|
ok: true,
|
|
20412
|
-
message:
|
|
20413
|
-
`) +
|
|
20414
|
-
`) +
|
|
20748
|
+
message: import_chalk11.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + import_chalk11.default.gray(`Language: ${language}
|
|
20749
|
+
`) + import_chalk11.default.gray(`Framework: ${framework || "none"}
|
|
20750
|
+
`) + import_chalk11.default.gray(`Prompt: ${cleanPrompt}`)
|
|
20415
20751
|
};
|
|
20416
20752
|
}
|
|
20417
20753
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -20423,7 +20759,7 @@ function generated() {
|
|
|
20423
20759
|
export { generated };`;
|
|
20424
20760
|
return {
|
|
20425
20761
|
ok: true,
|
|
20426
|
-
message:
|
|
20762
|
+
message: import_chalk11.default.green("\u2705 Code generated successfully:\n\n") + import_chalk11.default.gray("```" + language + "\n") + generatedCode + import_chalk11.default.gray("\n```"),
|
|
20427
20763
|
data: {
|
|
20428
20764
|
code: generatedCode,
|
|
20429
20765
|
language,
|
|
@@ -20436,7 +20772,7 @@ export { generated };`;
|
|
|
20436
20772
|
} catch (error2) {
|
|
20437
20773
|
return {
|
|
20438
20774
|
ok: false,
|
|
20439
|
-
message:
|
|
20775
|
+
message: import_chalk11.default.red(`Code generation failed: ${error2}`)
|
|
20440
20776
|
};
|
|
20441
20777
|
}
|
|
20442
20778
|
}
|
|
@@ -20450,7 +20786,7 @@ export { generated };`;
|
|
|
20450
20786
|
if (signal?.aborted) {
|
|
20451
20787
|
return {
|
|
20452
20788
|
ok: false,
|
|
20453
|
-
message:
|
|
20789
|
+
message: import_chalk11.default.yellow("Test operation canceled")
|
|
20454
20790
|
};
|
|
20455
20791
|
}
|
|
20456
20792
|
const subcommand = args[0] || "run";
|
|
@@ -20466,8 +20802,8 @@ export { generated };`;
|
|
|
20466
20802
|
default:
|
|
20467
20803
|
return {
|
|
20468
20804
|
ok: false,
|
|
20469
|
-
message:
|
|
20470
|
-
`) +
|
|
20805
|
+
message: import_chalk11.default.red(`Unknown test subcommand: ${subcommand}
|
|
20806
|
+
`) + import_chalk11.default.gray("Available: generate, run, coverage")
|
|
20471
20807
|
};
|
|
20472
20808
|
}
|
|
20473
20809
|
}
|
|
@@ -20475,7 +20811,7 @@ export { generated };`;
|
|
|
20475
20811
|
if (!target) {
|
|
20476
20812
|
return {
|
|
20477
20813
|
ok: false,
|
|
20478
|
-
message:
|
|
20814
|
+
message: import_chalk11.default.red(
|
|
20479
20815
|
"Please specify a file or function to generate tests for"
|
|
20480
20816
|
)
|
|
20481
20817
|
};
|
|
@@ -20492,9 +20828,9 @@ describe("${target}", () => {
|
|
|
20492
20828
|
});`;
|
|
20493
20829
|
return {
|
|
20494
20830
|
ok: true,
|
|
20495
|
-
message:
|
|
20831
|
+
message: import_chalk11.default.green(`\u2705 Tests generated for ${target}:
|
|
20496
20832
|
|
|
20497
|
-
`) +
|
|
20833
|
+
`) + import_chalk11.default.gray("```typescript\n") + testCode + import_chalk11.default.gray("\n```"),
|
|
20498
20834
|
data: { testCode, framework, target }
|
|
20499
20835
|
};
|
|
20500
20836
|
}
|
|
@@ -20507,23 +20843,23 @@ describe("${target}", () => {
|
|
|
20507
20843
|
if (coverage) command += " --coverage";
|
|
20508
20844
|
return {
|
|
20509
20845
|
ok: true,
|
|
20510
|
-
message:
|
|
20511
|
-
`) +
|
|
20846
|
+
message: import_chalk11.default.cyan(`\u{1F9EA} Running tests...
|
|
20847
|
+
`) + import_chalk11.default.gray(`Command: ${command}
|
|
20512
20848
|
|
|
20513
|
-
`) +
|
|
20849
|
+
`) + import_chalk11.default.green("\u2705 All tests passed!"),
|
|
20514
20850
|
data: { command, passed: true }
|
|
20515
20851
|
};
|
|
20516
20852
|
}
|
|
20517
20853
|
async showCoverage(options) {
|
|
20518
20854
|
return {
|
|
20519
20855
|
ok: true,
|
|
20520
|
-
message:
|
|
20856
|
+
message: import_chalk11.default.cyan("\u{1F4CA} Test Coverage Report:\n\n") + import_chalk11.default.gray("File".padEnd(40) + "% Stmts".padEnd(10) + "% Lines\n") + import_chalk11.default.gray("-".repeat(60) + "\n") + import_chalk11.default.green(
|
|
20521
20857
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
20522
|
-
) +
|
|
20858
|
+
) + import_chalk11.default.green(
|
|
20523
20859
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
20524
|
-
) +
|
|
20860
|
+
) + import_chalk11.default.yellow(
|
|
20525
20861
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
20526
|
-
) +
|
|
20862
|
+
) + import_chalk11.default.gray("-".repeat(60) + "\n") + import_chalk11.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
20527
20863
|
};
|
|
20528
20864
|
}
|
|
20529
20865
|
};
|
|
@@ -20537,33 +20873,33 @@ describe("${target}", () => {
|
|
|
20537
20873
|
if (!file) {
|
|
20538
20874
|
return {
|
|
20539
20875
|
ok: false,
|
|
20540
|
-
message:
|
|
20876
|
+
message: import_chalk11.default.red("Please specify a file to review\n") + import_chalk11.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
20541
20877
|
};
|
|
20542
20878
|
}
|
|
20543
20879
|
const checkSecurity = args.includes("--security");
|
|
20544
20880
|
const checkPerformance = args.includes("--performance");
|
|
20545
|
-
let message =
|
|
20881
|
+
let message = import_chalk11.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
20546
20882
|
|
|
20547
20883
|
`);
|
|
20548
|
-
message +=
|
|
20549
|
-
message +=
|
|
20550
|
-
message +=
|
|
20551
|
-
message +=
|
|
20884
|
+
message += import_chalk11.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
20885
|
+
message += import_chalk11.default.gray(" 1. Line 42: ") + import_chalk11.default.yellow("Missing error handling in async function\n");
|
|
20886
|
+
message += import_chalk11.default.gray(" 2. Line 89: ") + import_chalk11.default.yellow("Potential memory leak - event listener not removed\n");
|
|
20887
|
+
message += import_chalk11.default.gray(" 3. Line 156: ") + import_chalk11.default.yellow(
|
|
20552
20888
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
20553
20889
|
);
|
|
20554
20890
|
if (checkSecurity) {
|
|
20555
|
-
message +=
|
|
20556
|
-
message +=
|
|
20891
|
+
message += import_chalk11.default.red("\u{1F512} Security Issues (1):\n");
|
|
20892
|
+
message += import_chalk11.default.gray(" 1. Line 67: ") + import_chalk11.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
20557
20893
|
}
|
|
20558
20894
|
if (checkPerformance) {
|
|
20559
|
-
message +=
|
|
20560
|
-
message +=
|
|
20561
|
-
message +=
|
|
20562
|
-
}
|
|
20563
|
-
message +=
|
|
20564
|
-
message +=
|
|
20565
|
-
message +=
|
|
20566
|
-
message +=
|
|
20895
|
+
message += import_chalk11.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
20896
|
+
message += import_chalk11.default.gray(" 1. Line 23: ") + import_chalk11.default.blue("Consider memoization for expensive calculation\n");
|
|
20897
|
+
message += import_chalk11.default.gray(" 2. Line 145: ") + import_chalk11.default.blue("Use virtualization for large list rendering\n\n");
|
|
20898
|
+
}
|
|
20899
|
+
message += import_chalk11.default.green("\u2705 Positive Findings:\n");
|
|
20900
|
+
message += import_chalk11.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
20901
|
+
message += import_chalk11.default.gray(" \u2022 Consistent code style\n");
|
|
20902
|
+
message += import_chalk11.default.gray(" \u2022 Well-documented functions\n");
|
|
20567
20903
|
return {
|
|
20568
20904
|
ok: true,
|
|
20569
20905
|
message,
|
|
@@ -20593,8 +20929,8 @@ describe("${target}", () => {
|
|
|
20593
20929
|
default:
|
|
20594
20930
|
return {
|
|
20595
20931
|
ok: false,
|
|
20596
|
-
message:
|
|
20597
|
-
`) +
|
|
20932
|
+
message: import_chalk11.default.red(`Unknown bug subcommand: ${subcommand}
|
|
20933
|
+
`) + import_chalk11.default.gray("Available: report, list, analyze")
|
|
20598
20934
|
};
|
|
20599
20935
|
}
|
|
20600
20936
|
}
|
|
@@ -20603,18 +20939,18 @@ describe("${target}", () => {
|
|
|
20603
20939
|
if (!description) {
|
|
20604
20940
|
return {
|
|
20605
20941
|
ok: false,
|
|
20606
|
-
message:
|
|
20942
|
+
message: import_chalk11.default.red("Please provide a bug description")
|
|
20607
20943
|
};
|
|
20608
20944
|
}
|
|
20609
20945
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
20610
20946
|
return {
|
|
20611
20947
|
ok: true,
|
|
20612
|
-
message:
|
|
20948
|
+
message: import_chalk11.default.green(`\u{1F41B} Bug reported successfully!
|
|
20613
20949
|
|
|
20614
|
-
`) +
|
|
20615
|
-
`) +
|
|
20616
|
-
`) +
|
|
20617
|
-
`) +
|
|
20950
|
+
`) + import_chalk11.default.cyan(`Bug ID: ${bugId}
|
|
20951
|
+
`) + import_chalk11.default.gray(`Description: ${description}
|
|
20952
|
+
`) + import_chalk11.default.gray(`Status: Open
|
|
20953
|
+
`) + import_chalk11.default.gray(`Priority: To be determined
|
|
20618
20954
|
`),
|
|
20619
20955
|
data: { bugId, description, status: "open" }
|
|
20620
20956
|
};
|
|
@@ -20622,23 +20958,23 @@ describe("${target}", () => {
|
|
|
20622
20958
|
async listBugs() {
|
|
20623
20959
|
return {
|
|
20624
20960
|
ok: true,
|
|
20625
|
-
message:
|
|
20961
|
+
message: import_chalk11.default.cyan("\u{1F41B} Active Bugs:\n\n") + import_chalk11.default.yellow("1. BUG-A1B2C3: ") + import_chalk11.default.gray("Session timeout not handled properly\n") + import_chalk11.default.yellow("2. BUG-D4E5F6: ") + import_chalk11.default.gray("Memory leak in streaming responses\n") + import_chalk11.default.yellow("3. BUG-G7H8I9: ") + import_chalk11.default.gray("Spinner not stopping on error\n\n") + import_chalk11.default.gray("Total: 3 open bugs")
|
|
20626
20962
|
};
|
|
20627
20963
|
}
|
|
20628
20964
|
async analyzeBug(bugId) {
|
|
20629
20965
|
if (!bugId) {
|
|
20630
20966
|
return {
|
|
20631
20967
|
ok: false,
|
|
20632
|
-
message:
|
|
20968
|
+
message: import_chalk11.default.red("Please provide a bug ID to analyze")
|
|
20633
20969
|
};
|
|
20634
20970
|
}
|
|
20635
20971
|
return {
|
|
20636
20972
|
ok: true,
|
|
20637
|
-
message:
|
|
20973
|
+
message: import_chalk11.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
20638
20974
|
|
|
20639
|
-
`) +
|
|
20975
|
+
`) + import_chalk11.default.yellow("Summary: ") + import_chalk11.default.gray("Session timeout not handled properly\n") + import_chalk11.default.yellow("Severity: ") + import_chalk11.default.orange("Medium\n") + import_chalk11.default.yellow("Component: ") + import_chalk11.default.gray("SessionManager\n") + import_chalk11.default.yellow("Reported: ") + import_chalk11.default.gray("2 days ago\n\n") + import_chalk11.default.cyan("Possible Causes:\n") + import_chalk11.default.gray(
|
|
20640
20976
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
20641
|
-
) +
|
|
20977
|
+
) + import_chalk11.default.gray(" 2. Deadline timer not cleared on completion\n") + import_chalk11.default.gray(" 3. Race condition in state transitions\n\n") + import_chalk11.default.green("Suggested Fix:\n") + import_chalk11.default.gray(" Ensure all async operations respect the AbortSignal\n") + import_chalk11.default.gray(" Add finally block to clear timers\n")
|
|
20642
20978
|
};
|
|
20643
20979
|
}
|
|
20644
20980
|
};
|
|
@@ -20652,11 +20988,11 @@ describe("${target}", () => {
|
|
|
20652
20988
|
});
|
|
20653
20989
|
|
|
20654
20990
|
// src/services/interactive-session/handlers/SystemHandlers.ts
|
|
20655
|
-
var
|
|
20991
|
+
var import_chalk12, os3, StatusHandler, ModelHandler, MemoryHandler, HealthHandler, DoctorHandler, SystemHandlers;
|
|
20656
20992
|
var init_SystemHandlers = __esm({
|
|
20657
20993
|
"src/services/interactive-session/handlers/SystemHandlers.ts"() {
|
|
20658
|
-
|
|
20659
|
-
|
|
20994
|
+
import_chalk12 = __toESM(require("chalk"), 1);
|
|
20995
|
+
os3 = __toESM(require("os"), 1);
|
|
20660
20996
|
StatusHandler = class {
|
|
20661
20997
|
name = "/status";
|
|
20662
20998
|
description = "Show current system and session status";
|
|
@@ -20666,7 +21002,7 @@ var init_SystemHandlers = __esm({
|
|
|
20666
21002
|
if (signal?.aborted) {
|
|
20667
21003
|
return {
|
|
20668
21004
|
ok: false,
|
|
20669
|
-
message:
|
|
21005
|
+
message: import_chalk12.default.yellow("Status check canceled")
|
|
20670
21006
|
};
|
|
20671
21007
|
}
|
|
20672
21008
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -20674,47 +21010,47 @@ var init_SystemHandlers = __esm({
|
|
|
20674
21010
|
system: "operational",
|
|
20675
21011
|
uptime: process.uptime(),
|
|
20676
21012
|
memory: process.memoryUsage(),
|
|
20677
|
-
cpu:
|
|
21013
|
+
cpu: os3.cpus()[0],
|
|
20678
21014
|
platform: process.platform
|
|
20679
21015
|
};
|
|
20680
|
-
let message =
|
|
20681
|
-
message +=
|
|
20682
|
-
message +=
|
|
21016
|
+
let message = import_chalk12.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
21017
|
+
message += import_chalk12.default.green("\u2705 System: Operational\n");
|
|
21018
|
+
message += import_chalk12.default.gray(
|
|
20683
21019
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
20684
21020
|
`
|
|
20685
21021
|
);
|
|
20686
|
-
message +=
|
|
21022
|
+
message += import_chalk12.default.gray(
|
|
20687
21023
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20688
21024
|
`
|
|
20689
21025
|
);
|
|
20690
21026
|
if (verbose) {
|
|
20691
|
-
message +=
|
|
20692
|
-
message +=
|
|
21027
|
+
message += import_chalk12.default.gray("\nDetailed Information:\n");
|
|
21028
|
+
message += import_chalk12.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
20693
21029
|
`);
|
|
20694
|
-
message +=
|
|
20695
|
-
` \u2022 Platform: ${status.platform} (${
|
|
21030
|
+
message += import_chalk12.default.gray(
|
|
21031
|
+
` \u2022 Platform: ${status.platform} (${os3.arch()})
|
|
20696
21032
|
`
|
|
20697
21033
|
);
|
|
20698
|
-
message +=
|
|
21034
|
+
message += import_chalk12.default.gray(` \u2022 Node.js: ${process.version}
|
|
20699
21035
|
`);
|
|
20700
|
-
message +=
|
|
21036
|
+
message += import_chalk12.default.gray(` \u2022 Process ID: ${process.pid}
|
|
20701
21037
|
`);
|
|
20702
|
-
message +=
|
|
21038
|
+
message += import_chalk12.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
20703
21039
|
`);
|
|
20704
|
-
message +=
|
|
20705
|
-
message +=
|
|
21040
|
+
message += import_chalk12.default.gray("\nMemory Details:\n");
|
|
21041
|
+
message += import_chalk12.default.gray(
|
|
20706
21042
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
20707
21043
|
`
|
|
20708
21044
|
);
|
|
20709
|
-
message +=
|
|
21045
|
+
message += import_chalk12.default.gray(
|
|
20710
21046
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
20711
21047
|
`
|
|
20712
21048
|
);
|
|
20713
|
-
message +=
|
|
21049
|
+
message += import_chalk12.default.gray(
|
|
20714
21050
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20715
21051
|
`
|
|
20716
21052
|
);
|
|
20717
|
-
message +=
|
|
21053
|
+
message += import_chalk12.default.gray(
|
|
20718
21054
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
20719
21055
|
`
|
|
20720
21056
|
);
|
|
@@ -20743,7 +21079,7 @@ var init_SystemHandlers = __esm({
|
|
|
20743
21079
|
if (signal?.aborted) {
|
|
20744
21080
|
return {
|
|
20745
21081
|
ok: false,
|
|
20746
|
-
message:
|
|
21082
|
+
message: import_chalk12.default.yellow("Model operation canceled")
|
|
20747
21083
|
};
|
|
20748
21084
|
}
|
|
20749
21085
|
if (args.length === 0) {
|
|
@@ -20763,17 +21099,17 @@ var init_SystemHandlers = __esm({
|
|
|
20763
21099
|
}
|
|
20764
21100
|
}
|
|
20765
21101
|
async listModels() {
|
|
20766
|
-
let message =
|
|
20767
|
-
message +=
|
|
21102
|
+
let message = import_chalk12.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
21103
|
+
message += import_chalk12.default.green(`Current: ${this.currentModel}
|
|
20768
21104
|
|
|
20769
21105
|
`);
|
|
20770
21106
|
for (const model of this.availableModels) {
|
|
20771
|
-
const status = model.available ?
|
|
20772
|
-
const name2 = model.id === this.currentModel ?
|
|
20773
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
21107
|
+
const status = model.available ? import_chalk12.default.green("\u2705") : import_chalk12.default.red("\u274C");
|
|
21108
|
+
const name2 = model.id === this.currentModel ? import_chalk12.default.green.bold(model.id) : import_chalk12.default.cyan(model.id);
|
|
21109
|
+
message += `${status} ${name2.padEnd(20)} ${import_chalk12.default.gray(`[${model.provider}]`)}
|
|
20774
21110
|
`;
|
|
20775
21111
|
}
|
|
20776
|
-
message +=
|
|
21112
|
+
message += import_chalk12.default.gray("\nUse /model <name> to switch models");
|
|
20777
21113
|
return {
|
|
20778
21114
|
ok: true,
|
|
20779
21115
|
message,
|
|
@@ -20784,27 +21120,27 @@ var init_SystemHandlers = __esm({
|
|
|
20784
21120
|
if (!modelId) {
|
|
20785
21121
|
return {
|
|
20786
21122
|
ok: false,
|
|
20787
|
-
message:
|
|
21123
|
+
message: import_chalk12.default.red("Please specify a model to switch to")
|
|
20788
21124
|
};
|
|
20789
21125
|
}
|
|
20790
21126
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
20791
21127
|
if (!model) {
|
|
20792
21128
|
return {
|
|
20793
21129
|
ok: false,
|
|
20794
|
-
message:
|
|
20795
|
-
`) +
|
|
21130
|
+
message: import_chalk12.default.red(`Unknown model: ${modelId}
|
|
21131
|
+
`) + import_chalk12.default.gray("Use /model list to see available models")
|
|
20796
21132
|
};
|
|
20797
21133
|
}
|
|
20798
21134
|
if (!model.available) {
|
|
20799
21135
|
return {
|
|
20800
21136
|
ok: false,
|
|
20801
|
-
message:
|
|
21137
|
+
message: import_chalk12.default.yellow(`Model ${modelId} is not currently available`)
|
|
20802
21138
|
};
|
|
20803
21139
|
}
|
|
20804
21140
|
this.currentModel = modelId;
|
|
20805
21141
|
return {
|
|
20806
21142
|
ok: true,
|
|
20807
|
-
message:
|
|
21143
|
+
message: import_chalk12.default.green(`\u2705 Switched to ${modelId}`),
|
|
20808
21144
|
data: { model: modelId }
|
|
20809
21145
|
};
|
|
20810
21146
|
}
|
|
@@ -20813,27 +21149,27 @@ var init_SystemHandlers = __esm({
|
|
|
20813
21149
|
if (!model) {
|
|
20814
21150
|
return {
|
|
20815
21151
|
ok: false,
|
|
20816
|
-
message:
|
|
21152
|
+
message: import_chalk12.default.red(`Unknown model: ${modelId}`)
|
|
20817
21153
|
};
|
|
20818
21154
|
}
|
|
20819
|
-
let message =
|
|
21155
|
+
let message = import_chalk12.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
20820
21156
|
|
|
20821
21157
|
`);
|
|
20822
|
-
message +=
|
|
21158
|
+
message += import_chalk12.default.gray(`Provider: ${model.provider}
|
|
20823
21159
|
`);
|
|
20824
|
-
message +=
|
|
21160
|
+
message += import_chalk12.default.gray(
|
|
20825
21161
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
20826
21162
|
`
|
|
20827
21163
|
);
|
|
20828
|
-
message +=
|
|
21164
|
+
message += import_chalk12.default.gray(
|
|
20829
21165
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
20830
21166
|
`
|
|
20831
21167
|
);
|
|
20832
|
-
message +=
|
|
20833
|
-
message +=
|
|
20834
|
-
message +=
|
|
20835
|
-
message +=
|
|
20836
|
-
message +=
|
|
21168
|
+
message += import_chalk12.default.gray("\nCapabilities:\n");
|
|
21169
|
+
message += import_chalk12.default.gray(" \u2022 Context: 128K tokens\n");
|
|
21170
|
+
message += import_chalk12.default.gray(" \u2022 Languages: 95+\n");
|
|
21171
|
+
message += import_chalk12.default.gray(" \u2022 Code: Yes\n");
|
|
21172
|
+
message += import_chalk12.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
20837
21173
|
return {
|
|
20838
21174
|
ok: true,
|
|
20839
21175
|
message,
|
|
@@ -20865,39 +21201,39 @@ var init_SystemHandlers = __esm({
|
|
|
20865
21201
|
default:
|
|
20866
21202
|
return {
|
|
20867
21203
|
ok: false,
|
|
20868
|
-
message:
|
|
20869
|
-
`) +
|
|
21204
|
+
message: import_chalk12.default.red(`Unknown memory subcommand: ${subcommand}
|
|
21205
|
+
`) + import_chalk12.default.gray("Available: status, clear, export, compact")
|
|
20870
21206
|
};
|
|
20871
21207
|
}
|
|
20872
21208
|
}
|
|
20873
21209
|
async showStatus() {
|
|
20874
|
-
let message =
|
|
20875
|
-
message +=
|
|
20876
|
-
message +=
|
|
21210
|
+
let message = import_chalk12.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
21211
|
+
message += import_chalk12.default.yellow("System 1 (Fast):\n");
|
|
21212
|
+
message += import_chalk12.default.gray(
|
|
20877
21213
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
20878
21214
|
`
|
|
20879
21215
|
);
|
|
20880
|
-
message +=
|
|
21216
|
+
message += import_chalk12.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
20881
21217
|
|
|
20882
21218
|
`);
|
|
20883
|
-
message +=
|
|
20884
|
-
message +=
|
|
21219
|
+
message += import_chalk12.default.blue("System 2 (Deep):\n");
|
|
21220
|
+
message += import_chalk12.default.gray(
|
|
20885
21221
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
20886
21222
|
`
|
|
20887
21223
|
);
|
|
20888
|
-
message +=
|
|
21224
|
+
message += import_chalk12.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
20889
21225
|
|
|
20890
21226
|
`);
|
|
20891
|
-
message +=
|
|
20892
|
-
message +=
|
|
21227
|
+
message += import_chalk12.default.green("Total:\n");
|
|
21228
|
+
message += import_chalk12.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
20893
21229
|
`);
|
|
20894
|
-
message +=
|
|
21230
|
+
message += import_chalk12.default.gray(
|
|
20895
21231
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
20896
21232
|
`
|
|
20897
21233
|
);
|
|
20898
21234
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
20899
21235
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
20900
|
-
message +=
|
|
21236
|
+
message += import_chalk12.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
20901
21237
|
`);
|
|
20902
21238
|
return {
|
|
20903
21239
|
ok: true,
|
|
@@ -20911,14 +21247,14 @@ var init_SystemHandlers = __esm({
|
|
|
20911
21247
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
20912
21248
|
return {
|
|
20913
21249
|
ok: true,
|
|
20914
|
-
message:
|
|
21250
|
+
message: import_chalk12.default.green("\u2705 System 1 memory cleared")
|
|
20915
21251
|
};
|
|
20916
21252
|
}
|
|
20917
21253
|
if (system === "system2") {
|
|
20918
21254
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
20919
21255
|
return {
|
|
20920
21256
|
ok: true,
|
|
20921
|
-
message:
|
|
21257
|
+
message: import_chalk12.default.green("\u2705 System 2 memory cleared")
|
|
20922
21258
|
};
|
|
20923
21259
|
}
|
|
20924
21260
|
this.memoryStats = {
|
|
@@ -20928,15 +21264,15 @@ var init_SystemHandlers = __esm({
|
|
|
20928
21264
|
};
|
|
20929
21265
|
return {
|
|
20930
21266
|
ok: true,
|
|
20931
|
-
message:
|
|
21267
|
+
message: import_chalk12.default.green("\u{1F9F9} All memory cleared")
|
|
20932
21268
|
};
|
|
20933
21269
|
}
|
|
20934
21270
|
async exportMemory() {
|
|
20935
21271
|
const filename = `memory-export-${Date.now()}.json`;
|
|
20936
21272
|
return {
|
|
20937
21273
|
ok: true,
|
|
20938
|
-
message:
|
|
20939
|
-
`) +
|
|
21274
|
+
message: import_chalk12.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
21275
|
+
`) + import_chalk12.default.gray(
|
|
20940
21276
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
20941
21277
|
),
|
|
20942
21278
|
data: { filename, stats: this.memoryStats }
|
|
@@ -20954,9 +21290,9 @@ var init_SystemHandlers = __esm({
|
|
|
20954
21290
|
);
|
|
20955
21291
|
return {
|
|
20956
21292
|
ok: true,
|
|
20957
|
-
message:
|
|
20958
|
-
`) +
|
|
20959
|
-
`) +
|
|
21293
|
+
message: import_chalk12.default.green("\u2728 Memory compacted successfully\n") + import_chalk12.default.gray(`Before: ${before} tokens
|
|
21294
|
+
`) + import_chalk12.default.gray(`After: ${after} tokens
|
|
21295
|
+
`) + import_chalk12.default.gray(
|
|
20960
21296
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
20961
21297
|
),
|
|
20962
21298
|
data: { before, after, saved: before - after }
|
|
@@ -20972,11 +21308,11 @@ var init_SystemHandlers = __esm({
|
|
|
20972
21308
|
if (signal?.aborted) {
|
|
20973
21309
|
return {
|
|
20974
21310
|
ok: false,
|
|
20975
|
-
message:
|
|
21311
|
+
message: import_chalk12.default.yellow("Health check canceled")
|
|
20976
21312
|
};
|
|
20977
21313
|
}
|
|
20978
21314
|
const detailed = args.includes("--detailed");
|
|
20979
|
-
let message =
|
|
21315
|
+
let message = import_chalk12.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
20980
21316
|
const checks = [
|
|
20981
21317
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
20982
21318
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -20985,11 +21321,11 @@ var init_SystemHandlers = __esm({
|
|
|
20985
21321
|
{ name: "Network", status: "warning", latency: 250 }
|
|
20986
21322
|
];
|
|
20987
21323
|
for (const check of checks) {
|
|
20988
|
-
const icon = check.status === "ok" ?
|
|
20989
|
-
const status = check.status === "ok" ?
|
|
21324
|
+
const icon = check.status === "ok" ? import_chalk12.default.green("\u2705") : check.status === "warning" ? import_chalk12.default.yellow("\u26A0\uFE0F") : import_chalk12.default.red("\u274C");
|
|
21325
|
+
const status = check.status === "ok" ? import_chalk12.default.green("OK") : check.status === "warning" ? import_chalk12.default.yellow("WARNING") : import_chalk12.default.red("ERROR");
|
|
20990
21326
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
20991
21327
|
if (detailed) {
|
|
20992
|
-
message +=
|
|
21328
|
+
message += import_chalk12.default.gray(` (${check.latency}ms)`);
|
|
20993
21329
|
}
|
|
20994
21330
|
message += "\n";
|
|
20995
21331
|
}
|
|
@@ -20997,11 +21333,11 @@ var init_SystemHandlers = __esm({
|
|
|
20997
21333
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
20998
21334
|
message += "\n";
|
|
20999
21335
|
if (hasErrors) {
|
|
21000
|
-
message +=
|
|
21336
|
+
message += import_chalk12.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
21001
21337
|
} else if (hasWarnings) {
|
|
21002
|
-
message +=
|
|
21338
|
+
message += import_chalk12.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
21003
21339
|
} else {
|
|
21004
|
-
message +=
|
|
21340
|
+
message += import_chalk12.default.green("\u2705 All systems operational");
|
|
21005
21341
|
}
|
|
21006
21342
|
return {
|
|
21007
21343
|
ok: true,
|
|
@@ -21019,12 +21355,12 @@ var init_SystemHandlers = __esm({
|
|
|
21019
21355
|
if (signal?.aborted) {
|
|
21020
21356
|
return {
|
|
21021
21357
|
ok: false,
|
|
21022
|
-
message:
|
|
21358
|
+
message: import_chalk12.default.yellow("Doctor check canceled")
|
|
21023
21359
|
};
|
|
21024
21360
|
}
|
|
21025
21361
|
const autoFix = args.includes("--fix");
|
|
21026
|
-
let message =
|
|
21027
|
-
message +=
|
|
21362
|
+
let message = import_chalk12.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
21363
|
+
message += import_chalk12.default.gray("Running diagnostics...\n\n");
|
|
21028
21364
|
const issues = [
|
|
21029
21365
|
{
|
|
21030
21366
|
severity: "warning",
|
|
@@ -21046,20 +21382,20 @@ var init_SystemHandlers = __esm({
|
|
|
21046
21382
|
}
|
|
21047
21383
|
];
|
|
21048
21384
|
if (issues.length === 0) {
|
|
21049
|
-
message +=
|
|
21385
|
+
message += import_chalk12.default.green("\u2705 No issues found - system is healthy!");
|
|
21050
21386
|
return { ok: true, message };
|
|
21051
21387
|
}
|
|
21052
|
-
message +=
|
|
21388
|
+
message += import_chalk12.default.yellow(`Found ${issues.length} issue(s):
|
|
21053
21389
|
|
|
21054
21390
|
`);
|
|
21055
21391
|
for (const issue of issues) {
|
|
21056
|
-
const icon = issue.severity === "error" ?
|
|
21392
|
+
const icon = issue.severity === "error" ? import_chalk12.default.red("\u274C") : issue.severity === "warning" ? import_chalk12.default.yellow("\u26A0\uFE0F") : import_chalk12.default.blue("\u2139\uFE0F");
|
|
21057
21393
|
message += `${icon} ${issue.issue}
|
|
21058
21394
|
`;
|
|
21059
|
-
message +=
|
|
21395
|
+
message += import_chalk12.default.gray(` Solution: ${issue.solution}
|
|
21060
21396
|
`);
|
|
21061
21397
|
if (autoFix && issue.fixable) {
|
|
21062
|
-
message +=
|
|
21398
|
+
message += import_chalk12.default.green(` \u2705 Auto-fixed
|
|
21063
21399
|
`);
|
|
21064
21400
|
}
|
|
21065
21401
|
message += "\n";
|
|
@@ -21067,7 +21403,7 @@ var init_SystemHandlers = __esm({
|
|
|
21067
21403
|
if (!autoFix) {
|
|
21068
21404
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
21069
21405
|
if (fixableCount > 0) {
|
|
21070
|
-
message +=
|
|
21406
|
+
message += import_chalk12.default.gray(
|
|
21071
21407
|
`
|
|
21072
21408
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
21073
21409
|
);
|
|
@@ -21510,7 +21846,7 @@ var init_package = __esm({
|
|
|
21510
21846
|
"package.json"() {
|
|
21511
21847
|
package_default = {
|
|
21512
21848
|
name: "@bonginkan/maria",
|
|
21513
|
-
version: "4.2.
|
|
21849
|
+
version: "4.2.5",
|
|
21514
21850
|
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.",
|
|
21515
21851
|
keywords: [
|
|
21516
21852
|
"ai",
|
|
@@ -22062,10 +22398,10 @@ function showCodeGenerationAnimation() {
|
|
|
22062
22398
|
};
|
|
22063
22399
|
return animation;
|
|
22064
22400
|
}
|
|
22065
|
-
var
|
|
22401
|
+
var import_chalk13, ThinkingAnimation, ProcessAnimation, CodeGenerationAnimation, LoadingDots, BrainAnimation, ProgressBar, StreamingOutput;
|
|
22066
22402
|
var init_animations = __esm({
|
|
22067
22403
|
"src/utils/animations.ts"() {
|
|
22068
|
-
|
|
22404
|
+
import_chalk13 = __toESM(require("chalk"), 1);
|
|
22069
22405
|
ThinkingAnimation = class {
|
|
22070
22406
|
frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
22071
22407
|
currentFrame = 0;
|
|
@@ -22077,7 +22413,7 @@ var init_animations = __esm({
|
|
|
22077
22413
|
start() {
|
|
22078
22414
|
this.interval = setInterval(() => {
|
|
22079
22415
|
process.stdout.write(
|
|
22080
|
-
`\r${
|
|
22416
|
+
`\r${import_chalk13.default.cyan(this.frames[this.currentFrame])} ${import_chalk13.default.gray(this.message)}...`
|
|
22081
22417
|
);
|
|
22082
22418
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22083
22419
|
}, 80);
|
|
@@ -22115,7 +22451,7 @@ var init_animations = __esm({
|
|
|
22115
22451
|
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
22116
22452
|
const stage = this.stages[this.currentStage];
|
|
22117
22453
|
process.stdout.write(
|
|
22118
|
-
`\r${
|
|
22454
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage.icon} ${import_chalk13.default.gray(stage.message)}... ${import_chalk13.default.dim(`[${elapsed}s]`)}`
|
|
22119
22455
|
);
|
|
22120
22456
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
22121
22457
|
}, 80);
|
|
@@ -22177,11 +22513,11 @@ var init_animations = __esm({
|
|
|
22177
22513
|
const stage = stages[this.currentStage];
|
|
22178
22514
|
if (this.isComplex) {
|
|
22179
22515
|
process.stdout.write(
|
|
22180
|
-
`\r${
|
|
22516
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage} ${import_chalk13.default.dim(`[${elapsed}s]`)}`
|
|
22181
22517
|
);
|
|
22182
22518
|
} else {
|
|
22183
22519
|
process.stdout.write(
|
|
22184
|
-
`\r${
|
|
22520
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${import_chalk13.default.gray(stage)}...`
|
|
22185
22521
|
);
|
|
22186
22522
|
}
|
|
22187
22523
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
@@ -22224,7 +22560,7 @@ var init_animations = __esm({
|
|
|
22224
22560
|
start() {
|
|
22225
22561
|
this.interval = setInterval(() => {
|
|
22226
22562
|
process.stdout.write(
|
|
22227
|
-
`\r${
|
|
22563
|
+
`\r${import_chalk13.default.cyan(this.message)}${this.dots[this.currentDot]}`
|
|
22228
22564
|
);
|
|
22229
22565
|
this.currentDot = (this.currentDot + 1) % this.dots.length;
|
|
22230
22566
|
}, 300);
|
|
@@ -22253,7 +22589,7 @@ var init_animations = __esm({
|
|
|
22253
22589
|
const frame = this.frames[this.currentFrame];
|
|
22254
22590
|
const message = this.messages[this.currentFrame];
|
|
22255
22591
|
process.stdout.write(
|
|
22256
|
-
`\r${frame} ${
|
|
22592
|
+
`\r${frame} ${import_chalk13.default.cyan(message)}...`
|
|
22257
22593
|
);
|
|
22258
22594
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22259
22595
|
}, 1e3);
|
|
@@ -22281,7 +22617,7 @@ var init_animations = __esm({
|
|
|
22281
22617
|
const percentage = Math.floor(this.current / this.total * 100);
|
|
22282
22618
|
const filled = Math.floor(this.current / this.total * this.width);
|
|
22283
22619
|
const empty = this.width - filled;
|
|
22284
|
-
const bar =
|
|
22620
|
+
const bar = import_chalk13.default.green("\u2588").repeat(filled) + import_chalk13.default.gray("\u2591").repeat(empty);
|
|
22285
22621
|
process.stdout.write(`\r${this.label}: [${bar}] ${percentage}%`);
|
|
22286
22622
|
if (this.current >= this.total) {
|
|
22287
22623
|
process.stdout.write("\n");
|
|
@@ -22539,14 +22875,33 @@ var init_AuthenticationManager = __esm({
|
|
|
22539
22875
|
// 2 minutes clock skew tolerance
|
|
22540
22876
|
constructor() {
|
|
22541
22877
|
this.tokenStorage = new TokenStorage();
|
|
22542
|
-
this.authBase = process.env.MARIA_AUTH_BASE ||
|
|
22543
|
-
|
|
22544
|
-
this.authBase = "https://auth-server-1098737975582.us-central1.run.app";
|
|
22545
|
-
console.debug("Using Cloud Run URL for auth (DNS pending for auth.maria-code.ai)");
|
|
22546
|
-
}
|
|
22547
|
-
this.apiBase = process.env.MARIA_API_BASE || "https://api.maria-code.ai";
|
|
22878
|
+
this.authBase = process.env.MARIA_AUTH_BASE || this.getAuthBaseUrl();
|
|
22879
|
+
this.apiBase = process.env.MARIA_API_BASE || this.getApiBaseUrl();
|
|
22548
22880
|
this.clientId = process.env.MARIA_CLIENT_ID || "maria-cli";
|
|
22549
22881
|
}
|
|
22882
|
+
getAuthBaseUrl() {
|
|
22883
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22884
|
+
console.debug("Using local auth server (development mode)");
|
|
22885
|
+
return "http://localhost:3001";
|
|
22886
|
+
}
|
|
22887
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
22888
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
22889
|
+
console.debug("Attempting to use custom domain auth.maria-code.ai");
|
|
22890
|
+
return "https://auth.maria-code.ai";
|
|
22891
|
+
}
|
|
22892
|
+
console.debug("Using Cloud Run URL for auth:", cloudRunUrl);
|
|
22893
|
+
return cloudRunUrl;
|
|
22894
|
+
}
|
|
22895
|
+
getApiBaseUrl() {
|
|
22896
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22897
|
+
return "http://localhost:3000/api";
|
|
22898
|
+
}
|
|
22899
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
22900
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
22901
|
+
return "https://api.maria-code.ai";
|
|
22902
|
+
}
|
|
22903
|
+
return cloudRunApiUrl;
|
|
22904
|
+
}
|
|
22550
22905
|
/**
|
|
22551
22906
|
* Check if user is authenticated
|
|
22552
22907
|
*/
|
|
@@ -22575,6 +22930,27 @@ var init_AuthenticationManager = __esm({
|
|
|
22575
22930
|
* Get current authenticated user
|
|
22576
22931
|
*/
|
|
22577
22932
|
async getCurrentUser() {
|
|
22933
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22934
|
+
const tokens2 = await this.tokenStorage.load();
|
|
22935
|
+
if (!tokens2) {
|
|
22936
|
+
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
22937
|
+
}
|
|
22938
|
+
return {
|
|
22939
|
+
id: "local-dev-user",
|
|
22940
|
+
email: "developer@localhost",
|
|
22941
|
+
name: "Local Developer",
|
|
22942
|
+
plan: "ultra",
|
|
22943
|
+
usage: {
|
|
22944
|
+
requests: Math.floor(Math.random() * 100),
|
|
22945
|
+
// Random usage for testing
|
|
22946
|
+
requestLimit: 999999,
|
|
22947
|
+
requestsRemaining: 999999,
|
|
22948
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
22949
|
+
},
|
|
22950
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22951
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
22952
|
+
};
|
|
22953
|
+
}
|
|
22578
22954
|
const tokens = await this.getValidTokens();
|
|
22579
22955
|
if (!tokens) {
|
|
22580
22956
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
@@ -22612,6 +22988,9 @@ var init_AuthenticationManager = __esm({
|
|
|
22612
22988
|
const user2 = await this.getCurrentUser();
|
|
22613
22989
|
return { success: true, user: user2 };
|
|
22614
22990
|
}
|
|
22991
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22992
|
+
return await this.loginWithLocalMock();
|
|
22993
|
+
}
|
|
22615
22994
|
let tokens;
|
|
22616
22995
|
if (options.device) {
|
|
22617
22996
|
tokens = await this.loginWithDeviceFlow();
|
|
@@ -22619,6 +22998,19 @@ var init_AuthenticationManager = __esm({
|
|
|
22619
22998
|
try {
|
|
22620
22999
|
tokens = await this.loginWithPKCEFlow();
|
|
22621
23000
|
} catch (error2) {
|
|
23001
|
+
if (error2.message?.includes("ECONNREFUSED") || error2.message?.includes("fetch failed")) {
|
|
23002
|
+
console.error("\n\u274C Authentication service is currently unavailable");
|
|
23003
|
+
console.error("Please try one of the following:");
|
|
23004
|
+
console.error("1. Set MARIA_AUTH_MODE=local for local development");
|
|
23005
|
+
console.error("2. Check your internet connection");
|
|
23006
|
+
console.error("3. Visit https://status.maria-code.ai for service status\n");
|
|
23007
|
+
if (!process.env.MARIA_AUTH_MODE) {
|
|
23008
|
+
console.log("\u{1F4A1} Tip: Run with local auth mode:");
|
|
23009
|
+
console.log(" export MARIA_AUTH_MODE=local");
|
|
23010
|
+
console.log(" maria /login\n");
|
|
23011
|
+
}
|
|
23012
|
+
throw new Error("Authentication service unavailable. See above for alternatives.");
|
|
23013
|
+
}
|
|
22622
23014
|
console.warn("PKCE flow failed, falling back to device flow");
|
|
22623
23015
|
tokens = await this.loginWithDeviceFlow();
|
|
22624
23016
|
}
|
|
@@ -22633,6 +23025,43 @@ var init_AuthenticationManager = __esm({
|
|
|
22633
23025
|
};
|
|
22634
23026
|
}
|
|
22635
23027
|
}
|
|
23028
|
+
/**
|
|
23029
|
+
* Local mock authentication for development
|
|
23030
|
+
*/
|
|
23031
|
+
async loginWithLocalMock() {
|
|
23032
|
+
console.log("\u{1F510} Local Development Mode - Mock Authentication");
|
|
23033
|
+
const mockTokens = {
|
|
23034
|
+
idToken: "mock-id-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23035
|
+
accessToken: "mock-access-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23036
|
+
refreshToken: "mock-refresh-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23037
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1e3
|
|
23038
|
+
// 24 hours
|
|
23039
|
+
};
|
|
23040
|
+
await this.tokenStorage.save(mockTokens);
|
|
23041
|
+
const mockUser = {
|
|
23042
|
+
id: "local-dev-user",
|
|
23043
|
+
email: "developer@localhost",
|
|
23044
|
+
name: "Local Developer",
|
|
23045
|
+
plan: "ultra",
|
|
23046
|
+
// Give full access in dev mode
|
|
23047
|
+
usage: {
|
|
23048
|
+
requests: 0,
|
|
23049
|
+
requestLimit: 999999,
|
|
23050
|
+
requestsRemaining: 999999,
|
|
23051
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
23052
|
+
},
|
|
23053
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23054
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
23055
|
+
};
|
|
23056
|
+
console.log("\u2705 Logged in as developer@localhost (Local Mode)");
|
|
23057
|
+
console.log(" Plan: Ultra (Development)");
|
|
23058
|
+
console.log(" All features enabled for testing\n");
|
|
23059
|
+
return {
|
|
23060
|
+
success: true,
|
|
23061
|
+
user: mockUser,
|
|
23062
|
+
tokens: mockTokens
|
|
23063
|
+
};
|
|
23064
|
+
}
|
|
22636
23065
|
/**
|
|
22637
23066
|
* Logout and clean up
|
|
22638
23067
|
*/
|
|
@@ -23041,7 +23470,7 @@ function withAuth(fn) {
|
|
|
23041
23470
|
try {
|
|
23042
23471
|
const tokens = await authManager.getValidTokens();
|
|
23043
23472
|
if (!tokens) {
|
|
23044
|
-
console.log(
|
|
23473
|
+
console.log(import_chalk14.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23045
23474
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23046
23475
|
}
|
|
23047
23476
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -23050,39 +23479,39 @@ function withAuth(fn) {
|
|
|
23050
23479
|
return await fn(...args);
|
|
23051
23480
|
} catch (error2) {
|
|
23052
23481
|
if (error2.code === "AUTH_REQUIRED") {
|
|
23053
|
-
console.log(
|
|
23482
|
+
console.log(import_chalk14.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23054
23483
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23055
23484
|
}
|
|
23056
23485
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
23057
|
-
console.log(
|
|
23486
|
+
console.log(import_chalk14.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
23058
23487
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
23059
23488
|
}
|
|
23060
23489
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
23061
|
-
console.log(
|
|
23490
|
+
console.log(import_chalk14.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
23062
23491
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
23063
23492
|
}
|
|
23064
23493
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
23065
|
-
console.log(
|
|
23494
|
+
console.log(import_chalk14.default.yellow("\u{1F512} Not available in current plan"));
|
|
23066
23495
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
23067
23496
|
}
|
|
23068
23497
|
if (error2.code === "RATE_LIMITED") {
|
|
23069
23498
|
const retryAfter = error2.retryAfter || 5;
|
|
23070
|
-
console.log(
|
|
23499
|
+
console.log(import_chalk14.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
23071
23500
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
23072
23501
|
}
|
|
23073
23502
|
if (error2.code === "NETWORK_ERROR") {
|
|
23074
|
-
console.log(
|
|
23503
|
+
console.log(import_chalk14.default.red("\u{1F310} Network error, check connection"));
|
|
23075
23504
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
23076
23505
|
}
|
|
23077
23506
|
throw error2;
|
|
23078
23507
|
}
|
|
23079
23508
|
};
|
|
23080
23509
|
}
|
|
23081
|
-
var
|
|
23510
|
+
var import_chalk14, AUTH_EXIT_CODES, AUTH_EXEMPT_COMMANDS;
|
|
23082
23511
|
var init_withAuth = __esm({
|
|
23083
23512
|
"src/services/cli-auth/withAuth.ts"() {
|
|
23084
23513
|
init_AuthenticationManager();
|
|
23085
|
-
|
|
23514
|
+
import_chalk14 = __toESM(require("chalk"), 1);
|
|
23086
23515
|
AUTH_EXIT_CODES = {
|
|
23087
23516
|
AUTH_REQUIRED: 2,
|
|
23088
23517
|
REAUTH_REQUIRED: 2,
|
|
@@ -23305,19 +23734,19 @@ var conversation_persistence_exports = {};
|
|
|
23305
23734
|
__export(conversation_persistence_exports, {
|
|
23306
23735
|
ConversationPersistence: () => ConversationPersistence
|
|
23307
23736
|
});
|
|
23308
|
-
var import_fs3, path6,
|
|
23737
|
+
var import_fs3, path6, os5, ConversationPersistence;
|
|
23309
23738
|
var init_conversation_persistence = __esm({
|
|
23310
23739
|
"src/services/conversation-persistence.ts"() {
|
|
23311
23740
|
import_fs3 = require("fs");
|
|
23312
23741
|
path6 = __toESM(require("path"), 1);
|
|
23313
|
-
|
|
23742
|
+
os5 = __toESM(require("os"), 1);
|
|
23314
23743
|
ConversationPersistence = class {
|
|
23315
23744
|
sessionFile;
|
|
23316
23745
|
maxHistorySize;
|
|
23317
23746
|
autoSaveInterval = null;
|
|
23318
23747
|
pendingWrites = [];
|
|
23319
23748
|
constructor(maxHistorySize = 100) {
|
|
23320
|
-
const configDir = path6.join(
|
|
23749
|
+
const configDir = path6.join(os5.homedir(), ".maria");
|
|
23321
23750
|
this.sessionFile = path6.join(configDir, "conversation-history.json");
|
|
23322
23751
|
this.maxHistorySize = maxHistorySize;
|
|
23323
23752
|
this.ensureConfigDir();
|
|
@@ -26506,10 +26935,10 @@ var init_command_groups = __esm({
|
|
|
26506
26935
|
});
|
|
26507
26936
|
|
|
26508
26937
|
// src/services/autocomplete-dropdown.ts
|
|
26509
|
-
var
|
|
26938
|
+
var import_chalk15, AutocompleteDropdown;
|
|
26510
26939
|
var init_autocomplete_dropdown = __esm({
|
|
26511
26940
|
"src/services/autocomplete-dropdown.ts"() {
|
|
26512
|
-
|
|
26941
|
+
import_chalk15 = __toESM(require("chalk"), 1);
|
|
26513
26942
|
AutocompleteDropdown = class {
|
|
26514
26943
|
suggestions = [];
|
|
26515
26944
|
selectedIndex = 0;
|
|
@@ -26589,21 +27018,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
26589
27018
|
process.stdout.write("\x1B[s");
|
|
26590
27019
|
process.stdout.write("\n");
|
|
26591
27020
|
process.stdout.write(
|
|
26592
|
-
"\x1B[K" +
|
|
27021
|
+
"\x1B[K" + import_chalk15.default.white(
|
|
26593
27022
|
"\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"
|
|
26594
27023
|
) + "\n"
|
|
26595
27024
|
);
|
|
26596
27025
|
this.suggestions.forEach((suggestion, index) => {
|
|
26597
27026
|
const isSelected = index === this.selectedIndex;
|
|
26598
|
-
const prefix = isSelected ?
|
|
26599
|
-
const nameStyle = isSelected ?
|
|
27027
|
+
const prefix = isSelected ? import_chalk15.default.cyan("\u25BA ") : " ";
|
|
27028
|
+
const nameStyle = isSelected ? import_chalk15.default.inverse : (s2) => s2;
|
|
26600
27029
|
const displayName = suggestion.name.padEnd(20);
|
|
26601
27030
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
26602
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
27031
|
+
const line = `\u2502${prefix}${nameStyle(import_chalk15.default.white(displayName) + " " + import_chalk15.default.gray(displayDesc))} \u2502`;
|
|
26603
27032
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
26604
27033
|
});
|
|
26605
27034
|
process.stdout.write(
|
|
26606
|
-
"\x1B[K" +
|
|
27035
|
+
"\x1B[K" + import_chalk15.default.white(
|
|
26607
27036
|
"\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"
|
|
26608
27037
|
) + "\n"
|
|
26609
27038
|
);
|
|
@@ -26641,11 +27070,11 @@ var interactive_cli_exports = {};
|
|
|
26641
27070
|
__export(interactive_cli_exports, {
|
|
26642
27071
|
InteractiveCLI: () => InteractiveCLI
|
|
26643
27072
|
});
|
|
26644
|
-
var readline3,
|
|
27073
|
+
var readline3, import_chalk16, import_promises2, import_path3, import_os2, InteractiveCLI;
|
|
26645
27074
|
var init_interactive_cli = __esm({
|
|
26646
27075
|
"src/services/interactive-cli.ts"() {
|
|
26647
27076
|
readline3 = __toESM(require("readline"), 1);
|
|
26648
|
-
|
|
27077
|
+
import_chalk16 = __toESM(require("chalk"), 1);
|
|
26649
27078
|
init_command_groups();
|
|
26650
27079
|
init_autocomplete_dropdown();
|
|
26651
27080
|
init_defaults();
|
|
@@ -26944,7 +27373,7 @@ var init_interactive_cli = __esm({
|
|
|
26944
27373
|
}
|
|
26945
27374
|
readline3.cursorTo(process.stdout, 0);
|
|
26946
27375
|
readline3.clearLine(process.stdout, 0);
|
|
26947
|
-
const prompt =
|
|
27376
|
+
const prompt = import_chalk16.default.cyan("> ");
|
|
26948
27377
|
const displayInput = this.currentInput;
|
|
26949
27378
|
process.stdout.write(prompt + displayInput);
|
|
26950
27379
|
const promptLength = 2;
|
|
@@ -26964,9 +27393,9 @@ var init_interactive_cli = __esm({
|
|
|
26964
27393
|
readline3.moveCursor(process.stdout, 0, 2);
|
|
26965
27394
|
this.suggestions.forEach((suggestion, index) => {
|
|
26966
27395
|
const isSelected = index === this.selectedIndex;
|
|
26967
|
-
const prefix = isSelected ?
|
|
26968
|
-
const nameStyle = isSelected ?
|
|
26969
|
-
const descStyle = isSelected ?
|
|
27396
|
+
const prefix = isSelected ? import_chalk16.default.cyan("\u25BA ") : " ";
|
|
27397
|
+
const nameStyle = isSelected ? import_chalk16.default.inverse.white : import_chalk16.default.white;
|
|
27398
|
+
const descStyle = isSelected ? import_chalk16.default.inverse.gray : import_chalk16.default.gray;
|
|
26970
27399
|
const name2 = suggestion.name.padEnd(15);
|
|
26971
27400
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
26972
27401
|
readline3.cursorTo(process.stdout, 0);
|
|
@@ -26987,20 +27416,20 @@ var init_interactive_cli = __esm({
|
|
|
26987
27416
|
const promptLength = 2;
|
|
26988
27417
|
const savedX = this.cursorPosition + promptLength;
|
|
26989
27418
|
process.stdout.write("\n");
|
|
26990
|
-
process.stdout.write(
|
|
27419
|
+
process.stdout.write(import_chalk16.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
26991
27420
|
this.suggestions.forEach((suggestion, index) => {
|
|
26992
27421
|
const isSelected = index === this.selectedIndex;
|
|
26993
|
-
const prefix = isSelected ?
|
|
26994
|
-
const nameStyle = isSelected ?
|
|
26995
|
-
const descStyle = isSelected ?
|
|
27422
|
+
const prefix = isSelected ? import_chalk16.default.cyan("\u25BA ") : " ";
|
|
27423
|
+
const nameStyle = isSelected ? import_chalk16.default.inverse.white : import_chalk16.default.white;
|
|
27424
|
+
const descStyle = isSelected ? import_chalk16.default.inverse.gray : import_chalk16.default.gray;
|
|
26996
27425
|
const name2 = suggestion.name.padEnd(15);
|
|
26997
27426
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
26998
27427
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
26999
27428
|
`);
|
|
27000
27429
|
});
|
|
27001
|
-
process.stdout.write(
|
|
27430
|
+
process.stdout.write(import_chalk16.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"));
|
|
27002
27431
|
process.stdout.write(
|
|
27003
|
-
|
|
27432
|
+
import_chalk16.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
27004
27433
|
);
|
|
27005
27434
|
const totalLines = this.suggestions.length + 4;
|
|
27006
27435
|
readline3.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -27463,15 +27892,15 @@ ${this.description}
|
|
|
27463
27892
|
});
|
|
27464
27893
|
|
|
27465
27894
|
// src/services/memory-system/quick-persistence.ts
|
|
27466
|
-
var fs8, fsp,
|
|
27895
|
+
var fs8, fsp, os7, path8, import_crypto5, DIR, FILE, QuickPersistence;
|
|
27467
27896
|
var init_quick_persistence = __esm({
|
|
27468
27897
|
"src/services/memory-system/quick-persistence.ts"() {
|
|
27469
27898
|
fs8 = __toESM(require("fs"), 1);
|
|
27470
27899
|
fsp = __toESM(require("fs/promises"), 1);
|
|
27471
|
-
|
|
27900
|
+
os7 = __toESM(require("os"), 1);
|
|
27472
27901
|
path8 = __toESM(require("path"), 1);
|
|
27473
27902
|
import_crypto5 = require("crypto");
|
|
27474
|
-
DIR = path8.join(
|
|
27903
|
+
DIR = path8.join(os7.homedir(), ".maria", "memory");
|
|
27475
27904
|
FILE = path8.join(DIR, "memories.jsonl");
|
|
27476
27905
|
QuickPersistence = class {
|
|
27477
27906
|
static async init() {
|
|
@@ -27594,7 +28023,7 @@ var init_quick_persistence = __esm({
|
|
|
27594
28023
|
const mine = rows.filter((r2) => r2.userId === userId);
|
|
27595
28024
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
27596
28025
|
const filename = `maria-memory-export-${timestamp}.${format}`;
|
|
27597
|
-
const exportDir = path8.join(
|
|
28026
|
+
const exportDir = path8.join(os7.homedir(), ".maria", "exports");
|
|
27598
28027
|
const exportPath = path8.join(exportDir, filename);
|
|
27599
28028
|
await fsp.mkdir(exportDir, { recursive: true });
|
|
27600
28029
|
if (format === "jsonl") {
|
|
@@ -29634,14 +30063,14 @@ __export(HelpCommand_exports, {
|
|
|
29634
30063
|
HelpCommand: () => HelpCommand,
|
|
29635
30064
|
meta: () => meta
|
|
29636
30065
|
});
|
|
29637
|
-
var
|
|
30066
|
+
var import_chalk17, HelpCommand, meta;
|
|
29638
30067
|
var init_HelpCommand = __esm({
|
|
29639
30068
|
"src/slash-commands/categories/core/handlers/HelpCommand.ts"() {
|
|
29640
30069
|
init_base_command();
|
|
29641
30070
|
init_ReadyCommandsService();
|
|
29642
30071
|
init_telemetry_helper();
|
|
29643
30072
|
init_subscription_manager();
|
|
29644
|
-
|
|
30073
|
+
import_chalk17 = __toESM(require("chalk"), 1);
|
|
29645
30074
|
HelpCommand = class extends BaseCommand {
|
|
29646
30075
|
name = "help";
|
|
29647
30076
|
category = "core";
|
|
@@ -29756,9 +30185,9 @@ var init_HelpCommand = __esm({
|
|
|
29756
30185
|
const stats = await this.readyService.getStatistics();
|
|
29757
30186
|
const lines = [];
|
|
29758
30187
|
lines.push("\u2550".repeat(60));
|
|
29759
|
-
lines.push(
|
|
30188
|
+
lines.push(import_chalk17.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
29760
30189
|
lines.push("");
|
|
29761
|
-
lines.push(
|
|
30190
|
+
lines.push(import_chalk17.default.bold("Quick Access:"));
|
|
29762
30191
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
29763
30192
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
29764
30193
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -29773,7 +30202,7 @@ var init_HelpCommand = __esm({
|
|
|
29773
30202
|
}
|
|
29774
30203
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
29775
30204
|
for (const category of categories) {
|
|
29776
|
-
lines.push(
|
|
30205
|
+
lines.push(import_chalk17.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
29777
30206
|
const showCommands = category.commands.slice(0, 4);
|
|
29778
30207
|
for (const cmd of showCommands) {
|
|
29779
30208
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -29793,7 +30222,7 @@ var init_HelpCommand = __esm({
|
|
|
29793
30222
|
}
|
|
29794
30223
|
lines.push("");
|
|
29795
30224
|
}
|
|
29796
|
-
lines.push(
|
|
30225
|
+
lines.push(import_chalk17.default.bold("Pro Tips:"));
|
|
29797
30226
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
29798
30227
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
29799
30228
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -29832,33 +30261,33 @@ var init_HelpCommand = __esm({
|
|
|
29832
30261
|
formatCommandHelp(command) {
|
|
29833
30262
|
const lines = [];
|
|
29834
30263
|
lines.push("");
|
|
29835
|
-
lines.push(`\u{1F4D6} ${
|
|
30264
|
+
lines.push(`\u{1F4D6} ${import_chalk17.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
29836
30265
|
lines.push("\u2550".repeat(50));
|
|
29837
30266
|
lines.push("");
|
|
29838
|
-
lines.push(
|
|
30267
|
+
lines.push(import_chalk17.default.bold("\u2139\uFE0F Information:"));
|
|
29839
30268
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
29840
30269
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
29841
30270
|
if (command.aliases && command.aliases.length > 0) {
|
|
29842
30271
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
29843
30272
|
}
|
|
29844
30273
|
lines.push("");
|
|
29845
|
-
lines.push(
|
|
30274
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Usage:"));
|
|
29846
30275
|
lines.push(` ${command.usage}`);
|
|
29847
30276
|
lines.push("");
|
|
29848
|
-
lines.push(
|
|
30277
|
+
lines.push(import_chalk17.default.bold("\u{1F4CB} Contract Validation:"));
|
|
29849
30278
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
29850
30279
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29851
30280
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29852
30281
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29853
30282
|
lines.push("");
|
|
29854
30283
|
if (command.examples && command.examples.length > 0) {
|
|
29855
|
-
lines.push(
|
|
30284
|
+
lines.push(import_chalk17.default.bold("\u{1F4DD} Examples:"));
|
|
29856
30285
|
for (const example of command.examples) {
|
|
29857
30286
|
lines.push(` ${example}`);
|
|
29858
30287
|
}
|
|
29859
30288
|
lines.push("");
|
|
29860
30289
|
}
|
|
29861
|
-
lines.push(
|
|
30290
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Quick Tips:"));
|
|
29862
30291
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
29863
30292
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
29864
30293
|
if (command.category !== "core") {
|
|
@@ -29909,7 +30338,7 @@ var init_HelpCommand = __esm({
|
|
|
29909
30338
|
};
|
|
29910
30339
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
29911
30340
|
lines.push("");
|
|
29912
|
-
lines.push(`${emoji} ${
|
|
30341
|
+
lines.push(`${emoji} ${import_chalk17.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
29913
30342
|
lines.push("\u2550".repeat(50));
|
|
29914
30343
|
lines.push("");
|
|
29915
30344
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -29943,7 +30372,7 @@ var init_HelpCommand = __esm({
|
|
|
29943
30372
|
formatSearchResults(searchTerm, results) {
|
|
29944
30373
|
const lines = [];
|
|
29945
30374
|
lines.push("");
|
|
29946
|
-
lines.push(`\u{1F50D} ${
|
|
30375
|
+
lines.push(`\u{1F50D} ${import_chalk17.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
29947
30376
|
lines.push("\u2550".repeat(50));
|
|
29948
30377
|
lines.push("");
|
|
29949
30378
|
for (const result of results) {
|
|
@@ -29956,7 +30385,7 @@ var init_HelpCommand = __esm({
|
|
|
29956
30385
|
}
|
|
29957
30386
|
lines.push("");
|
|
29958
30387
|
}
|
|
29959
|
-
lines.push(
|
|
30388
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
29960
30389
|
lines.push("");
|
|
29961
30390
|
return lines.join("\n");
|
|
29962
30391
|
}
|
|
@@ -29967,38 +30396,38 @@ var init_HelpCommand = __esm({
|
|
|
29967
30396
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
29968
30397
|
const lines = [];
|
|
29969
30398
|
lines.push("");
|
|
29970
|
-
lines.push(`\u{1F680} ${
|
|
30399
|
+
lines.push(`\u{1F680} ${import_chalk17.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
29971
30400
|
lines.push("\u2550".repeat(50));
|
|
29972
30401
|
lines.push("");
|
|
29973
|
-
lines.push(
|
|
30402
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
29974
30403
|
lines.push("");
|
|
29975
|
-
lines.push(
|
|
30404
|
+
lines.push(import_chalk17.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
29976
30405
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
29977
30406
|
if (modelCmd) {
|
|
29978
30407
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
29979
30408
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
29980
30409
|
}
|
|
29981
30410
|
lines.push("");
|
|
29982
|
-
lines.push(
|
|
30411
|
+
lines.push(import_chalk17.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
29983
30412
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
29984
30413
|
if (statusCmd) {
|
|
29985
30414
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
29986
30415
|
lines.push(` Try: /status`);
|
|
29987
30416
|
}
|
|
29988
30417
|
lines.push("");
|
|
29989
|
-
lines.push(
|
|
30418
|
+
lines.push(import_chalk17.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
29990
30419
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
29991
30420
|
if (codeCmd) {
|
|
29992
30421
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
29993
30422
|
lines.push(` Try: /code create a hello world function`);
|
|
29994
30423
|
}
|
|
29995
30424
|
lines.push("");
|
|
29996
|
-
lines.push(
|
|
30425
|
+
lines.push(import_chalk17.default.bold("\u{1F527} Essential Commands:"));
|
|
29997
30426
|
for (const cmd of quickCommands) {
|
|
29998
30427
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
29999
30428
|
}
|
|
30000
30429
|
lines.push("");
|
|
30001
|
-
lines.push(
|
|
30430
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Next Steps:"));
|
|
30002
30431
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
30003
30432
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
30004
30433
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -30013,20 +30442,20 @@ var init_HelpCommand = __esm({
|
|
|
30013
30442
|
const categories = await this.readyService.getCategories();
|
|
30014
30443
|
const lines = [];
|
|
30015
30444
|
lines.push("");
|
|
30016
|
-
lines.push(`\u{1F4CA} ${
|
|
30445
|
+
lines.push(`\u{1F4CA} ${import_chalk17.default.bold("READY COMMANDS STATISTICS")}`);
|
|
30017
30446
|
lines.push("\u2550".repeat(40));
|
|
30018
30447
|
lines.push("");
|
|
30019
|
-
lines.push(
|
|
30448
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Overall:"));
|
|
30020
30449
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
30021
30450
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
30022
30451
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
30023
30452
|
lines.push("");
|
|
30024
|
-
lines.push(
|
|
30453
|
+
lines.push(import_chalk17.default.bold("\u26A1 Performance:"));
|
|
30025
30454
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
30026
30455
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
30027
30456
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
30028
30457
|
lines.push("");
|
|
30029
|
-
lines.push(
|
|
30458
|
+
lines.push(import_chalk17.default.bold("\u{1F4CB} By Category:"));
|
|
30030
30459
|
for (const category of categories) {
|
|
30031
30460
|
const avgTime = Math.round(
|
|
30032
30461
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -30034,7 +30463,7 @@ var init_HelpCommand = __esm({
|
|
|
30034
30463
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
30035
30464
|
}
|
|
30036
30465
|
lines.push("");
|
|
30037
|
-
lines.push(
|
|
30466
|
+
lines.push(import_chalk17.default.bold("\u2705 Contract Validation:"));
|
|
30038
30467
|
lines.push(" All commands tested for:");
|
|
30039
30468
|
lines.push(" \u2022 Basic execution without crashes");
|
|
30040
30469
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -30208,10 +30637,10 @@ var init_LoginCommand = __esm({
|
|
|
30208
30637
|
if (!authResult.success) {
|
|
30209
30638
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
30210
30639
|
}
|
|
30211
|
-
const
|
|
30212
|
-
const plan =
|
|
30213
|
-
const quotaLeft =
|
|
30214
|
-
const email =
|
|
30640
|
+
const userInfo2 = authResult.user;
|
|
30641
|
+
const plan = userInfo2?.plan || "Free";
|
|
30642
|
+
const quotaLeft = userInfo2?.usage?.requestsRemaining || 100;
|
|
30643
|
+
const email = userInfo2?.email || "user";
|
|
30215
30644
|
await trackCommand({
|
|
30216
30645
|
cmd: "login",
|
|
30217
30646
|
status: "success",
|
|
@@ -30251,11 +30680,11 @@ var init_LoginCommand = __esm({
|
|
|
30251
30680
|
});
|
|
30252
30681
|
|
|
30253
30682
|
// src/services/model-selector-ui.ts
|
|
30254
|
-
var readline4,
|
|
30683
|
+
var readline4, import_chalk18, ModelSelectorUI;
|
|
30255
30684
|
var init_model_selector_ui = __esm({
|
|
30256
30685
|
"src/services/model-selector-ui.ts"() {
|
|
30257
30686
|
readline4 = __toESM(require("readline"), 1);
|
|
30258
|
-
|
|
30687
|
+
import_chalk18 = __toESM(require("chalk"), 1);
|
|
30259
30688
|
ModelSelectorUI = class {
|
|
30260
30689
|
models = [];
|
|
30261
30690
|
selectedIndex = 0;
|
|
@@ -30282,7 +30711,7 @@ var init_model_selector_ui = __esm({
|
|
|
30282
30711
|
output: process.stdout,
|
|
30283
30712
|
terminal: true
|
|
30284
30713
|
});
|
|
30285
|
-
console.log(
|
|
30714
|
+
console.log(import_chalk18.default.green(
|
|
30286
30715
|
"\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"
|
|
30287
30716
|
));
|
|
30288
30717
|
process.stdout.write("\x1B7");
|
|
@@ -30350,14 +30779,14 @@ var init_model_selector_ui = __esm({
|
|
|
30350
30779
|
}
|
|
30351
30780
|
renderFromSavedPosition() {
|
|
30352
30781
|
if (this.isDestroyed) return;
|
|
30353
|
-
console.log(
|
|
30354
|
-
"\u2502 " +
|
|
30782
|
+
console.log(import_chalk18.default.green(
|
|
30783
|
+
"\u2502 " + import_chalk18.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
30355
30784
|
));
|
|
30356
30785
|
this.renderContent();
|
|
30357
30786
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
30358
30787
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
30359
|
-
console.log(
|
|
30360
|
-
console.log(
|
|
30788
|
+
console.log(import_chalk18.default.green("\u2502 ") + import_chalk18.default.dim.green(helpText.padEnd(76)) + import_chalk18.default.green(" \u2502"));
|
|
30789
|
+
console.log(import_chalk18.default.green(
|
|
30361
30790
|
"\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"
|
|
30362
30791
|
));
|
|
30363
30792
|
}
|
|
@@ -30398,19 +30827,19 @@ var init_model_selector_ui = __esm({
|
|
|
30398
30827
|
const item = displayItems[i2];
|
|
30399
30828
|
if (item.type === "group") {
|
|
30400
30829
|
console.log(
|
|
30401
|
-
|
|
30830
|
+
import_chalk18.default.green("\u2502") + import_chalk18.default.dim.green(" \u2501\u2501\u2501 ") + import_chalk18.default.greenBright(item.content.substring(2, item.content.indexOf(" \u2500"))) + import_chalk18.default.dim.green(" " + "\u2501".repeat(71 - item.content.indexOf(" \u2500"))) + import_chalk18.default.green("\u2502")
|
|
30402
30831
|
);
|
|
30403
30832
|
} else {
|
|
30404
30833
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
30405
|
-
const prefix = isSelected ?
|
|
30834
|
+
const prefix = isSelected ? import_chalk18.default.greenBright("\u25B6 ") : " ";
|
|
30406
30835
|
const modelText = item.content;
|
|
30407
30836
|
if (isSelected) {
|
|
30408
30837
|
console.log(
|
|
30409
|
-
|
|
30838
|
+
import_chalk18.default.green("\u2502") + prefix + import_chalk18.default.black.bgGreen(modelText.padEnd(75)) + import_chalk18.default.green("\u2502")
|
|
30410
30839
|
);
|
|
30411
30840
|
} else {
|
|
30412
30841
|
console.log(
|
|
30413
|
-
|
|
30842
|
+
import_chalk18.default.green("\u2502") + prefix + import_chalk18.default.green(modelText.substring(0, 75).padEnd(75)) + import_chalk18.default.green("\u2502")
|
|
30414
30843
|
);
|
|
30415
30844
|
}
|
|
30416
30845
|
}
|
|
@@ -32662,8 +33091,8 @@ async function loadServices() {
|
|
|
32662
33091
|
try {
|
|
32663
33092
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32664
33093
|
if (commandName === "battlecard") {
|
|
32665
|
-
console.log(
|
|
32666
|
-
console.log(
|
|
33094
|
+
console.log(import_chalk19.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
33095
|
+
console.log(import_chalk19.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32667
33096
|
return {
|
|
32668
33097
|
success: false,
|
|
32669
33098
|
message: "Command not available on Free plan"
|
|
@@ -32724,7 +33153,7 @@ async function loadServices() {
|
|
|
32724
33153
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32725
33154
|
}
|
|
32726
33155
|
} catch (e2) {
|
|
32727
|
-
console.warn(
|
|
33156
|
+
console.warn(import_chalk19.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32728
33157
|
}
|
|
32729
33158
|
}
|
|
32730
33159
|
async function init() {
|
|
@@ -32838,20 +33267,20 @@ async function enforceAuth(cmd) {
|
|
|
32838
33267
|
try {
|
|
32839
33268
|
const tokens = await authManager.getValidTokens();
|
|
32840
33269
|
if (!tokens) {
|
|
32841
|
-
console.log(
|
|
33270
|
+
console.log(import_chalk19.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32842
33271
|
process.exit(2);
|
|
32843
33272
|
return false;
|
|
32844
33273
|
}
|
|
32845
33274
|
return true;
|
|
32846
33275
|
} catch (error2) {
|
|
32847
33276
|
if (error2.code === "AUTH_REQUIRED") {
|
|
32848
|
-
console.log(
|
|
33277
|
+
console.log(import_chalk19.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32849
33278
|
process.exit(2);
|
|
32850
33279
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
32851
|
-
console.log(
|
|
33280
|
+
console.log(import_chalk19.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
32852
33281
|
process.exit(2);
|
|
32853
33282
|
} else {
|
|
32854
|
-
console.log(
|
|
33283
|
+
console.log(import_chalk19.default.red("\u{1F310} Network error, check connection"));
|
|
32855
33284
|
process.exit(1);
|
|
32856
33285
|
}
|
|
32857
33286
|
return false;
|
|
@@ -32891,7 +33320,7 @@ async function handleSlash(input3) {
|
|
|
32891
33320
|
console.log(JSON.stringify(result.data, null, 2));
|
|
32892
33321
|
}
|
|
32893
33322
|
} else {
|
|
32894
|
-
console.log(
|
|
33323
|
+
console.log(import_chalk19.default.red(`Help Error: ${result.message}`));
|
|
32895
33324
|
}
|
|
32896
33325
|
return true;
|
|
32897
33326
|
}
|
|
@@ -32899,7 +33328,7 @@ async function handleSlash(input3) {
|
|
|
32899
33328
|
if (process.env.MARIA_DEBUG === "1") {
|
|
32900
33329
|
console.error("HelpCommand error:", helpError);
|
|
32901
33330
|
}
|
|
32902
|
-
console.log(
|
|
33331
|
+
console.log(import_chalk19.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
32903
33332
|
}
|
|
32904
33333
|
const help = `
|
|
32905
33334
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -32924,7 +33353,7 @@ Chat:
|
|
|
32924
33353
|
session.length = 0;
|
|
32925
33354
|
if (ctx?.clearContext) ctx.clearContext();
|
|
32926
33355
|
console.clear();
|
|
32927
|
-
console.log(
|
|
33356
|
+
console.log(import_chalk19.default.cyan("\u2728 Session cleared"));
|
|
32928
33357
|
return true;
|
|
32929
33358
|
}
|
|
32930
33359
|
if (cmd === "code") {
|
|
@@ -32932,7 +33361,7 @@ Chat:
|
|
|
32932
33361
|
const prompt = args.join(" ").trim();
|
|
32933
33362
|
if (!prompt) {
|
|
32934
33363
|
console.log(
|
|
32935
|
-
|
|
33364
|
+
import_chalk19.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
32936
33365
|
);
|
|
32937
33366
|
return true;
|
|
32938
33367
|
}
|
|
@@ -32944,7 +33373,7 @@ Chat:
|
|
|
32944
33373
|
const prompt = args.join(" ").trim();
|
|
32945
33374
|
if (!prompt) {
|
|
32946
33375
|
console.log(
|
|
32947
|
-
|
|
33376
|
+
import_chalk19.default.cyan("\u{1F3A8} **Image Generation**\n") + import_chalk19.default.white("Usage: /image <prompt>\n") + import_chalk19.default.gray("Example: /image \u5BCC\u58EB\u5C71\u306E\u65E5\u306E\u51FA")
|
|
32948
33377
|
);
|
|
32949
33378
|
return true;
|
|
32950
33379
|
}
|
|
@@ -32956,14 +33385,14 @@ Chat:
|
|
|
32956
33385
|
options: {},
|
|
32957
33386
|
logger: {
|
|
32958
33387
|
info: (msg) => console.log(msg),
|
|
32959
|
-
error: (msg) => console.error(
|
|
32960
|
-
warn: (msg) => console.warn(
|
|
33388
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33389
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
32961
33390
|
}
|
|
32962
33391
|
};
|
|
32963
33392
|
await imageCommand2.execute(context2);
|
|
32964
33393
|
}
|
|
32965
33394
|
} catch (error2) {
|
|
32966
|
-
console.error(
|
|
33395
|
+
console.error(import_chalk19.default.red("Image generation failed:"), error2.message);
|
|
32967
33396
|
}
|
|
32968
33397
|
return true;
|
|
32969
33398
|
}
|
|
@@ -32972,7 +33401,7 @@ Chat:
|
|
|
32972
33401
|
const prompt = args.join(" ").trim();
|
|
32973
33402
|
if (!prompt) {
|
|
32974
33403
|
console.log(
|
|
32975
|
-
|
|
33404
|
+
import_chalk19.default.cyan("\u{1F3AC} **Video Generation**\n") + import_chalk19.default.white("Usage: /video <prompt>\n") + import_chalk19.default.gray("Example: /video \u6D77\u306E\u6CE2\u304C\u6253\u3061\u5BC4\u305B\u308B\u69D8\u5B50")
|
|
32976
33405
|
);
|
|
32977
33406
|
return true;
|
|
32978
33407
|
}
|
|
@@ -32984,14 +33413,14 @@ Chat:
|
|
|
32984
33413
|
options: {},
|
|
32985
33414
|
logger: {
|
|
32986
33415
|
info: (msg) => console.log(msg),
|
|
32987
|
-
error: (msg) => console.error(
|
|
32988
|
-
warn: (msg) => console.warn(
|
|
33416
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33417
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
32989
33418
|
}
|
|
32990
33419
|
};
|
|
32991
33420
|
await videoCommand2.execute(context2);
|
|
32992
33421
|
}
|
|
32993
33422
|
} catch (error2) {
|
|
32994
|
-
console.error(
|
|
33423
|
+
console.error(import_chalk19.default.red("Video generation failed:"), error2.message);
|
|
32995
33424
|
}
|
|
32996
33425
|
return true;
|
|
32997
33426
|
}
|
|
@@ -33000,7 +33429,7 @@ Chat:
|
|
|
33000
33429
|
const prompt = args.join(" ").trim();
|
|
33001
33430
|
if (!prompt) {
|
|
33002
33431
|
console.log(
|
|
33003
|
-
|
|
33432
|
+
import_chalk19.default.cyan("\u{1F399}\uFE0F **Voice Synthesis**\n") + import_chalk19.default.white("Usage: /voice <text>\n") + import_chalk19.default.gray("Example: /voice \u3053\u3093\u306B\u3061\u306F\u3001\u5143\u6C17\u3067\u3059\u304B\uFF1F")
|
|
33004
33433
|
);
|
|
33005
33434
|
return true;
|
|
33006
33435
|
}
|
|
@@ -33012,14 +33441,14 @@ Chat:
|
|
|
33012
33441
|
options: {},
|
|
33013
33442
|
logger: {
|
|
33014
33443
|
info: (msg) => console.log(msg),
|
|
33015
|
-
error: (msg) => console.error(
|
|
33016
|
-
warn: (msg) => console.warn(
|
|
33444
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33445
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
33017
33446
|
}
|
|
33018
33447
|
};
|
|
33019
33448
|
await voiceCommand2.execute(context2);
|
|
33020
33449
|
}
|
|
33021
33450
|
} catch (error2) {
|
|
33022
|
-
console.error(
|
|
33451
|
+
console.error(import_chalk19.default.red("Voice synthesis failed:"), error2.message);
|
|
33023
33452
|
}
|
|
33024
33453
|
return true;
|
|
33025
33454
|
}
|
|
@@ -33038,36 +33467,36 @@ Chat:
|
|
|
33038
33467
|
if (args.includes("status")) {
|
|
33039
33468
|
if (await authManager.isAuthenticated()) {
|
|
33040
33469
|
const user = await authManager.getCurrentUser();
|
|
33041
|
-
console.log(
|
|
33042
|
-
console.log(
|
|
33043
|
-
console.log(
|
|
33470
|
+
console.log(import_chalk19.default.green("\u2705 Authenticated"));
|
|
33471
|
+
console.log(import_chalk19.default.white(`\u{1F464} User: ${import_chalk19.default.cyan(user.email)}`));
|
|
33472
|
+
console.log(import_chalk19.default.white(`\u{1F4CA} Plan: ${import_chalk19.default.cyan(user.plan)}`));
|
|
33044
33473
|
} else {
|
|
33045
|
-
console.log(
|
|
33046
|
-
console.log(
|
|
33474
|
+
console.log(import_chalk19.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
33475
|
+
console.log(import_chalk19.default.gray("Use /login to sign in"));
|
|
33047
33476
|
}
|
|
33048
33477
|
} else {
|
|
33049
33478
|
const result = await authManager.login(options2);
|
|
33050
33479
|
if (result.success && result.user) {
|
|
33051
|
-
console.log(
|
|
33052
|
-
console.log(
|
|
33053
|
-
console.log(
|
|
33480
|
+
console.log(import_chalk19.default.green("\u2705 Successfully logged in!"));
|
|
33481
|
+
console.log(import_chalk19.default.white(`\u{1F464} User: ${import_chalk19.default.cyan(result.user.email)}`));
|
|
33482
|
+
console.log(import_chalk19.default.white(`\u{1F4CA} Plan: ${import_chalk19.default.cyan(result.user.plan)}`));
|
|
33054
33483
|
} else {
|
|
33055
|
-
console.log(
|
|
33056
|
-
if (result.error) console.log(
|
|
33484
|
+
console.log(import_chalk19.default.red("\u274C Login failed"));
|
|
33485
|
+
if (result.error) console.log(import_chalk19.default.gray(result.error));
|
|
33057
33486
|
}
|
|
33058
33487
|
}
|
|
33059
33488
|
}
|
|
33060
33489
|
} catch (error2) {
|
|
33061
|
-
console.error(
|
|
33490
|
+
console.error(import_chalk19.default.red("Login error:"), error2.message);
|
|
33062
33491
|
}
|
|
33063
33492
|
return true;
|
|
33064
33493
|
}
|
|
33065
33494
|
if (cmd === "logout" || cmd === "signout") {
|
|
33066
33495
|
try {
|
|
33067
33496
|
await authManager.logout();
|
|
33068
|
-
console.log(
|
|
33497
|
+
console.log(import_chalk19.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
33069
33498
|
} catch (error2) {
|
|
33070
|
-
console.error(
|
|
33499
|
+
console.error(import_chalk19.default.red("Logout error:"), error2.message);
|
|
33071
33500
|
}
|
|
33072
33501
|
return true;
|
|
33073
33502
|
}
|
|
@@ -33168,11 +33597,11 @@ Chat:
|
|
|
33168
33597
|
}
|
|
33169
33598
|
}
|
|
33170
33599
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33171
|
-
console.log(
|
|
33172
|
-
console.log(
|
|
33173
|
-
console.log(
|
|
33174
|
-
console.log(
|
|
33175
|
-
console.log(
|
|
33600
|
+
console.log(import_chalk19.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33601
|
+
console.log(import_chalk19.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33602
|
+
console.log(import_chalk19.default.gray(" \u2022 Type /help to see available commands"));
|
|
33603
|
+
console.log(import_chalk19.default.gray(" \u2022 Check if you need to /login first"));
|
|
33604
|
+
console.log(import_chalk19.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33176
33605
|
}
|
|
33177
33606
|
return true;
|
|
33178
33607
|
}
|
|
@@ -33440,11 +33869,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33440
33869
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33441
33870
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33442
33871
|
console.log(
|
|
33443
|
-
|
|
33444
|
-
`) +
|
|
33445
|
-
`) +
|
|
33446
|
-
`) +
|
|
33447
|
-
`) +
|
|
33872
|
+
import_chalk19.default.green("\n\u2705 **Code Saved**\n") + import_chalk19.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33873
|
+
`) + import_chalk19.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33874
|
+
`) + import_chalk19.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33875
|
+
`) + import_chalk19.default.white(` \u{1F4DD} Language: ${language}
|
|
33876
|
+
`) + import_chalk19.default.dim(`
|
|
33448
33877
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33449
33878
|
);
|
|
33450
33879
|
} else {
|
|
@@ -33453,11 +33882,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33453
33882
|
} catch (e2) {
|
|
33454
33883
|
spinner.stop();
|
|
33455
33884
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33456
|
-
console.error(
|
|
33885
|
+
console.error(import_chalk19.default.red("Code generation error:"), e2.message || e2);
|
|
33457
33886
|
}
|
|
33458
33887
|
const fallbackCode = templateFallback(prompt);
|
|
33459
33888
|
console.log(
|
|
33460
|
-
|
|
33889
|
+
import_chalk19.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33461
33890
|
);
|
|
33462
33891
|
console.log(fallbackCode);
|
|
33463
33892
|
try {
|
|
@@ -33466,14 +33895,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33466
33895
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33467
33896
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33468
33897
|
console.log(
|
|
33469
|
-
|
|
33470
|
-
`) +
|
|
33471
|
-
`) +
|
|
33472
|
-
`) +
|
|
33898
|
+
import_chalk19.default.green("\n\u2705 **Template Code Saved**\n") + import_chalk19.default.white(`\u{1F4C1} **File (Click to open):**
|
|
33899
|
+
`) + import_chalk19.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
33900
|
+
`) + import_chalk19.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
33901
|
+
`) + import_chalk19.default.dim(`
|
|
33473
33902
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33474
33903
|
);
|
|
33475
33904
|
} catch (saveError) {
|
|
33476
|
-
console.error(
|
|
33905
|
+
console.error(import_chalk19.default.red("Failed to save code:"), saveError);
|
|
33477
33906
|
}
|
|
33478
33907
|
}
|
|
33479
33908
|
}
|
|
@@ -33529,7 +33958,7 @@ ${userPrompt}`;
|
|
|
33529
33958
|
(seq) => response2.includes(seq)
|
|
33530
33959
|
);
|
|
33531
33960
|
if (guidedFlowDetected) {
|
|
33532
|
-
console.log(
|
|
33961
|
+
console.log(import_chalk19.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33533
33962
|
return null;
|
|
33534
33963
|
}
|
|
33535
33964
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33697,14 +34126,14 @@ async function streamAnswer(text) {
|
|
|
33697
34126
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33698
34127
|
} else {
|
|
33699
34128
|
animation.stop();
|
|
33700
|
-
console.log(
|
|
34129
|
+
console.log(import_chalk19.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33701
34130
|
}
|
|
33702
34131
|
} catch (e2) {
|
|
33703
34132
|
animation.stop();
|
|
33704
34133
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33705
|
-
console.log(
|
|
34134
|
+
console.log(import_chalk19.default.yellow(e2.message));
|
|
33706
34135
|
} else {
|
|
33707
|
-
console.log(
|
|
34136
|
+
console.log(import_chalk19.default.red("Error generating response:"), e2.message || e2);
|
|
33708
34137
|
}
|
|
33709
34138
|
}
|
|
33710
34139
|
}
|
|
@@ -33719,9 +34148,9 @@ async function handleLine(line) {
|
|
|
33719
34148
|
if (consumed) return;
|
|
33720
34149
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33721
34150
|
if (!isAuthenticated) {
|
|
33722
|
-
console.log(
|
|
33723
|
-
console.log(
|
|
33724
|
-
console.log(
|
|
34151
|
+
console.log(import_chalk19.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
34152
|
+
console.log(import_chalk19.default.cyan("Please run: /login"));
|
|
34153
|
+
console.log(import_chalk19.default.gray("Or use slash commands like /help, /version"));
|
|
33725
34154
|
return;
|
|
33726
34155
|
}
|
|
33727
34156
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -33743,7 +34172,7 @@ async function startInteractiveSession() {
|
|
|
33743
34172
|
}
|
|
33744
34173
|
}
|
|
33745
34174
|
const stop = async () => {
|
|
33746
|
-
console.log(
|
|
34175
|
+
console.log(import_chalk19.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33747
34176
|
if (store?.close) await store.close().catch(() => {
|
|
33748
34177
|
});
|
|
33749
34178
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -33753,7 +34182,7 @@ async function startInteractiveSession() {
|
|
|
33753
34182
|
process.once("SIGINT", stop);
|
|
33754
34183
|
process.once("SIGTERM", stop);
|
|
33755
34184
|
if (!isTTY) {
|
|
33756
|
-
console.log(
|
|
34185
|
+
console.log(import_chalk19.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
33757
34186
|
const rl = readline5.createInterface({
|
|
33758
34187
|
input: import_node_process3.stdin,
|
|
33759
34188
|
output: import_node_process3.stdout,
|
|
@@ -33768,7 +34197,7 @@ async function startInteractiveSession() {
|
|
|
33768
34197
|
if (interactiveCLI) {
|
|
33769
34198
|
while (true) {
|
|
33770
34199
|
try {
|
|
33771
|
-
const prompt =
|
|
34200
|
+
const prompt = import_chalk19.default.gray("> ");
|
|
33772
34201
|
process.stdout.write(prompt);
|
|
33773
34202
|
const line = await interactiveCLI.question("");
|
|
33774
34203
|
console.log();
|
|
@@ -33783,14 +34212,14 @@ async function startInteractiveSession() {
|
|
|
33783
34212
|
await stop();
|
|
33784
34213
|
return;
|
|
33785
34214
|
}
|
|
33786
|
-
console.error(
|
|
34215
|
+
console.error(import_chalk19.default.red("Error:"), error2?.message || error2);
|
|
33787
34216
|
}
|
|
33788
34217
|
}
|
|
33789
34218
|
} else {
|
|
33790
34219
|
const rl = readline5.createInterface({ input: import_node_process3.stdin, output: import_node_process3.stdout });
|
|
33791
34220
|
while (true) {
|
|
33792
34221
|
try {
|
|
33793
|
-
const prompt =
|
|
34222
|
+
const prompt = import_chalk19.default.gray("> ");
|
|
33794
34223
|
const line = await rl.question(prompt);
|
|
33795
34224
|
console.log();
|
|
33796
34225
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -33804,7 +34233,7 @@ async function startInteractiveSession() {
|
|
|
33804
34233
|
await stop();
|
|
33805
34234
|
return;
|
|
33806
34235
|
}
|
|
33807
|
-
console.error(
|
|
34236
|
+
console.error(import_chalk19.default.red("Error:"), error2?.message || error2);
|
|
33808
34237
|
}
|
|
33809
34238
|
}
|
|
33810
34239
|
}
|
|
@@ -33814,7 +34243,7 @@ function createCLI() {
|
|
|
33814
34243
|
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) => {
|
|
33815
34244
|
loadEnvironmentVariables();
|
|
33816
34245
|
if (options.server) {
|
|
33817
|
-
console.log(
|
|
34246
|
+
console.log(import_chalk19.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
33818
34247
|
try {
|
|
33819
34248
|
const serverPath = path11.join(process.cwd(), "server.mjs");
|
|
33820
34249
|
const { spawn } = await import("child_process");
|
|
@@ -33823,37 +34252,48 @@ function createCLI() {
|
|
|
33823
34252
|
env: process.env
|
|
33824
34253
|
});
|
|
33825
34254
|
serverProcess.on("error", (error2) => {
|
|
33826
|
-
console.error(
|
|
34255
|
+
console.error(import_chalk19.default.red("\u274C Server process error:"), error2);
|
|
33827
34256
|
process.exit(1);
|
|
33828
34257
|
});
|
|
33829
34258
|
return;
|
|
33830
34259
|
} catch (error2) {
|
|
33831
|
-
console.error(
|
|
34260
|
+
console.error(import_chalk19.default.red("\u274C Failed to start server mode:"), error2);
|
|
33832
34261
|
process.exit(1);
|
|
33833
34262
|
}
|
|
33834
34263
|
}
|
|
33835
|
-
startupDisplayed
|
|
34264
|
+
if (!startupDisplayed) {
|
|
34265
|
+
try {
|
|
34266
|
+
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
34267
|
+
displayStartupLogo2();
|
|
34268
|
+
startupDisplayed = true;
|
|
34269
|
+
} catch {
|
|
34270
|
+
console.log(import_chalk19.default.cyan(`
|
|
34271
|
+
\u{1F680} MARIA v${getVersion()}
|
|
34272
|
+
`));
|
|
34273
|
+
startupDisplayed = true;
|
|
34274
|
+
}
|
|
34275
|
+
}
|
|
33836
34276
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
33837
34277
|
if (useV3) {
|
|
33838
34278
|
try {
|
|
33839
|
-
console.log(
|
|
34279
|
+
console.log(import_chalk19.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
33840
34280
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
33841
34281
|
const maria = new MariaAI2();
|
|
33842
34282
|
await maria.initialize();
|
|
33843
34283
|
return;
|
|
33844
34284
|
} catch (e2) {
|
|
33845
|
-
console.warn(
|
|
34285
|
+
console.warn(import_chalk19.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
33846
34286
|
}
|
|
33847
34287
|
}
|
|
33848
34288
|
await startInteractiveSession();
|
|
33849
34289
|
});
|
|
33850
34290
|
return program2;
|
|
33851
34291
|
}
|
|
33852
|
-
var import_commander,
|
|
34292
|
+
var import_commander, import_chalk19, readline5, import_node_process3, path11, fs11, AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, startupDisplayed, program;
|
|
33853
34293
|
var init_cli = __esm({
|
|
33854
34294
|
"src/cli.ts"() {
|
|
33855
34295
|
import_commander = require("commander");
|
|
33856
|
-
|
|
34296
|
+
import_chalk19 = __toESM(require("chalk"), 1);
|
|
33857
34297
|
readline5 = __toESM(require("readline/promises"), 1);
|
|
33858
34298
|
import_node_process3 = require("process");
|
|
33859
34299
|
path11 = __toESM(require("path"), 1);
|
|
@@ -33896,22 +34336,23 @@ function createCLI2() {
|
|
|
33896
34336
|
}
|
|
33897
34337
|
});
|
|
33898
34338
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
33899
|
-
console.log(
|
|
34339
|
+
console.log(import_chalk20.default.cyan("Setting up Ollama..."));
|
|
33900
34340
|
console.log(
|
|
33901
|
-
|
|
34341
|
+
import_chalk20.default.yellow("Please run: brew install ollama && ollama serve")
|
|
33902
34342
|
);
|
|
33903
34343
|
});
|
|
33904
34344
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
33905
|
-
console.log(
|
|
33906
|
-
console.log(
|
|
34345
|
+
console.log(import_chalk20.default.cyan("Setting up vLLM..."));
|
|
34346
|
+
console.log(import_chalk20.default.yellow("Please run: pip install vllm"));
|
|
33907
34347
|
});
|
|
33908
34348
|
return program2;
|
|
33909
34349
|
}
|
|
33910
|
-
var
|
|
34350
|
+
var import_chalk20, import_commander2, MariaAI;
|
|
33911
34351
|
var init_maria_ai = __esm({
|
|
33912
34352
|
"src/maria-ai.ts"() {
|
|
33913
|
-
|
|
34353
|
+
import_chalk20 = __toESM(require("chalk"), 1);
|
|
33914
34354
|
import_commander2 = require("commander");
|
|
34355
|
+
init_startup_display();
|
|
33915
34356
|
init_provider_selector();
|
|
33916
34357
|
init_config2();
|
|
33917
34358
|
init_IntelligentRouterService();
|
|
@@ -33928,16 +34369,17 @@ var init_maria_ai = __esm({
|
|
|
33928
34369
|
}
|
|
33929
34370
|
async initialize() {
|
|
33930
34371
|
try {
|
|
34372
|
+
displayStartupLogo();
|
|
33931
34373
|
await this.providerSelector.initialize();
|
|
33932
34374
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
33933
34375
|
console.log(
|
|
33934
|
-
|
|
34376
|
+
import_chalk20.default.green(`
|
|
33935
34377
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
33936
34378
|
);
|
|
33937
34379
|
this.config.set("currentProvider", provider);
|
|
33938
34380
|
this.config.set("currentModel", model);
|
|
33939
34381
|
await this.config.save();
|
|
33940
|
-
console.log(
|
|
34382
|
+
console.log(import_chalk20.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
33941
34383
|
this.router = new IntelligentRouterService({
|
|
33942
34384
|
confidenceThreshold: 0.85,
|
|
33943
34385
|
enableLearning: true,
|
|
@@ -33945,12 +34387,12 @@ var init_maria_ai = __esm({
|
|
|
33945
34387
|
});
|
|
33946
34388
|
await this.router.initialize();
|
|
33947
34389
|
console.log(
|
|
33948
|
-
|
|
34390
|
+
import_chalk20.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
33949
34391
|
);
|
|
33950
34392
|
this.session = createInteractiveSession(this);
|
|
33951
34393
|
await this.session.start();
|
|
33952
34394
|
} catch (error2) {
|
|
33953
|
-
console.error(
|
|
34395
|
+
console.error(import_chalk20.default.red("\n\u274C Initialization failed:"), error2);
|
|
33954
34396
|
process.exit(1);
|
|
33955
34397
|
}
|
|
33956
34398
|
}
|
|
@@ -33958,7 +34400,7 @@ var init_maria_ai = __esm({
|
|
|
33958
34400
|
if (this.session) {
|
|
33959
34401
|
await this.session.stop();
|
|
33960
34402
|
}
|
|
33961
|
-
console.log(
|
|
34403
|
+
console.log(import_chalk20.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33962
34404
|
}
|
|
33963
34405
|
};
|
|
33964
34406
|
}
|
|
@@ -33968,7 +34410,7 @@ var init_maria_ai = __esm({
|
|
|
33968
34410
|
init_maria_ai();
|
|
33969
34411
|
|
|
33970
34412
|
// src/utils/version-check.ts
|
|
33971
|
-
var
|
|
34413
|
+
var import_chalk21 = __toESM(require("chalk"), 1);
|
|
33972
34414
|
var import_semver = __toESM(require("semver"), 1);
|
|
33973
34415
|
var MINIMUM_NODE_VERSION = "18.0.0";
|
|
33974
34416
|
var RECOMMENDED_NODE_VERSION = "20.0.0";
|
|
@@ -33976,25 +34418,25 @@ function checkNodeVersion() {
|
|
|
33976
34418
|
const currentVersion = process.version;
|
|
33977
34419
|
if (!import_semver.default.satisfies(currentVersion, `>=${MINIMUM_NODE_VERSION}`)) {
|
|
33978
34420
|
console.error(
|
|
33979
|
-
|
|
34421
|
+
import_chalk21.default.red(`
|
|
33980
34422
|
\u274C Node.js version ${currentVersion} is not supported.`)
|
|
33981
34423
|
);
|
|
33982
34424
|
console.error(
|
|
33983
|
-
|
|
34425
|
+
import_chalk21.default.yellow(`Minimum required version: ${MINIMUM_NODE_VERSION}`)
|
|
33984
34426
|
);
|
|
33985
34427
|
console.error(
|
|
33986
|
-
|
|
34428
|
+
import_chalk21.default.yellow(
|
|
33987
34429
|
`Recommended version: ${RECOMMENDED_NODE_VERSION} or higher`
|
|
33988
34430
|
)
|
|
33989
34431
|
);
|
|
33990
|
-
console.error(
|
|
33991
|
-
console.error(
|
|
34432
|
+
console.error(import_chalk21.default.cyan("\nPlease upgrade Node.js:"));
|
|
34433
|
+
console.error(import_chalk21.default.gray(" \u2022 Using nvm: nvm install 20 && nvm use 20"));
|
|
33992
34434
|
console.error(
|
|
33993
|
-
|
|
34435
|
+
import_chalk21.default.gray(
|
|
33994
34436
|
" \u2022 Using nodenv: nodenv install 20.0.0 && nodenv global 20.0.0"
|
|
33995
34437
|
)
|
|
33996
34438
|
);
|
|
33997
|
-
console.error(
|
|
34439
|
+
console.error(import_chalk21.default.gray(" \u2022 Download from: https://nodejs.org/"));
|
|
33998
34440
|
process.exit(1);
|
|
33999
34441
|
}
|
|
34000
34442
|
}
|