@bonginkan/maria 4.2.4 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/maria.cjs +1210 -610
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +1078 -486
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/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({
|
|
@@ -6717,16 +7135,12 @@ var init_SecretManagerIntegration = __esm({
|
|
|
6717
7135
|
const [version] = await this.client.accessSecretVersion({ name: name2 });
|
|
6718
7136
|
const payload = version.payload?.data;
|
|
6719
7137
|
if (!payload) {
|
|
6720
|
-
console.error(`Secret ${secretName} has no payload`);
|
|
6721
7138
|
return void 0;
|
|
6722
7139
|
}
|
|
6723
7140
|
const secret = payload.toString();
|
|
6724
7141
|
this.cacheSecret(secretName, secret);
|
|
6725
7142
|
return secret;
|
|
6726
7143
|
} catch (error2) {
|
|
6727
|
-
if (error2.code !== 5) {
|
|
6728
|
-
console.error(`Failed to access secret ${secretName}:`, error2);
|
|
6729
|
-
}
|
|
6730
7144
|
return this.getFallbackFromEnv(provider);
|
|
6731
7145
|
}
|
|
6732
7146
|
}
|
|
@@ -6809,7 +7223,6 @@ var init_SecretManagerIntegration = __esm({
|
|
|
6809
7223
|
this.cacheExpiry.delete(secretName);
|
|
6810
7224
|
return true;
|
|
6811
7225
|
} catch (error2) {
|
|
6812
|
-
console.error(`Failed to create/update secret ${secretName}:`, error2);
|
|
6813
7226
|
return false;
|
|
6814
7227
|
}
|
|
6815
7228
|
}
|
|
@@ -7913,10 +8326,10 @@ var init_llm_health_checker = __esm({
|
|
|
7913
8326
|
});
|
|
7914
8327
|
|
|
7915
8328
|
// src/services/provider-selector.ts
|
|
7916
|
-
var
|
|
8329
|
+
var import_chalk2, ProviderSelector;
|
|
7917
8330
|
var init_provider_selector = __esm({
|
|
7918
8331
|
"src/services/provider-selector.ts"() {
|
|
7919
|
-
|
|
8332
|
+
import_chalk2 = __toESM(require("chalk"), 1);
|
|
7920
8333
|
init_providers();
|
|
7921
8334
|
ProviderSelector = class {
|
|
7922
8335
|
config;
|
|
@@ -7932,29 +8345,29 @@ var init_provider_selector = __esm({
|
|
|
7932
8345
|
const inquirer = await import("inquirer");
|
|
7933
8346
|
const prompt = inquirer.default?.prompt || inquirer.prompt;
|
|
7934
8347
|
const providers = await this.getAvailableProviders();
|
|
7935
|
-
console.log(
|
|
7936
|
-
console.log(
|
|
8348
|
+
console.log(import_chalk2.default.cyan("\nAvailable AI Providers:"));
|
|
8349
|
+
console.log(import_chalk2.default.gray("\u2500".repeat(50)));
|
|
7937
8350
|
const _cloudProviders = providers.filter((p) => p.type === "cloud");
|
|
7938
8351
|
const _localProviders = providers.filter((p) => p.type === "local");
|
|
7939
8352
|
if (_cloudProviders.length > 0) {
|
|
7940
|
-
console.log(
|
|
8353
|
+
console.log(import_chalk2.default.yellow("\n\u2601\uFE0F Cloud AI:"));
|
|
7941
8354
|
_cloudProviders.forEach((p) => {
|
|
7942
8355
|
if (p.available) {
|
|
7943
8356
|
console.log(
|
|
7944
|
-
` ${
|
|
8357
|
+
` ${import_chalk2.default.green("*")} ${import_chalk2.default.white(p.name.split(" ")[0])}`
|
|
7945
8358
|
);
|
|
7946
8359
|
} else {
|
|
7947
|
-
console.log(` ${
|
|
8360
|
+
console.log(` ${import_chalk2.default.gray(p.name.split(" ")[0])}`);
|
|
7948
8361
|
}
|
|
7949
8362
|
});
|
|
7950
8363
|
}
|
|
7951
8364
|
if (_localProviders.length > 0) {
|
|
7952
|
-
console.log(
|
|
8365
|
+
console.log(import_chalk2.default.cyan("\n\u{1F4BB} Local AI:"));
|
|
7953
8366
|
_localProviders.forEach((p) => {
|
|
7954
8367
|
if (p.available) {
|
|
7955
|
-
console.log(` ${
|
|
8368
|
+
console.log(` ${import_chalk2.default.green("*")} ${import_chalk2.default.white(p.name)}`);
|
|
7956
8369
|
} else {
|
|
7957
|
-
console.log(` ${
|
|
8370
|
+
console.log(` ${import_chalk2.default.green("*")} ${import_chalk2.default.gray(p.name)}`);
|
|
7958
8371
|
}
|
|
7959
8372
|
});
|
|
7960
8373
|
}
|
|
@@ -7969,20 +8382,20 @@ var init_provider_selector = __esm({
|
|
|
7969
8382
|
});
|
|
7970
8383
|
if (selectableProviders.length === 0) {
|
|
7971
8384
|
console.log(
|
|
7972
|
-
|
|
8385
|
+
import_chalk2.default.yellow("\n\u26A0\uFE0F No AI providers are currently available.")
|
|
7973
8386
|
);
|
|
7974
|
-
console.log(
|
|
8387
|
+
console.log(import_chalk2.default.gray("\nTo use MARIA, you need to:"));
|
|
7975
8388
|
console.log(
|
|
7976
|
-
|
|
8389
|
+
import_chalk2.default.gray(
|
|
7977
8390
|
"1. Set up API keys for cloud providers (OpenAI, Anthropic, Google, etc.)"
|
|
7978
8391
|
)
|
|
7979
8392
|
);
|
|
7980
|
-
console.log(
|
|
8393
|
+
console.log(import_chalk2.default.gray(" Example: export OPENAI_API_KEY=your_api_key"));
|
|
7981
8394
|
console.log(
|
|
7982
|
-
|
|
8395
|
+
import_chalk2.default.gray("2. Or start a local AI service (Ollama, LM Studio, vLLM)")
|
|
7983
8396
|
);
|
|
7984
|
-
console.log(
|
|
7985
|
-
console.log(
|
|
8397
|
+
console.log(import_chalk2.default.gray(" Example: maria setup-ollama"));
|
|
8398
|
+
console.log(import_chalk2.default.gray("\nFor more information, run: maria --help"));
|
|
7986
8399
|
process.exit(1);
|
|
7987
8400
|
}
|
|
7988
8401
|
const choices = selectableProviders.map((p) => ({
|
|
@@ -8003,29 +8416,29 @@ var init_provider_selector = __esm({
|
|
|
8003
8416
|
const provider = providers.find((p) => p.value === selectedProvider);
|
|
8004
8417
|
if (provider && provider.type === "local" && !provider.available) {
|
|
8005
8418
|
console.log(
|
|
8006
|
-
|
|
8419
|
+
import_chalk2.default.yellow(`
|
|
8007
8420
|
\u26A0\uFE0F ${provider.name} is not currently running.`)
|
|
8008
8421
|
);
|
|
8009
|
-
console.log(
|
|
8422
|
+
console.log(import_chalk2.default.gray(`
|
|
8010
8423
|
To use ${provider.name}, you need to:`));
|
|
8011
8424
|
if (selectedProvider === "ollama") {
|
|
8012
|
-
console.log(
|
|
8013
|
-
console.log(
|
|
8014
|
-
console.log(
|
|
8425
|
+
console.log(import_chalk2.default.gray("1. Install Ollama: brew install ollama"));
|
|
8426
|
+
console.log(import_chalk2.default.gray("2. Start Ollama: ollama serve"));
|
|
8427
|
+
console.log(import_chalk2.default.gray("3. Pull a model: ollama pull llama3.2:3b"));
|
|
8015
8428
|
console.log(
|
|
8016
|
-
|
|
8429
|
+
import_chalk2.default.gray("\nOr use the setup command: maria setup-ollama")
|
|
8017
8430
|
);
|
|
8018
8431
|
} else if (selectedProvider === "lmstudio") {
|
|
8019
8432
|
console.log(
|
|
8020
|
-
|
|
8433
|
+
import_chalk2.default.gray("1. Download LM Studio from https://lmstudio.ai")
|
|
8021
8434
|
);
|
|
8022
|
-
console.log(
|
|
8023
|
-
console.log(
|
|
8024
|
-
console.log(
|
|
8435
|
+
console.log(import_chalk2.default.gray("2. Start LM Studio application"));
|
|
8436
|
+
console.log(import_chalk2.default.gray("3. Load a model in LM Studio"));
|
|
8437
|
+
console.log(import_chalk2.default.gray("4. Start the local server in LM Studio"));
|
|
8025
8438
|
} else if (selectedProvider === "vllm") {
|
|
8026
|
-
console.log(
|
|
8027
|
-
console.log(
|
|
8028
|
-
console.log(
|
|
8439
|
+
console.log(import_chalk2.default.gray("1. Install vLLM: pip install vllm"));
|
|
8440
|
+
console.log(import_chalk2.default.gray("2. Start vLLM server with a model"));
|
|
8441
|
+
console.log(import_chalk2.default.gray("\nOr use the setup command: maria setup-vllm"));
|
|
8029
8442
|
}
|
|
8030
8443
|
process.exit(1);
|
|
8031
8444
|
}
|
|
@@ -8668,8 +9081,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8668
9081
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
8669
9082
|
const fs12 = await importNodeBuiltin2("fs");
|
|
8670
9083
|
const _path = await importNodeBuiltin2("path");
|
|
8671
|
-
const
|
|
8672
|
-
const targetPath = configPath || _path.join(
|
|
9084
|
+
const os9 = await importNodeBuiltin2("os");
|
|
9085
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
8673
9086
|
try {
|
|
8674
9087
|
const data2 = await fs12.promises.readFile(targetPath, "utf-8");
|
|
8675
9088
|
return JSON.parse(data2);
|
|
@@ -8687,8 +9100,8 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8687
9100
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
8688
9101
|
const fs12 = await importNodeBuiltin2("fs");
|
|
8689
9102
|
const _path = await importNodeBuiltin2("path");
|
|
8690
|
-
const
|
|
8691
|
-
const targetPath = configPath || _path.join(
|
|
9103
|
+
const os9 = await importNodeBuiltin2("os");
|
|
9104
|
+
const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
|
|
8692
9105
|
try {
|
|
8693
9106
|
if (options?.backup) {
|
|
8694
9107
|
try {
|
|
@@ -8836,88 +9249,6 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
8836
9249
|
}
|
|
8837
9250
|
});
|
|
8838
9251
|
|
|
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
9252
|
// src/config/defaults.ts
|
|
8922
9253
|
var parseList, DEFAULT_UI_CONFIG, DEFAULT_PROVIDER_PREFS, AI_PROVIDERS_CONFIG, APP_VERSION;
|
|
8923
9254
|
var init_defaults = __esm({
|
|
@@ -12141,7 +12472,7 @@ var init_UserPatternAnalyzer = __esm({
|
|
|
12141
12472
|
});
|
|
12142
12473
|
|
|
12143
12474
|
// src/services/intelligent-router/app/IntelligentRouterService.ts
|
|
12144
|
-
var import_node_events,
|
|
12475
|
+
var import_node_events, import_chalk3, IntelligentRouterService;
|
|
12145
12476
|
var init_IntelligentRouterService = __esm({
|
|
12146
12477
|
"src/services/intelligent-router/app/IntelligentRouterService.ts"() {
|
|
12147
12478
|
import_node_events = require("events");
|
|
@@ -12152,7 +12483,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12152
12483
|
init_LanguageDetector();
|
|
12153
12484
|
init_CommandMappings();
|
|
12154
12485
|
init_UserPatternAnalyzer();
|
|
12155
|
-
|
|
12486
|
+
import_chalk3 = __toESM(require("chalk"), 1);
|
|
12156
12487
|
IntelligentRouterService = class extends import_node_events.EventEmitter {
|
|
12157
12488
|
nlpProcessor;
|
|
12158
12489
|
intentRecognizer;
|
|
@@ -12211,7 +12542,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12211
12542
|
this.emit("initialized");
|
|
12212
12543
|
} catch (_error) {
|
|
12213
12544
|
console._error(
|
|
12214
|
-
|
|
12545
|
+
import_chalk3.default.red("Failed to initialize Intelligent Router:"),
|
|
12215
12546
|
_error
|
|
12216
12547
|
);
|
|
12217
12548
|
throw _error;
|
|
@@ -12265,7 +12596,7 @@ var init_IntelligentRouterService = __esm({
|
|
|
12265
12596
|
} catch (_error) {
|
|
12266
12597
|
this.metrics.failedRoutes++;
|
|
12267
12598
|
this.emit("route:_error", { input: input3, _error });
|
|
12268
|
-
console._error(
|
|
12599
|
+
console._error(import_chalk3.default.red("Routing _error:"), _error);
|
|
12269
12600
|
return null;
|
|
12270
12601
|
}
|
|
12271
12602
|
}
|
|
@@ -12950,38 +13281,38 @@ var init_ReadlineAdapter = __esm({
|
|
|
12950
13281
|
});
|
|
12951
13282
|
|
|
12952
13283
|
// src/services/interactive-session/adapters/ChalkAdapter.ts
|
|
12953
|
-
var
|
|
13284
|
+
var import_chalk4, import_ora, ChalkAdapter;
|
|
12954
13285
|
var init_ChalkAdapter = __esm({
|
|
12955
13286
|
"src/services/interactive-session/adapters/ChalkAdapter.ts"() {
|
|
12956
|
-
|
|
13287
|
+
import_chalk4 = __toESM(require("chalk"), 1);
|
|
12957
13288
|
import_ora = __toESM(require("ora"), 1);
|
|
12958
13289
|
ChalkAdapter = class {
|
|
12959
13290
|
spinners = /* @__PURE__ */ new Map();
|
|
12960
13291
|
spinnerId = 0;
|
|
12961
13292
|
async showWelcome() {
|
|
12962
13293
|
console.log(
|
|
12963
|
-
|
|
13294
|
+
import_chalk4.default.cyan.bold("\n\u{1F916} Welcome to MARIA Interactive Session v3.5.0")
|
|
12964
13295
|
);
|
|
12965
|
-
console.log(
|
|
13296
|
+
console.log(import_chalk4.default.gray("Type /help for available commands\n"));
|
|
12966
13297
|
}
|
|
12967
13298
|
showGoodbye() {
|
|
12968
13299
|
this.stopAllSpinners();
|
|
12969
|
-
console.log(
|
|
13300
|
+
console.log(import_chalk4.default.yellow("\n\u{1F44B} Goodbye! Thank you for using MARIA.\n"));
|
|
12970
13301
|
}
|
|
12971
13302
|
async print(message) {
|
|
12972
13303
|
console.log(message);
|
|
12973
13304
|
}
|
|
12974
13305
|
error(message) {
|
|
12975
|
-
console.error(
|
|
13306
|
+
console.error(import_chalk4.default.red(`\u274C ${message}`));
|
|
12976
13307
|
}
|
|
12977
13308
|
success(message) {
|
|
12978
|
-
console.log(
|
|
13309
|
+
console.log(import_chalk4.default.green(`\u2705 ${message}`));
|
|
12979
13310
|
}
|
|
12980
13311
|
warning(message) {
|
|
12981
|
-
console.warn(
|
|
13312
|
+
console.warn(import_chalk4.default.yellow(`\u26A0\uFE0F ${message}`));
|
|
12982
13313
|
}
|
|
12983
13314
|
info(message) {
|
|
12984
|
-
console.info(
|
|
13315
|
+
console.info(import_chalk4.default.blue(`\u2139\uFE0F ${message}`));
|
|
12985
13316
|
}
|
|
12986
13317
|
startSpinner(message) {
|
|
12987
13318
|
const id = `spinner-${++this.spinnerId}`;
|
|
@@ -13031,12 +13362,12 @@ var init_ChalkAdapter = __esm({
|
|
|
13031
13362
|
* Format helpers for consistent styling
|
|
13032
13363
|
*/
|
|
13033
13364
|
static format = {
|
|
13034
|
-
command: (text) =>
|
|
13035
|
-
keyword: (text) =>
|
|
13036
|
-
value: (text) =>
|
|
13037
|
-
dim: (text) =>
|
|
13038
|
-
bold: (text) =>
|
|
13039
|
-
code: (text) =>
|
|
13365
|
+
command: (text) => import_chalk4.default.cyan(text),
|
|
13366
|
+
keyword: (text) => import_chalk4.default.magenta(text),
|
|
13367
|
+
value: (text) => import_chalk4.default.green(text),
|
|
13368
|
+
dim: (text) => import_chalk4.default.gray(text),
|
|
13369
|
+
bold: (text) => import_chalk4.default.bold(text),
|
|
13370
|
+
code: (text) => import_chalk4.default.bgGray.white(` ${text} `)
|
|
13040
13371
|
};
|
|
13041
13372
|
};
|
|
13042
13373
|
}
|
|
@@ -15141,10 +15472,10 @@ var init_dual_memory_engine = __esm({
|
|
|
15141
15472
|
});
|
|
15142
15473
|
|
|
15143
15474
|
// src/utils/logger.ts
|
|
15144
|
-
var
|
|
15475
|
+
var import_chalk5, LogLevel, Logger, logger, envLogLevel;
|
|
15145
15476
|
var init_logger = __esm({
|
|
15146
15477
|
"src/utils/logger.ts"() {
|
|
15147
|
-
|
|
15478
|
+
import_chalk5 = __toESM(require("chalk"), 1);
|
|
15148
15479
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
15149
15480
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
15150
15481
|
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
@@ -15162,27 +15493,27 @@ var init_logger = __esm({
|
|
|
15162
15493
|
}
|
|
15163
15494
|
debug(...args) {
|
|
15164
15495
|
if (this.level <= 0 /* DEBUG */) {
|
|
15165
|
-
console.log(
|
|
15496
|
+
console.log(import_chalk5.default.magenta(`${this.prefix} [DEBUG]`), ...args);
|
|
15166
15497
|
}
|
|
15167
15498
|
}
|
|
15168
15499
|
info(...args) {
|
|
15169
15500
|
if (this.level <= 1 /* INFO */) {
|
|
15170
|
-
console.log(
|
|
15501
|
+
console.log(import_chalk5.default.bold.magenta(`${this.prefix} [INFO]`), ...args);
|
|
15171
15502
|
}
|
|
15172
15503
|
}
|
|
15173
15504
|
warn(...args) {
|
|
15174
15505
|
if (this.level <= 2 /* WARN */) {
|
|
15175
|
-
console.warn(
|
|
15506
|
+
console.warn(import_chalk5.default.bold.magenta(`${this.prefix} [WARN]`), ...args);
|
|
15176
15507
|
}
|
|
15177
15508
|
}
|
|
15178
15509
|
error(...args) {
|
|
15179
15510
|
if (this.level <= 3 /* ERROR */) {
|
|
15180
|
-
console.error(
|
|
15511
|
+
console.error(import_chalk5.default.bold.magenta(`${this.prefix} [ERROR]`), ...args);
|
|
15181
15512
|
}
|
|
15182
15513
|
}
|
|
15183
15514
|
success(...args) {
|
|
15184
15515
|
if (this.level <= 1 /* INFO */) {
|
|
15185
|
-
console.log(
|
|
15516
|
+
console.log(import_chalk5.default.bold.magenta(`${this.prefix} [SUCCESS]`), ...args);
|
|
15186
15517
|
}
|
|
15187
15518
|
}
|
|
15188
15519
|
task(taskName, status, message) {
|
|
@@ -15196,10 +15527,10 @@ var init_logger = __esm({
|
|
|
15196
15527
|
error: "\u274C"
|
|
15197
15528
|
};
|
|
15198
15529
|
const statusColors = {
|
|
15199
|
-
start:
|
|
15200
|
-
progress:
|
|
15201
|
-
complete:
|
|
15202
|
-
error:
|
|
15530
|
+
start: import_chalk5.default.bold.magenta,
|
|
15531
|
+
progress: import_chalk5.default.magenta,
|
|
15532
|
+
complete: import_chalk5.default.bold.magenta,
|
|
15533
|
+
error: import_chalk5.default.bold.magenta
|
|
15203
15534
|
};
|
|
15204
15535
|
const icon = statusIcons[status];
|
|
15205
15536
|
const color = statusColors[status];
|
|
@@ -15216,14 +15547,14 @@ var init_logger = __esm({
|
|
|
15216
15547
|
if (this.level > 0 /* DEBUG */) {
|
|
15217
15548
|
return;
|
|
15218
15549
|
}
|
|
15219
|
-
console.log(
|
|
15550
|
+
console.log(import_chalk5.default.magenta(`${this.prefix} [JSON]`));
|
|
15220
15551
|
console.log(pretty ? JSON.stringify(obj, null, 2) : JSON.stringify(obj));
|
|
15221
15552
|
}
|
|
15222
15553
|
divider() {
|
|
15223
15554
|
if (this.level > 1 /* INFO */) {
|
|
15224
15555
|
return;
|
|
15225
15556
|
}
|
|
15226
|
-
console.log(
|
|
15557
|
+
console.log(import_chalk5.default.magenta("\u2500".repeat(60)));
|
|
15227
15558
|
}
|
|
15228
15559
|
clear() {
|
|
15229
15560
|
console.clear();
|
|
@@ -15243,7 +15574,7 @@ var init_logger = __esm({
|
|
|
15243
15574
|
const progressText = `${current}/${total}`;
|
|
15244
15575
|
const labelText = label ? ` ${label}` : "";
|
|
15245
15576
|
process.stdout.write(
|
|
15246
|
-
`\r${
|
|
15577
|
+
`\r${import_chalk5.default.bold.magenta(bar)} ${percentage}% ${progressText}${labelText}`
|
|
15247
15578
|
);
|
|
15248
15579
|
if (current === total) {
|
|
15249
15580
|
process.stdout.write("\n");
|
|
@@ -18312,11 +18643,11 @@ var init_ApprovalEngine = __esm({
|
|
|
18312
18643
|
});
|
|
18313
18644
|
|
|
18314
18645
|
// src/services/quick-approval/QuickApprovalInterface.ts
|
|
18315
|
-
var import_node_events3,
|
|
18646
|
+
var import_node_events3, import_chalk6, QuickApprovalInterface;
|
|
18316
18647
|
var init_QuickApprovalInterface = __esm({
|
|
18317
18648
|
"src/services/quick-approval/QuickApprovalInterface.ts"() {
|
|
18318
18649
|
import_node_events3 = require("events");
|
|
18319
|
-
|
|
18650
|
+
import_chalk6 = __toESM(require("chalk"), 1);
|
|
18320
18651
|
init_ApprovalEngine();
|
|
18321
18652
|
QuickApprovalInterface = class _QuickApprovalInterface extends import_node_events3.EventEmitter {
|
|
18322
18653
|
static instance;
|
|
@@ -18398,26 +18729,26 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18398
18729
|
const _lang = options.language || "en";
|
|
18399
18730
|
const _labels = LANGUAGE_LABELS[_lang] || LANGUAGE_LABELS.en;
|
|
18400
18731
|
console.log("");
|
|
18401
|
-
console.log(
|
|
18732
|
+
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
18733
|
console.log(
|
|
18403
|
-
|
|
18734
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18404
18735
|
` ${_labels.approvalRequest}${" ".repeat(Math.max(0, 43 - _labels.approvalRequest.length))}`
|
|
18405
|
-
) +
|
|
18736
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18406
18737
|
);
|
|
18407
|
-
console.log(
|
|
18738
|
+
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
18739
|
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
18740
|
console.log(
|
|
18410
|
-
|
|
18411
|
-
` > ${_labels.id}: ${
|
|
18412
|
-
) +
|
|
18741
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18742
|
+
` > ${_labels.id}: ${import_chalk6.default.yellow(_requestId)}${" ".repeat(Math.max(0, 35 - _requestId.length - _labels.id.length))}`
|
|
18743
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18413
18744
|
);
|
|
18414
18745
|
const _title = _request.context?.description || _request.themeId || "API Cache Improvement";
|
|
18415
18746
|
const _titleDisplay = _title.length > 25 ? _title.substring(0, 22) + "..." : _title;
|
|
18416
18747
|
const _titleLabel = ` ${_labels._title}:`;
|
|
18417
18748
|
console.log(
|
|
18418
|
-
|
|
18749
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18419
18750
|
`${_titleLabel} ${_titleDisplay}${" ".repeat(Math.max(0, 42 - _titleLabel.length - _titleDisplay.length))}`
|
|
18420
|
-
) +
|
|
18751
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18421
18752
|
);
|
|
18422
18753
|
const _riskLevel = this.formatRiskLevelSimple(_request.riskAssessment);
|
|
18423
18754
|
const _approvalsCount = _riskLevel === "HIGH" || _riskLevel === "CRITICAL" ? "2" : "1";
|
|
@@ -18425,37 +18756,37 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18425
18756
|
const _levelLabel = ` ${_labels.level}:`;
|
|
18426
18757
|
const _levelDisplay = `${_riskLevel} ${_approvalsText}`;
|
|
18427
18758
|
console.log(
|
|
18428
|
-
|
|
18759
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18429
18760
|
`${_levelLabel} ${_levelDisplay}${" ".repeat(Math.max(0, 42 - _levelLabel.length - _levelDisplay.length))}`
|
|
18430
|
-
) +
|
|
18761
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18431
18762
|
);
|
|
18432
18763
|
const _impact = _request.estimatedTime || "p95 latency -20%";
|
|
18433
18764
|
const _impactLabel = ` ${_labels._impact}:`;
|
|
18434
18765
|
console.log(
|
|
18435
|
-
|
|
18766
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18436
18767
|
`${_impactLabel} ${_impact}${" ".repeat(Math.max(0, 42 - _impactLabel.length - _impact.length))}`
|
|
18437
|
-
) +
|
|
18768
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18438
18769
|
);
|
|
18439
18770
|
const _approversLabel = ` ${_labels.approvers}:`;
|
|
18440
18771
|
const _approversStatus = "[x] Lead [ ] QA";
|
|
18441
18772
|
console.log(
|
|
18442
|
-
|
|
18773
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18443
18774
|
`${_approversLabel} ${_approversStatus}${" ".repeat(Math.max(0, 42 - _approversLabel.length - _approversStatus.length))}`
|
|
18444
|
-
) +
|
|
18775
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18445
18776
|
);
|
|
18446
18777
|
const _deadline = new Date(Date.now() + 30 * 60 * 1e3);
|
|
18447
18778
|
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
18779
|
const _deadlineLabel = ` ${_labels._deadline}:`;
|
|
18449
18780
|
console.log(
|
|
18450
|
-
|
|
18781
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18451
18782
|
`${_deadlineLabel} ${_timeStr}${" ".repeat(Math.max(0, 42 - _deadlineLabel.length - _timeStr.length))}`
|
|
18452
|
-
) +
|
|
18783
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18453
18784
|
);
|
|
18454
|
-
console.log(
|
|
18785
|
+
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
18786
|
console.log(
|
|
18456
|
-
|
|
18787
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18457
18788
|
` ${_labels.actions}:${" ".repeat(Math.max(0, 42 - _labels.actions.length))}`
|
|
18458
|
-
) +
|
|
18789
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18459
18790
|
);
|
|
18460
18791
|
this.menuOptions.forEach((option, _index) => {
|
|
18461
18792
|
const _isSelected = _index === this.selectedIndex;
|
|
@@ -18466,32 +18797,32 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18466
18797
|
switch (option) {
|
|
18467
18798
|
case "approve":
|
|
18468
18799
|
label = _labels.approve;
|
|
18469
|
-
color =
|
|
18800
|
+
color = import_chalk6.default.green;
|
|
18470
18801
|
break;
|
|
18471
18802
|
case "reject":
|
|
18472
18803
|
label = _labels.reject;
|
|
18473
|
-
color =
|
|
18804
|
+
color = import_chalk6.default.red;
|
|
18474
18805
|
break;
|
|
18475
18806
|
case "cancel":
|
|
18476
18807
|
label = _labels.cancel;
|
|
18477
|
-
color =
|
|
18808
|
+
color = import_chalk6.default.yellow;
|
|
18478
18809
|
break;
|
|
18479
18810
|
}
|
|
18480
18811
|
const _optionText = `${_prefix}[${_key}] ${label}`;
|
|
18481
18812
|
const _colorFunc = _isSelected ? color.bold : color;
|
|
18482
18813
|
console.log(
|
|
18483
|
-
|
|
18814
|
+
import_chalk6.default.gray("\u2502") + _colorFunc(
|
|
18484
18815
|
`${_optionText}${" ".repeat(Math.max(0, 43 - _optionText.length))}`
|
|
18485
|
-
) +
|
|
18816
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18486
18817
|
);
|
|
18487
18818
|
});
|
|
18488
|
-
console.log(
|
|
18819
|
+
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
18820
|
console.log(
|
|
18490
|
-
|
|
18821
|
+
import_chalk6.default.gray("\u2502") + import_chalk6.default.white(
|
|
18491
18822
|
` ${_labels.moveInstruction}${" ".repeat(Math.max(0, 43 - _labels.moveInstruction.length))}`
|
|
18492
|
-
) +
|
|
18823
|
+
) + import_chalk6.default.gray("\u2502")
|
|
18493
18824
|
);
|
|
18494
|
-
console.log(
|
|
18825
|
+
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
18826
|
console.log("");
|
|
18496
18827
|
}
|
|
18497
18828
|
/**
|
|
@@ -18507,13 +18838,13 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18507
18838
|
};
|
|
18508
18839
|
const _formatted = keyMap[_key] || _key;
|
|
18509
18840
|
const colorMap = {
|
|
18510
|
-
"shift+tab":
|
|
18511
|
-
"ctrl+y":
|
|
18512
|
-
"ctrl+n":
|
|
18513
|
-
"ctrl+t":
|
|
18514
|
-
"ctrl+r":
|
|
18841
|
+
"shift+tab": import_chalk6.default.bgGreen.black.bold,
|
|
18842
|
+
"ctrl+y": import_chalk6.default.bgBlue.white.bold,
|
|
18843
|
+
"ctrl+n": import_chalk6.default.bgRed.white.bold,
|
|
18844
|
+
"ctrl+t": import_chalk6.default.bgMagenta.white.bold,
|
|
18845
|
+
"ctrl+r": import_chalk6.default.bgYellow.black.bold
|
|
18515
18846
|
};
|
|
18516
|
-
const _colorFunc = colorMap[_key] ||
|
|
18847
|
+
const _colorFunc = colorMap[_key] || import_chalk6.default.bgCyan.black.bold;
|
|
18517
18848
|
return _colorFunc(` ${_formatted} `);
|
|
18518
18849
|
}
|
|
18519
18850
|
/**
|
|
@@ -18522,15 +18853,15 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18522
18853
|
formatRiskLevel(risk) {
|
|
18523
18854
|
switch (risk.toLowerCase()) {
|
|
18524
18855
|
case "critical":
|
|
18525
|
-
return
|
|
18856
|
+
return import_chalk6.default.red.bold("CRITICAL");
|
|
18526
18857
|
case "high":
|
|
18527
|
-
return
|
|
18858
|
+
return import_chalk6.default.red("HIGH");
|
|
18528
18859
|
case "medium":
|
|
18529
|
-
return
|
|
18860
|
+
return import_chalk6.default.yellow("MEDIUM");
|
|
18530
18861
|
case "low":
|
|
18531
|
-
return
|
|
18862
|
+
return import_chalk6.default.green("LOW");
|
|
18532
18863
|
default:
|
|
18533
|
-
return
|
|
18864
|
+
return import_chalk6.default.white(risk);
|
|
18534
18865
|
}
|
|
18535
18866
|
}
|
|
18536
18867
|
/**
|
|
@@ -18600,7 +18931,7 @@ var init_QuickApprovalInterface = __esm({
|
|
|
18600
18931
|
}
|
|
18601
18932
|
if (_key === "") {
|
|
18602
18933
|
console.log(`
|
|
18603
|
-
${
|
|
18934
|
+
${import_chalk6.default.red("Approval cancelled by user")}`);
|
|
18604
18935
|
this.emit("approval-cancelled", this.currentRequest.id);
|
|
18605
18936
|
return;
|
|
18606
18937
|
}
|
|
@@ -18657,20 +18988,20 @@ ${import_chalk5.default.red("Approval cancelled by user")}`);
|
|
|
18657
18988
|
}
|
|
18658
18989
|
console.clear();
|
|
18659
18990
|
console.log(`
|
|
18660
|
-
${
|
|
18991
|
+
${import_chalk6.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18661
18992
|
console.log(
|
|
18662
|
-
|
|
18993
|
+
import_chalk6.default.bgGreen.black.bold("\u2502") + import_chalk6.default.bgGreen.black.bold(
|
|
18663
18994
|
` \u2713 CHOICE SELECTED / \u9078\u629E\u5B8C\u4E86:${" ".repeat(47)}`
|
|
18664
|
-
) +
|
|
18995
|
+
) + import_chalk6.default.bgGreen.black.bold("\u2502")
|
|
18665
18996
|
);
|
|
18666
|
-
console.log(
|
|
18997
|
+
console.log(import_chalk6.default.bgGreen.black.bold(`\u251C${"\u2500".repeat(78)}\u2524`));
|
|
18667
18998
|
const _choiceText = `${_choice.label} (${_choice.labelJa})`;
|
|
18668
18999
|
const _padding = " ".repeat(Math.max(0, 76 - _choiceText.length));
|
|
18669
19000
|
console.log(
|
|
18670
|
-
|
|
19001
|
+
import_chalk6.default.bgGreen.black.bold("\u2502") + import_chalk6.default.bgGreen.black.bold(` ${_choiceText}${_padding}`) + import_chalk6.default.bgGreen.black.bold("\u2502")
|
|
18671
19002
|
);
|
|
18672
|
-
console.log(
|
|
18673
|
-
console.log(
|
|
19003
|
+
console.log(import_chalk6.default.bgGreen.black.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
19004
|
+
console.log(import_chalk6.default.yellow("\n\u{1F504} Processing your approval decision..."));
|
|
18674
19005
|
try {
|
|
18675
19006
|
const _response = await this.approvalEngine.processApprovalResponse(
|
|
18676
19007
|
this.currentRequest.id,
|
|
@@ -18680,30 +19011,30 @@ ${import_chalk5.default.bgGreen.black.bold(`\u250C${"\u2500".repeat(78)}\u2510`)
|
|
|
18680
19011
|
);
|
|
18681
19012
|
response.quickDecision = true;
|
|
18682
19013
|
console.log(`
|
|
18683
|
-
${
|
|
19014
|
+
${import_chalk6.default.bgGreen.black(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18684
19015
|
console.log(
|
|
18685
|
-
|
|
19016
|
+
import_chalk6.default.bgGreen.black("\u2502") + import_chalk6.default.bgGreen.black(
|
|
18686
19017
|
` \u{1F389} APPROVAL PROCESSED SUCCESSFULLY / \u627F\u8A8D\u51E6\u7406\u5B8C\u4E86!${" ".repeat(32)}`
|
|
18687
|
-
) +
|
|
19018
|
+
) + import_chalk6.default.bgGreen.black("\u2502")
|
|
18688
19019
|
);
|
|
18689
|
-
console.log(
|
|
19020
|
+
console.log(import_chalk6.default.bgGreen.black(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
18690
19021
|
if (_choice.trustLevel) {
|
|
18691
19022
|
console.log(
|
|
18692
|
-
|
|
19023
|
+
import_chalk6.default.blue(`
|
|
18693
19024
|
\u2728 Trust level updated: ${_choice.trustLevel}`)
|
|
18694
19025
|
);
|
|
18695
19026
|
}
|
|
18696
19027
|
this.emit("approval-_response", _response);
|
|
18697
19028
|
} catch (_error) {
|
|
18698
19029
|
console.log(`
|
|
18699
|
-
${
|
|
19030
|
+
${import_chalk6.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`);
|
|
18700
19031
|
console.log(
|
|
18701
|
-
|
|
19032
|
+
import_chalk6.default.bgRed.white.bold("\u2502") + import_chalk6.default.bgRed.white.bold(
|
|
18702
19033
|
` \u274C ERROR PROCESSING APPROVAL / \u627F\u8A8D\u51E6\u7406\u30A8\u30E9\u30FC${" ".repeat(35)}`
|
|
18703
|
-
) +
|
|
19034
|
+
) + import_chalk6.default.bgRed.white.bold("\u2502")
|
|
18704
19035
|
);
|
|
18705
|
-
console.log(
|
|
18706
|
-
console._error(
|
|
19036
|
+
console.log(import_chalk6.default.bgRed.white.bold(`\u2514${"\u2500".repeat(78)}\u2518`));
|
|
19037
|
+
console._error(import_chalk6.default.red("\nError details:"), _error);
|
|
18707
19038
|
this.emit("approval-_error", _error);
|
|
18708
19039
|
}
|
|
18709
19040
|
}
|
|
@@ -18717,7 +19048,7 @@ ${import_chalk5.default.bgRed.white.bold(`\u250C${"\u2500".repeat(78)}\u2510`)}`
|
|
|
18717
19048
|
timeoutId = setTimeout(() => {
|
|
18718
19049
|
console.log(
|
|
18719
19050
|
`
|
|
18720
|
-
${
|
|
19051
|
+
${import_chalk6.default.yellow("\u23F0 Approval request timed out - auto-approving...")}`
|
|
18721
19052
|
);
|
|
18722
19053
|
this.handleTimeoutResponse(resolve);
|
|
18723
19054
|
}, timeout);
|
|
@@ -18761,7 +19092,7 @@ ${import_chalk5.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
18761
19092
|
response.quickDecision = true;
|
|
18762
19093
|
resolve(_response);
|
|
18763
19094
|
} catch (_error) {
|
|
18764
|
-
console._error(
|
|
19095
|
+
console._error(import_chalk6.default.red("Error processing timeout approval:"), _error);
|
|
18765
19096
|
}
|
|
18766
19097
|
}
|
|
18767
19098
|
/**
|
|
@@ -18776,11 +19107,11 @@ ${import_chalk5.default.yellow("\u23F0 Approval request timed out - auto-approvi
|
|
|
18776
19107
|
);
|
|
18777
19108
|
this.approvalEngine.on("trust-level-changed", (event) => {
|
|
18778
19109
|
console.log(
|
|
18779
|
-
|
|
19110
|
+
import_chalk6.default.blue(
|
|
18780
19111
|
`\u2728 Trust level changed: ${event.oldLevel} \u2192 ${event.newLevel}`
|
|
18781
19112
|
)
|
|
18782
19113
|
);
|
|
18783
|
-
console.log(
|
|
19114
|
+
console.log(import_chalk6.default.gray(`Reason: ${event.reason}`));
|
|
18784
19115
|
});
|
|
18785
19116
|
}
|
|
18786
19117
|
/**
|
|
@@ -19569,22 +19900,22 @@ function formatProgressBar(current, total, width = 20) {
|
|
|
19569
19900
|
}
|
|
19570
19901
|
function formatError(message, code) {
|
|
19571
19902
|
const prefix = code ? `[${code}] ` : "";
|
|
19572
|
-
return
|
|
19903
|
+
return import_chalk7.default.red(`\u274C ${prefix}${message}`);
|
|
19573
19904
|
}
|
|
19574
19905
|
function formatSuccess(message) {
|
|
19575
|
-
return
|
|
19906
|
+
return import_chalk7.default.green(`\u2705 ${message}`);
|
|
19576
19907
|
}
|
|
19577
19908
|
function formatWarning(message) {
|
|
19578
|
-
return
|
|
19909
|
+
return import_chalk7.default.yellow(`\u26A0\uFE0F ${message}`);
|
|
19579
19910
|
}
|
|
19580
19911
|
function formatInfo(message) {
|
|
19581
|
-
return
|
|
19912
|
+
return import_chalk7.default.blue(`\u2139\uFE0F ${message}`);
|
|
19582
19913
|
}
|
|
19583
19914
|
function formatTable(headers, rows, options = {}) {
|
|
19584
19915
|
const {
|
|
19585
19916
|
columnWidths = headers.map(() => 20),
|
|
19586
19917
|
separator = " | ",
|
|
19587
|
-
headerColor =
|
|
19918
|
+
headerColor = import_chalk7.default.cyan.bold
|
|
19588
19919
|
} = options;
|
|
19589
19920
|
const headerRow = headers.map((h2, i2) => headerColor(h2.padEnd(columnWidths[i2]))).join(separator);
|
|
19590
19921
|
const separatorLine = columnWidths.map((w) => "-".repeat(w)).join(separator);
|
|
@@ -19596,8 +19927,8 @@ function formatTable(headers, rows, options = {}) {
|
|
|
19596
19927
|
function formatKeyValue(data2, options = {}) {
|
|
19597
19928
|
const {
|
|
19598
19929
|
keyWidth = 20,
|
|
19599
|
-
keyColor =
|
|
19600
|
-
valueColor =
|
|
19930
|
+
keyColor = import_chalk7.default.gray,
|
|
19931
|
+
valueColor = import_chalk7.default.white,
|
|
19601
19932
|
separator = ": "
|
|
19602
19933
|
} = options;
|
|
19603
19934
|
return Object.entries(data2).map(([key2, value]) => {
|
|
@@ -19619,19 +19950,19 @@ function formatTimestamp(date, format = "short") {
|
|
|
19619
19950
|
return d.toLocaleTimeString();
|
|
19620
19951
|
}
|
|
19621
19952
|
}
|
|
19622
|
-
var
|
|
19953
|
+
var import_chalk7;
|
|
19623
19954
|
var init_FormatUtils = __esm({
|
|
19624
19955
|
"src/services/interactive-session/display/FormatUtils.ts"() {
|
|
19625
|
-
|
|
19956
|
+
import_chalk7 = __toESM(require("chalk"), 1);
|
|
19626
19957
|
}
|
|
19627
19958
|
});
|
|
19628
19959
|
|
|
19629
19960
|
// src/services/interactive-session/display/DisplayManager.ts
|
|
19630
|
-
var
|
|
19961
|
+
var os2, import_chalk8, DisplayManager;
|
|
19631
19962
|
var init_DisplayManager = __esm({
|
|
19632
19963
|
"src/services/interactive-session/display/DisplayManager.ts"() {
|
|
19633
|
-
|
|
19634
|
-
|
|
19964
|
+
os2 = __toESM(require("os"), 1);
|
|
19965
|
+
import_chalk8 = __toESM(require("chalk"), 1);
|
|
19635
19966
|
init_SpinnerManager();
|
|
19636
19967
|
init_FormatUtils();
|
|
19637
19968
|
DisplayManager = class {
|
|
@@ -19643,7 +19974,7 @@ var init_DisplayManager = __esm({
|
|
|
19643
19974
|
cursorState = { visible: true };
|
|
19644
19975
|
constructor(options = {}) {
|
|
19645
19976
|
this.spinnerManager = SpinnerManager.getInstance();
|
|
19646
|
-
this.platform =
|
|
19977
|
+
this.platform = os2.platform();
|
|
19647
19978
|
this.isWindows = this.platform === "win32";
|
|
19648
19979
|
this.isTTY = process.stdout.isTTY || false;
|
|
19649
19980
|
this.options = {
|
|
@@ -19653,7 +19984,7 @@ var init_DisplayManager = __esm({
|
|
|
19653
19984
|
theme: options.theme ?? "auto"
|
|
19654
19985
|
};
|
|
19655
19986
|
if (!this.options.enableColors) {
|
|
19656
|
-
|
|
19987
|
+
import_chalk8.default.level = 0;
|
|
19657
19988
|
}
|
|
19658
19989
|
this.setupCleanupHandlers();
|
|
19659
19990
|
}
|
|
@@ -19770,7 +20101,7 @@ var init_DisplayManager = __esm({
|
|
|
19770
20101
|
const {
|
|
19771
20102
|
padding = 1,
|
|
19772
20103
|
borderStyle = "single",
|
|
19773
|
-
borderColor =
|
|
20104
|
+
borderColor = import_chalk8.default.gray
|
|
19774
20105
|
} = options;
|
|
19775
20106
|
const lines = content.split("\n");
|
|
19776
20107
|
const maxLength = Math.max(...lines.map((l) => l.length));
|
|
@@ -19828,7 +20159,7 @@ var init_DisplayManager = __esm({
|
|
|
19828
20159
|
*/
|
|
19829
20160
|
startSpinner(text) {
|
|
19830
20161
|
if (!this.options.enableAnimations) {
|
|
19831
|
-
this.writeLine(
|
|
20162
|
+
this.writeLine(import_chalk8.default.gray(`\u2299 ${text || "Processing..."}`));
|
|
19832
20163
|
return "no-animation";
|
|
19833
20164
|
}
|
|
19834
20165
|
return this.spinnerManager.start({ text });
|
|
@@ -19921,10 +20252,10 @@ var init_DisplayManager = __esm({
|
|
|
19921
20252
|
});
|
|
19922
20253
|
|
|
19923
20254
|
// src/services/interactive-session/display/StatusDisplay.ts
|
|
19924
|
-
var
|
|
20255
|
+
var import_chalk9, StatusDisplay;
|
|
19925
20256
|
var init_StatusDisplay = __esm({
|
|
19926
20257
|
"src/services/interactive-session/display/StatusDisplay.ts"() {
|
|
19927
|
-
|
|
20258
|
+
import_chalk9 = __toESM(require("chalk"), 1);
|
|
19928
20259
|
init_FormatUtils();
|
|
19929
20260
|
StatusDisplay = class {
|
|
19930
20261
|
/**
|
|
@@ -19935,11 +20266,11 @@ var init_StatusDisplay = __esm({
|
|
|
19935
20266
|
*/
|
|
19936
20267
|
static renderSystemStatus(status, detailed = false) {
|
|
19937
20268
|
const lines = [];
|
|
19938
|
-
lines.push(
|
|
20269
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F4CA} System Status"));
|
|
19939
20270
|
lines.push("");
|
|
19940
20271
|
const statusIcon = status.operational ? "\u2705" : "\u274C";
|
|
19941
20272
|
const statusText = status.operational ? "Operational" : "Issues Detected";
|
|
19942
|
-
const statusColor = status.operational ?
|
|
20273
|
+
const statusColor = status.operational ? import_chalk9.default.green : import_chalk9.default.red;
|
|
19943
20274
|
lines.push(`${statusIcon} Status: ${statusColor(statusText)}`);
|
|
19944
20275
|
lines.push(
|
|
19945
20276
|
`\u23F1\uFE0F Uptime: ${formatDuration(status.uptime * 1e3)}`
|
|
@@ -19960,15 +20291,15 @@ var init_StatusDisplay = __esm({
|
|
|
19960
20291
|
if (status.errors > 0 || status.warnings > 0) {
|
|
19961
20292
|
lines.push("");
|
|
19962
20293
|
if (status.errors > 0) {
|
|
19963
|
-
lines.push(
|
|
20294
|
+
lines.push(import_chalk9.default.red(`\u274C Errors: ${status.errors}`));
|
|
19964
20295
|
}
|
|
19965
20296
|
if (status.warnings > 0) {
|
|
19966
|
-
lines.push(
|
|
20297
|
+
lines.push(import_chalk9.default.yellow(`\u26A0\uFE0F Warnings: ${status.warnings}`));
|
|
19967
20298
|
}
|
|
19968
20299
|
}
|
|
19969
20300
|
if (detailed) {
|
|
19970
20301
|
lines.push("");
|
|
19971
|
-
lines.push(
|
|
20302
|
+
lines.push(import_chalk9.default.gray("Detailed Information:"));
|
|
19972
20303
|
const details = formatKeyValue(
|
|
19973
20304
|
{
|
|
19974
20305
|
"Process ID": process.pid,
|
|
@@ -19978,8 +20309,8 @@ var init_StatusDisplay = __esm({
|
|
|
19978
20309
|
"Working Directory": process.cwd()
|
|
19979
20310
|
},
|
|
19980
20311
|
{
|
|
19981
|
-
keyColor:
|
|
19982
|
-
valueColor:
|
|
20312
|
+
keyColor: import_chalk9.default.gray,
|
|
20313
|
+
valueColor: import_chalk9.default.white
|
|
19983
20314
|
}
|
|
19984
20315
|
);
|
|
19985
20316
|
lines.push(details);
|
|
@@ -19993,9 +20324,9 @@ var init_StatusDisplay = __esm({
|
|
|
19993
20324
|
*/
|
|
19994
20325
|
static renderMemoryStatus(status) {
|
|
19995
20326
|
const lines = [];
|
|
19996
|
-
lines.push(
|
|
20327
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F9E0} Memory Status"));
|
|
19997
20328
|
lines.push("");
|
|
19998
|
-
lines.push(
|
|
20329
|
+
lines.push(import_chalk9.default.yellow("System 1 (Fast):"));
|
|
19999
20330
|
const s1NodeBar = formatProgressBar(
|
|
20000
20331
|
status.system1.nodes,
|
|
20001
20332
|
status.system1.maxNodes,
|
|
@@ -20013,7 +20344,7 @@ var init_StatusDisplay = __esm({
|
|
|
20013
20344
|
` \u2022 Tokens: ${status.system1.tokens}/${status.system1.maxTokens} ${s1TokenBar}`
|
|
20014
20345
|
);
|
|
20015
20346
|
lines.push("");
|
|
20016
|
-
lines.push(
|
|
20347
|
+
lines.push(import_chalk9.default.blue("System 2 (Deep):"));
|
|
20017
20348
|
const s2TraceBar = formatProgressBar(
|
|
20018
20349
|
status.system2.traces,
|
|
20019
20350
|
status.system2.maxTraces,
|
|
@@ -20031,7 +20362,7 @@ var init_StatusDisplay = __esm({
|
|
|
20031
20362
|
` \u2022 Tokens: ${status.system2.tokens}/${status.system2.maxTokens} ${s2TokenBar}`
|
|
20032
20363
|
);
|
|
20033
20364
|
lines.push("");
|
|
20034
|
-
lines.push(
|
|
20365
|
+
lines.push(import_chalk9.default.green("Total:"));
|
|
20035
20366
|
const totalBar = formatProgressBar(
|
|
20036
20367
|
status.total.tokens,
|
|
20037
20368
|
status.total.maxTokens,
|
|
@@ -20040,7 +20371,7 @@ var init_StatusDisplay = __esm({
|
|
|
20040
20371
|
lines.push(` \u2022 Tokens: ${status.total.tokens}/${status.total.maxTokens}`);
|
|
20041
20372
|
lines.push(` \u2022 Usage: ${totalBar}`);
|
|
20042
20373
|
const usage = status.total.tokens / status.total.maxTokens * 100;
|
|
20043
|
-
const usageColor = usage > 80 ?
|
|
20374
|
+
const usageColor = usage > 80 ? import_chalk9.default.red : usage > 60 ? import_chalk9.default.yellow : import_chalk9.default.green;
|
|
20044
20375
|
lines.push(
|
|
20045
20376
|
` \u2022 ${usageColor(formatPercentage(usage / 100, 1))} utilized`
|
|
20046
20377
|
);
|
|
@@ -20053,9 +20384,9 @@ var init_StatusDisplay = __esm({
|
|
|
20053
20384
|
*/
|
|
20054
20385
|
static renderModelStatus(status) {
|
|
20055
20386
|
const lines = [];
|
|
20056
|
-
lines.push(
|
|
20387
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F916} Model Status"));
|
|
20057
20388
|
lines.push("");
|
|
20058
|
-
lines.push(
|
|
20389
|
+
lines.push(import_chalk9.default.green(`Current: ${import_chalk9.default.bold(status.current)}`));
|
|
20059
20390
|
lines.push("");
|
|
20060
20391
|
lines.push("Available Models:");
|
|
20061
20392
|
const headers = ["Model", "Provider", "Status", "Capabilities"];
|
|
@@ -20067,7 +20398,7 @@ var init_StatusDisplay = __esm({
|
|
|
20067
20398
|
const table = formatTable(headers, rows, {
|
|
20068
20399
|
columnWidths: [20, 15, 8, 30],
|
|
20069
20400
|
separator: " \u2502 ",
|
|
20070
|
-
headerColor:
|
|
20401
|
+
headerColor: import_chalk9.default.gray
|
|
20071
20402
|
});
|
|
20072
20403
|
lines.push(table);
|
|
20073
20404
|
return lines.join("\n");
|
|
@@ -20079,19 +20410,19 @@ var init_StatusDisplay = __esm({
|
|
|
20079
20410
|
*/
|
|
20080
20411
|
static renderHealthChecks(checks) {
|
|
20081
20412
|
const lines = [];
|
|
20082
|
-
lines.push(
|
|
20413
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F3E5} Health Checks"));
|
|
20083
20414
|
lines.push("");
|
|
20084
20415
|
for (const check of checks) {
|
|
20085
20416
|
const icon = check.status === "ok" ? "\u2705" : check.status === "warning" ? "\u26A0\uFE0F" : "\u274C";
|
|
20086
|
-
const statusColor = check.status === "ok" ?
|
|
20417
|
+
const statusColor = check.status === "ok" ? import_chalk9.default.green : check.status === "warning" ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20087
20418
|
let line = `${icon} ${check.name.padEnd(25)} ${statusColor(check.status.toUpperCase())}`;
|
|
20088
20419
|
if (check.latency !== void 0) {
|
|
20089
|
-
const latencyColor = check.latency < 100 ?
|
|
20420
|
+
const latencyColor = check.latency < 100 ? import_chalk9.default.green : check.latency < 500 ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20090
20421
|
line += ` ${latencyColor(`(${check.latency}ms)`)}`;
|
|
20091
20422
|
}
|
|
20092
20423
|
lines.push(line);
|
|
20093
20424
|
if (check.message) {
|
|
20094
|
-
lines.push(
|
|
20425
|
+
lines.push(import_chalk9.default.gray(` ${check.message}`));
|
|
20095
20426
|
}
|
|
20096
20427
|
}
|
|
20097
20428
|
lines.push("");
|
|
@@ -20100,16 +20431,16 @@ var init_StatusDisplay = __esm({
|
|
|
20100
20431
|
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
20101
20432
|
if (errorCount > 0) {
|
|
20102
20433
|
lines.push(
|
|
20103
|
-
|
|
20434
|
+
import_chalk9.default.red(
|
|
20104
20435
|
`\u26A0\uFE0F System has ${errorCount} error(s) - intervention required`
|
|
20105
20436
|
)
|
|
20106
20437
|
);
|
|
20107
20438
|
} else if (warningCount > 0) {
|
|
20108
20439
|
lines.push(
|
|
20109
|
-
|
|
20440
|
+
import_chalk9.default.yellow(`\u26A0\uFE0F System operational with ${warningCount} warning(s)`)
|
|
20110
20441
|
);
|
|
20111
20442
|
} else {
|
|
20112
|
-
lines.push(
|
|
20443
|
+
lines.push(import_chalk9.default.green("\u2705 All systems operational"));
|
|
20113
20444
|
}
|
|
20114
20445
|
return lines.join("\n");
|
|
20115
20446
|
}
|
|
@@ -20120,7 +20451,7 @@ var init_StatusDisplay = __esm({
|
|
|
20120
20451
|
*/
|
|
20121
20452
|
static renderSessionStats(stats) {
|
|
20122
20453
|
const lines = [];
|
|
20123
|
-
lines.push(
|
|
20454
|
+
lines.push(import_chalk9.default.cyan.bold("\u{1F4C8} Session Statistics"));
|
|
20124
20455
|
lines.push("");
|
|
20125
20456
|
const data2 = formatKeyValue(
|
|
20126
20457
|
{
|
|
@@ -20133,14 +20464,14 @@ var init_StatusDisplay = __esm({
|
|
|
20133
20464
|
},
|
|
20134
20465
|
{
|
|
20135
20466
|
keyWidth: 20,
|
|
20136
|
-
keyColor:
|
|
20137
|
-
valueColor:
|
|
20467
|
+
keyColor: import_chalk9.default.gray,
|
|
20468
|
+
valueColor: import_chalk9.default.white
|
|
20138
20469
|
}
|
|
20139
20470
|
);
|
|
20140
20471
|
lines.push(data2);
|
|
20141
20472
|
lines.push("");
|
|
20142
20473
|
const performance3 = stats.avgResponseTime < 100 ? "Excellent" : stats.avgResponseTime < 500 ? "Good" : stats.avgResponseTime < 1e3 ? "Fair" : "Poor";
|
|
20143
|
-
const perfColor = performance3 === "Excellent" ?
|
|
20474
|
+
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
20475
|
lines.push(`Performance: ${perfColor(performance3)}`);
|
|
20145
20476
|
return lines.join("\n");
|
|
20146
20477
|
}
|
|
@@ -20152,22 +20483,22 @@ var init_StatusDisplay = __esm({
|
|
|
20152
20483
|
static renderStatusBar(data2) {
|
|
20153
20484
|
const segments = [];
|
|
20154
20485
|
if (data2.mode) {
|
|
20155
|
-
segments.push(
|
|
20486
|
+
segments.push(import_chalk9.default.cyan(`[${data2.mode}]`));
|
|
20156
20487
|
}
|
|
20157
20488
|
if (data2.model) {
|
|
20158
|
-
segments.push(
|
|
20489
|
+
segments.push(import_chalk9.default.blue(`\u{1F916} ${data2.model}`));
|
|
20159
20490
|
}
|
|
20160
20491
|
if (data2.memory !== void 0) {
|
|
20161
|
-
const memoryColor = data2.memory > 80 ?
|
|
20492
|
+
const memoryColor = data2.memory > 80 ? import_chalk9.default.red : data2.memory > 60 ? import_chalk9.default.yellow : import_chalk9.default.green;
|
|
20162
20493
|
segments.push(memoryColor(`\u{1F4BE} ${data2.memory}%`));
|
|
20163
20494
|
}
|
|
20164
20495
|
if (data2.latency !== void 0) {
|
|
20165
|
-
const latencyColor = data2.latency < 100 ?
|
|
20496
|
+
const latencyColor = data2.latency < 100 ? import_chalk9.default.green : data2.latency < 500 ? import_chalk9.default.yellow : import_chalk9.default.red;
|
|
20166
20497
|
segments.push(latencyColor(`\u26A1 ${data2.latency}ms`));
|
|
20167
20498
|
}
|
|
20168
20499
|
if (data2.time) {
|
|
20169
20500
|
segments.push(
|
|
20170
|
-
|
|
20501
|
+
import_chalk9.default.gray(formatTimestamp(data2.time, "short"))
|
|
20171
20502
|
);
|
|
20172
20503
|
}
|
|
20173
20504
|
return segments.join(" \u2502 ");
|
|
@@ -20177,10 +20508,10 @@ var init_StatusDisplay = __esm({
|
|
|
20177
20508
|
});
|
|
20178
20509
|
|
|
20179
20510
|
// src/services/interactive-session/handlers/CoreHandlers.ts
|
|
20180
|
-
var
|
|
20511
|
+
var import_chalk10, import_perf_hooks, HelpHandler, ClearHandler, ExitHandler, VersionHandler, HistoryHandler, CoreHandlers;
|
|
20181
20512
|
var init_CoreHandlers = __esm({
|
|
20182
20513
|
"src/services/interactive-session/handlers/CoreHandlers.ts"() {
|
|
20183
|
-
|
|
20514
|
+
import_chalk10 = __toESM(require("chalk"), 1);
|
|
20184
20515
|
import_perf_hooks = require("perf_hooks");
|
|
20185
20516
|
HelpHandler = class {
|
|
20186
20517
|
registry;
|
|
@@ -20190,7 +20521,7 @@ var init_CoreHandlers = __esm({
|
|
|
20190
20521
|
async execute(args) {
|
|
20191
20522
|
const startTime = import_perf_hooks.performance.now();
|
|
20192
20523
|
const commands = this.registry.getCommands();
|
|
20193
|
-
let message =
|
|
20524
|
+
let message = import_chalk10.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
|
|
20194
20525
|
|
|
20195
20526
|
`);
|
|
20196
20527
|
const categories = {
|
|
@@ -20201,17 +20532,17 @@ var init_CoreHandlers = __esm({
|
|
|
20201
20532
|
system: ["/status", "/config", "/logs", "/approve"]
|
|
20202
20533
|
};
|
|
20203
20534
|
for (const [category, cmds] of Object.entries(categories)) {
|
|
20204
|
-
message +=
|
|
20535
|
+
message += import_chalk10.default.yellow(`
|
|
20205
20536
|
${category.toUpperCase()}:
|
|
20206
20537
|
`);
|
|
20207
20538
|
for (const cmd of cmds) {
|
|
20208
20539
|
if (commands.includes(cmd)) {
|
|
20209
|
-
message += ` ${
|
|
20540
|
+
message += ` ${import_chalk10.default.green(cmd.padEnd(15))} - ${this.getCommandDescription(cmd)}
|
|
20210
20541
|
`;
|
|
20211
20542
|
}
|
|
20212
20543
|
}
|
|
20213
20544
|
}
|
|
20214
|
-
message +=
|
|
20545
|
+
message += import_chalk10.default.gray(
|
|
20215
20546
|
`
|
|
20216
20547
|
Type '/help <command>' for detailed information about a specific command.`
|
|
20217
20548
|
);
|
|
@@ -20259,7 +20590,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20259
20590
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20260
20591
|
return {
|
|
20261
20592
|
success: true,
|
|
20262
|
-
message:
|
|
20593
|
+
message: import_chalk10.default.gray("Terminal cleared."),
|
|
20263
20594
|
metadata: {
|
|
20264
20595
|
processingTime,
|
|
20265
20596
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -20270,7 +20601,7 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20270
20601
|
ExitHandler = class {
|
|
20271
20602
|
async execute(args) {
|
|
20272
20603
|
const startTime = import_perf_hooks.performance.now();
|
|
20273
|
-
const message =
|
|
20604
|
+
const message = import_chalk10.default.yellow("\u{1F44B} Goodbye! Thank you for using MARIA.\n");
|
|
20274
20605
|
process.emit("SIGTERM");
|
|
20275
20606
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20276
20607
|
return {
|
|
@@ -20294,23 +20625,23 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20294
20625
|
platform: process.platform,
|
|
20295
20626
|
arch: process.arch
|
|
20296
20627
|
};
|
|
20297
|
-
let message =
|
|
20298
|
-
message +=
|
|
20628
|
+
let message = import_chalk10.default.cyan("\u{1F680} MARIA System Information\n\n");
|
|
20629
|
+
message += import_chalk10.default.white(` Version: ${import_chalk10.default.green(packageInfo.version)}
|
|
20299
20630
|
`);
|
|
20300
|
-
message +=
|
|
20631
|
+
message += import_chalk10.default.white(` Package: ${import_chalk10.default.green(packageInfo.name)}
|
|
20301
20632
|
`);
|
|
20302
|
-
message +=
|
|
20633
|
+
message += import_chalk10.default.white(` Node: ${import_chalk10.default.green(packageInfo.node)}
|
|
20303
20634
|
`);
|
|
20304
|
-
message +=
|
|
20305
|
-
` Platform: ${
|
|
20635
|
+
message += import_chalk10.default.white(
|
|
20636
|
+
` Platform: ${import_chalk10.default.green(packageInfo.platform)}
|
|
20306
20637
|
`
|
|
20307
20638
|
);
|
|
20308
|
-
message +=
|
|
20639
|
+
message += import_chalk10.default.white(` Arch: ${import_chalk10.default.green(packageInfo.arch)}
|
|
20309
20640
|
`);
|
|
20310
|
-
message +=
|
|
20641
|
+
message += import_chalk10.default.gray(`
|
|
20311
20642
|
Build: Production
|
|
20312
20643
|
`);
|
|
20313
|
-
message +=
|
|
20644
|
+
message += import_chalk10.default.gray(` License: MIT
|
|
20314
20645
|
`);
|
|
20315
20646
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20316
20647
|
return {
|
|
@@ -20335,15 +20666,15 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20335
20666
|
this.history.push("/history");
|
|
20336
20667
|
}
|
|
20337
20668
|
const recent = this.history.slice(-limit);
|
|
20338
|
-
let message =
|
|
20669
|
+
let message = import_chalk10.default.cyan(`\u{1F4DC} Command History (last ${recent.length}):
|
|
20339
20670
|
|
|
20340
20671
|
`);
|
|
20341
20672
|
recent.forEach((cmd, index) => {
|
|
20342
20673
|
const num = this.history.length - recent.length + index + 1;
|
|
20343
|
-
message +=
|
|
20674
|
+
message += import_chalk10.default.gray(` ${num.toString().padStart(3)}: `) + import_chalk10.default.white(cmd) + "\n";
|
|
20344
20675
|
});
|
|
20345
20676
|
if (recent.length === 0) {
|
|
20346
|
-
message =
|
|
20677
|
+
message = import_chalk10.default.gray("No command history available.");
|
|
20347
20678
|
}
|
|
20348
20679
|
const processingTime = import_perf_hooks.performance.now() - startTime;
|
|
20349
20680
|
return {
|
|
@@ -20374,10 +20705,10 @@ Type '/help <command>' for detailed information about a specific command.`
|
|
|
20374
20705
|
});
|
|
20375
20706
|
|
|
20376
20707
|
// src/services/interactive-session/handlers/DevHandlers.ts
|
|
20377
|
-
var
|
|
20708
|
+
var import_chalk11, CodeHandler, TestHandler, ReviewHandler, BugHandler, DevHandlers;
|
|
20378
20709
|
var init_DevHandlers = __esm({
|
|
20379
20710
|
"src/services/interactive-session/handlers/DevHandlers.ts"() {
|
|
20380
|
-
|
|
20711
|
+
import_chalk11 = __toESM(require("chalk"), 1);
|
|
20381
20712
|
CodeHandler = class {
|
|
20382
20713
|
constructor(codeService) {
|
|
20383
20714
|
this.codeService = codeService;
|
|
@@ -20392,13 +20723,13 @@ var init_DevHandlers = __esm({
|
|
|
20392
20723
|
if (!prompt) {
|
|
20393
20724
|
return {
|
|
20394
20725
|
ok: false,
|
|
20395
|
-
message:
|
|
20726
|
+
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
20727
|
};
|
|
20397
20728
|
}
|
|
20398
20729
|
if (signal?.aborted) {
|
|
20399
20730
|
return {
|
|
20400
20731
|
ok: false,
|
|
20401
|
-
message:
|
|
20732
|
+
message: import_chalk11.default.yellow("Code generation canceled")
|
|
20402
20733
|
};
|
|
20403
20734
|
}
|
|
20404
20735
|
try {
|
|
@@ -20409,9 +20740,9 @@ var init_DevHandlers = __esm({
|
|
|
20409
20740
|
if (dryRun) {
|
|
20410
20741
|
return {
|
|
20411
20742
|
ok: true,
|
|
20412
|
-
message:
|
|
20413
|
-
`) +
|
|
20414
|
-
`) +
|
|
20743
|
+
message: import_chalk11.default.cyan("\u{1F50D} Dry run mode - would generate:\n") + import_chalk11.default.gray(`Language: ${language}
|
|
20744
|
+
`) + import_chalk11.default.gray(`Framework: ${framework || "none"}
|
|
20745
|
+
`) + import_chalk11.default.gray(`Prompt: ${cleanPrompt}`)
|
|
20415
20746
|
};
|
|
20416
20747
|
}
|
|
20417
20748
|
const generatedCode = `// Generated code for: ${cleanPrompt}
|
|
@@ -20423,7 +20754,7 @@ function generated() {
|
|
|
20423
20754
|
export { generated };`;
|
|
20424
20755
|
return {
|
|
20425
20756
|
ok: true,
|
|
20426
|
-
message:
|
|
20757
|
+
message: import_chalk11.default.green("\u2705 Code generated successfully:\n\n") + import_chalk11.default.gray("```" + language + "\n") + generatedCode + import_chalk11.default.gray("\n```"),
|
|
20427
20758
|
data: {
|
|
20428
20759
|
code: generatedCode,
|
|
20429
20760
|
language,
|
|
@@ -20436,7 +20767,7 @@ export { generated };`;
|
|
|
20436
20767
|
} catch (error2) {
|
|
20437
20768
|
return {
|
|
20438
20769
|
ok: false,
|
|
20439
|
-
message:
|
|
20770
|
+
message: import_chalk11.default.red(`Code generation failed: ${error2}`)
|
|
20440
20771
|
};
|
|
20441
20772
|
}
|
|
20442
20773
|
}
|
|
@@ -20450,7 +20781,7 @@ export { generated };`;
|
|
|
20450
20781
|
if (signal?.aborted) {
|
|
20451
20782
|
return {
|
|
20452
20783
|
ok: false,
|
|
20453
|
-
message:
|
|
20784
|
+
message: import_chalk11.default.yellow("Test operation canceled")
|
|
20454
20785
|
};
|
|
20455
20786
|
}
|
|
20456
20787
|
const subcommand = args[0] || "run";
|
|
@@ -20466,8 +20797,8 @@ export { generated };`;
|
|
|
20466
20797
|
default:
|
|
20467
20798
|
return {
|
|
20468
20799
|
ok: false,
|
|
20469
|
-
message:
|
|
20470
|
-
`) +
|
|
20800
|
+
message: import_chalk11.default.red(`Unknown test subcommand: ${subcommand}
|
|
20801
|
+
`) + import_chalk11.default.gray("Available: generate, run, coverage")
|
|
20471
20802
|
};
|
|
20472
20803
|
}
|
|
20473
20804
|
}
|
|
@@ -20475,7 +20806,7 @@ export { generated };`;
|
|
|
20475
20806
|
if (!target) {
|
|
20476
20807
|
return {
|
|
20477
20808
|
ok: false,
|
|
20478
|
-
message:
|
|
20809
|
+
message: import_chalk11.default.red(
|
|
20479
20810
|
"Please specify a file or function to generate tests for"
|
|
20480
20811
|
)
|
|
20481
20812
|
};
|
|
@@ -20492,9 +20823,9 @@ describe("${target}", () => {
|
|
|
20492
20823
|
});`;
|
|
20493
20824
|
return {
|
|
20494
20825
|
ok: true,
|
|
20495
|
-
message:
|
|
20826
|
+
message: import_chalk11.default.green(`\u2705 Tests generated for ${target}:
|
|
20496
20827
|
|
|
20497
|
-
`) +
|
|
20828
|
+
`) + import_chalk11.default.gray("```typescript\n") + testCode + import_chalk11.default.gray("\n```"),
|
|
20498
20829
|
data: { testCode, framework, target }
|
|
20499
20830
|
};
|
|
20500
20831
|
}
|
|
@@ -20507,23 +20838,23 @@ describe("${target}", () => {
|
|
|
20507
20838
|
if (coverage) command += " --coverage";
|
|
20508
20839
|
return {
|
|
20509
20840
|
ok: true,
|
|
20510
|
-
message:
|
|
20511
|
-
`) +
|
|
20841
|
+
message: import_chalk11.default.cyan(`\u{1F9EA} Running tests...
|
|
20842
|
+
`) + import_chalk11.default.gray(`Command: ${command}
|
|
20512
20843
|
|
|
20513
|
-
`) +
|
|
20844
|
+
`) + import_chalk11.default.green("\u2705 All tests passed!"),
|
|
20514
20845
|
data: { command, passed: true }
|
|
20515
20846
|
};
|
|
20516
20847
|
}
|
|
20517
20848
|
async showCoverage(options) {
|
|
20518
20849
|
return {
|
|
20519
20850
|
ok: true,
|
|
20520
|
-
message:
|
|
20851
|
+
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
20852
|
"SessionStateMachine.ts".padEnd(40) + "100.00".padEnd(10) + "100.00\n"
|
|
20522
|
-
) +
|
|
20853
|
+
) + import_chalk11.default.green(
|
|
20523
20854
|
"InputController.ts".padEnd(40) + "95.50".padEnd(10) + "94.20\n"
|
|
20524
|
-
) +
|
|
20855
|
+
) + import_chalk11.default.yellow(
|
|
20525
20856
|
"SessionManager.ts".padEnd(40) + "78.30".padEnd(10) + "76.50\n"
|
|
20526
|
-
) +
|
|
20857
|
+
) + import_chalk11.default.gray("-".repeat(60) + "\n") + import_chalk11.default.cyan("Total".padEnd(40) + "85.60".padEnd(10) + "84.30")
|
|
20527
20858
|
};
|
|
20528
20859
|
}
|
|
20529
20860
|
};
|
|
@@ -20537,33 +20868,33 @@ describe("${target}", () => {
|
|
|
20537
20868
|
if (!file) {
|
|
20538
20869
|
return {
|
|
20539
20870
|
ok: false,
|
|
20540
|
-
message:
|
|
20871
|
+
message: import_chalk11.default.red("Please specify a file to review\n") + import_chalk11.default.gray("Usage: /review <file> [--security] [--performance]")
|
|
20541
20872
|
};
|
|
20542
20873
|
}
|
|
20543
20874
|
const checkSecurity = args.includes("--security");
|
|
20544
20875
|
const checkPerformance = args.includes("--performance");
|
|
20545
|
-
let message =
|
|
20876
|
+
let message = import_chalk11.default.cyan(`\u{1F50D} Code Review for ${file}
|
|
20546
20877
|
|
|
20547
20878
|
`);
|
|
20548
|
-
message +=
|
|
20549
|
-
message +=
|
|
20550
|
-
message +=
|
|
20551
|
-
message +=
|
|
20879
|
+
message += import_chalk11.default.yellow("\u26A0\uFE0F Issues Found (3):\n");
|
|
20880
|
+
message += import_chalk11.default.gray(" 1. Line 42: ") + import_chalk11.default.yellow("Missing error handling in async function\n");
|
|
20881
|
+
message += import_chalk11.default.gray(" 2. Line 89: ") + import_chalk11.default.yellow("Potential memory leak - event listener not removed\n");
|
|
20882
|
+
message += import_chalk11.default.gray(" 3. Line 156: ") + import_chalk11.default.yellow(
|
|
20552
20883
|
"Complex function - consider refactoring (cyclomatic complexity: 12)\n\n"
|
|
20553
20884
|
);
|
|
20554
20885
|
if (checkSecurity) {
|
|
20555
|
-
message +=
|
|
20556
|
-
message +=
|
|
20886
|
+
message += import_chalk11.default.red("\u{1F512} Security Issues (1):\n");
|
|
20887
|
+
message += import_chalk11.default.gray(" 1. Line 67: ") + import_chalk11.default.red("Potential XSS vulnerability - user input not sanitized\n\n");
|
|
20557
20888
|
}
|
|
20558
20889
|
if (checkPerformance) {
|
|
20559
|
-
message +=
|
|
20560
|
-
message +=
|
|
20561
|
-
message +=
|
|
20562
|
-
}
|
|
20563
|
-
message +=
|
|
20564
|
-
message +=
|
|
20565
|
-
message +=
|
|
20566
|
-
message +=
|
|
20890
|
+
message += import_chalk11.default.blue("\u26A1 Performance Suggestions (2):\n");
|
|
20891
|
+
message += import_chalk11.default.gray(" 1. Line 23: ") + import_chalk11.default.blue("Consider memoization for expensive calculation\n");
|
|
20892
|
+
message += import_chalk11.default.gray(" 2. Line 145: ") + import_chalk11.default.blue("Use virtualization for large list rendering\n\n");
|
|
20893
|
+
}
|
|
20894
|
+
message += import_chalk11.default.green("\u2705 Positive Findings:\n");
|
|
20895
|
+
message += import_chalk11.default.gray(" \u2022 Good TypeScript type coverage (92%)\n");
|
|
20896
|
+
message += import_chalk11.default.gray(" \u2022 Consistent code style\n");
|
|
20897
|
+
message += import_chalk11.default.gray(" \u2022 Well-documented functions\n");
|
|
20567
20898
|
return {
|
|
20568
20899
|
ok: true,
|
|
20569
20900
|
message,
|
|
@@ -20593,8 +20924,8 @@ describe("${target}", () => {
|
|
|
20593
20924
|
default:
|
|
20594
20925
|
return {
|
|
20595
20926
|
ok: false,
|
|
20596
|
-
message:
|
|
20597
|
-
`) +
|
|
20927
|
+
message: import_chalk11.default.red(`Unknown bug subcommand: ${subcommand}
|
|
20928
|
+
`) + import_chalk11.default.gray("Available: report, list, analyze")
|
|
20598
20929
|
};
|
|
20599
20930
|
}
|
|
20600
20931
|
}
|
|
@@ -20603,18 +20934,18 @@ describe("${target}", () => {
|
|
|
20603
20934
|
if (!description) {
|
|
20604
20935
|
return {
|
|
20605
20936
|
ok: false,
|
|
20606
|
-
message:
|
|
20937
|
+
message: import_chalk11.default.red("Please provide a bug description")
|
|
20607
20938
|
};
|
|
20608
20939
|
}
|
|
20609
20940
|
const bugId = `BUG-${Date.now().toString(36).toUpperCase()}`;
|
|
20610
20941
|
return {
|
|
20611
20942
|
ok: true,
|
|
20612
|
-
message:
|
|
20943
|
+
message: import_chalk11.default.green(`\u{1F41B} Bug reported successfully!
|
|
20613
20944
|
|
|
20614
|
-
`) +
|
|
20615
|
-
`) +
|
|
20616
|
-
`) +
|
|
20617
|
-
`) +
|
|
20945
|
+
`) + import_chalk11.default.cyan(`Bug ID: ${bugId}
|
|
20946
|
+
`) + import_chalk11.default.gray(`Description: ${description}
|
|
20947
|
+
`) + import_chalk11.default.gray(`Status: Open
|
|
20948
|
+
`) + import_chalk11.default.gray(`Priority: To be determined
|
|
20618
20949
|
`),
|
|
20619
20950
|
data: { bugId, description, status: "open" }
|
|
20620
20951
|
};
|
|
@@ -20622,23 +20953,23 @@ describe("${target}", () => {
|
|
|
20622
20953
|
async listBugs() {
|
|
20623
20954
|
return {
|
|
20624
20955
|
ok: true,
|
|
20625
|
-
message:
|
|
20956
|
+
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
20957
|
};
|
|
20627
20958
|
}
|
|
20628
20959
|
async analyzeBug(bugId) {
|
|
20629
20960
|
if (!bugId) {
|
|
20630
20961
|
return {
|
|
20631
20962
|
ok: false,
|
|
20632
|
-
message:
|
|
20963
|
+
message: import_chalk11.default.red("Please provide a bug ID to analyze")
|
|
20633
20964
|
};
|
|
20634
20965
|
}
|
|
20635
20966
|
return {
|
|
20636
20967
|
ok: true,
|
|
20637
|
-
message:
|
|
20968
|
+
message: import_chalk11.default.cyan(`\u{1F50D} Bug Analysis for ${bugId}:
|
|
20638
20969
|
|
|
20639
|
-
`) +
|
|
20970
|
+
`) + 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
20971
|
" 1. AbortSignal not propagated to all async operations\n"
|
|
20641
|
-
) +
|
|
20972
|
+
) + 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
20973
|
};
|
|
20643
20974
|
}
|
|
20644
20975
|
};
|
|
@@ -20652,11 +20983,11 @@ describe("${target}", () => {
|
|
|
20652
20983
|
});
|
|
20653
20984
|
|
|
20654
20985
|
// src/services/interactive-session/handlers/SystemHandlers.ts
|
|
20655
|
-
var
|
|
20986
|
+
var import_chalk12, os3, StatusHandler, ModelHandler, MemoryHandler, HealthHandler, DoctorHandler, SystemHandlers;
|
|
20656
20987
|
var init_SystemHandlers = __esm({
|
|
20657
20988
|
"src/services/interactive-session/handlers/SystemHandlers.ts"() {
|
|
20658
|
-
|
|
20659
|
-
|
|
20989
|
+
import_chalk12 = __toESM(require("chalk"), 1);
|
|
20990
|
+
os3 = __toESM(require("os"), 1);
|
|
20660
20991
|
StatusHandler = class {
|
|
20661
20992
|
name = "/status";
|
|
20662
20993
|
description = "Show current system and session status";
|
|
@@ -20666,7 +20997,7 @@ var init_SystemHandlers = __esm({
|
|
|
20666
20997
|
if (signal?.aborted) {
|
|
20667
20998
|
return {
|
|
20668
20999
|
ok: false,
|
|
20669
|
-
message:
|
|
21000
|
+
message: import_chalk12.default.yellow("Status check canceled")
|
|
20670
21001
|
};
|
|
20671
21002
|
}
|
|
20672
21003
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
@@ -20674,47 +21005,47 @@ var init_SystemHandlers = __esm({
|
|
|
20674
21005
|
system: "operational",
|
|
20675
21006
|
uptime: process.uptime(),
|
|
20676
21007
|
memory: process.memoryUsage(),
|
|
20677
|
-
cpu:
|
|
21008
|
+
cpu: os3.cpus()[0],
|
|
20678
21009
|
platform: process.platform
|
|
20679
21010
|
};
|
|
20680
|
-
let message =
|
|
20681
|
-
message +=
|
|
20682
|
-
message +=
|
|
21011
|
+
let message = import_chalk12.default.cyan.bold("\u{1F4CA} System Status\n\n");
|
|
21012
|
+
message += import_chalk12.default.green("\u2705 System: Operational\n");
|
|
21013
|
+
message += import_chalk12.default.gray(
|
|
20683
21014
|
`\u23F1\uFE0F Uptime: ${Math.floor(status.uptime / 60)}m ${Math.floor(status.uptime % 60)}s
|
|
20684
21015
|
`
|
|
20685
21016
|
);
|
|
20686
|
-
message +=
|
|
21017
|
+
message += import_chalk12.default.gray(
|
|
20687
21018
|
`\u{1F4BE} Memory: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB / ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20688
21019
|
`
|
|
20689
21020
|
);
|
|
20690
21021
|
if (verbose) {
|
|
20691
|
-
message +=
|
|
20692
|
-
message +=
|
|
21022
|
+
message += import_chalk12.default.gray("\nDetailed Information:\n");
|
|
21023
|
+
message += import_chalk12.default.gray(` \u2022 CPU: ${status.cpu.model}
|
|
20693
21024
|
`);
|
|
20694
|
-
message +=
|
|
20695
|
-
` \u2022 Platform: ${status.platform} (${
|
|
21025
|
+
message += import_chalk12.default.gray(
|
|
21026
|
+
` \u2022 Platform: ${status.platform} (${os3.arch()})
|
|
20696
21027
|
`
|
|
20697
21028
|
);
|
|
20698
|
-
message +=
|
|
21029
|
+
message += import_chalk12.default.gray(` \u2022 Node.js: ${process.version}
|
|
20699
21030
|
`);
|
|
20700
|
-
message +=
|
|
21031
|
+
message += import_chalk12.default.gray(` \u2022 Process ID: ${process.pid}
|
|
20701
21032
|
`);
|
|
20702
|
-
message +=
|
|
21033
|
+
message += import_chalk12.default.gray(` \u2022 Working Directory: ${process.cwd()}
|
|
20703
21034
|
`);
|
|
20704
|
-
message +=
|
|
20705
|
-
message +=
|
|
21035
|
+
message += import_chalk12.default.gray("\nMemory Details:\n");
|
|
21036
|
+
message += import_chalk12.default.gray(
|
|
20706
21037
|
` \u2022 RSS: ${Math.round(status.memory.rss / 1024 / 1024)}MB
|
|
20707
21038
|
`
|
|
20708
21039
|
);
|
|
20709
|
-
message +=
|
|
21040
|
+
message += import_chalk12.default.gray(
|
|
20710
21041
|
` \u2022 Heap Used: ${Math.round(status.memory.heapUsed / 1024 / 1024)}MB
|
|
20711
21042
|
`
|
|
20712
21043
|
);
|
|
20713
|
-
message +=
|
|
21044
|
+
message += import_chalk12.default.gray(
|
|
20714
21045
|
` \u2022 Heap Total: ${Math.round(status.memory.heapTotal / 1024 / 1024)}MB
|
|
20715
21046
|
`
|
|
20716
21047
|
);
|
|
20717
|
-
message +=
|
|
21048
|
+
message += import_chalk12.default.gray(
|
|
20718
21049
|
` \u2022 External: ${Math.round(status.memory.external / 1024 / 1024)}MB
|
|
20719
21050
|
`
|
|
20720
21051
|
);
|
|
@@ -20743,7 +21074,7 @@ var init_SystemHandlers = __esm({
|
|
|
20743
21074
|
if (signal?.aborted) {
|
|
20744
21075
|
return {
|
|
20745
21076
|
ok: false,
|
|
20746
|
-
message:
|
|
21077
|
+
message: import_chalk12.default.yellow("Model operation canceled")
|
|
20747
21078
|
};
|
|
20748
21079
|
}
|
|
20749
21080
|
if (args.length === 0) {
|
|
@@ -20763,17 +21094,17 @@ var init_SystemHandlers = __esm({
|
|
|
20763
21094
|
}
|
|
20764
21095
|
}
|
|
20765
21096
|
async listModels() {
|
|
20766
|
-
let message =
|
|
20767
|
-
message +=
|
|
21097
|
+
let message = import_chalk12.default.cyan.bold("\u{1F916} Available Models\n\n");
|
|
21098
|
+
message += import_chalk12.default.green(`Current: ${this.currentModel}
|
|
20768
21099
|
|
|
20769
21100
|
`);
|
|
20770
21101
|
for (const model of this.availableModels) {
|
|
20771
|
-
const status = model.available ?
|
|
20772
|
-
const name2 = model.id === this.currentModel ?
|
|
20773
|
-
message += `${status} ${name2.padEnd(20)} ${
|
|
21102
|
+
const status = model.available ? import_chalk12.default.green("\u2705") : import_chalk12.default.red("\u274C");
|
|
21103
|
+
const name2 = model.id === this.currentModel ? import_chalk12.default.green.bold(model.id) : import_chalk12.default.cyan(model.id);
|
|
21104
|
+
message += `${status} ${name2.padEnd(20)} ${import_chalk12.default.gray(`[${model.provider}]`)}
|
|
20774
21105
|
`;
|
|
20775
21106
|
}
|
|
20776
|
-
message +=
|
|
21107
|
+
message += import_chalk12.default.gray("\nUse /model <name> to switch models");
|
|
20777
21108
|
return {
|
|
20778
21109
|
ok: true,
|
|
20779
21110
|
message,
|
|
@@ -20784,27 +21115,27 @@ var init_SystemHandlers = __esm({
|
|
|
20784
21115
|
if (!modelId) {
|
|
20785
21116
|
return {
|
|
20786
21117
|
ok: false,
|
|
20787
|
-
message:
|
|
21118
|
+
message: import_chalk12.default.red("Please specify a model to switch to")
|
|
20788
21119
|
};
|
|
20789
21120
|
}
|
|
20790
21121
|
const model = this.availableModels.find((m2) => m2.id === modelId);
|
|
20791
21122
|
if (!model) {
|
|
20792
21123
|
return {
|
|
20793
21124
|
ok: false,
|
|
20794
|
-
message:
|
|
20795
|
-
`) +
|
|
21125
|
+
message: import_chalk12.default.red(`Unknown model: ${modelId}
|
|
21126
|
+
`) + import_chalk12.default.gray("Use /model list to see available models")
|
|
20796
21127
|
};
|
|
20797
21128
|
}
|
|
20798
21129
|
if (!model.available) {
|
|
20799
21130
|
return {
|
|
20800
21131
|
ok: false,
|
|
20801
|
-
message:
|
|
21132
|
+
message: import_chalk12.default.yellow(`Model ${modelId} is not currently available`)
|
|
20802
21133
|
};
|
|
20803
21134
|
}
|
|
20804
21135
|
this.currentModel = modelId;
|
|
20805
21136
|
return {
|
|
20806
21137
|
ok: true,
|
|
20807
|
-
message:
|
|
21138
|
+
message: import_chalk12.default.green(`\u2705 Switched to ${modelId}`),
|
|
20808
21139
|
data: { model: modelId }
|
|
20809
21140
|
};
|
|
20810
21141
|
}
|
|
@@ -20813,27 +21144,27 @@ var init_SystemHandlers = __esm({
|
|
|
20813
21144
|
if (!model) {
|
|
20814
21145
|
return {
|
|
20815
21146
|
ok: false,
|
|
20816
|
-
message:
|
|
21147
|
+
message: import_chalk12.default.red(`Unknown model: ${modelId}`)
|
|
20817
21148
|
};
|
|
20818
21149
|
}
|
|
20819
|
-
let message =
|
|
21150
|
+
let message = import_chalk12.default.cyan(`\u{1F4CB} Model Information: ${modelId}
|
|
20820
21151
|
|
|
20821
21152
|
`);
|
|
20822
|
-
message +=
|
|
21153
|
+
message += import_chalk12.default.gray(`Provider: ${model.provider}
|
|
20823
21154
|
`);
|
|
20824
|
-
message +=
|
|
21155
|
+
message += import_chalk12.default.gray(
|
|
20825
21156
|
`Status: ${model.available ? "Available" : "Unavailable"}
|
|
20826
21157
|
`
|
|
20827
21158
|
);
|
|
20828
|
-
message +=
|
|
21159
|
+
message += import_chalk12.default.gray(
|
|
20829
21160
|
`Current: ${model.id === this.currentModel ? "Yes" : "No"}
|
|
20830
21161
|
`
|
|
20831
21162
|
);
|
|
20832
|
-
message +=
|
|
20833
|
-
message +=
|
|
20834
|
-
message +=
|
|
20835
|
-
message +=
|
|
20836
|
-
message +=
|
|
21163
|
+
message += import_chalk12.default.gray("\nCapabilities:\n");
|
|
21164
|
+
message += import_chalk12.default.gray(" \u2022 Context: 128K tokens\n");
|
|
21165
|
+
message += import_chalk12.default.gray(" \u2022 Languages: 95+\n");
|
|
21166
|
+
message += import_chalk12.default.gray(" \u2022 Code: Yes\n");
|
|
21167
|
+
message += import_chalk12.default.gray(" \u2022 Vision: ") + (modelId.includes("gpt-4") ? "Yes\n" : "No\n");
|
|
20837
21168
|
return {
|
|
20838
21169
|
ok: true,
|
|
20839
21170
|
message,
|
|
@@ -20865,39 +21196,39 @@ var init_SystemHandlers = __esm({
|
|
|
20865
21196
|
default:
|
|
20866
21197
|
return {
|
|
20867
21198
|
ok: false,
|
|
20868
|
-
message:
|
|
20869
|
-
`) +
|
|
21199
|
+
message: import_chalk12.default.red(`Unknown memory subcommand: ${subcommand}
|
|
21200
|
+
`) + import_chalk12.default.gray("Available: status, clear, export, compact")
|
|
20870
21201
|
};
|
|
20871
21202
|
}
|
|
20872
21203
|
}
|
|
20873
21204
|
async showStatus() {
|
|
20874
|
-
let message =
|
|
20875
|
-
message +=
|
|
20876
|
-
message +=
|
|
21205
|
+
let message = import_chalk12.default.cyan.bold("\u{1F9E0} Memory Status\n\n");
|
|
21206
|
+
message += import_chalk12.default.yellow("System 1 (Fast):\n");
|
|
21207
|
+
message += import_chalk12.default.gray(
|
|
20877
21208
|
` \u2022 Knowledge Nodes: ${this.memoryStats.system1.nodes}
|
|
20878
21209
|
`
|
|
20879
21210
|
);
|
|
20880
|
-
message +=
|
|
21211
|
+
message += import_chalk12.default.gray(` \u2022 Tokens: ${this.memoryStats.system1.tokens}
|
|
20881
21212
|
|
|
20882
21213
|
`);
|
|
20883
|
-
message +=
|
|
20884
|
-
message +=
|
|
21214
|
+
message += import_chalk12.default.blue("System 2 (Deep):\n");
|
|
21215
|
+
message += import_chalk12.default.gray(
|
|
20885
21216
|
` \u2022 Reasoning Traces: ${this.memoryStats.system2.traces}
|
|
20886
21217
|
`
|
|
20887
21218
|
);
|
|
20888
|
-
message +=
|
|
21219
|
+
message += import_chalk12.default.gray(` \u2022 Tokens: ${this.memoryStats.system2.tokens}
|
|
20889
21220
|
|
|
20890
21221
|
`);
|
|
20891
|
-
message +=
|
|
20892
|
-
message +=
|
|
21222
|
+
message += import_chalk12.default.green("Total:\n");
|
|
21223
|
+
message += import_chalk12.default.gray(` \u2022 Entries: ${this.memoryStats.total.entries}
|
|
20893
21224
|
`);
|
|
20894
|
-
message +=
|
|
21225
|
+
message += import_chalk12.default.gray(
|
|
20895
21226
|
` \u2022 Tokens: ${this.memoryStats.total.tokens} / 128000
|
|
20896
21227
|
`
|
|
20897
21228
|
);
|
|
20898
21229
|
const usage = Math.round(this.memoryStats.total.tokens / 128e3 * 100);
|
|
20899
21230
|
const bar = "\u2588".repeat(Math.floor(usage / 5)) + "\u2591".repeat(20 - Math.floor(usage / 5));
|
|
20900
|
-
message +=
|
|
21231
|
+
message += import_chalk12.default.gray(` \u2022 Usage: [${bar}] ${usage}%
|
|
20901
21232
|
`);
|
|
20902
21233
|
return {
|
|
20903
21234
|
ok: true,
|
|
@@ -20911,14 +21242,14 @@ var init_SystemHandlers = __esm({
|
|
|
20911
21242
|
this.memoryStats.system1 = { nodes: 0, tokens: 0 };
|
|
20912
21243
|
return {
|
|
20913
21244
|
ok: true,
|
|
20914
|
-
message:
|
|
21245
|
+
message: import_chalk12.default.green("\u2705 System 1 memory cleared")
|
|
20915
21246
|
};
|
|
20916
21247
|
}
|
|
20917
21248
|
if (system === "system2") {
|
|
20918
21249
|
this.memoryStats.system2 = { traces: 0, tokens: 0 };
|
|
20919
21250
|
return {
|
|
20920
21251
|
ok: true,
|
|
20921
|
-
message:
|
|
21252
|
+
message: import_chalk12.default.green("\u2705 System 2 memory cleared")
|
|
20922
21253
|
};
|
|
20923
21254
|
}
|
|
20924
21255
|
this.memoryStats = {
|
|
@@ -20928,15 +21259,15 @@ var init_SystemHandlers = __esm({
|
|
|
20928
21259
|
};
|
|
20929
21260
|
return {
|
|
20930
21261
|
ok: true,
|
|
20931
|
-
message:
|
|
21262
|
+
message: import_chalk12.default.green("\u{1F9F9} All memory cleared")
|
|
20932
21263
|
};
|
|
20933
21264
|
}
|
|
20934
21265
|
async exportMemory() {
|
|
20935
21266
|
const filename = `memory-export-${Date.now()}.json`;
|
|
20936
21267
|
return {
|
|
20937
21268
|
ok: true,
|
|
20938
|
-
message:
|
|
20939
|
-
`) +
|
|
21269
|
+
message: import_chalk12.default.green(`\u{1F4E6} Memory exported to ${filename}
|
|
21270
|
+
`) + import_chalk12.default.gray(
|
|
20940
21271
|
`Size: ${Math.round(JSON.stringify(this.memoryStats).length / 1024)}KB`
|
|
20941
21272
|
),
|
|
20942
21273
|
data: { filename, stats: this.memoryStats }
|
|
@@ -20954,9 +21285,9 @@ var init_SystemHandlers = __esm({
|
|
|
20954
21285
|
);
|
|
20955
21286
|
return {
|
|
20956
21287
|
ok: true,
|
|
20957
|
-
message:
|
|
20958
|
-
`) +
|
|
20959
|
-
`) +
|
|
21288
|
+
message: import_chalk12.default.green("\u2728 Memory compacted successfully\n") + import_chalk12.default.gray(`Before: ${before} tokens
|
|
21289
|
+
`) + import_chalk12.default.gray(`After: ${after} tokens
|
|
21290
|
+
`) + import_chalk12.default.gray(
|
|
20960
21291
|
`Saved: ${before - after} tokens (${Math.round((1 - after / before) * 100)}%)`
|
|
20961
21292
|
),
|
|
20962
21293
|
data: { before, after, saved: before - after }
|
|
@@ -20972,11 +21303,11 @@ var init_SystemHandlers = __esm({
|
|
|
20972
21303
|
if (signal?.aborted) {
|
|
20973
21304
|
return {
|
|
20974
21305
|
ok: false,
|
|
20975
|
-
message:
|
|
21306
|
+
message: import_chalk12.default.yellow("Health check canceled")
|
|
20976
21307
|
};
|
|
20977
21308
|
}
|
|
20978
21309
|
const detailed = args.includes("--detailed");
|
|
20979
|
-
let message =
|
|
21310
|
+
let message = import_chalk12.default.cyan.bold("\u{1F3E5} System Health Check\n\n");
|
|
20980
21311
|
const checks = [
|
|
20981
21312
|
{ name: "Core Services", status: "ok", latency: 12 },
|
|
20982
21313
|
{ name: "Memory System", status: "ok", latency: 8 },
|
|
@@ -20985,11 +21316,11 @@ var init_SystemHandlers = __esm({
|
|
|
20985
21316
|
{ name: "Network", status: "warning", latency: 250 }
|
|
20986
21317
|
];
|
|
20987
21318
|
for (const check of checks) {
|
|
20988
|
-
const icon = check.status === "ok" ?
|
|
20989
|
-
const status = check.status === "ok" ?
|
|
21319
|
+
const icon = check.status === "ok" ? import_chalk12.default.green("\u2705") : check.status === "warning" ? import_chalk12.default.yellow("\u26A0\uFE0F") : import_chalk12.default.red("\u274C");
|
|
21320
|
+
const status = check.status === "ok" ? import_chalk12.default.green("OK") : check.status === "warning" ? import_chalk12.default.yellow("WARNING") : import_chalk12.default.red("ERROR");
|
|
20990
21321
|
message += `${icon} ${check.name.padEnd(20)} ${status}`;
|
|
20991
21322
|
if (detailed) {
|
|
20992
|
-
message +=
|
|
21323
|
+
message += import_chalk12.default.gray(` (${check.latency}ms)`);
|
|
20993
21324
|
}
|
|
20994
21325
|
message += "\n";
|
|
20995
21326
|
}
|
|
@@ -20997,11 +21328,11 @@ var init_SystemHandlers = __esm({
|
|
|
20997
21328
|
const hasErrors = checks.some((c) => c.status === "error");
|
|
20998
21329
|
message += "\n";
|
|
20999
21330
|
if (hasErrors) {
|
|
21000
|
-
message +=
|
|
21331
|
+
message += import_chalk12.default.red("\u26A0\uFE0F System has errors - intervention required");
|
|
21001
21332
|
} else if (hasWarnings) {
|
|
21002
|
-
message +=
|
|
21333
|
+
message += import_chalk12.default.yellow("\u26A0\uFE0F System operational with warnings");
|
|
21003
21334
|
} else {
|
|
21004
|
-
message +=
|
|
21335
|
+
message += import_chalk12.default.green("\u2705 All systems operational");
|
|
21005
21336
|
}
|
|
21006
21337
|
return {
|
|
21007
21338
|
ok: true,
|
|
@@ -21019,12 +21350,12 @@ var init_SystemHandlers = __esm({
|
|
|
21019
21350
|
if (signal?.aborted) {
|
|
21020
21351
|
return {
|
|
21021
21352
|
ok: false,
|
|
21022
|
-
message:
|
|
21353
|
+
message: import_chalk12.default.yellow("Doctor check canceled")
|
|
21023
21354
|
};
|
|
21024
21355
|
}
|
|
21025
21356
|
const autoFix = args.includes("--fix");
|
|
21026
|
-
let message =
|
|
21027
|
-
message +=
|
|
21357
|
+
let message = import_chalk12.default.cyan.bold("\u{1F468}\u2695\uFE0F System Doctor\n\n");
|
|
21358
|
+
message += import_chalk12.default.gray("Running diagnostics...\n\n");
|
|
21028
21359
|
const issues = [
|
|
21029
21360
|
{
|
|
21030
21361
|
severity: "warning",
|
|
@@ -21046,20 +21377,20 @@ var init_SystemHandlers = __esm({
|
|
|
21046
21377
|
}
|
|
21047
21378
|
];
|
|
21048
21379
|
if (issues.length === 0) {
|
|
21049
|
-
message +=
|
|
21380
|
+
message += import_chalk12.default.green("\u2705 No issues found - system is healthy!");
|
|
21050
21381
|
return { ok: true, message };
|
|
21051
21382
|
}
|
|
21052
|
-
message +=
|
|
21383
|
+
message += import_chalk12.default.yellow(`Found ${issues.length} issue(s):
|
|
21053
21384
|
|
|
21054
21385
|
`);
|
|
21055
21386
|
for (const issue of issues) {
|
|
21056
|
-
const icon = issue.severity === "error" ?
|
|
21387
|
+
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
21388
|
message += `${icon} ${issue.issue}
|
|
21058
21389
|
`;
|
|
21059
|
-
message +=
|
|
21390
|
+
message += import_chalk12.default.gray(` Solution: ${issue.solution}
|
|
21060
21391
|
`);
|
|
21061
21392
|
if (autoFix && issue.fixable) {
|
|
21062
|
-
message +=
|
|
21393
|
+
message += import_chalk12.default.green(` \u2705 Auto-fixed
|
|
21063
21394
|
`);
|
|
21064
21395
|
}
|
|
21065
21396
|
message += "\n";
|
|
@@ -21067,7 +21398,7 @@ var init_SystemHandlers = __esm({
|
|
|
21067
21398
|
if (!autoFix) {
|
|
21068
21399
|
const fixableCount = issues.filter((i2) => i2.fixable).length;
|
|
21069
21400
|
if (fixableCount > 0) {
|
|
21070
|
-
message +=
|
|
21401
|
+
message += import_chalk12.default.gray(
|
|
21071
21402
|
`
|
|
21072
21403
|
Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
21073
21404
|
);
|
|
@@ -21510,7 +21841,7 @@ var init_package = __esm({
|
|
|
21510
21841
|
"package.json"() {
|
|
21511
21842
|
package_default = {
|
|
21512
21843
|
name: "@bonginkan/maria",
|
|
21513
|
-
version: "4.2.
|
|
21844
|
+
version: "4.2.6",
|
|
21514
21845
|
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
21846
|
keywords: [
|
|
21516
21847
|
"ai",
|
|
@@ -22062,10 +22393,10 @@ function showCodeGenerationAnimation() {
|
|
|
22062
22393
|
};
|
|
22063
22394
|
return animation;
|
|
22064
22395
|
}
|
|
22065
|
-
var
|
|
22396
|
+
var import_chalk13, ThinkingAnimation, ProcessAnimation, CodeGenerationAnimation, LoadingDots, BrainAnimation, ProgressBar, StreamingOutput;
|
|
22066
22397
|
var init_animations = __esm({
|
|
22067
22398
|
"src/utils/animations.ts"() {
|
|
22068
|
-
|
|
22399
|
+
import_chalk13 = __toESM(require("chalk"), 1);
|
|
22069
22400
|
ThinkingAnimation = class {
|
|
22070
22401
|
frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
22071
22402
|
currentFrame = 0;
|
|
@@ -22077,7 +22408,7 @@ var init_animations = __esm({
|
|
|
22077
22408
|
start() {
|
|
22078
22409
|
this.interval = setInterval(() => {
|
|
22079
22410
|
process.stdout.write(
|
|
22080
|
-
`\r${
|
|
22411
|
+
`\r${import_chalk13.default.cyan(this.frames[this.currentFrame])} ${import_chalk13.default.gray(this.message)}...`
|
|
22081
22412
|
);
|
|
22082
22413
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22083
22414
|
}, 80);
|
|
@@ -22115,7 +22446,7 @@ var init_animations = __esm({
|
|
|
22115
22446
|
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
22116
22447
|
const stage = this.stages[this.currentStage];
|
|
22117
22448
|
process.stdout.write(
|
|
22118
|
-
`\r${
|
|
22449
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage.icon} ${import_chalk13.default.gray(stage.message)}... ${import_chalk13.default.dim(`[${elapsed}s]`)}`
|
|
22119
22450
|
);
|
|
22120
22451
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
22121
22452
|
}, 80);
|
|
@@ -22177,11 +22508,11 @@ var init_animations = __esm({
|
|
|
22177
22508
|
const stage = stages[this.currentStage];
|
|
22178
22509
|
if (this.isComplex) {
|
|
22179
22510
|
process.stdout.write(
|
|
22180
|
-
`\r${
|
|
22511
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${stage} ${import_chalk13.default.dim(`[${elapsed}s]`)}`
|
|
22181
22512
|
);
|
|
22182
22513
|
} else {
|
|
22183
22514
|
process.stdout.write(
|
|
22184
|
-
`\r${
|
|
22515
|
+
`\r${import_chalk13.default.cyan(this.spinnerFrames[this.currentFrame])} ${import_chalk13.default.gray(stage)}...`
|
|
22185
22516
|
);
|
|
22186
22517
|
}
|
|
22187
22518
|
this.currentFrame = (this.currentFrame + 1) % this.spinnerFrames.length;
|
|
@@ -22224,7 +22555,7 @@ var init_animations = __esm({
|
|
|
22224
22555
|
start() {
|
|
22225
22556
|
this.interval = setInterval(() => {
|
|
22226
22557
|
process.stdout.write(
|
|
22227
|
-
`\r${
|
|
22558
|
+
`\r${import_chalk13.default.cyan(this.message)}${this.dots[this.currentDot]}`
|
|
22228
22559
|
);
|
|
22229
22560
|
this.currentDot = (this.currentDot + 1) % this.dots.length;
|
|
22230
22561
|
}, 300);
|
|
@@ -22253,7 +22584,7 @@ var init_animations = __esm({
|
|
|
22253
22584
|
const frame = this.frames[this.currentFrame];
|
|
22254
22585
|
const message = this.messages[this.currentFrame];
|
|
22255
22586
|
process.stdout.write(
|
|
22256
|
-
`\r${frame} ${
|
|
22587
|
+
`\r${frame} ${import_chalk13.default.cyan(message)}...`
|
|
22257
22588
|
);
|
|
22258
22589
|
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
22259
22590
|
}, 1e3);
|
|
@@ -22281,7 +22612,7 @@ var init_animations = __esm({
|
|
|
22281
22612
|
const percentage = Math.floor(this.current / this.total * 100);
|
|
22282
22613
|
const filled = Math.floor(this.current / this.total * this.width);
|
|
22283
22614
|
const empty = this.width - filled;
|
|
22284
|
-
const bar =
|
|
22615
|
+
const bar = import_chalk13.default.green("\u2588").repeat(filled) + import_chalk13.default.gray("\u2591").repeat(empty);
|
|
22285
22616
|
process.stdout.write(`\r${this.label}: [${bar}] ${percentage}%`);
|
|
22286
22617
|
if (this.current >= this.total) {
|
|
22287
22618
|
process.stdout.write("\n");
|
|
@@ -22518,39 +22849,220 @@ var init_TokenStorage = __esm({
|
|
|
22518
22849
|
}
|
|
22519
22850
|
});
|
|
22520
22851
|
|
|
22852
|
+
// src/services/cli-auth/AuthSecretManager.ts
|
|
22853
|
+
var import_secret_manager2, AuthSecretManager, authSecretManager;
|
|
22854
|
+
var init_AuthSecretManager = __esm({
|
|
22855
|
+
"src/services/cli-auth/AuthSecretManager.ts"() {
|
|
22856
|
+
import_secret_manager2 = require("@google-cloud/secret-manager");
|
|
22857
|
+
AuthSecretManager = class {
|
|
22858
|
+
client;
|
|
22859
|
+
cache = /* @__PURE__ */ new Map();
|
|
22860
|
+
cacheExpiry = /* @__PURE__ */ new Map();
|
|
22861
|
+
CACHE_TTL = 36e5;
|
|
22862
|
+
// 1 hour
|
|
22863
|
+
projectId;
|
|
22864
|
+
constructor() {
|
|
22865
|
+
this.projectId = process.env.GCLOUD_PROJECT || "maria-code-470602";
|
|
22866
|
+
this.client = new import_secret_manager2.SecretManagerServiceClient();
|
|
22867
|
+
}
|
|
22868
|
+
/**
|
|
22869
|
+
* Get authentication configuration from Secret Manager
|
|
22870
|
+
*/
|
|
22871
|
+
async getAuthConfig() {
|
|
22872
|
+
const [authBase, apiBase, clientId] = await Promise.all([
|
|
22873
|
+
this.getSecret("maria-auth-server-url").catch(() => null),
|
|
22874
|
+
this.getSecret("maria-api-server-url").catch(() => null),
|
|
22875
|
+
this.getSecret("maria-cli-client-id").catch(() => null)
|
|
22876
|
+
]);
|
|
22877
|
+
return {
|
|
22878
|
+
authBase: authBase || this.getAuthBaseUrlFallback(),
|
|
22879
|
+
apiBase: apiBase || this.getApiBaseUrlFallback(),
|
|
22880
|
+
clientId: clientId || process.env.MARIA_CLIENT_ID || "maria-cli"
|
|
22881
|
+
};
|
|
22882
|
+
}
|
|
22883
|
+
/**
|
|
22884
|
+
* Get a specific secret from Secret Manager
|
|
22885
|
+
*/
|
|
22886
|
+
async getSecret(secretName) {
|
|
22887
|
+
const cached = this.getCachedSecret(secretName);
|
|
22888
|
+
if (cached) {
|
|
22889
|
+
return cached;
|
|
22890
|
+
}
|
|
22891
|
+
try {
|
|
22892
|
+
const name2 = `projects/${this.projectId}/secrets/${secretName}/versions/latest`;
|
|
22893
|
+
const [version] = await this.client.accessSecretVersion({ name: name2 });
|
|
22894
|
+
const payload = version.payload?.data;
|
|
22895
|
+
if (!payload) {
|
|
22896
|
+
return null;
|
|
22897
|
+
}
|
|
22898
|
+
const secret = payload.toString();
|
|
22899
|
+
this.cacheSecret(secretName, secret);
|
|
22900
|
+
return secret;
|
|
22901
|
+
} catch (error2) {
|
|
22902
|
+
return null;
|
|
22903
|
+
}
|
|
22904
|
+
}
|
|
22905
|
+
/**
|
|
22906
|
+
* Get all OAuth configuration secrets
|
|
22907
|
+
*/
|
|
22908
|
+
async getOAuthSecrets() {
|
|
22909
|
+
const secretNames = [
|
|
22910
|
+
"google-client-id",
|
|
22911
|
+
"google-client-secret",
|
|
22912
|
+
"github-client-id",
|
|
22913
|
+
"github-client-secret",
|
|
22914
|
+
"nextauth-secret",
|
|
22915
|
+
"firebase-project-id",
|
|
22916
|
+
"session-keys"
|
|
22917
|
+
];
|
|
22918
|
+
const results = await Promise.allSettled(
|
|
22919
|
+
secretNames.map((name2) => this.getSecret(name2))
|
|
22920
|
+
);
|
|
22921
|
+
return {
|
|
22922
|
+
googleClientId: results[0].status === "fulfilled" ? results[0].value || void 0 : void 0,
|
|
22923
|
+
googleClientSecret: results[1].status === "fulfilled" ? results[1].value || void 0 : void 0,
|
|
22924
|
+
githubClientId: results[2].status === "fulfilled" ? results[2].value || void 0 : void 0,
|
|
22925
|
+
githubClientSecret: results[3].status === "fulfilled" ? results[3].value || void 0 : void 0,
|
|
22926
|
+
nextAuthSecret: results[4].status === "fulfilled" ? results[4].value || void 0 : void 0,
|
|
22927
|
+
firebaseProjectId: results[5].status === "fulfilled" ? results[5].value || void 0 : void 0,
|
|
22928
|
+
sessionKeys: results[6].status === "fulfilled" ? results[6].value || void 0 : void 0
|
|
22929
|
+
};
|
|
22930
|
+
}
|
|
22931
|
+
/**
|
|
22932
|
+
* Cache a secret value
|
|
22933
|
+
*/
|
|
22934
|
+
cacheSecret(name2, value) {
|
|
22935
|
+
this.cache.set(name2, value);
|
|
22936
|
+
this.cacheExpiry.set(name2, Date.now() + this.CACHE_TTL);
|
|
22937
|
+
}
|
|
22938
|
+
/**
|
|
22939
|
+
* Get cached secret if not expired
|
|
22940
|
+
*/
|
|
22941
|
+
getCachedSecret(name2) {
|
|
22942
|
+
const expiry = this.cacheExpiry.get(name2);
|
|
22943
|
+
if (!expiry || Date.now() > expiry) {
|
|
22944
|
+
this.cache.delete(name2);
|
|
22945
|
+
this.cacheExpiry.delete(name2);
|
|
22946
|
+
return null;
|
|
22947
|
+
}
|
|
22948
|
+
return this.cache.get(name2) || null;
|
|
22949
|
+
}
|
|
22950
|
+
/**
|
|
22951
|
+
* Clear all cached secrets
|
|
22952
|
+
*/
|
|
22953
|
+
clearCache() {
|
|
22954
|
+
this.cache.clear();
|
|
22955
|
+
this.cacheExpiry.clear();
|
|
22956
|
+
}
|
|
22957
|
+
/**
|
|
22958
|
+
* Fallback for auth base URL
|
|
22959
|
+
*/
|
|
22960
|
+
getAuthBaseUrlFallback() {
|
|
22961
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22962
|
+
return "http://localhost:3001";
|
|
22963
|
+
}
|
|
22964
|
+
if (process.env.MARIA_AUTH_BASE) {
|
|
22965
|
+
return process.env.MARIA_AUTH_BASE;
|
|
22966
|
+
}
|
|
22967
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
22968
|
+
return cloudRunUrl;
|
|
22969
|
+
}
|
|
22970
|
+
/**
|
|
22971
|
+
* Fallback for API base URL
|
|
22972
|
+
*/
|
|
22973
|
+
getApiBaseUrlFallback() {
|
|
22974
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
22975
|
+
return "http://localhost:3000/api";
|
|
22976
|
+
}
|
|
22977
|
+
if (process.env.MARIA_API_BASE) {
|
|
22978
|
+
return process.env.MARIA_API_BASE;
|
|
22979
|
+
}
|
|
22980
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
22981
|
+
return cloudRunApiUrl;
|
|
22982
|
+
}
|
|
22983
|
+
};
|
|
22984
|
+
authSecretManager = new AuthSecretManager();
|
|
22985
|
+
}
|
|
22986
|
+
});
|
|
22987
|
+
|
|
22521
22988
|
// src/services/cli-auth/AuthenticationManager.ts
|
|
22522
22989
|
var import_crypto4, import_http, import_url, import_open, AuthenticationManager, authManager;
|
|
22523
22990
|
var init_AuthenticationManager = __esm({
|
|
22524
22991
|
"src/services/cli-auth/AuthenticationManager.ts"() {
|
|
22525
22992
|
init_types();
|
|
22526
22993
|
init_TokenStorage();
|
|
22994
|
+
init_AuthSecretManager();
|
|
22527
22995
|
import_crypto4 = __toESM(require("crypto"), 1);
|
|
22528
22996
|
import_http = require("http");
|
|
22529
22997
|
import_url = require("url");
|
|
22530
22998
|
import_open = __toESM(require("open"), 1);
|
|
22531
22999
|
AuthenticationManager = class {
|
|
22532
23000
|
tokenStorage;
|
|
22533
|
-
|
|
22534
|
-
|
|
22535
|
-
|
|
23001
|
+
secretManager;
|
|
23002
|
+
authBase = "";
|
|
23003
|
+
apiBase = "";
|
|
23004
|
+
clientId = "";
|
|
23005
|
+
initialized = false;
|
|
23006
|
+
initPromise = null;
|
|
22536
23007
|
REFRESH_THRESHOLD = 5 * 60 * 1e3;
|
|
22537
23008
|
// 5 minutes
|
|
22538
23009
|
CLOCK_SKEW = 2 * 60 * 1e3;
|
|
22539
23010
|
// 2 minutes clock skew tolerance
|
|
22540
23011
|
constructor() {
|
|
22541
23012
|
this.tokenStorage = new TokenStorage();
|
|
22542
|
-
this.
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
23013
|
+
this.secretManager = new AuthSecretManager();
|
|
23014
|
+
this.initPromise = this.initialize();
|
|
23015
|
+
}
|
|
23016
|
+
/**
|
|
23017
|
+
* Initialize configuration from Secret Manager
|
|
23018
|
+
*/
|
|
23019
|
+
async initialize() {
|
|
23020
|
+
try {
|
|
23021
|
+
const config2 = await this.secretManager.getAuthConfig();
|
|
23022
|
+
this.authBase = config2.authBase;
|
|
23023
|
+
this.apiBase = config2.apiBase;
|
|
23024
|
+
this.clientId = config2.clientId;
|
|
23025
|
+
this.initialized = true;
|
|
23026
|
+
} catch (error2) {
|
|
23027
|
+
this.authBase = this.getAuthBaseUrl();
|
|
23028
|
+
this.apiBase = this.getApiBaseUrl();
|
|
23029
|
+
this.clientId = process.env.MARIA_CLIENT_ID || "maria-cli";
|
|
23030
|
+
this.initialized = true;
|
|
23031
|
+
}
|
|
23032
|
+
}
|
|
23033
|
+
/**
|
|
23034
|
+
* Ensure the manager is initialized before use
|
|
23035
|
+
*/
|
|
23036
|
+
async ensureInitialized() {
|
|
23037
|
+
if (!this.initialized && this.initPromise) {
|
|
23038
|
+
await this.initPromise;
|
|
23039
|
+
}
|
|
23040
|
+
}
|
|
23041
|
+
getAuthBaseUrl() {
|
|
23042
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
23043
|
+
return "http://localhost:3001";
|
|
23044
|
+
}
|
|
23045
|
+
const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
|
|
23046
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
23047
|
+
return "https://auth.maria-code.ai";
|
|
23048
|
+
}
|
|
23049
|
+
return cloudRunUrl;
|
|
23050
|
+
}
|
|
23051
|
+
getApiBaseUrl() {
|
|
23052
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
23053
|
+
return "http://localhost:3000/api";
|
|
22546
23054
|
}
|
|
22547
|
-
|
|
22548
|
-
|
|
23055
|
+
const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
|
|
23056
|
+
if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
|
|
23057
|
+
return "https://api.maria-code.ai";
|
|
23058
|
+
}
|
|
23059
|
+
return cloudRunApiUrl;
|
|
22549
23060
|
}
|
|
22550
23061
|
/**
|
|
22551
23062
|
* Check if user is authenticated
|
|
22552
23063
|
*/
|
|
22553
23064
|
async isAuthenticated() {
|
|
23065
|
+
await this.ensureInitialized();
|
|
22554
23066
|
try {
|
|
22555
23067
|
const tokens = await this.tokenStorage.load();
|
|
22556
23068
|
if (!tokens) return false;
|
|
@@ -22566,6 +23078,7 @@ var init_AuthenticationManager = __esm({
|
|
|
22566
23078
|
* Require authenticated user (throws if not authenticated)
|
|
22567
23079
|
*/
|
|
22568
23080
|
async requireUser() {
|
|
23081
|
+
await this.ensureInitialized();
|
|
22569
23082
|
if (!await this.isAuthenticated()) {
|
|
22570
23083
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
22571
23084
|
}
|
|
@@ -22575,6 +23088,26 @@ var init_AuthenticationManager = __esm({
|
|
|
22575
23088
|
* Get current authenticated user
|
|
22576
23089
|
*/
|
|
22577
23090
|
async getCurrentUser() {
|
|
23091
|
+
await this.ensureInitialized();
|
|
23092
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
23093
|
+
const tokens2 = await this.tokenStorage.load();
|
|
23094
|
+
if (!tokens2) {
|
|
23095
|
+
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
23096
|
+
}
|
|
23097
|
+
return {
|
|
23098
|
+
id: "local-dev-user",
|
|
23099
|
+
email: "developer@localhost",
|
|
23100
|
+
name: "Local Developer",
|
|
23101
|
+
plan: "ULTRA",
|
|
23102
|
+
usage: {
|
|
23103
|
+
requests: Math.floor(Math.random() * 100),
|
|
23104
|
+
// Random usage for testing
|
|
23105
|
+
requestLimit: 999999,
|
|
23106
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
23107
|
+
},
|
|
23108
|
+
models: []
|
|
23109
|
+
};
|
|
23110
|
+
}
|
|
22578
23111
|
const tokens = await this.getValidTokens();
|
|
22579
23112
|
if (!tokens) {
|
|
22580
23113
|
throw new AuthenticationRequiredError(ERROR_MESSAGES.AUTH_REQUIRED);
|
|
@@ -22595,7 +23128,8 @@ var init_AuthenticationManager = __esm({
|
|
|
22595
23128
|
if (!response2.ok) {
|
|
22596
23129
|
throw new Error(`Failed to fetch user profile: ${response2.statusText}`);
|
|
22597
23130
|
}
|
|
22598
|
-
|
|
23131
|
+
const userData = await response2.json();
|
|
23132
|
+
return userData;
|
|
22599
23133
|
} catch (error2) {
|
|
22600
23134
|
if (error2 instanceof AuthenticationRequiredError || error2 instanceof QuotaExceededError) {
|
|
22601
23135
|
throw error2;
|
|
@@ -22607,11 +23141,15 @@ var init_AuthenticationManager = __esm({
|
|
|
22607
23141
|
* Login with OAuth2 PKCE flow
|
|
22608
23142
|
*/
|
|
22609
23143
|
async login(options = {}) {
|
|
23144
|
+
await this.ensureInitialized();
|
|
22610
23145
|
try {
|
|
22611
23146
|
if (await this.isAuthenticated() && !options.force) {
|
|
22612
23147
|
const user2 = await this.getCurrentUser();
|
|
22613
23148
|
return { success: true, user: user2 };
|
|
22614
23149
|
}
|
|
23150
|
+
if (process.env.MARIA_AUTH_MODE === "local") {
|
|
23151
|
+
return await this.loginWithLocalMock();
|
|
23152
|
+
}
|
|
22615
23153
|
let tokens;
|
|
22616
23154
|
if (options.device) {
|
|
22617
23155
|
tokens = await this.loginWithDeviceFlow();
|
|
@@ -22619,6 +23157,19 @@ var init_AuthenticationManager = __esm({
|
|
|
22619
23157
|
try {
|
|
22620
23158
|
tokens = await this.loginWithPKCEFlow();
|
|
22621
23159
|
} catch (error2) {
|
|
23160
|
+
if (error2.message?.includes("ECONNREFUSED") || error2.message?.includes("fetch failed")) {
|
|
23161
|
+
console.error("\n\u274C Authentication service is currently unavailable");
|
|
23162
|
+
console.error("Please try one of the following:");
|
|
23163
|
+
console.error("1. Set MARIA_AUTH_MODE=local for local development");
|
|
23164
|
+
console.error("2. Check your internet connection");
|
|
23165
|
+
console.error("3. Visit https://status.maria-code.ai for service status\n");
|
|
23166
|
+
if (!process.env.MARIA_AUTH_MODE) {
|
|
23167
|
+
console.log("\u{1F4A1} Tip: Run with local auth mode:");
|
|
23168
|
+
console.log(" export MARIA_AUTH_MODE=local");
|
|
23169
|
+
console.log(" maria /login\n");
|
|
23170
|
+
}
|
|
23171
|
+
throw new Error("Authentication service unavailable. See above for alternatives.");
|
|
23172
|
+
}
|
|
22622
23173
|
console.warn("PKCE flow failed, falling back to device flow");
|
|
22623
23174
|
tokens = await this.loginWithDeviceFlow();
|
|
22624
23175
|
}
|
|
@@ -22633,10 +23184,46 @@ var init_AuthenticationManager = __esm({
|
|
|
22633
23184
|
};
|
|
22634
23185
|
}
|
|
22635
23186
|
}
|
|
23187
|
+
/**
|
|
23188
|
+
* Local mock authentication for development
|
|
23189
|
+
*/
|
|
23190
|
+
async loginWithLocalMock() {
|
|
23191
|
+
console.log("\u{1F510} Local Development Mode - Mock Authentication");
|
|
23192
|
+
const mockTokens = {
|
|
23193
|
+
idToken: "mock-id-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23194
|
+
accessToken: "mock-access-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23195
|
+
refreshToken: "mock-refresh-token-" + import_crypto4.default.randomBytes(16).toString("hex"),
|
|
23196
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1e3
|
|
23197
|
+
// 24 hours
|
|
23198
|
+
};
|
|
23199
|
+
await this.tokenStorage.save(mockTokens);
|
|
23200
|
+
const mockUser = {
|
|
23201
|
+
id: "local-dev-user",
|
|
23202
|
+
email: "developer@localhost",
|
|
23203
|
+
name: "Local Developer",
|
|
23204
|
+
plan: "ULTRA",
|
|
23205
|
+
// Give full access in dev mode
|
|
23206
|
+
usage: {
|
|
23207
|
+
requests: 0,
|
|
23208
|
+
requestLimit: 999999,
|
|
23209
|
+
resetAt: Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
23210
|
+
},
|
|
23211
|
+
models: []
|
|
23212
|
+
};
|
|
23213
|
+
console.log("\u2705 Logged in as developer@localhost (Local Mode)");
|
|
23214
|
+
console.log(" Plan: Ultra (Development)");
|
|
23215
|
+
console.log(" All features enabled for testing\n");
|
|
23216
|
+
return {
|
|
23217
|
+
success: true,
|
|
23218
|
+
user: mockUser,
|
|
23219
|
+
tokens: mockTokens
|
|
23220
|
+
};
|
|
23221
|
+
}
|
|
22636
23222
|
/**
|
|
22637
23223
|
* Logout and clean up
|
|
22638
23224
|
*/
|
|
22639
23225
|
async logout(options = {}) {
|
|
23226
|
+
await this.ensureInitialized();
|
|
22640
23227
|
try {
|
|
22641
23228
|
const tokens = await this.tokenStorage.load();
|
|
22642
23229
|
if (tokens && !options.force) {
|
|
@@ -22658,6 +23245,7 @@ var init_AuthenticationManager = __esm({
|
|
|
22658
23245
|
* Refresh authentication token
|
|
22659
23246
|
*/
|
|
22660
23247
|
async refreshToken() {
|
|
23248
|
+
await this.ensureInitialized();
|
|
22661
23249
|
try {
|
|
22662
23250
|
const tokens = await this.tokenStorage.load();
|
|
22663
23251
|
if (!tokens?.refreshToken) return false;
|
|
@@ -22701,7 +23289,6 @@ var init_AuthenticationManager = __esm({
|
|
|
22701
23289
|
*/
|
|
22702
23290
|
async checkPlanAccess(feature) {
|
|
22703
23291
|
const user = await this.getCurrentUser();
|
|
22704
|
-
const freeFeatures = ["chat", "code", "help", "status", "version"];
|
|
22705
23292
|
const restrictedFeatures = ["image", "video", "voice", "advanced-search"];
|
|
22706
23293
|
if (user.plan === "FREE" && restrictedFeatures.includes(feature)) {
|
|
22707
23294
|
throw new PlanRestrictedError(ERROR_MESSAGES.PLAN_RESTRICTED);
|
|
@@ -23041,7 +23628,7 @@ function withAuth(fn) {
|
|
|
23041
23628
|
try {
|
|
23042
23629
|
const tokens = await authManager.getValidTokens();
|
|
23043
23630
|
if (!tokens) {
|
|
23044
|
-
console.log(
|
|
23631
|
+
console.log(import_chalk14.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23045
23632
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23046
23633
|
}
|
|
23047
23634
|
global.MARIA_ID_TOKEN = tokens.idToken;
|
|
@@ -23050,39 +23637,39 @@ function withAuth(fn) {
|
|
|
23050
23637
|
return await fn(...args);
|
|
23051
23638
|
} catch (error2) {
|
|
23052
23639
|
if (error2.code === "AUTH_REQUIRED") {
|
|
23053
|
-
console.log(
|
|
23640
|
+
console.log(import_chalk14.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
23054
23641
|
process.exit(AUTH_EXIT_CODES.AUTH_REQUIRED);
|
|
23055
23642
|
}
|
|
23056
23643
|
if (error2.code === "REAUTH_REQUIRED" || error2.code === "TOKEN_EXPIRED") {
|
|
23057
|
-
console.log(
|
|
23644
|
+
console.log(import_chalk14.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
23058
23645
|
process.exit(AUTH_EXIT_CODES.REAUTH_REQUIRED);
|
|
23059
23646
|
}
|
|
23060
23647
|
if (error2.code === "QUOTA_EXCEEDED") {
|
|
23061
|
-
console.log(
|
|
23648
|
+
console.log(import_chalk14.default.yellow("\u26A0 Quota exceeded \xB7 Run: maria /billing"));
|
|
23062
23649
|
process.exit(AUTH_EXIT_CODES.QUOTA_EXCEEDED);
|
|
23063
23650
|
}
|
|
23064
23651
|
if (error2.code === "PLAN_RESTRICTED") {
|
|
23065
|
-
console.log(
|
|
23652
|
+
console.log(import_chalk14.default.yellow("\u{1F512} Not available in current plan"));
|
|
23066
23653
|
process.exit(AUTH_EXIT_CODES.PLAN_RESTRICTED);
|
|
23067
23654
|
}
|
|
23068
23655
|
if (error2.code === "RATE_LIMITED") {
|
|
23069
23656
|
const retryAfter = error2.retryAfter || 5;
|
|
23070
|
-
console.log(
|
|
23657
|
+
console.log(import_chalk14.default.yellow(`\u23F1\uFE0F Rate limit: wait ${retryAfter}s`));
|
|
23071
23658
|
process.exit(AUTH_EXIT_CODES.RATE_LIMITED);
|
|
23072
23659
|
}
|
|
23073
23660
|
if (error2.code === "NETWORK_ERROR") {
|
|
23074
|
-
console.log(
|
|
23661
|
+
console.log(import_chalk14.default.red("\u{1F310} Network error, check connection"));
|
|
23075
23662
|
process.exit(AUTH_EXIT_CODES.NETWORK_ERROR);
|
|
23076
23663
|
}
|
|
23077
23664
|
throw error2;
|
|
23078
23665
|
}
|
|
23079
23666
|
};
|
|
23080
23667
|
}
|
|
23081
|
-
var
|
|
23668
|
+
var import_chalk14, AUTH_EXIT_CODES, AUTH_EXEMPT_COMMANDS;
|
|
23082
23669
|
var init_withAuth = __esm({
|
|
23083
23670
|
"src/services/cli-auth/withAuth.ts"() {
|
|
23084
23671
|
init_AuthenticationManager();
|
|
23085
|
-
|
|
23672
|
+
import_chalk14 = __toESM(require("chalk"), 1);
|
|
23086
23673
|
AUTH_EXIT_CODES = {
|
|
23087
23674
|
AUTH_REQUIRED: 2,
|
|
23088
23675
|
REAUTH_REQUIRED: 2,
|
|
@@ -23305,19 +23892,19 @@ var conversation_persistence_exports = {};
|
|
|
23305
23892
|
__export(conversation_persistence_exports, {
|
|
23306
23893
|
ConversationPersistence: () => ConversationPersistence
|
|
23307
23894
|
});
|
|
23308
|
-
var import_fs3, path6,
|
|
23895
|
+
var import_fs3, path6, os5, ConversationPersistence;
|
|
23309
23896
|
var init_conversation_persistence = __esm({
|
|
23310
23897
|
"src/services/conversation-persistence.ts"() {
|
|
23311
23898
|
import_fs3 = require("fs");
|
|
23312
23899
|
path6 = __toESM(require("path"), 1);
|
|
23313
|
-
|
|
23900
|
+
os5 = __toESM(require("os"), 1);
|
|
23314
23901
|
ConversationPersistence = class {
|
|
23315
23902
|
sessionFile;
|
|
23316
23903
|
maxHistorySize;
|
|
23317
23904
|
autoSaveInterval = null;
|
|
23318
23905
|
pendingWrites = [];
|
|
23319
23906
|
constructor(maxHistorySize = 100) {
|
|
23320
|
-
const configDir = path6.join(
|
|
23907
|
+
const configDir = path6.join(os5.homedir(), ".maria");
|
|
23321
23908
|
this.sessionFile = path6.join(configDir, "conversation-history.json");
|
|
23322
23909
|
this.maxHistorySize = maxHistorySize;
|
|
23323
23910
|
this.ensureConfigDir();
|
|
@@ -26506,10 +27093,10 @@ var init_command_groups = __esm({
|
|
|
26506
27093
|
});
|
|
26507
27094
|
|
|
26508
27095
|
// src/services/autocomplete-dropdown.ts
|
|
26509
|
-
var
|
|
27096
|
+
var import_chalk15, AutocompleteDropdown;
|
|
26510
27097
|
var init_autocomplete_dropdown = __esm({
|
|
26511
27098
|
"src/services/autocomplete-dropdown.ts"() {
|
|
26512
|
-
|
|
27099
|
+
import_chalk15 = __toESM(require("chalk"), 1);
|
|
26513
27100
|
AutocompleteDropdown = class {
|
|
26514
27101
|
suggestions = [];
|
|
26515
27102
|
selectedIndex = 0;
|
|
@@ -26589,21 +27176,21 @@ var init_autocomplete_dropdown = __esm({
|
|
|
26589
27176
|
process.stdout.write("\x1B[s");
|
|
26590
27177
|
process.stdout.write("\n");
|
|
26591
27178
|
process.stdout.write(
|
|
26592
|
-
"\x1B[K" +
|
|
27179
|
+
"\x1B[K" + import_chalk15.default.white(
|
|
26593
27180
|
"\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
27181
|
) + "\n"
|
|
26595
27182
|
);
|
|
26596
27183
|
this.suggestions.forEach((suggestion, index) => {
|
|
26597
27184
|
const isSelected = index === this.selectedIndex;
|
|
26598
|
-
const prefix = isSelected ?
|
|
26599
|
-
const nameStyle = isSelected ?
|
|
27185
|
+
const prefix = isSelected ? import_chalk15.default.cyan("\u25BA ") : " ";
|
|
27186
|
+
const nameStyle = isSelected ? import_chalk15.default.inverse : (s2) => s2;
|
|
26600
27187
|
const displayName = suggestion.name.padEnd(20);
|
|
26601
27188
|
const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
|
|
26602
|
-
const line = `\u2502${prefix}${nameStyle(
|
|
27189
|
+
const line = `\u2502${prefix}${nameStyle(import_chalk15.default.white(displayName) + " " + import_chalk15.default.gray(displayDesc))} \u2502`;
|
|
26603
27190
|
process.stdout.write("\x1B[K" + line + "\n");
|
|
26604
27191
|
});
|
|
26605
27192
|
process.stdout.write(
|
|
26606
|
-
"\x1B[K" +
|
|
27193
|
+
"\x1B[K" + import_chalk15.default.white(
|
|
26607
27194
|
"\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
27195
|
) + "\n"
|
|
26609
27196
|
);
|
|
@@ -26641,11 +27228,11 @@ var interactive_cli_exports = {};
|
|
|
26641
27228
|
__export(interactive_cli_exports, {
|
|
26642
27229
|
InteractiveCLI: () => InteractiveCLI
|
|
26643
27230
|
});
|
|
26644
|
-
var readline3,
|
|
27231
|
+
var readline3, import_chalk16, import_promises2, import_path3, import_os2, InteractiveCLI;
|
|
26645
27232
|
var init_interactive_cli = __esm({
|
|
26646
27233
|
"src/services/interactive-cli.ts"() {
|
|
26647
27234
|
readline3 = __toESM(require("readline"), 1);
|
|
26648
|
-
|
|
27235
|
+
import_chalk16 = __toESM(require("chalk"), 1);
|
|
26649
27236
|
init_command_groups();
|
|
26650
27237
|
init_autocomplete_dropdown();
|
|
26651
27238
|
init_defaults();
|
|
@@ -26944,7 +27531,7 @@ var init_interactive_cli = __esm({
|
|
|
26944
27531
|
}
|
|
26945
27532
|
readline3.cursorTo(process.stdout, 0);
|
|
26946
27533
|
readline3.clearLine(process.stdout, 0);
|
|
26947
|
-
const prompt =
|
|
27534
|
+
const prompt = import_chalk16.default.cyan("> ");
|
|
26948
27535
|
const displayInput = this.currentInput;
|
|
26949
27536
|
process.stdout.write(prompt + displayInput);
|
|
26950
27537
|
const promptLength = 2;
|
|
@@ -26964,9 +27551,9 @@ var init_interactive_cli = __esm({
|
|
|
26964
27551
|
readline3.moveCursor(process.stdout, 0, 2);
|
|
26965
27552
|
this.suggestions.forEach((suggestion, index) => {
|
|
26966
27553
|
const isSelected = index === this.selectedIndex;
|
|
26967
|
-
const prefix = isSelected ?
|
|
26968
|
-
const nameStyle = isSelected ?
|
|
26969
|
-
const descStyle = isSelected ?
|
|
27554
|
+
const prefix = isSelected ? import_chalk16.default.cyan("\u25BA ") : " ";
|
|
27555
|
+
const nameStyle = isSelected ? import_chalk16.default.inverse.white : import_chalk16.default.white;
|
|
27556
|
+
const descStyle = isSelected ? import_chalk16.default.inverse.gray : import_chalk16.default.gray;
|
|
26970
27557
|
const name2 = suggestion.name.padEnd(15);
|
|
26971
27558
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
26972
27559
|
readline3.cursorTo(process.stdout, 0);
|
|
@@ -26987,20 +27574,20 @@ var init_interactive_cli = __esm({
|
|
|
26987
27574
|
const promptLength = 2;
|
|
26988
27575
|
const savedX = this.cursorPosition + promptLength;
|
|
26989
27576
|
process.stdout.write("\n");
|
|
26990
|
-
process.stdout.write(
|
|
27577
|
+
process.stdout.write(import_chalk16.default.white("\u256D\u2500\u2500\u2500\u2500 Command Suggestions \u2500\u2500\u2500\u2500\u256E\n"));
|
|
26991
27578
|
this.suggestions.forEach((suggestion, index) => {
|
|
26992
27579
|
const isSelected = index === this.selectedIndex;
|
|
26993
|
-
const prefix = isSelected ?
|
|
26994
|
-
const nameStyle = isSelected ?
|
|
26995
|
-
const descStyle = isSelected ?
|
|
27580
|
+
const prefix = isSelected ? import_chalk16.default.cyan("\u25BA ") : " ";
|
|
27581
|
+
const nameStyle = isSelected ? import_chalk16.default.inverse.white : import_chalk16.default.white;
|
|
27582
|
+
const descStyle = isSelected ? import_chalk16.default.inverse.gray : import_chalk16.default.gray;
|
|
26996
27583
|
const name2 = suggestion.name.padEnd(15);
|
|
26997
27584
|
const desc = suggestion.description.length > 40 ? suggestion.description.substring(0, 37) + "..." : suggestion.description;
|
|
26998
27585
|
process.stdout.write(`${prefix}${nameStyle(name2)} ${descStyle(desc)}
|
|
26999
27586
|
`);
|
|
27000
27587
|
});
|
|
27001
|
-
process.stdout.write(
|
|
27588
|
+
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
27589
|
process.stdout.write(
|
|
27003
|
-
|
|
27590
|
+
import_chalk16.default.dim("\u2191/\u2193: Navigate \u2022 Tab/Enter: Select \u2022 Esc: Cancel")
|
|
27004
27591
|
);
|
|
27005
27592
|
const totalLines = this.suggestions.length + 4;
|
|
27006
27593
|
readline3.moveCursor(process.stdout, 0, -totalLines);
|
|
@@ -27463,15 +28050,15 @@ ${this.description}
|
|
|
27463
28050
|
});
|
|
27464
28051
|
|
|
27465
28052
|
// src/services/memory-system/quick-persistence.ts
|
|
27466
|
-
var fs8, fsp,
|
|
28053
|
+
var fs8, fsp, os7, path8, import_crypto5, DIR, FILE, QuickPersistence;
|
|
27467
28054
|
var init_quick_persistence = __esm({
|
|
27468
28055
|
"src/services/memory-system/quick-persistence.ts"() {
|
|
27469
28056
|
fs8 = __toESM(require("fs"), 1);
|
|
27470
28057
|
fsp = __toESM(require("fs/promises"), 1);
|
|
27471
|
-
|
|
28058
|
+
os7 = __toESM(require("os"), 1);
|
|
27472
28059
|
path8 = __toESM(require("path"), 1);
|
|
27473
28060
|
import_crypto5 = require("crypto");
|
|
27474
|
-
DIR = path8.join(
|
|
28061
|
+
DIR = path8.join(os7.homedir(), ".maria", "memory");
|
|
27475
28062
|
FILE = path8.join(DIR, "memories.jsonl");
|
|
27476
28063
|
QuickPersistence = class {
|
|
27477
28064
|
static async init() {
|
|
@@ -27594,7 +28181,7 @@ var init_quick_persistence = __esm({
|
|
|
27594
28181
|
const mine = rows.filter((r2) => r2.userId === userId);
|
|
27595
28182
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
27596
28183
|
const filename = `maria-memory-export-${timestamp}.${format}`;
|
|
27597
|
-
const exportDir = path8.join(
|
|
28184
|
+
const exportDir = path8.join(os7.homedir(), ".maria", "exports");
|
|
27598
28185
|
const exportPath = path8.join(exportDir, filename);
|
|
27599
28186
|
await fsp.mkdir(exportDir, { recursive: true });
|
|
27600
28187
|
if (format === "jsonl") {
|
|
@@ -29634,14 +30221,14 @@ __export(HelpCommand_exports, {
|
|
|
29634
30221
|
HelpCommand: () => HelpCommand,
|
|
29635
30222
|
meta: () => meta
|
|
29636
30223
|
});
|
|
29637
|
-
var
|
|
30224
|
+
var import_chalk17, HelpCommand, meta;
|
|
29638
30225
|
var init_HelpCommand = __esm({
|
|
29639
30226
|
"src/slash-commands/categories/core/handlers/HelpCommand.ts"() {
|
|
29640
30227
|
init_base_command();
|
|
29641
30228
|
init_ReadyCommandsService();
|
|
29642
30229
|
init_telemetry_helper();
|
|
29643
30230
|
init_subscription_manager();
|
|
29644
|
-
|
|
30231
|
+
import_chalk17 = __toESM(require("chalk"), 1);
|
|
29645
30232
|
HelpCommand = class extends BaseCommand {
|
|
29646
30233
|
name = "help";
|
|
29647
30234
|
category = "core";
|
|
@@ -29756,9 +30343,9 @@ var init_HelpCommand = __esm({
|
|
|
29756
30343
|
const stats = await this.readyService.getStatistics();
|
|
29757
30344
|
const lines = [];
|
|
29758
30345
|
lines.push("\u2550".repeat(60));
|
|
29759
|
-
lines.push(
|
|
30346
|
+
lines.push(import_chalk17.default.bold(`${stats.totalReady} READY Commands | ${stats.categoriesCount} Categories`));
|
|
29760
30347
|
lines.push("");
|
|
29761
|
-
lines.push(
|
|
30348
|
+
lines.push(import_chalk17.default.bold("Quick Access:"));
|
|
29762
30349
|
lines.push(" /help <command> - Detailed help for specific command");
|
|
29763
30350
|
lines.push(" /help --quickstart - Essential commands for new users");
|
|
29764
30351
|
lines.push(" /help --stats - Performance statistics");
|
|
@@ -29773,7 +30360,7 @@ var init_HelpCommand = __esm({
|
|
|
29773
30360
|
}
|
|
29774
30361
|
globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
|
|
29775
30362
|
for (const category of categories) {
|
|
29776
|
-
lines.push(
|
|
30363
|
+
lines.push(import_chalk17.default.bold(`${category.name.toUpperCase()} (${category.count})`));
|
|
29777
30364
|
const showCommands = category.commands.slice(0, 4);
|
|
29778
30365
|
for (const cmd of showCommands) {
|
|
29779
30366
|
const needsGpu = this.hasGpuRequirement(cmd.description);
|
|
@@ -29793,7 +30380,7 @@ var init_HelpCommand = __esm({
|
|
|
29793
30380
|
}
|
|
29794
30381
|
lines.push("");
|
|
29795
30382
|
}
|
|
29796
|
-
lines.push(
|
|
30383
|
+
lines.push(import_chalk17.default.bold("Pro Tips:"));
|
|
29797
30384
|
lines.push(" \u2022 All listed commands are production-ready");
|
|
29798
30385
|
lines.push(" \u2022 Use fuzzy search: /help --search confi \u2192 finds /config");
|
|
29799
30386
|
lines.push(" \u2022 Categories ordered by importance");
|
|
@@ -29832,33 +30419,33 @@ var init_HelpCommand = __esm({
|
|
|
29832
30419
|
formatCommandHelp(command) {
|
|
29833
30420
|
const lines = [];
|
|
29834
30421
|
lines.push("");
|
|
29835
|
-
lines.push(`\u{1F4D6} ${
|
|
30422
|
+
lines.push(`\u{1F4D6} ${import_chalk17.default.bold(`/${command.name}`)} - ${command.description}`);
|
|
29836
30423
|
lines.push("\u2550".repeat(50));
|
|
29837
30424
|
lines.push("");
|
|
29838
|
-
lines.push(
|
|
30425
|
+
lines.push(import_chalk17.default.bold("\u2139\uFE0F Information:"));
|
|
29839
30426
|
lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
|
|
29840
30427
|
lines.push(` Status: \u2705 READY (contract validated)`);
|
|
29841
30428
|
if (command.aliases && command.aliases.length > 0) {
|
|
29842
30429
|
lines.push(` Aliases: ${command.aliases.map((a2) => `/${a2}`).join(", ")}`);
|
|
29843
30430
|
}
|
|
29844
30431
|
lines.push("");
|
|
29845
|
-
lines.push(
|
|
30432
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Usage:"));
|
|
29846
30433
|
lines.push(` ${command.usage}`);
|
|
29847
30434
|
lines.push("");
|
|
29848
|
-
lines.push(
|
|
30435
|
+
lines.push(import_chalk17.default.bold("\u{1F4CB} Contract Validation:"));
|
|
29849
30436
|
lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
|
|
29850
30437
|
lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29851
30438
|
lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29852
30439
|
lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
|
|
29853
30440
|
lines.push("");
|
|
29854
30441
|
if (command.examples && command.examples.length > 0) {
|
|
29855
|
-
lines.push(
|
|
30442
|
+
lines.push(import_chalk17.default.bold("\u{1F4DD} Examples:"));
|
|
29856
30443
|
for (const example of command.examples) {
|
|
29857
30444
|
lines.push(` ${example}`);
|
|
29858
30445
|
}
|
|
29859
30446
|
lines.push("");
|
|
29860
30447
|
}
|
|
29861
|
-
lines.push(
|
|
30448
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Quick Tips:"));
|
|
29862
30449
|
lines.push(` \u2022 This command is production-ready and fully tested`);
|
|
29863
30450
|
lines.push(` \u2022 Try /${command.name} --help for additional options`);
|
|
29864
30451
|
if (command.category !== "core") {
|
|
@@ -29909,7 +30496,7 @@ var init_HelpCommand = __esm({
|
|
|
29909
30496
|
};
|
|
29910
30497
|
const emoji = emojiMap[categoryName.toLowerCase()] || "\u{1F4CB}";
|
|
29911
30498
|
lines.push("");
|
|
29912
|
-
lines.push(`${emoji} ${
|
|
30499
|
+
lines.push(`${emoji} ${import_chalk17.default.bold(categoryName.toUpperCase() + " COMMANDS")} (${commands.length} READY)`);
|
|
29913
30500
|
lines.push("\u2550".repeat(50));
|
|
29914
30501
|
lines.push("");
|
|
29915
30502
|
const maxNameLength = Math.max(...commands.map((c) => c.name.length)) + 1;
|
|
@@ -29943,7 +30530,7 @@ var init_HelpCommand = __esm({
|
|
|
29943
30530
|
formatSearchResults(searchTerm, results) {
|
|
29944
30531
|
const lines = [];
|
|
29945
30532
|
lines.push("");
|
|
29946
|
-
lines.push(`\u{1F50D} ${
|
|
30533
|
+
lines.push(`\u{1F50D} ${import_chalk17.default.bold("SEARCH RESULTS")} for "${searchTerm}" (${results.length} matches)`);
|
|
29947
30534
|
lines.push("\u2550".repeat(50));
|
|
29948
30535
|
lines.push("");
|
|
29949
30536
|
for (const result of results) {
|
|
@@ -29956,7 +30543,7 @@ var init_HelpCommand = __esm({
|
|
|
29956
30543
|
}
|
|
29957
30544
|
lines.push("");
|
|
29958
30545
|
}
|
|
29959
|
-
lines.push(
|
|
30546
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Tip:") + " Higher scores indicate better matches");
|
|
29960
30547
|
lines.push("");
|
|
29961
30548
|
return lines.join("\n");
|
|
29962
30549
|
}
|
|
@@ -29967,38 +30554,38 @@ var init_HelpCommand = __esm({
|
|
|
29967
30554
|
const quickCommands = await this.readyService.getQuickStartCommands();
|
|
29968
30555
|
const lines = [];
|
|
29969
30556
|
lines.push("");
|
|
29970
|
-
lines.push(`\u{1F680} ${
|
|
30557
|
+
lines.push(`\u{1F680} ${import_chalk17.default.bold("MARIA QUICKSTART")} - Essential Commands`);
|
|
29971
30558
|
lines.push("\u2550".repeat(50));
|
|
29972
30559
|
lines.push("");
|
|
29973
|
-
lines.push(
|
|
30560
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Get Started in 3 Steps:"));
|
|
29974
30561
|
lines.push("");
|
|
29975
|
-
lines.push(
|
|
30562
|
+
lines.push(import_chalk17.default.bold("1\uFE0F\u20E3 Configure Your AI Provider"));
|
|
29976
30563
|
const modelCmd = quickCommands.find((c) => c.name === "model");
|
|
29977
30564
|
if (modelCmd) {
|
|
29978
30565
|
lines.push(` /${modelCmd.name} - ${modelCmd.description}`);
|
|
29979
30566
|
lines.push(` Try: /model set provider=openai key=sk-...`);
|
|
29980
30567
|
}
|
|
29981
30568
|
lines.push("");
|
|
29982
|
-
lines.push(
|
|
30569
|
+
lines.push(import_chalk17.default.bold("2\uFE0F\u20E3 Check System Status"));
|
|
29983
30570
|
const statusCmd = quickCommands.find((c) => c.name === "status");
|
|
29984
30571
|
if (statusCmd) {
|
|
29985
30572
|
lines.push(` /${statusCmd.name} - ${statusCmd.description}`);
|
|
29986
30573
|
lines.push(` Try: /status`);
|
|
29987
30574
|
}
|
|
29988
30575
|
lines.push("");
|
|
29989
|
-
lines.push(
|
|
30576
|
+
lines.push(import_chalk17.default.bold("3\uFE0F\u20E3 Start Coding"));
|
|
29990
30577
|
const codeCmd = quickCommands.find((c) => c.name === "code");
|
|
29991
30578
|
if (codeCmd) {
|
|
29992
30579
|
lines.push(` /${codeCmd.name} - ${codeCmd.description}`);
|
|
29993
30580
|
lines.push(` Try: /code create a hello world function`);
|
|
29994
30581
|
}
|
|
29995
30582
|
lines.push("");
|
|
29996
|
-
lines.push(
|
|
30583
|
+
lines.push(import_chalk17.default.bold("\u{1F527} Essential Commands:"));
|
|
29997
30584
|
for (const cmd of quickCommands) {
|
|
29998
30585
|
lines.push(` /${cmd.name.padEnd(12)} - ${cmd.description}`);
|
|
29999
30586
|
}
|
|
30000
30587
|
lines.push("");
|
|
30001
|
-
lines.push(
|
|
30588
|
+
lines.push(import_chalk17.default.bold("\u{1F4A1} Next Steps:"));
|
|
30002
30589
|
lines.push(" \u2022 /help --category <name> - Explore command categories");
|
|
30003
30590
|
lines.push(" \u2022 /help --search <term> - Find specific functionality");
|
|
30004
30591
|
lines.push(" \u2022 /help <command> - Get detailed command help");
|
|
@@ -30013,20 +30600,20 @@ var init_HelpCommand = __esm({
|
|
|
30013
30600
|
const categories = await this.readyService.getCategories();
|
|
30014
30601
|
const lines = [];
|
|
30015
30602
|
lines.push("");
|
|
30016
|
-
lines.push(`\u{1F4CA} ${
|
|
30603
|
+
lines.push(`\u{1F4CA} ${import_chalk17.default.bold("READY COMMANDS STATISTICS")}`);
|
|
30017
30604
|
lines.push("\u2550".repeat(40));
|
|
30018
30605
|
lines.push("");
|
|
30019
|
-
lines.push(
|
|
30606
|
+
lines.push(import_chalk17.default.bold("\u{1F3AF} Overall:"));
|
|
30020
30607
|
lines.push(` Total READY Commands: ${stats.totalReady}`);
|
|
30021
30608
|
lines.push(` Categories: ${stats.categoriesCount}`);
|
|
30022
30609
|
lines.push(` Last Updated: ${stats.lastUpdated?.toLocaleString() || "Unknown"}`);
|
|
30023
30610
|
lines.push("");
|
|
30024
|
-
lines.push(
|
|
30611
|
+
lines.push(import_chalk17.default.bold("\u26A1 Performance:"));
|
|
30025
30612
|
lines.push(` Average Response Time: ${stats.avgResponseTime}ms`);
|
|
30026
30613
|
lines.push(` Fastest Command: /${stats.fastestCommand}`);
|
|
30027
30614
|
lines.push(` Slowest Command: /${stats.slowestCommand}`);
|
|
30028
30615
|
lines.push("");
|
|
30029
|
-
lines.push(
|
|
30616
|
+
lines.push(import_chalk17.default.bold("\u{1F4CB} By Category:"));
|
|
30030
30617
|
for (const category of categories) {
|
|
30031
30618
|
const avgTime = Math.round(
|
|
30032
30619
|
category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
|
|
@@ -30034,7 +30621,7 @@ var init_HelpCommand = __esm({
|
|
|
30034
30621
|
lines.push(` ${category.emoji} ${category.name.padEnd(15)}: ${category.count.toString().padStart(2)} commands (${avgTime}ms avg)`);
|
|
30035
30622
|
}
|
|
30036
30623
|
lines.push("");
|
|
30037
|
-
lines.push(
|
|
30624
|
+
lines.push(import_chalk17.default.bold("\u2705 Contract Validation:"));
|
|
30038
30625
|
lines.push(" All commands tested for:");
|
|
30039
30626
|
lines.push(" \u2022 Basic execution without crashes");
|
|
30040
30627
|
lines.push(" \u2022 TTY/non-TTY/pipe compatibility");
|
|
@@ -30208,10 +30795,10 @@ var init_LoginCommand = __esm({
|
|
|
30208
30795
|
if (!authResult.success) {
|
|
30209
30796
|
return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
|
|
30210
30797
|
}
|
|
30211
|
-
const
|
|
30212
|
-
const plan =
|
|
30213
|
-
const quotaLeft =
|
|
30214
|
-
const email =
|
|
30798
|
+
const userInfo2 = authResult.user;
|
|
30799
|
+
const plan = userInfo2?.plan || "Free";
|
|
30800
|
+
const quotaLeft = userInfo2?.usage?.requestsRemaining || 100;
|
|
30801
|
+
const email = userInfo2?.email || "user";
|
|
30215
30802
|
await trackCommand({
|
|
30216
30803
|
cmd: "login",
|
|
30217
30804
|
status: "success",
|
|
@@ -30251,11 +30838,11 @@ var init_LoginCommand = __esm({
|
|
|
30251
30838
|
});
|
|
30252
30839
|
|
|
30253
30840
|
// src/services/model-selector-ui.ts
|
|
30254
|
-
var readline4,
|
|
30841
|
+
var readline4, import_chalk18, ModelSelectorUI;
|
|
30255
30842
|
var init_model_selector_ui = __esm({
|
|
30256
30843
|
"src/services/model-selector-ui.ts"() {
|
|
30257
30844
|
readline4 = __toESM(require("readline"), 1);
|
|
30258
|
-
|
|
30845
|
+
import_chalk18 = __toESM(require("chalk"), 1);
|
|
30259
30846
|
ModelSelectorUI = class {
|
|
30260
30847
|
models = [];
|
|
30261
30848
|
selectedIndex = 0;
|
|
@@ -30282,7 +30869,7 @@ var init_model_selector_ui = __esm({
|
|
|
30282
30869
|
output: process.stdout,
|
|
30283
30870
|
terminal: true
|
|
30284
30871
|
});
|
|
30285
|
-
console.log(
|
|
30872
|
+
console.log(import_chalk18.default.green(
|
|
30286
30873
|
"\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
30874
|
));
|
|
30288
30875
|
process.stdout.write("\x1B7");
|
|
@@ -30350,14 +30937,14 @@ var init_model_selector_ui = __esm({
|
|
|
30350
30937
|
}
|
|
30351
30938
|
renderFromSavedPosition() {
|
|
30352
30939
|
if (this.isDestroyed) return;
|
|
30353
|
-
console.log(
|
|
30354
|
-
"\u2502 " +
|
|
30940
|
+
console.log(import_chalk18.default.green(
|
|
30941
|
+
"\u2502 " + import_chalk18.default.greenBright("SELECT MODEL:") + " ".repeat(62) + "\u2502"
|
|
30355
30942
|
));
|
|
30356
30943
|
this.renderContent();
|
|
30357
30944
|
const scrollInfo = `[${this.selectedIndex + 1}/${this.models.length}]`;
|
|
30358
30945
|
const helpText = `\u2193:NEXT \u2191:PREV ENTER:EXEC ESC:ABORT ${scrollInfo}`;
|
|
30359
|
-
console.log(
|
|
30360
|
-
console.log(
|
|
30946
|
+
console.log(import_chalk18.default.green("\u2502 ") + import_chalk18.default.dim.green(helpText.padEnd(76)) + import_chalk18.default.green(" \u2502"));
|
|
30947
|
+
console.log(import_chalk18.default.green(
|
|
30361
30948
|
"\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
30949
|
));
|
|
30363
30950
|
}
|
|
@@ -30398,19 +30985,19 @@ var init_model_selector_ui = __esm({
|
|
|
30398
30985
|
const item = displayItems[i2];
|
|
30399
30986
|
if (item.type === "group") {
|
|
30400
30987
|
console.log(
|
|
30401
|
-
|
|
30988
|
+
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
30989
|
);
|
|
30403
30990
|
} else {
|
|
30404
30991
|
const isSelected = item.modelIndex === this.selectedIndex;
|
|
30405
|
-
const prefix = isSelected ?
|
|
30992
|
+
const prefix = isSelected ? import_chalk18.default.greenBright("\u25B6 ") : " ";
|
|
30406
30993
|
const modelText = item.content;
|
|
30407
30994
|
if (isSelected) {
|
|
30408
30995
|
console.log(
|
|
30409
|
-
|
|
30996
|
+
import_chalk18.default.green("\u2502") + prefix + import_chalk18.default.black.bgGreen(modelText.padEnd(75)) + import_chalk18.default.green("\u2502")
|
|
30410
30997
|
);
|
|
30411
30998
|
} else {
|
|
30412
30999
|
console.log(
|
|
30413
|
-
|
|
31000
|
+
import_chalk18.default.green("\u2502") + prefix + import_chalk18.default.green(modelText.substring(0, 75).padEnd(75)) + import_chalk18.default.green("\u2502")
|
|
30414
31001
|
);
|
|
30415
31002
|
}
|
|
30416
31003
|
}
|
|
@@ -32662,8 +33249,8 @@ async function loadServices() {
|
|
|
32662
33249
|
try {
|
|
32663
33250
|
const commandName = command.startsWith("/") ? command.slice(1) : command;
|
|
32664
33251
|
if (commandName === "battlecard") {
|
|
32665
|
-
console.log(
|
|
32666
|
-
console.log(
|
|
33252
|
+
console.log(import_chalk19.default.yellow("\u{1F512} /battlecard is not available on Free plan"));
|
|
33253
|
+
console.log(import_chalk19.default.gray(" Join the waitlist for business features: https://maria-code.ai/waitlist"));
|
|
32667
33254
|
return {
|
|
32668
33255
|
success: false,
|
|
32669
33256
|
message: "Command not available on Free plan"
|
|
@@ -32724,7 +33311,7 @@ async function loadServices() {
|
|
|
32724
33311
|
commandManager.setLegacyHandler(legacyHandlerAdapter);
|
|
32725
33312
|
}
|
|
32726
33313
|
} catch (e2) {
|
|
32727
|
-
console.warn(
|
|
33314
|
+
console.warn(import_chalk19.default.yellow("\u26A0 Some services unavailable, using fallbacks"));
|
|
32728
33315
|
}
|
|
32729
33316
|
}
|
|
32730
33317
|
async function init() {
|
|
@@ -32838,20 +33425,20 @@ async function enforceAuth(cmd) {
|
|
|
32838
33425
|
try {
|
|
32839
33426
|
const tokens = await authManager.getValidTokens();
|
|
32840
33427
|
if (!tokens) {
|
|
32841
|
-
console.log(
|
|
33428
|
+
console.log(import_chalk19.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32842
33429
|
process.exit(2);
|
|
32843
33430
|
return false;
|
|
32844
33431
|
}
|
|
32845
33432
|
return true;
|
|
32846
33433
|
} catch (error2) {
|
|
32847
33434
|
if (error2.code === "AUTH_REQUIRED") {
|
|
32848
|
-
console.log(
|
|
33435
|
+
console.log(import_chalk19.default.red("\u{1F510} Authentication required \xB7 Run: maria /login"));
|
|
32849
33436
|
process.exit(2);
|
|
32850
33437
|
} else if (error2.code === "REAUTH_REQUIRED") {
|
|
32851
|
-
console.log(
|
|
33438
|
+
console.log(import_chalk19.default.yellow("\u{1F504} Please re-authenticate \xB7 Run: maria /login"));
|
|
32852
33439
|
process.exit(2);
|
|
32853
33440
|
} else {
|
|
32854
|
-
console.log(
|
|
33441
|
+
console.log(import_chalk19.default.red("\u{1F310} Network error, check connection"));
|
|
32855
33442
|
process.exit(1);
|
|
32856
33443
|
}
|
|
32857
33444
|
return false;
|
|
@@ -32891,7 +33478,7 @@ async function handleSlash(input3) {
|
|
|
32891
33478
|
console.log(JSON.stringify(result.data, null, 2));
|
|
32892
33479
|
}
|
|
32893
33480
|
} else {
|
|
32894
|
-
console.log(
|
|
33481
|
+
console.log(import_chalk19.default.red(`Help Error: ${result.message}`));
|
|
32895
33482
|
}
|
|
32896
33483
|
return true;
|
|
32897
33484
|
}
|
|
@@ -32899,7 +33486,7 @@ async function handleSlash(input3) {
|
|
|
32899
33486
|
if (process.env.MARIA_DEBUG === "1") {
|
|
32900
33487
|
console.error("HelpCommand error:", helpError);
|
|
32901
33488
|
}
|
|
32902
|
-
console.log(
|
|
33489
|
+
console.log(import_chalk19.default.yellow("\u26A0 Dynamic help unavailable, using fallback"));
|
|
32903
33490
|
}
|
|
32904
33491
|
const help = `
|
|
32905
33492
|
\u{1F4D6} MARIA CLI Help
|
|
@@ -32924,7 +33511,7 @@ Chat:
|
|
|
32924
33511
|
session.length = 0;
|
|
32925
33512
|
if (ctx?.clearContext) ctx.clearContext();
|
|
32926
33513
|
console.clear();
|
|
32927
|
-
console.log(
|
|
33514
|
+
console.log(import_chalk19.default.cyan("\u2728 Session cleared"));
|
|
32928
33515
|
return true;
|
|
32929
33516
|
}
|
|
32930
33517
|
if (cmd === "code") {
|
|
@@ -32932,7 +33519,7 @@ Chat:
|
|
|
32932
33519
|
const prompt = args.join(" ").trim();
|
|
32933
33520
|
if (!prompt) {
|
|
32934
33521
|
console.log(
|
|
32935
|
-
|
|
33522
|
+
import_chalk19.default.red("Usage: /code <request> e.g. /code build a REST API")
|
|
32936
33523
|
);
|
|
32937
33524
|
return true;
|
|
32938
33525
|
}
|
|
@@ -32944,7 +33531,7 @@ Chat:
|
|
|
32944
33531
|
const prompt = args.join(" ").trim();
|
|
32945
33532
|
if (!prompt) {
|
|
32946
33533
|
console.log(
|
|
32947
|
-
|
|
33534
|
+
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
33535
|
);
|
|
32949
33536
|
return true;
|
|
32950
33537
|
}
|
|
@@ -32956,14 +33543,14 @@ Chat:
|
|
|
32956
33543
|
options: {},
|
|
32957
33544
|
logger: {
|
|
32958
33545
|
info: (msg) => console.log(msg),
|
|
32959
|
-
error: (msg) => console.error(
|
|
32960
|
-
warn: (msg) => console.warn(
|
|
33546
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33547
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
32961
33548
|
}
|
|
32962
33549
|
};
|
|
32963
33550
|
await imageCommand2.execute(context2);
|
|
32964
33551
|
}
|
|
32965
33552
|
} catch (error2) {
|
|
32966
|
-
console.error(
|
|
33553
|
+
console.error(import_chalk19.default.red("Image generation failed:"), error2.message);
|
|
32967
33554
|
}
|
|
32968
33555
|
return true;
|
|
32969
33556
|
}
|
|
@@ -32972,7 +33559,7 @@ Chat:
|
|
|
32972
33559
|
const prompt = args.join(" ").trim();
|
|
32973
33560
|
if (!prompt) {
|
|
32974
33561
|
console.log(
|
|
32975
|
-
|
|
33562
|
+
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
33563
|
);
|
|
32977
33564
|
return true;
|
|
32978
33565
|
}
|
|
@@ -32984,14 +33571,14 @@ Chat:
|
|
|
32984
33571
|
options: {},
|
|
32985
33572
|
logger: {
|
|
32986
33573
|
info: (msg) => console.log(msg),
|
|
32987
|
-
error: (msg) => console.error(
|
|
32988
|
-
warn: (msg) => console.warn(
|
|
33574
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33575
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
32989
33576
|
}
|
|
32990
33577
|
};
|
|
32991
33578
|
await videoCommand2.execute(context2);
|
|
32992
33579
|
}
|
|
32993
33580
|
} catch (error2) {
|
|
32994
|
-
console.error(
|
|
33581
|
+
console.error(import_chalk19.default.red("Video generation failed:"), error2.message);
|
|
32995
33582
|
}
|
|
32996
33583
|
return true;
|
|
32997
33584
|
}
|
|
@@ -33000,7 +33587,7 @@ Chat:
|
|
|
33000
33587
|
const prompt = args.join(" ").trim();
|
|
33001
33588
|
if (!prompt) {
|
|
33002
33589
|
console.log(
|
|
33003
|
-
|
|
33590
|
+
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
33591
|
);
|
|
33005
33592
|
return true;
|
|
33006
33593
|
}
|
|
@@ -33012,14 +33599,14 @@ Chat:
|
|
|
33012
33599
|
options: {},
|
|
33013
33600
|
logger: {
|
|
33014
33601
|
info: (msg) => console.log(msg),
|
|
33015
|
-
error: (msg) => console.error(
|
|
33016
|
-
warn: (msg) => console.warn(
|
|
33602
|
+
error: (msg) => console.error(import_chalk19.default.red(msg)),
|
|
33603
|
+
warn: (msg) => console.warn(import_chalk19.default.yellow(msg))
|
|
33017
33604
|
}
|
|
33018
33605
|
};
|
|
33019
33606
|
await voiceCommand2.execute(context2);
|
|
33020
33607
|
}
|
|
33021
33608
|
} catch (error2) {
|
|
33022
|
-
console.error(
|
|
33609
|
+
console.error(import_chalk19.default.red("Voice synthesis failed:"), error2.message);
|
|
33023
33610
|
}
|
|
33024
33611
|
return true;
|
|
33025
33612
|
}
|
|
@@ -33038,36 +33625,36 @@ Chat:
|
|
|
33038
33625
|
if (args.includes("status")) {
|
|
33039
33626
|
if (await authManager.isAuthenticated()) {
|
|
33040
33627
|
const user = await authManager.getCurrentUser();
|
|
33041
|
-
console.log(
|
|
33042
|
-
console.log(
|
|
33043
|
-
console.log(
|
|
33628
|
+
console.log(import_chalk19.default.green("\u2705 Authenticated"));
|
|
33629
|
+
console.log(import_chalk19.default.white(`\u{1F464} User: ${import_chalk19.default.cyan(user.email)}`));
|
|
33630
|
+
console.log(import_chalk19.default.white(`\u{1F4CA} Plan: ${import_chalk19.default.cyan(user.plan)}`));
|
|
33044
33631
|
} else {
|
|
33045
|
-
console.log(
|
|
33046
|
-
console.log(
|
|
33632
|
+
console.log(import_chalk19.default.yellow("\u26A0\uFE0F Not authenticated"));
|
|
33633
|
+
console.log(import_chalk19.default.gray("Use /login to sign in"));
|
|
33047
33634
|
}
|
|
33048
33635
|
} else {
|
|
33049
33636
|
const result = await authManager.login(options2);
|
|
33050
33637
|
if (result.success && result.user) {
|
|
33051
|
-
console.log(
|
|
33052
|
-
console.log(
|
|
33053
|
-
console.log(
|
|
33638
|
+
console.log(import_chalk19.default.green("\u2705 Successfully logged in!"));
|
|
33639
|
+
console.log(import_chalk19.default.white(`\u{1F464} User: ${import_chalk19.default.cyan(result.user.email)}`));
|
|
33640
|
+
console.log(import_chalk19.default.white(`\u{1F4CA} Plan: ${import_chalk19.default.cyan(result.user.plan)}`));
|
|
33054
33641
|
} else {
|
|
33055
|
-
console.log(
|
|
33056
|
-
if (result.error) console.log(
|
|
33642
|
+
console.log(import_chalk19.default.red("\u274C Login failed"));
|
|
33643
|
+
if (result.error) console.log(import_chalk19.default.gray(result.error));
|
|
33057
33644
|
}
|
|
33058
33645
|
}
|
|
33059
33646
|
}
|
|
33060
33647
|
} catch (error2) {
|
|
33061
|
-
console.error(
|
|
33648
|
+
console.error(import_chalk19.default.red("Login error:"), error2.message);
|
|
33062
33649
|
}
|
|
33063
33650
|
return true;
|
|
33064
33651
|
}
|
|
33065
33652
|
if (cmd === "logout" || cmd === "signout") {
|
|
33066
33653
|
try {
|
|
33067
33654
|
await authManager.logout();
|
|
33068
|
-
console.log(
|
|
33655
|
+
console.log(import_chalk19.default.green("\u{1F44B} Signed out. Local credentials removed."));
|
|
33069
33656
|
} catch (error2) {
|
|
33070
|
-
console.error(
|
|
33657
|
+
console.error(import_chalk19.default.red("Logout error:"), error2.message);
|
|
33071
33658
|
}
|
|
33072
33659
|
return true;
|
|
33073
33660
|
}
|
|
@@ -33168,11 +33755,11 @@ Chat:
|
|
|
33168
33755
|
}
|
|
33169
33756
|
}
|
|
33170
33757
|
if (!["battlecard", "sales-dashboard", "tune", "pilot-setup"].includes(cmd)) {
|
|
33171
|
-
console.log(
|
|
33172
|
-
console.log(
|
|
33173
|
-
console.log(
|
|
33174
|
-
console.log(
|
|
33175
|
-
console.log(
|
|
33758
|
+
console.log(import_chalk19.default.red(`\u274C Unknown command: /${cmd}`));
|
|
33759
|
+
console.log(import_chalk19.default.yellow("\n\u{1F4A1} Suggestions:"));
|
|
33760
|
+
console.log(import_chalk19.default.gray(" \u2022 Type /help to see available commands"));
|
|
33761
|
+
console.log(import_chalk19.default.gray(" \u2022 Check if you need to /login first"));
|
|
33762
|
+
console.log(import_chalk19.default.gray(` \u2022 Try similar commands: /help --search ${cmd}`));
|
|
33176
33763
|
}
|
|
33177
33764
|
return true;
|
|
33178
33765
|
}
|
|
@@ -33440,11 +34027,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33440
34027
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33441
34028
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33442
34029
|
console.log(
|
|
33443
|
-
|
|
33444
|
-
`) +
|
|
33445
|
-
`) +
|
|
33446
|
-
`) +
|
|
33447
|
-
`) +
|
|
34030
|
+
import_chalk19.default.green("\n\u2705 **Code Saved**\n") + import_chalk19.default.white(`\u{1F4C1} **File (Click to open):**
|
|
34031
|
+
`) + import_chalk19.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
34032
|
+
`) + import_chalk19.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
34033
|
+
`) + import_chalk19.default.white(` \u{1F4DD} Language: ${language}
|
|
34034
|
+
`) + import_chalk19.default.dim(`
|
|
33448
34035
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33449
34036
|
);
|
|
33450
34037
|
} else {
|
|
@@ -33453,11 +34040,11 @@ async function handleCodeCommand(prompt) {
|
|
|
33453
34040
|
} catch (e2) {
|
|
33454
34041
|
spinner.stop();
|
|
33455
34042
|
if (process.env.MARIA_DEBUG === "1") {
|
|
33456
|
-
console.error(
|
|
34043
|
+
console.error(import_chalk19.default.red("Code generation error:"), e2.message || e2);
|
|
33457
34044
|
}
|
|
33458
34045
|
const fallbackCode = templateFallback(prompt);
|
|
33459
34046
|
console.log(
|
|
33460
|
-
|
|
34047
|
+
import_chalk19.default.yellow("\u26A0 AI unavailable, using template fallback:\n")
|
|
33461
34048
|
);
|
|
33462
34049
|
console.log(fallbackCode);
|
|
33463
34050
|
try {
|
|
@@ -33466,14 +34053,14 @@ async function handleCodeCommand(prompt) {
|
|
|
33466
34053
|
const filepath = path11.resolve(process.cwd(), filename);
|
|
33467
34054
|
await fs11.writeFile(filepath, code, "utf-8");
|
|
33468
34055
|
console.log(
|
|
33469
|
-
|
|
33470
|
-
`) +
|
|
33471
|
-
`) +
|
|
33472
|
-
`) +
|
|
34056
|
+
import_chalk19.default.green("\n\u2705 **Template Code Saved**\n") + import_chalk19.default.white(`\u{1F4C1} **File (Click to open):**
|
|
34057
|
+
`) + import_chalk19.default.cyan(`\u2022 [${filename}](file://${filepath})
|
|
34058
|
+
`) + import_chalk19.default.gray(` \u{1F4CD} Path: \`${filepath}\`
|
|
34059
|
+
`) + import_chalk19.default.dim(`
|
|
33473
34060
|
\u{1F4A1} Tip: Command+Click (Mac) or Ctrl+Click (Windows/Linux) to open file`)
|
|
33474
34061
|
);
|
|
33475
34062
|
} catch (saveError) {
|
|
33476
|
-
console.error(
|
|
34063
|
+
console.error(import_chalk19.default.red("Failed to save code:"), saveError);
|
|
33477
34064
|
}
|
|
33478
34065
|
}
|
|
33479
34066
|
}
|
|
@@ -33529,7 +34116,7 @@ ${userPrompt}`;
|
|
|
33529
34116
|
(seq) => response2.includes(seq)
|
|
33530
34117
|
);
|
|
33531
34118
|
if (guidedFlowDetected) {
|
|
33532
|
-
console.log(
|
|
34119
|
+
console.log(import_chalk19.default.yellow("\u26A0 Guided flow detected, switching to fallback"));
|
|
33533
34120
|
return null;
|
|
33534
34121
|
}
|
|
33535
34122
|
const codeMatch = response2.match(/```[\s\S]*?```/);
|
|
@@ -33697,14 +34284,14 @@ async function streamAnswer(text) {
|
|
|
33697
34284
|
if (store?.addMessage) await store.addMessage(msg);
|
|
33698
34285
|
} else {
|
|
33699
34286
|
animation.stop();
|
|
33700
|
-
console.log(
|
|
34287
|
+
console.log(import_chalk19.default.yellow("AI service unavailable. Please check your configuration."));
|
|
33701
34288
|
}
|
|
33702
34289
|
} catch (e2) {
|
|
33703
34290
|
animation.stop();
|
|
33704
34291
|
if (e2.message?.includes("timeout") || e2.message?.includes("\u23F1\uFE0F")) {
|
|
33705
|
-
console.log(
|
|
34292
|
+
console.log(import_chalk19.default.yellow(e2.message));
|
|
33706
34293
|
} else {
|
|
33707
|
-
console.log(
|
|
34294
|
+
console.log(import_chalk19.default.red("Error generating response:"), e2.message || e2);
|
|
33708
34295
|
}
|
|
33709
34296
|
}
|
|
33710
34297
|
}
|
|
@@ -33719,9 +34306,9 @@ async function handleLine(line) {
|
|
|
33719
34306
|
if (consumed) return;
|
|
33720
34307
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
33721
34308
|
if (!isAuthenticated) {
|
|
33722
|
-
console.log(
|
|
33723
|
-
console.log(
|
|
33724
|
-
console.log(
|
|
34309
|
+
console.log(import_chalk19.default.yellow("\n\u26A0\uFE0F Authentication required for chat features"));
|
|
34310
|
+
console.log(import_chalk19.default.cyan("Please run: /login"));
|
|
34311
|
+
console.log(import_chalk19.default.gray("Or use slash commands like /help, /version"));
|
|
33725
34312
|
return;
|
|
33726
34313
|
}
|
|
33727
34314
|
const user = { role: "user", content: input3, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -33743,7 +34330,7 @@ async function startInteractiveSession() {
|
|
|
33743
34330
|
}
|
|
33744
34331
|
}
|
|
33745
34332
|
const stop = async () => {
|
|
33746
|
-
console.log(
|
|
34333
|
+
console.log(import_chalk19.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33747
34334
|
if (store?.close) await store.close().catch(() => {
|
|
33748
34335
|
});
|
|
33749
34336
|
if (interactiveCLI?.cleanup) interactiveCLI.cleanup();
|
|
@@ -33753,7 +34340,7 @@ async function startInteractiveSession() {
|
|
|
33753
34340
|
process.once("SIGINT", stop);
|
|
33754
34341
|
process.once("SIGTERM", stop);
|
|
33755
34342
|
if (!isTTY) {
|
|
33756
|
-
console.log(
|
|
34343
|
+
console.log(import_chalk19.default.gray("[Pipe mode detected - streaming input/output]"));
|
|
33757
34344
|
const rl = readline5.createInterface({
|
|
33758
34345
|
input: import_node_process3.stdin,
|
|
33759
34346
|
output: import_node_process3.stdout,
|
|
@@ -33768,7 +34355,7 @@ async function startInteractiveSession() {
|
|
|
33768
34355
|
if (interactiveCLI) {
|
|
33769
34356
|
while (true) {
|
|
33770
34357
|
try {
|
|
33771
|
-
const prompt =
|
|
34358
|
+
const prompt = import_chalk19.default.gray("> ");
|
|
33772
34359
|
process.stdout.write(prompt);
|
|
33773
34360
|
const line = await interactiveCLI.question("");
|
|
33774
34361
|
console.log();
|
|
@@ -33783,14 +34370,14 @@ async function startInteractiveSession() {
|
|
|
33783
34370
|
await stop();
|
|
33784
34371
|
return;
|
|
33785
34372
|
}
|
|
33786
|
-
console.error(
|
|
34373
|
+
console.error(import_chalk19.default.red("Error:"), error2?.message || error2);
|
|
33787
34374
|
}
|
|
33788
34375
|
}
|
|
33789
34376
|
} else {
|
|
33790
34377
|
const rl = readline5.createInterface({ input: import_node_process3.stdin, output: import_node_process3.stdout });
|
|
33791
34378
|
while (true) {
|
|
33792
34379
|
try {
|
|
33793
|
-
const prompt =
|
|
34380
|
+
const prompt = import_chalk19.default.gray("> ");
|
|
33794
34381
|
const line = await rl.question(prompt);
|
|
33795
34382
|
console.log();
|
|
33796
34383
|
if (line.toLowerCase() === "exit" || line.toLowerCase() === "quit") {
|
|
@@ -33804,7 +34391,7 @@ async function startInteractiveSession() {
|
|
|
33804
34391
|
await stop();
|
|
33805
34392
|
return;
|
|
33806
34393
|
}
|
|
33807
|
-
console.error(
|
|
34394
|
+
console.error(import_chalk19.default.red("Error:"), error2?.message || error2);
|
|
33808
34395
|
}
|
|
33809
34396
|
}
|
|
33810
34397
|
}
|
|
@@ -33814,7 +34401,7 @@ function createCLI() {
|
|
|
33814
34401
|
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
34402
|
loadEnvironmentVariables();
|
|
33816
34403
|
if (options.server) {
|
|
33817
|
-
console.log(
|
|
34404
|
+
console.log(import_chalk19.default.green("\u{1F680} Starting MARIA server mode..."));
|
|
33818
34405
|
try {
|
|
33819
34406
|
const serverPath = path11.join(process.cwd(), "server.mjs");
|
|
33820
34407
|
const { spawn } = await import("child_process");
|
|
@@ -33823,37 +34410,48 @@ function createCLI() {
|
|
|
33823
34410
|
env: process.env
|
|
33824
34411
|
});
|
|
33825
34412
|
serverProcess.on("error", (error2) => {
|
|
33826
|
-
console.error(
|
|
34413
|
+
console.error(import_chalk19.default.red("\u274C Server process error:"), error2);
|
|
33827
34414
|
process.exit(1);
|
|
33828
34415
|
});
|
|
33829
34416
|
return;
|
|
33830
34417
|
} catch (error2) {
|
|
33831
|
-
console.error(
|
|
34418
|
+
console.error(import_chalk19.default.red("\u274C Failed to start server mode:"), error2);
|
|
33832
34419
|
process.exit(1);
|
|
33833
34420
|
}
|
|
33834
34421
|
}
|
|
33835
|
-
startupDisplayed
|
|
34422
|
+
if (!startupDisplayed) {
|
|
34423
|
+
try {
|
|
34424
|
+
const { displayStartupLogo: displayStartupLogo2 } = await Promise.resolve().then(() => (init_startup_display(), startup_display_exports));
|
|
34425
|
+
displayStartupLogo2();
|
|
34426
|
+
startupDisplayed = true;
|
|
34427
|
+
} catch {
|
|
34428
|
+
console.log(import_chalk19.default.cyan(`
|
|
34429
|
+
\u{1F680} MARIA v${getVersion()}
|
|
34430
|
+
`));
|
|
34431
|
+
startupDisplayed = true;
|
|
34432
|
+
}
|
|
34433
|
+
}
|
|
33836
34434
|
const useV3 = options.v3Session || process.env.MARIA_USE_V3_SESSION === "1";
|
|
33837
34435
|
if (useV3) {
|
|
33838
34436
|
try {
|
|
33839
|
-
console.log(
|
|
34437
|
+
console.log(import_chalk19.default.cyan("\u{1F680} Starting MARIA v3 session..."));
|
|
33840
34438
|
const { MariaAI: MariaAI2 } = await Promise.resolve().then(() => (init_maria_ai(), maria_ai_exports));
|
|
33841
34439
|
const maria = new MariaAI2();
|
|
33842
34440
|
await maria.initialize();
|
|
33843
34441
|
return;
|
|
33844
34442
|
} catch (e2) {
|
|
33845
|
-
console.warn(
|
|
34443
|
+
console.warn(import_chalk19.default.yellow("\u26A0 V3 session unavailable, using standard mode"));
|
|
33846
34444
|
}
|
|
33847
34445
|
}
|
|
33848
34446
|
await startInteractiveSession();
|
|
33849
34447
|
});
|
|
33850
34448
|
return program2;
|
|
33851
34449
|
}
|
|
33852
|
-
var import_commander,
|
|
34450
|
+
var import_commander, import_chalk19, readline5, import_node_process3, path11, fs11, AIResponseService2, ChatContextService2, ConversationPersistence2, InteractiveCLI2, ai, ctx, store, session, commandManager, startupDisplayed, program;
|
|
33853
34451
|
var init_cli = __esm({
|
|
33854
34452
|
"src/cli.ts"() {
|
|
33855
34453
|
import_commander = require("commander");
|
|
33856
|
-
|
|
34454
|
+
import_chalk19 = __toESM(require("chalk"), 1);
|
|
33857
34455
|
readline5 = __toESM(require("readline/promises"), 1);
|
|
33858
34456
|
import_node_process3 = require("process");
|
|
33859
34457
|
path11 = __toESM(require("path"), 1);
|
|
@@ -33896,22 +34494,23 @@ function createCLI2() {
|
|
|
33896
34494
|
}
|
|
33897
34495
|
});
|
|
33898
34496
|
program2.command("setup-ollama").description("Setup Ollama for local AI").action(async () => {
|
|
33899
|
-
console.log(
|
|
34497
|
+
console.log(import_chalk20.default.cyan("Setting up Ollama..."));
|
|
33900
34498
|
console.log(
|
|
33901
|
-
|
|
34499
|
+
import_chalk20.default.yellow("Please run: brew install ollama && ollama serve")
|
|
33902
34500
|
);
|
|
33903
34501
|
});
|
|
33904
34502
|
program2.command("setup-vllm").description("Setup vLLM for local AI").action(async () => {
|
|
33905
|
-
console.log(
|
|
33906
|
-
console.log(
|
|
34503
|
+
console.log(import_chalk20.default.cyan("Setting up vLLM..."));
|
|
34504
|
+
console.log(import_chalk20.default.yellow("Please run: pip install vllm"));
|
|
33907
34505
|
});
|
|
33908
34506
|
return program2;
|
|
33909
34507
|
}
|
|
33910
|
-
var
|
|
34508
|
+
var import_chalk20, import_commander2, MariaAI;
|
|
33911
34509
|
var init_maria_ai = __esm({
|
|
33912
34510
|
"src/maria-ai.ts"() {
|
|
33913
|
-
|
|
34511
|
+
import_chalk20 = __toESM(require("chalk"), 1);
|
|
33914
34512
|
import_commander2 = require("commander");
|
|
34513
|
+
init_startup_display();
|
|
33915
34514
|
init_provider_selector();
|
|
33916
34515
|
init_config2();
|
|
33917
34516
|
init_IntelligentRouterService();
|
|
@@ -33928,16 +34527,17 @@ var init_maria_ai = __esm({
|
|
|
33928
34527
|
}
|
|
33929
34528
|
async initialize() {
|
|
33930
34529
|
try {
|
|
34530
|
+
displayStartupLogo();
|
|
33931
34531
|
await this.providerSelector.initialize();
|
|
33932
34532
|
const { provider, model } = await this.providerSelector.selectProvider();
|
|
33933
34533
|
console.log(
|
|
33934
|
-
|
|
34534
|
+
import_chalk20.default.green(`
|
|
33935
34535
|
\u2705 Selected: ${provider} with model ${model}`)
|
|
33936
34536
|
);
|
|
33937
34537
|
this.config.set("currentProvider", provider);
|
|
33938
34538
|
this.config.set("currentModel", model);
|
|
33939
34539
|
await this.config.save();
|
|
33940
|
-
console.log(
|
|
34540
|
+
console.log(import_chalk20.default.cyan("\n\u{1F9E0} Initializing Intelligent Router..."));
|
|
33941
34541
|
this.router = new IntelligentRouterService({
|
|
33942
34542
|
confidenceThreshold: 0.85,
|
|
33943
34543
|
enableLearning: true,
|
|
@@ -33945,12 +34545,12 @@ var init_maria_ai = __esm({
|
|
|
33945
34545
|
});
|
|
33946
34546
|
await this.router.initialize();
|
|
33947
34547
|
console.log(
|
|
33948
|
-
|
|
34548
|
+
import_chalk20.default.green("\u2705 Intelligent Router initialized successfully\n")
|
|
33949
34549
|
);
|
|
33950
34550
|
this.session = createInteractiveSession(this);
|
|
33951
34551
|
await this.session.start();
|
|
33952
34552
|
} catch (error2) {
|
|
33953
|
-
console.error(
|
|
34553
|
+
console.error(import_chalk20.default.red("\n\u274C Initialization failed:"), error2);
|
|
33954
34554
|
process.exit(1);
|
|
33955
34555
|
}
|
|
33956
34556
|
}
|
|
@@ -33958,7 +34558,7 @@ var init_maria_ai = __esm({
|
|
|
33958
34558
|
if (this.session) {
|
|
33959
34559
|
await this.session.stop();
|
|
33960
34560
|
}
|
|
33961
|
-
console.log(
|
|
34561
|
+
console.log(import_chalk20.default.cyan("\n\u{1F44B} Goodbye!"));
|
|
33962
34562
|
}
|
|
33963
34563
|
};
|
|
33964
34564
|
}
|
|
@@ -33968,7 +34568,7 @@ var init_maria_ai = __esm({
|
|
|
33968
34568
|
init_maria_ai();
|
|
33969
34569
|
|
|
33970
34570
|
// src/utils/version-check.ts
|
|
33971
|
-
var
|
|
34571
|
+
var import_chalk21 = __toESM(require("chalk"), 1);
|
|
33972
34572
|
var import_semver = __toESM(require("semver"), 1);
|
|
33973
34573
|
var MINIMUM_NODE_VERSION = "18.0.0";
|
|
33974
34574
|
var RECOMMENDED_NODE_VERSION = "20.0.0";
|
|
@@ -33976,25 +34576,25 @@ function checkNodeVersion() {
|
|
|
33976
34576
|
const currentVersion = process.version;
|
|
33977
34577
|
if (!import_semver.default.satisfies(currentVersion, `>=${MINIMUM_NODE_VERSION}`)) {
|
|
33978
34578
|
console.error(
|
|
33979
|
-
|
|
34579
|
+
import_chalk21.default.red(`
|
|
33980
34580
|
\u274C Node.js version ${currentVersion} is not supported.`)
|
|
33981
34581
|
);
|
|
33982
34582
|
console.error(
|
|
33983
|
-
|
|
34583
|
+
import_chalk21.default.yellow(`Minimum required version: ${MINIMUM_NODE_VERSION}`)
|
|
33984
34584
|
);
|
|
33985
34585
|
console.error(
|
|
33986
|
-
|
|
34586
|
+
import_chalk21.default.yellow(
|
|
33987
34587
|
`Recommended version: ${RECOMMENDED_NODE_VERSION} or higher`
|
|
33988
34588
|
)
|
|
33989
34589
|
);
|
|
33990
|
-
console.error(
|
|
33991
|
-
console.error(
|
|
34590
|
+
console.error(import_chalk21.default.cyan("\nPlease upgrade Node.js:"));
|
|
34591
|
+
console.error(import_chalk21.default.gray(" \u2022 Using nvm: nvm install 20 && nvm use 20"));
|
|
33992
34592
|
console.error(
|
|
33993
|
-
|
|
34593
|
+
import_chalk21.default.gray(
|
|
33994
34594
|
" \u2022 Using nodenv: nodenv install 20.0.0 && nodenv global 20.0.0"
|
|
33995
34595
|
)
|
|
33996
34596
|
);
|
|
33997
|
-
console.error(
|
|
34597
|
+
console.error(import_chalk21.default.gray(" \u2022 Download from: https://nodejs.org/"));
|
|
33998
34598
|
process.exit(1);
|
|
33999
34599
|
}
|
|
34000
34600
|
}
|