web-agent-bridge 2.3.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.
Files changed (35) hide show
  1. package/package.json +12 -4
  2. package/public/commander-dashboard.html +243 -0
  3. package/public/css/premium.css +317 -317
  4. package/public/demo.html +259 -259
  5. package/public/index.html +644 -644
  6. package/public/mesh-dashboard.html +309 -382
  7. package/public/premium-dashboard.html +2487 -2487
  8. package/public/premium.html +791 -791
  9. package/public/script/wab.min.js +124 -87
  10. package/script/ai-agent-bridge.js +154 -84
  11. package/sdk/agent-mesh.js +287 -171
  12. package/sdk/commander.js +262 -0
  13. package/sdk/index.js +260 -260
  14. package/server/index.js +8 -1
  15. package/server/migrations/002_premium_features.sql +418 -418
  16. package/server/models/db.js +24 -5
  17. package/server/routes/admin-premium.js +671 -671
  18. package/server/routes/commander.js +316 -0
  19. package/server/routes/mesh.js +370 -201
  20. package/server/routes/premium-v2.js +686 -686
  21. package/server/routes/premium.js +724 -724
  22. package/server/services/agent-learning.js +230 -77
  23. package/server/services/agent-memory.js +625 -625
  24. package/server/services/agent-mesh.js +260 -67
  25. package/server/services/agent-symphony.js +548 -518
  26. package/server/services/commander.js +738 -0
  27. package/server/services/edge-compute.js +440 -0
  28. package/server/services/local-ai.js +389 -0
  29. package/server/services/plugins.js +747 -747
  30. package/server/services/self-healing.js +843 -843
  31. package/server/services/swarm.js +788 -788
  32. package/server/services/vision.js +871 -871
  33. package/public/admin/dashboard.html +0 -848
  34. package/public/admin/login.html +0 -84
  35. package/public/video/tutorial.mp4 +0 -0
@@ -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, email, hashed, name, role || 'admin');
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 admin = db.prepare(`SELECT * FROM admins WHERE email = ?`).get(email);
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: admin.email, name: admin.name, role: admin.role };
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,