@bonginkan/maria 4.2.9 → 4.2.11
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/README.md +33 -5
- package/dist/READY.manifest.json +12 -12
- package/dist/bin/maria.cjs +96 -60
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +96 -60
- package/dist/cli.cjs.map +1 -1
- package/package.json +2 -2
- package/src/slash-commands/READY.manifest.json +12 -12
package/dist/cli.cjs
CHANGED
|
@@ -876,6 +876,7 @@ var init_AuthenticationManager = __esm({
|
|
|
876
876
|
this.clientId = config2.clientId;
|
|
877
877
|
this.initialized = true;
|
|
878
878
|
} catch (error2) {
|
|
879
|
+
console.warn("Auth config initialization failed, using fallbacks:", error2);
|
|
879
880
|
this.authBase = this.getAuthBaseUrl();
|
|
880
881
|
this.apiBase = this.getApiBaseUrl();
|
|
881
882
|
this.clientId = process.env.MARIA_CLIENT_ID || "maria-cli";
|
|
@@ -922,7 +923,8 @@ var init_AuthenticationManager = __esm({
|
|
|
922
923
|
return await this.refreshToken();
|
|
923
924
|
}
|
|
924
925
|
return true;
|
|
925
|
-
} catch {
|
|
926
|
+
} catch (error2) {
|
|
927
|
+
console.error("isAuthenticated failed:", error2);
|
|
926
928
|
return false;
|
|
927
929
|
}
|
|
928
930
|
}
|
|
@@ -986,6 +988,7 @@ var init_AuthenticationManager = __esm({
|
|
|
986
988
|
if (error2 instanceof AuthenticationRequiredError || error2 instanceof QuotaExceededError) {
|
|
987
989
|
throw error2;
|
|
988
990
|
}
|
|
991
|
+
console.error("getCurrentUser failed:", error2);
|
|
989
992
|
throw new Error(ERROR_MESSAGES.NETWORK_ERROR);
|
|
990
993
|
}
|
|
991
994
|
}
|
|
@@ -1009,6 +1012,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1009
1012
|
try {
|
|
1010
1013
|
tokens = await this.loginWithPKCEFlow();
|
|
1011
1014
|
} catch (error2) {
|
|
1015
|
+
console.error("PKCE flow error:", error2);
|
|
1012
1016
|
if (error2.message?.includes("ECONNREFUSED") || error2.message?.includes("fetch failed")) {
|
|
1013
1017
|
console.error("\n\u274C Authentication service is currently unavailable");
|
|
1014
1018
|
console.error("Please try one of the following:");
|
|
@@ -1030,6 +1034,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1030
1034
|
const user = await this.getCurrentUser();
|
|
1031
1035
|
return { success: true, user, tokens };
|
|
1032
1036
|
} catch (error2) {
|
|
1037
|
+
console.error("Login failed:", error2);
|
|
1033
1038
|
return {
|
|
1034
1039
|
success: false,
|
|
1035
1040
|
error: error2.message || "Login failed"
|
|
@@ -1121,7 +1126,8 @@ var init_AuthenticationManager = __esm({
|
|
|
1121
1126
|
};
|
|
1122
1127
|
await this.tokenStorage.save(updatedTokens);
|
|
1123
1128
|
return true;
|
|
1124
|
-
} catch {
|
|
1129
|
+
} catch (error2) {
|
|
1130
|
+
console.error("Token refresh failed:", error2);
|
|
1125
1131
|
return false;
|
|
1126
1132
|
}
|
|
1127
1133
|
}
|
|
@@ -1163,6 +1169,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1163
1169
|
await open__default.default(authUrl);
|
|
1164
1170
|
} catch (error2) {
|
|
1165
1171
|
server.close();
|
|
1172
|
+
console.error("Failed to open browser for authentication:", error2);
|
|
1166
1173
|
throw new Error("Failed to open browser");
|
|
1167
1174
|
}
|
|
1168
1175
|
const authCode = await this.waitForCallback(server, pkceParams.state);
|
|
@@ -1186,49 +1193,62 @@ var init_AuthenticationManager = __esm({
|
|
|
1186
1193
|
* Login with device flow (fallback)
|
|
1187
1194
|
*/
|
|
1188
1195
|
async loginWithDeviceFlow() {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
headers: { "Content-Type": "application/json" },
|
|
1192
|
-
body: JSON.stringify({
|
|
1193
|
-
client_id: this.clientId,
|
|
1194
|
-
scope: "user:profile user:inference org:create_api_key"
|
|
1195
|
-
})
|
|
1196
|
-
});
|
|
1197
|
-
if (!response2.ok) {
|
|
1198
|
-
throw new Error(`Device flow start failed: ${response2.statusText}`);
|
|
1199
|
-
}
|
|
1200
|
-
const deviceResponse = await response2.json();
|
|
1201
|
-
console.log(`\u{1F510} Device Login`);
|
|
1202
|
-
console.log(`Open: ${deviceResponse.verificationUri}`);
|
|
1203
|
-
console.log(`Code: ${deviceResponse.userCode}`);
|
|
1204
|
-
const deadline = Date.now() + deviceResponse.expiresIn * 1e3;
|
|
1205
|
-
const intervalMs = Math.max(1500, deviceResponse.interval * 1e3);
|
|
1206
|
-
while (Date.now() < deadline) {
|
|
1207
|
-
await this.sleep(intervalMs);
|
|
1208
|
-
const finishResponse = await fetch(`${this.authBase}/oauth/device/finish`, {
|
|
1196
|
+
try {
|
|
1197
|
+
const response2 = await fetch(`${this.authBase}/oauth/device/start`, {
|
|
1209
1198
|
method: "POST",
|
|
1210
1199
|
headers: { "Content-Type": "application/json" },
|
|
1211
1200
|
body: JSON.stringify({
|
|
1212
1201
|
client_id: this.clientId,
|
|
1213
|
-
|
|
1202
|
+
scope: "user:profile user:inference org:create_api_key"
|
|
1214
1203
|
})
|
|
1215
1204
|
});
|
|
1216
|
-
if (
|
|
1217
|
-
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
refreshToken: tokens.refresh_token,
|
|
1227
|
-
customToken: tokens.custom_token,
|
|
1228
|
-
expiresAt: Date.now() + tokens.expires_in * 1e3
|
|
1205
|
+
if (!response2.ok) {
|
|
1206
|
+
throw new Error(`Device flow start failed: ${response2.statusText}`);
|
|
1207
|
+
}
|
|
1208
|
+
const raw = await response2.json();
|
|
1209
|
+
const deviceResponse = {
|
|
1210
|
+
verificationUri: raw.verification_uri || raw.verificationUri || "https://auth.maria-code.ai/device",
|
|
1211
|
+
userCode: raw.user_code || raw.userCode || "",
|
|
1212
|
+
deviceCode: raw.device_code || raw.deviceCode || "",
|
|
1213
|
+
interval: (typeof raw.interval === "number" ? raw.interval : parseInt(String(raw.interval || 5), 10)) || 5,
|
|
1214
|
+
expiresIn: (typeof raw.expires_in === "number" ? raw.expires_in : parseInt(String(raw.expires_in || raw.expiresIn || 600), 10)) || 600
|
|
1229
1215
|
};
|
|
1216
|
+
const verificationUrl = deviceResponse.verificationUri || `${this.authBase}/device`;
|
|
1217
|
+
console.log(`\u{1F510} Device Login`);
|
|
1218
|
+
console.log(`Open: ${verificationUrl}`);
|
|
1219
|
+
console.log(`Code: ${deviceResponse.userCode}`);
|
|
1220
|
+
const deadline = Date.now() + deviceResponse.expiresIn * 1e3;
|
|
1221
|
+
const intervalMs = Math.max(1500, deviceResponse.interval * 1e3);
|
|
1222
|
+
while (Date.now() < deadline) {
|
|
1223
|
+
await this.sleep(intervalMs);
|
|
1224
|
+
const finishResponse = await fetch(`${this.authBase}/oauth/device/finish`, {
|
|
1225
|
+
method: "POST",
|
|
1226
|
+
headers: { "Content-Type": "application/json" },
|
|
1227
|
+
body: JSON.stringify({
|
|
1228
|
+
client_id: this.clientId,
|
|
1229
|
+
device_code: deviceResponse.deviceCode
|
|
1230
|
+
})
|
|
1231
|
+
});
|
|
1232
|
+
if (finishResponse.status === 428 || finishResponse.status === 400) {
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
if (!finishResponse.ok) {
|
|
1236
|
+
throw new Error(`Device flow failed: ${finishResponse.statusText}`);
|
|
1237
|
+
}
|
|
1238
|
+
const tokens = await finishResponse.json();
|
|
1239
|
+
return {
|
|
1240
|
+
idToken: tokens.id_token || tokens.access_token || "",
|
|
1241
|
+
accessToken: tokens.access_token || tokens.id_token || "",
|
|
1242
|
+
refreshToken: tokens.refresh_token || "",
|
|
1243
|
+
customToken: tokens.custom_token,
|
|
1244
|
+
expiresAt: Date.now() + (tokens.expires_in ? Number(tokens.expires_in) : 600) * 1e3
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
throw new Error(ERROR_MESSAGES.LOGIN_TIMEOUT);
|
|
1248
|
+
} catch (error2) {
|
|
1249
|
+
console.error("Device flow error:", error2);
|
|
1250
|
+
throw error2;
|
|
1230
1251
|
}
|
|
1231
|
-
throw new Error(ERROR_MESSAGES.LOGIN_TIMEOUT);
|
|
1232
1252
|
}
|
|
1233
1253
|
/**
|
|
1234
1254
|
* Generate PKCE parameters
|
|
@@ -1267,8 +1287,10 @@ var init_AuthenticationManager = __esm({
|
|
|
1267
1287
|
} catch (error2) {
|
|
1268
1288
|
lastError = error2;
|
|
1269
1289
|
if (error2.code !== "EADDRINUSE") {
|
|
1290
|
+
console.error("Failed to start callback server:", error2);
|
|
1270
1291
|
throw error2;
|
|
1271
1292
|
}
|
|
1293
|
+
console.warn("Callback server port in use, retrying...", error2?.message || error2);
|
|
1272
1294
|
}
|
|
1273
1295
|
}
|
|
1274
1296
|
throw lastError || new Error("Failed to find available port");
|
|
@@ -1300,6 +1322,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1300
1322
|
return new Promise((resolve4, reject) => {
|
|
1301
1323
|
const timeout = setTimeout(() => {
|
|
1302
1324
|
server.close();
|
|
1325
|
+
console.error("OAuth callback timed out");
|
|
1303
1326
|
reject(new Error(ERROR_MESSAGES.LOGIN_TIMEOUT));
|
|
1304
1327
|
}, 5 * 60 * 1e3);
|
|
1305
1328
|
server.on("request", (req, res) => {
|
|
@@ -1312,6 +1335,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1312
1335
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
1313
1336
|
res.end(this.getErrorPage(error2));
|
|
1314
1337
|
clearTimeout(timeout);
|
|
1338
|
+
console.error("OAuth callback returned error:", error2);
|
|
1315
1339
|
reject(new Error(error2));
|
|
1316
1340
|
return;
|
|
1317
1341
|
}
|
|
@@ -1319,6 +1343,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1319
1343
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
1320
1344
|
res.end(this.getErrorPage("Invalid state parameter"));
|
|
1321
1345
|
clearTimeout(timeout);
|
|
1346
|
+
console.error("OAuth callback invalid state", { received: state, expected: expectedState });
|
|
1322
1347
|
reject(new Error(ERROR_MESSAGES.INVALID_STATE));
|
|
1323
1348
|
return;
|
|
1324
1349
|
}
|
|
@@ -1336,28 +1361,39 @@ var init_AuthenticationManager = __esm({
|
|
|
1336
1361
|
* Exchange authorization code for tokens
|
|
1337
1362
|
*/
|
|
1338
1363
|
async exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1364
|
+
try {
|
|
1365
|
+
const response2 = await fetch(`${this.authBase}/oauth/token`, {
|
|
1366
|
+
method: "POST",
|
|
1367
|
+
headers: { "Content-Type": "application/json" },
|
|
1368
|
+
body: JSON.stringify({
|
|
1369
|
+
grant_type: "authorization_code",
|
|
1370
|
+
client_id: this.clientId,
|
|
1371
|
+
code,
|
|
1372
|
+
code_verifier: codeVerifier,
|
|
1373
|
+
redirect_uri: redirectUri
|
|
1374
|
+
})
|
|
1375
|
+
});
|
|
1376
|
+
if (!response2.ok) {
|
|
1377
|
+
let bodyText = "";
|
|
1378
|
+
try {
|
|
1379
|
+
bodyText = await response2.text();
|
|
1380
|
+
} catch {
|
|
1381
|
+
}
|
|
1382
|
+
console.error("Token exchange failed:", response2.status, response2.statusText, bodyText);
|
|
1383
|
+
throw new Error(`Token exchange failed: ${response2.status} ${response2.statusText}`);
|
|
1384
|
+
}
|
|
1385
|
+
const tokens = await response2.json();
|
|
1386
|
+
return {
|
|
1387
|
+
idToken: tokens.id_token,
|
|
1388
|
+
accessToken: tokens.access_token,
|
|
1389
|
+
refreshToken: tokens.refresh_token,
|
|
1390
|
+
customToken: tokens.custom_token,
|
|
1391
|
+
expiresAt: Date.now() + tokens.expires_in * 1e3
|
|
1392
|
+
};
|
|
1393
|
+
} catch (error2) {
|
|
1394
|
+
console.error("Token exchange request error:", error2);
|
|
1395
|
+
throw error2;
|
|
1352
1396
|
}
|
|
1353
|
-
const tokens = await response2.json();
|
|
1354
|
-
return {
|
|
1355
|
-
idToken: tokens.id_token,
|
|
1356
|
-
accessToken: tokens.access_token,
|
|
1357
|
-
refreshToken: tokens.refresh_token,
|
|
1358
|
-
customToken: tokens.custom_token,
|
|
1359
|
-
expiresAt: Date.now() + tokens.expires_in * 1e3
|
|
1360
|
-
};
|
|
1361
1397
|
}
|
|
1362
1398
|
/**
|
|
1363
1399
|
* Revoke tokens on server
|
|
@@ -31619,8 +31655,8 @@ var init_package = __esm({
|
|
|
31619
31655
|
"package.json"() {
|
|
31620
31656
|
package_default = {
|
|
31621
31657
|
name: "@bonginkan/maria",
|
|
31622
|
-
version: "4.2.
|
|
31623
|
-
description: "\u{1F680} MARIA v4.2.
|
|
31658
|
+
version: "4.2.11",
|
|
31659
|
+
description: "\u{1F680} MARIA v4.2.11 - 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.",
|
|
31624
31660
|
keywords: [
|
|
31625
31661
|
"ai",
|
|
31626
31662
|
"cli",
|