web-agent-bridge 2.2.0 → 2.3.1
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.ar.md +7 -0
- package/README.md +7 -0
- package/package.json +12 -4
- package/public/commander-dashboard.html +243 -0
- package/public/css/premium.css +317 -317
- package/public/demo.html +259 -259
- package/public/index.html +644 -592
- package/public/llms.txt +1 -0
- package/public/mesh-dashboard.html +328 -0
- package/public/premium-dashboard.html +2487 -2487
- package/public/premium.html +791 -791
- package/public/script/wab.min.js +181 -6
- package/script/ai-agent-bridge.js +196 -0
- package/sdk/agent-mesh.js +449 -0
- package/sdk/commander.js +262 -0
- package/sdk/index.js +260 -259
- package/sdk/package.json +1 -1
- package/server/index.js +13 -1
- package/server/migrations/002_premium_features.sql +418 -418
- package/server/models/db.js +24 -5
- package/server/routes/admin-premium.js +671 -671
- package/server/routes/commander.js +316 -0
- package/server/routes/mesh.js +469 -0
- package/server/routes/premium-v2.js +686 -686
- package/server/routes/premium.js +724 -724
- package/server/services/agent-learning.js +575 -0
- package/server/services/agent-memory.js +625 -625
- package/server/services/agent-mesh.js +539 -0
- package/server/services/agent-symphony.js +711 -0
- package/server/services/commander.js +738 -0
- package/server/services/edge-compute.js +440 -0
- package/server/services/local-ai.js +389 -0
- package/server/services/plugins.js +747 -747
- package/server/services/self-healing.js +843 -843
- package/server/services/swarm.js +788 -788
- package/server/services/vision.js +871 -871
- package/public/admin/dashboard.html +0 -848
- package/public/admin/login.html +0 -84
- package/public/video/tutorial.mp4 +0 -0
package/server/models/db.js
CHANGED
|
@@ -287,18 +287,36 @@ function verifyLicense(domain, licenseKey) {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
// ─── Admin Operations ─────────────────────────────────────────────────
|
|
290
|
+
function normalizeAdminEmail(email) {
|
|
291
|
+
if (email == null) return '';
|
|
292
|
+
return String(email).trim().toLowerCase();
|
|
293
|
+
}
|
|
294
|
+
|
|
290
295
|
function createAdmin({ email, password, name, role }) {
|
|
296
|
+
const normEmail = normalizeAdminEmail(email);
|
|
297
|
+
if (!normEmail) throw new Error('Admin email required');
|
|
291
298
|
const id = uuidv4();
|
|
292
299
|
const hashed = bcrypt.hashSync(password, 12);
|
|
293
|
-
db.prepare(`INSERT INTO admins (id, email, password, name, role) VALUES (?, ?, ?, ?, ?)`).run(id,
|
|
294
|
-
return { id, email, name, role: role || 'admin' };
|
|
300
|
+
db.prepare(`INSERT INTO admins (id, email, password, name, role) VALUES (?, ?, ?, ?, ?)`).run(id, normEmail, hashed, name, role || 'admin');
|
|
301
|
+
return { id, email: normEmail, name, role: role || 'admin' };
|
|
295
302
|
}
|
|
296
303
|
|
|
297
304
|
function loginAdmin({ email, password }) {
|
|
298
|
-
const
|
|
305
|
+
const normEmail = normalizeAdminEmail(email);
|
|
306
|
+
if (!normEmail || password == null || password === '') return null;
|
|
307
|
+
const admin = db.prepare(`SELECT * FROM admins WHERE LOWER(TRIM(email)) = ?`).get(normEmail);
|
|
299
308
|
if (!admin) return null;
|
|
300
309
|
if (!bcrypt.compareSync(password, admin.password)) return null;
|
|
301
|
-
return { id: admin.id, email:
|
|
310
|
+
return { id: admin.id, email: normEmail, name: admin.name, role: admin.role };
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** CLI / ops only: set password for an existing admin row by email. */
|
|
314
|
+
function resetAdminPassword(email, newPassword) {
|
|
315
|
+
const normEmail = normalizeAdminEmail(email);
|
|
316
|
+
if (!normEmail) return false;
|
|
317
|
+
const hashed = bcrypt.hashSync(newPassword, 12);
|
|
318
|
+
const r = db.prepare(`UPDATE admins SET password = ? WHERE LOWER(TRIM(email)) = ?`).run(hashed, normEmail);
|
|
319
|
+
return r.changes > 0;
|
|
302
320
|
}
|
|
303
321
|
|
|
304
322
|
function findAdminById(id) {
|
|
@@ -313,7 +331,7 @@ function maybeBootstrapAdmin() {
|
|
|
313
331
|
if (isTest) return;
|
|
314
332
|
const count = db.prepare(`SELECT COUNT(*) as c FROM admins`).get().c;
|
|
315
333
|
if (count > 0) return;
|
|
316
|
-
const email = process.env.BOOTSTRAP_ADMIN_EMAIL;
|
|
334
|
+
const email = normalizeAdminEmail(process.env.BOOTSTRAP_ADMIN_EMAIL);
|
|
317
335
|
const password = process.env.BOOTSTRAP_ADMIN_PASSWORD;
|
|
318
336
|
if (!email || !password) {
|
|
319
337
|
console.warn('[WAB] No admin accounts. Set BOOTSTRAP_ADMIN_EMAIL and BOOTSTRAP_ADMIN_PASSWORD for first boot, or run: node scripts/create-admin.js <email> <password>');
|
|
@@ -528,6 +546,7 @@ module.exports = {
|
|
|
528
546
|
// Admin
|
|
529
547
|
createAdmin,
|
|
530
548
|
loginAdmin,
|
|
549
|
+
resetAdminPassword,
|
|
531
550
|
findAdminById,
|
|
532
551
|
maybeBootstrapAdmin,
|
|
533
552
|
getAllUsers,
|