@agenticmail/enterprise 0.5.296 → 0.5.298
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/chunk-A5LURBEY.js +1519 -0
- package/dist/chunk-DZU6DQ3I.js +1519 -0
- package/dist/chunk-PNOFGWIB.js +4014 -0
- package/dist/chunk-WQRGOMQJ.js +4008 -0
- package/dist/chunk-Y3WLLVOK.js +48 -0
- package/dist/cli-agent-WSCDFYMU.js +1778 -0
- package/dist/cli-recover-NXARYVSH.js +487 -0
- package/dist/cli-serve-GTTDOLB7.js +143 -0
- package/dist/cli-serve-RRKVF3QM.js +143 -0
- package/dist/cli-verify-RKB6KQN4.js +149 -0
- package/dist/cli.js +5 -5
- package/dist/dashboard/app.js +3 -1
- package/dist/dashboard/pages/agent-detail/index.js +20 -0
- package/dist/dashboard/pages/agents.js +12 -2
- package/dist/dashboard/pages/users.js +248 -24
- package/dist/factory-M6E7YAKW.js +9 -0
- package/dist/index.js +3 -3
- package/dist/page-registry-NV4AIPCF.js +178 -0
- package/dist/postgres-LJSV5YUF.js +771 -0
- package/dist/server-CCQIW6GR.js +15 -0
- package/dist/server-VTMQY7VU.js +15 -0
- package/dist/setup-HK4WDXUL.js +20 -0
- package/dist/setup-OL4GJ53G.js +20 -0
- package/dist/sqlite-E5KKAJ24.js +503 -0
- package/package.json +1 -1
- package/src/admin/page-registry.ts +11 -5
- package/src/admin/routes.ts +66 -3
- package/src/auth/routes.ts +5 -0
- package/src/dashboard/app.js +3 -1
- package/src/dashboard/pages/agent-detail/index.js +20 -0
- package/src/dashboard/pages/agents.js +12 -2
- package/src/dashboard/pages/users.js +248 -24
- package/src/db/adapter.ts +1 -0
- package/src/db/postgres.ts +2 -0
- package/src/db/sqlite.ts +1 -0
|
@@ -6,23 +6,37 @@ import { HelpButton } from '../components/help-button.js';
|
|
|
6
6
|
// ─── Permission Editor Component ───────────────────
|
|
7
7
|
|
|
8
8
|
function PermissionEditor({ userId, userName, currentPerms, pageRegistry, onSave, onClose }) {
|
|
9
|
-
// Deep clone perms
|
|
9
|
+
// Deep clone perms (skip _allowedAgents from page grants)
|
|
10
10
|
var [grants, setGrants] = useState(function() {
|
|
11
11
|
if (currentPerms === '*') {
|
|
12
|
-
// Start with all pages selected (all tabs)
|
|
13
12
|
var all = {};
|
|
14
13
|
Object.keys(pageRegistry).forEach(function(pid) { all[pid] = true; });
|
|
15
14
|
return all;
|
|
16
15
|
}
|
|
17
|
-
// Clone existing
|
|
18
16
|
var c = {};
|
|
19
17
|
Object.keys(currentPerms || {}).forEach(function(pid) {
|
|
18
|
+
if (pid === '_allowedAgents') return; // skip agent field
|
|
20
19
|
var g = currentPerms[pid];
|
|
21
20
|
c[pid] = g === true ? true : (Array.isArray(g) ? g.slice() : true);
|
|
22
21
|
});
|
|
23
22
|
return c;
|
|
24
23
|
});
|
|
25
24
|
var [fullAccess, setFullAccess] = useState(currentPerms === '*');
|
|
25
|
+
|
|
26
|
+
// Agent access control
|
|
27
|
+
var [agents, setAgents] = useState([]);
|
|
28
|
+
var [allowedAgents, setAllowedAgents] = useState(function() {
|
|
29
|
+
if (currentPerms === '*') return '*';
|
|
30
|
+
return (currentPerms || {})._allowedAgents || '*';
|
|
31
|
+
});
|
|
32
|
+
var [allAgentsAccess, setAllAgentsAccess] = useState(function() {
|
|
33
|
+
if (currentPerms === '*') return true;
|
|
34
|
+
return (currentPerms || {})._allowedAgents === '*' || !(currentPerms || {})._allowedAgents;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
useEffect(function() {
|
|
38
|
+
apiCall('/agents').then(function(d) { setAgents(d.agents || d || []); }).catch(function() {});
|
|
39
|
+
}, []);
|
|
26
40
|
var [saving, setSaving] = useState(false);
|
|
27
41
|
var [expandedPage, setExpandedPage] = useState(null);
|
|
28
42
|
|
|
@@ -86,8 +100,11 @@ function PermissionEditor({ userId, userName, currentPerms, pageRegistry, onSave
|
|
|
86
100
|
var all = {};
|
|
87
101
|
Object.keys(pageRegistry).forEach(function(pid) { all[pid] = true; });
|
|
88
102
|
setGrants(all);
|
|
103
|
+
setAllAgentsAccess(true);
|
|
104
|
+
setAllowedAgents('*');
|
|
89
105
|
} else {
|
|
90
106
|
setGrants({});
|
|
107
|
+
setAllAgentsAccess(true);
|
|
91
108
|
}
|
|
92
109
|
};
|
|
93
110
|
|
|
@@ -101,7 +118,17 @@ function PermissionEditor({ userId, userName, currentPerms, pageRegistry, onSave
|
|
|
101
118
|
var doSave = async function() {
|
|
102
119
|
setSaving(true);
|
|
103
120
|
try {
|
|
104
|
-
var permsToSave
|
|
121
|
+
var permsToSave;
|
|
122
|
+
if (fullAccess) {
|
|
123
|
+
permsToSave = '*';
|
|
124
|
+
} else {
|
|
125
|
+
permsToSave = Object.assign({}, grants);
|
|
126
|
+
if (!allAgentsAccess && Array.isArray(allowedAgents)) {
|
|
127
|
+
permsToSave._allowedAgents = allowedAgents;
|
|
128
|
+
} else {
|
|
129
|
+
permsToSave._allowedAgents = '*';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
105
132
|
await onSave(permsToSave);
|
|
106
133
|
} catch(e) { /* handled by parent */ }
|
|
107
134
|
setSaving(false);
|
|
@@ -201,11 +228,61 @@ function PermissionEditor({ userId, userName, currentPerms, pageRegistry, onSave
|
|
|
201
228
|
})
|
|
202
229
|
),
|
|
203
230
|
|
|
231
|
+
// ─── Agent Access ──────────────────────────
|
|
232
|
+
!fullAccess && h('div', { style: { marginTop: 16 } },
|
|
233
|
+
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 } },
|
|
234
|
+
h('div', null,
|
|
235
|
+
h('strong', { style: { fontSize: 13 } }, 'Agent Access'),
|
|
236
|
+
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 1 } }, 'Which agents this user can see and manage')
|
|
237
|
+
),
|
|
238
|
+
h('label', { style: { display: 'flex', alignItems: 'center', gap: 6, fontSize: 12, cursor: 'pointer' } },
|
|
239
|
+
h('input', { type: 'checkbox', checked: allAgentsAccess, onChange: function() {
|
|
240
|
+
var newVal = !allAgentsAccess;
|
|
241
|
+
setAllAgentsAccess(newVal);
|
|
242
|
+
if (newVal) setAllowedAgents('*');
|
|
243
|
+
else setAllowedAgents([]);
|
|
244
|
+
}, style: _checkbox }),
|
|
245
|
+
'All Agents'
|
|
246
|
+
)
|
|
247
|
+
),
|
|
248
|
+
!allAgentsAccess && h('div', { style: { maxHeight: 180, overflowY: 'auto', border: '1px solid var(--border)', borderRadius: 8 } },
|
|
249
|
+
agents.length === 0
|
|
250
|
+
? h('div', { style: { padding: 16, textAlign: 'center', color: 'var(--text-muted)', fontSize: 12 } }, 'No agents found')
|
|
251
|
+
: agents.map(function(a) {
|
|
252
|
+
var checked = Array.isArray(allowedAgents) && allowedAgents.indexOf(a.id) >= 0;
|
|
253
|
+
return h('div', {
|
|
254
|
+
key: a.id,
|
|
255
|
+
style: Object.assign({}, _cs, checked ? { background: 'var(--bg-tertiary)' } : {}),
|
|
256
|
+
onClick: function() {
|
|
257
|
+
setAllowedAgents(function(prev) {
|
|
258
|
+
var arr = Array.isArray(prev) ? prev.slice() : [];
|
|
259
|
+
var idx = arr.indexOf(a.id);
|
|
260
|
+
if (idx >= 0) arr.splice(idx, 1);
|
|
261
|
+
else arr.push(a.id);
|
|
262
|
+
return arr;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
h('input', { type: 'checkbox', checked: checked, readOnly: true, style: _checkbox }),
|
|
267
|
+
h('div', { style: { flex: 1 } },
|
|
268
|
+
h('div', { style: { fontWeight: 500, fontSize: 13 } }, a.displayName || a.name || a.id),
|
|
269
|
+
a.role && h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, a.role)
|
|
270
|
+
),
|
|
271
|
+
a.status && h('span', { className: 'badge badge-' + (a.status === 'active' || a.status === 'running' ? 'success' : 'neutral'), style: { fontSize: 9 } }, a.status)
|
|
272
|
+
);
|
|
273
|
+
})
|
|
274
|
+
),
|
|
275
|
+
!allAgentsAccess && Array.isArray(allowedAgents) && h('div', { style: { marginTop: 4, fontSize: 11, color: 'var(--text-muted)' } },
|
|
276
|
+
allowedAgents.length === 0 ? 'No agents selected — user will see no agents' : allowedAgents.length + ' agent' + (allowedAgents.length !== 1 ? 's' : '') + ' selected'
|
|
277
|
+
)
|
|
278
|
+
),
|
|
279
|
+
|
|
204
280
|
// Summary
|
|
205
281
|
h('div', { style: { marginTop: 12, padding: 8, background: 'var(--bg-tertiary)', borderRadius: 6, fontSize: 11, color: 'var(--text-muted)' } },
|
|
206
282
|
fullAccess
|
|
207
|
-
? 'This user has full access to all pages and
|
|
208
|
-
: 'Access to ' + Object.keys(grants).length + ' of ' + Object.keys(pageRegistry).length + ' pages
|
|
283
|
+
? 'This user has full access to all pages, tabs, and agents.'
|
|
284
|
+
: 'Access to ' + Object.keys(grants).length + ' of ' + Object.keys(pageRegistry).length + ' pages' +
|
|
285
|
+
(allAgentsAccess ? ', all agents.' : ', ' + (Array.isArray(allowedAgents) ? allowedAgents.length : 0) + ' agents.')
|
|
209
286
|
)
|
|
210
287
|
);
|
|
211
288
|
}
|
|
@@ -214,15 +291,31 @@ function PermissionEditor({ userId, userName, currentPerms, pageRegistry, onSave
|
|
|
214
291
|
|
|
215
292
|
function InlinePermissionPicker({ permissions, pageRegistry, onChange }) {
|
|
216
293
|
var [expandedPage, setExpandedPage] = useState(null);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
294
|
+
var [agents, setAgents] = useState([]);
|
|
295
|
+
useEffect(function() { apiCall('/agents').then(function(d) { setAgents(d.agents || d || []); }).catch(function() {}); }, []);
|
|
296
|
+
|
|
297
|
+
// Resolve grants from permissions (skip _allowedAgents)
|
|
298
|
+
var rawGrants = permissions === '*' ? (function() { var a = {}; Object.keys(pageRegistry).forEach(function(p) { a[p] = true; }); return a; })() : (permissions || {});
|
|
299
|
+
var grants = {};
|
|
300
|
+
Object.keys(rawGrants).forEach(function(k) { if (k !== '_allowedAgents') grants[k] = rawGrants[k]; });
|
|
301
|
+
var currentAllowed = permissions === '*' ? '*' : (rawGrants._allowedAgents || '*');
|
|
302
|
+
var allAgentsMode = currentAllowed === '*';
|
|
303
|
+
|
|
304
|
+
var emitChange = function(nextGrants, nextAllowed) {
|
|
305
|
+
var result = Object.assign({}, nextGrants);
|
|
306
|
+
if (nextAllowed !== undefined) result._allowedAgents = nextAllowed;
|
|
307
|
+
else if (currentAllowed !== '*') result._allowedAgents = currentAllowed;
|
|
308
|
+
var allPages = Object.keys(nextGrants).length === Object.keys(pageRegistry).length && Object.values(nextGrants).every(function(v) { return v === true; });
|
|
309
|
+
var allAg = (result._allowedAgents || '*') === '*';
|
|
310
|
+
if (allPages && allAg) return onChange('*');
|
|
311
|
+
onChange(result);
|
|
312
|
+
};
|
|
220
313
|
|
|
221
314
|
var togglePage = function(pid) {
|
|
222
315
|
var next = Object.assign({}, grants);
|
|
223
316
|
if (next[pid]) { delete next[pid]; if (expandedPage === pid) setExpandedPage(null); }
|
|
224
317
|
else { next[pid] = true; }
|
|
225
|
-
|
|
318
|
+
emitChange(next);
|
|
226
319
|
};
|
|
227
320
|
|
|
228
321
|
var toggleTab = function(pid, tabId) {
|
|
@@ -243,7 +336,7 @@ function InlinePermissionPicker({ permissions, pageRegistry, onChange }) {
|
|
|
243
336
|
next[pid] = newArr.length === allTabs.length ? true : newArr;
|
|
244
337
|
}
|
|
245
338
|
}
|
|
246
|
-
|
|
339
|
+
emitChange(next);
|
|
247
340
|
};
|
|
248
341
|
|
|
249
342
|
var isTabChecked = function(pid, tabId) {
|
|
@@ -288,14 +381,38 @@ function InlinePermissionPicker({ permissions, pageRegistry, onChange }) {
|
|
|
288
381
|
);
|
|
289
382
|
})
|
|
290
383
|
);
|
|
291
|
-
})
|
|
384
|
+
}),
|
|
385
|
+
// Agent access section
|
|
386
|
+
agents.length > 0 && h('div', { style: { marginTop: 8 } },
|
|
387
|
+
h('div', { style: { fontSize: 10, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.05em', color: 'var(--text-muted)', padding: '4px 10px 2px' } }, 'Agent Access'),
|
|
388
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, padding: '4px 10px', fontSize: 12, cursor: 'pointer' }, onClick: function() {
|
|
389
|
+
emitChange(grants, allAgentsMode ? [] : '*');
|
|
390
|
+
} },
|
|
391
|
+
h('input', { type: 'checkbox', checked: allAgentsMode, readOnly: true, style: { width: 14, height: 14, accentColor: 'var(--primary)', cursor: 'pointer' } }),
|
|
392
|
+
h('span', { style: { fontWeight: 500 } }, 'All Agents')
|
|
393
|
+
),
|
|
394
|
+
!allAgentsMode && agents.map(function(a) {
|
|
395
|
+
var checked = Array.isArray(currentAllowed) && currentAllowed.indexOf(a.id) >= 0;
|
|
396
|
+
return h('div', { key: a.id, style: { display: 'flex', alignItems: 'center', gap: 8, padding: '3px 10px 3px 28px', fontSize: 11, cursor: 'pointer' }, onClick: function() {
|
|
397
|
+
var arr = Array.isArray(currentAllowed) ? currentAllowed.slice() : [];
|
|
398
|
+
var idx = arr.indexOf(a.id);
|
|
399
|
+
if (idx >= 0) arr.splice(idx, 1); else arr.push(a.id);
|
|
400
|
+
emitChange(grants, arr);
|
|
401
|
+
} },
|
|
402
|
+
h('input', { type: 'checkbox', checked: checked, readOnly: true, style: { width: 13, height: 13, accentColor: 'var(--primary)', cursor: 'pointer' } }),
|
|
403
|
+
h('span', null, a.displayName || a.name || a.id),
|
|
404
|
+
a.role && h('span', { style: { color: 'var(--text-muted)', marginLeft: 4 } }, '(' + a.role + ')')
|
|
405
|
+
);
|
|
406
|
+
})
|
|
407
|
+
)
|
|
292
408
|
);
|
|
293
409
|
}
|
|
294
410
|
|
|
295
411
|
// ─── Users Page ────────────────────────────────────
|
|
296
412
|
|
|
297
413
|
export function UsersPage() {
|
|
298
|
-
var
|
|
414
|
+
var app = useApp();
|
|
415
|
+
var toast = app.toast;
|
|
299
416
|
var [users, setUsers] = useState([]);
|
|
300
417
|
var [creating, setCreating] = useState(false);
|
|
301
418
|
var [form, setForm] = useState({ email: '', password: '', name: '', role: 'viewer', permissions: '*' });
|
|
@@ -343,22 +460,39 @@ export function UsersPage() {
|
|
|
343
460
|
setResetting(false);
|
|
344
461
|
};
|
|
345
462
|
|
|
346
|
-
var
|
|
463
|
+
var toggleActive = async function(user) {
|
|
464
|
+
var action = user.isActive === false ? 'reactivate' : 'deactivate';
|
|
347
465
|
var ok = await showConfirm({
|
|
348
|
-
title: '
|
|
349
|
-
message:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
466
|
+
title: action === 'deactivate' ? 'Deactivate User' : 'Reactivate User',
|
|
467
|
+
message: action === 'deactivate'
|
|
468
|
+
? 'Deactivate "' + (user.name || user.email) + '"? They will be unable to log in and will see a message to contact their organization.'
|
|
469
|
+
: 'Reactivate "' + (user.name || user.email) + '"? They will be able to log in again.',
|
|
470
|
+
danger: action === 'deactivate',
|
|
471
|
+
confirmText: action === 'deactivate' ? 'Deactivate' : 'Reactivate'
|
|
353
472
|
});
|
|
354
473
|
if (!ok) return;
|
|
355
474
|
try {
|
|
356
|
-
await apiCall('/users/' + user.id, { method: '
|
|
357
|
-
toast('User
|
|
475
|
+
await apiCall('/users/' + user.id + '/' + action, { method: 'POST' });
|
|
476
|
+
toast('User ' + action + 'd', 'success');
|
|
358
477
|
load();
|
|
359
478
|
} catch (e) { toast(e.message, 'error'); }
|
|
360
479
|
};
|
|
361
480
|
|
|
481
|
+
var [deleteStep, setDeleteStep] = useState(0);
|
|
482
|
+
var [deleteTarget, setDeleteTarget] = useState(null);
|
|
483
|
+
var [deleteTyped, setDeleteTyped] = useState('');
|
|
484
|
+
|
|
485
|
+
var startDelete = function(user) { setDeleteTarget(user); setDeleteStep(1); setDeleteTyped(''); };
|
|
486
|
+
var cancelDelete = function() { setDeleteTarget(null); setDeleteStep(0); setDeleteTyped(''); };
|
|
487
|
+
|
|
488
|
+
var confirmDelete = async function() {
|
|
489
|
+
try {
|
|
490
|
+
await apiCall('/users/' + deleteTarget.id, { method: 'DELETE', body: JSON.stringify({ confirmationToken: 'DELETE_USER_' + deleteTarget.email }) });
|
|
491
|
+
toast('User permanently deleted', 'success');
|
|
492
|
+
cancelDelete(); load();
|
|
493
|
+
} catch (e) { toast(e.message, 'error'); }
|
|
494
|
+
};
|
|
495
|
+
|
|
362
496
|
var openPermissions = async function(user) {
|
|
363
497
|
try {
|
|
364
498
|
var d = await apiCall('/users/' + user.id + '/permissions');
|
|
@@ -485,18 +619,100 @@ export function UsersPage() {
|
|
|
485
619
|
onClose: function() { setPermTarget(null); }
|
|
486
620
|
}),
|
|
487
621
|
|
|
622
|
+
// 5-step delete confirmation modal
|
|
623
|
+
deleteTarget && h(Modal, {
|
|
624
|
+
title: 'Delete User — Step ' + deleteStep + ' of 5',
|
|
625
|
+
onClose: cancelDelete,
|
|
626
|
+
width: 480,
|
|
627
|
+
footer: h(Fragment, null,
|
|
628
|
+
h('button', { className: 'btn btn-secondary', onClick: deleteStep === 1 ? cancelDelete : function() { setDeleteStep(deleteStep - 1); } }, deleteStep === 1 ? 'Cancel' : 'Back'),
|
|
629
|
+
deleteStep < 5
|
|
630
|
+
? h('button', { className: 'btn btn-' + (deleteStep >= 3 ? 'danger' : 'primary'), onClick: function() { setDeleteStep(deleteStep + 1); } }, 'Continue')
|
|
631
|
+
: h('button', { className: 'btn btn-danger', onClick: confirmDelete, disabled: deleteTyped !== deleteTarget.email }, 'Permanently Delete')
|
|
632
|
+
)
|
|
633
|
+
},
|
|
634
|
+
// Step 1: Warning
|
|
635
|
+
deleteStep === 1 && h('div', null,
|
|
636
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, padding: 16, background: 'var(--danger-soft, rgba(220,38,38,0.08))', borderRadius: 8, marginBottom: 16 } },
|
|
637
|
+
h('svg', { width: 24, height: 24, viewBox: '0 0 24 24', fill: 'none', stroke: 'var(--danger)', strokeWidth: 2 }, h('path', { d: 'M12 9v4m0 4h.01M10.29 3.86l-8.6 14.86A2 2 0 0 0 3.4 21h17.2a2 2 0 0 0 1.71-2.98L13.71 3.86a2 2 0 0 0-3.42 0z' })),
|
|
638
|
+
h('div', null,
|
|
639
|
+
h('strong', null, 'Permanent Deletion'),
|
|
640
|
+
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } }, 'This action cannot be undone.')
|
|
641
|
+
)
|
|
642
|
+
),
|
|
643
|
+
h('p', { style: { fontSize: 13 } }, 'You are about to permanently delete the user account for:'),
|
|
644
|
+
h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8, marginTop: 8 } },
|
|
645
|
+
h('strong', null, deleteTarget.name || 'Unnamed'), h('br'),
|
|
646
|
+
h('span', { style: { fontSize: 12, color: 'var(--text-muted)', fontFamily: 'var(--font-mono)' } }, deleteTarget.email)
|
|
647
|
+
),
|
|
648
|
+
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 12 } }, 'Consider deactivating instead — deactivated users can be reactivated later.')
|
|
649
|
+
),
|
|
650
|
+
// Step 2: Data loss
|
|
651
|
+
deleteStep === 2 && h('div', null,
|
|
652
|
+
h('h4', { style: { marginBottom: 12 } }, 'Data That Will Be Lost'),
|
|
653
|
+
h('ul', { style: { paddingLeft: 20, fontSize: 13, lineHeight: 1.8 } },
|
|
654
|
+
h('li', null, 'All login sessions will be terminated immediately'),
|
|
655
|
+
h('li', null, 'Audit log entries will be orphaned (no user reference)'),
|
|
656
|
+
h('li', null, 'Any API keys created by this user will be revoked'),
|
|
657
|
+
h('li', null, 'Permission grants and role assignments will be removed'),
|
|
658
|
+
h('li', null, '2FA configuration and backup codes will be destroyed')
|
|
659
|
+
)
|
|
660
|
+
),
|
|
661
|
+
// Step 3: Impact
|
|
662
|
+
deleteStep === 3 && h('div', null,
|
|
663
|
+
h('h4', { style: { marginBottom: 12 } }, 'Impact Assessment'),
|
|
664
|
+
h('div', { style: { padding: 12, background: 'var(--warning-soft, rgba(245,158,11,0.08))', borderRadius: 8, fontSize: 13, lineHeight: 1.6 } },
|
|
665
|
+
h('p', null, 'If this user manages or supervises any agents, those agents will lose their manager assignment.'),
|
|
666
|
+
h('p', { style: { marginTop: 8 } }, 'If this user created approval workflows, pending approvals may become orphaned.'),
|
|
667
|
+
h('p', { style: { marginTop: 8 } }, 'Any scheduled tasks or cron jobs created by this user will continue to run but cannot be modified.')
|
|
668
|
+
)
|
|
669
|
+
),
|
|
670
|
+
// Step 4: Alternative
|
|
671
|
+
deleteStep === 4 && h('div', null,
|
|
672
|
+
h('h4', { style: { marginBottom: 12 } }, 'Are You Sure?'),
|
|
673
|
+
h('div', { style: { padding: 16, background: 'var(--success-soft, rgba(21,128,61,0.08))', borderRadius: 8, marginBottom: 16 } },
|
|
674
|
+
h('strong', null, 'Recommended alternative: Deactivate'),
|
|
675
|
+
h('p', { style: { fontSize: 12, color: 'var(--text-secondary)', marginTop: 4 } }, 'Deactivating blocks login while preserving all data. The user can be reactivated at any time. This is the safe option.')
|
|
676
|
+
),
|
|
677
|
+
h('div', { style: { padding: 16, background: 'var(--danger-soft, rgba(220,38,38,0.08))', borderRadius: 8 } },
|
|
678
|
+
h('strong', null, 'Permanent deletion'),
|
|
679
|
+
h('p', { style: { fontSize: 12, color: 'var(--text-secondary)', marginTop: 4 } }, 'Removes the user and all associated data forever. There is no recovery.')
|
|
680
|
+
)
|
|
681
|
+
),
|
|
682
|
+
// Step 5: Type email to confirm
|
|
683
|
+
deleteStep === 5 && h('div', null,
|
|
684
|
+
h('h4', { style: { marginBottom: 12, color: 'var(--danger)' } }, 'Final Confirmation'),
|
|
685
|
+
h('p', { style: { fontSize: 13, marginBottom: 12 } }, 'Type the user\'s email address to confirm permanent deletion:'),
|
|
686
|
+
h('div', { style: { padding: 8, background: 'var(--bg-tertiary)', borderRadius: 6, fontFamily: 'var(--font-mono)', fontSize: 13, textAlign: 'center', marginBottom: 12 } }, deleteTarget.email),
|
|
687
|
+
h('input', {
|
|
688
|
+
className: 'input', type: 'text', value: deleteTyped,
|
|
689
|
+
onChange: function(e) { setDeleteTyped(e.target.value); },
|
|
690
|
+
placeholder: 'Type email to confirm',
|
|
691
|
+
autoFocus: true,
|
|
692
|
+
style: { fontFamily: 'var(--font-mono)', fontSize: 13, borderColor: deleteTyped === deleteTarget.email ? 'var(--danger)' : 'var(--border)' }
|
|
693
|
+
}),
|
|
694
|
+
deleteTyped && deleteTyped !== deleteTarget.email && h('div', { style: { fontSize: 11, color: 'var(--danger)', marginTop: 4 } }, 'Email does not match')
|
|
695
|
+
)
|
|
696
|
+
),
|
|
697
|
+
|
|
488
698
|
// Users table
|
|
489
699
|
h('div', { className: 'card' },
|
|
490
700
|
h('div', { className: 'card-body-flush' },
|
|
491
701
|
users.length === 0 ? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No users')
|
|
492
702
|
: h('table', null,
|
|
493
|
-
h('thead', null, h('tr', null, h('th', null, 'Name'), h('th', null, 'Email'), h('th', null, 'Role'), h('th', null, 'Access'), h('th', null, '2FA'), h('th', null, 'Created'), h('th', { style: { width:
|
|
703
|
+
h('thead', null, h('tr', null, h('th', null, 'Name'), h('th', null, 'Email'), h('th', null, 'Role'), h('th', null, 'Status'), h('th', null, 'Access'), h('th', null, '2FA'), h('th', null, 'Created'), h('th', { style: { width: 200 } }, 'Actions'))),
|
|
494
704
|
h('tbody', null, users.map(function(u) {
|
|
495
705
|
var isRestricted = u.role === 'member' || u.role === 'viewer';
|
|
496
|
-
|
|
706
|
+
var isDeactivated = u.isActive === false;
|
|
707
|
+
var isSelf = u.id === ((app || {}).user || {}).id;
|
|
708
|
+
return h('tr', { key: u.id, style: isDeactivated ? { opacity: 0.6 } : {} },
|
|
497
709
|
h('td', null, h('strong', null, u.name || '-')),
|
|
498
710
|
h('td', null, h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, u.email)),
|
|
499
711
|
h('td', null, h('span', { className: 'badge badge-' + (u.role === 'owner' ? 'warning' : u.role === 'admin' ? 'primary' : 'neutral') }, u.role)),
|
|
712
|
+
h('td', null, isDeactivated
|
|
713
|
+
? h('span', { className: 'badge badge-danger', style: { fontSize: 10 } }, 'Deactivated')
|
|
714
|
+
: h('span', { className: 'badge badge-success', style: { fontSize: 10 } }, 'Active')
|
|
715
|
+
),
|
|
500
716
|
h('td', null, permBadge(u)),
|
|
501
717
|
h('td', null, u.totpEnabled ? h('span', { className: 'badge badge-success' }, 'On') : h('span', { className: 'badge badge-neutral' }, 'Off')),
|
|
502
718
|
h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, u.createdAt ? new Date(u.createdAt).toLocaleDateString() : '-'),
|
|
@@ -509,7 +725,15 @@ export function UsersPage() {
|
|
|
509
725
|
style: !isRestricted ? { opacity: 0.4 } : {}
|
|
510
726
|
}, I.shield()),
|
|
511
727
|
h('button', { className: 'btn btn-ghost btn-sm', title: 'Reset Password', onClick: function() { setResetTarget(u); setNewPassword(''); } }, I.lock()),
|
|
512
|
-
|
|
728
|
+
// Deactivate / Reactivate
|
|
729
|
+
!isSelf && h('button', {
|
|
730
|
+
className: 'btn btn-ghost btn-sm',
|
|
731
|
+
title: isDeactivated ? 'Reactivate User' : 'Deactivate User',
|
|
732
|
+
onClick: function() { toggleActive(u); },
|
|
733
|
+
style: { color: isDeactivated ? 'var(--success, #15803d)' : 'var(--warning, #f59e0b)' }
|
|
734
|
+
}, isDeactivated ? I.check() : I.pause()),
|
|
735
|
+
// Delete (owner only)
|
|
736
|
+
!isSelf && h('button', { className: 'btn btn-ghost btn-sm', title: 'Delete User Permanently', onClick: function() { startDelete(u); }, style: { color: 'var(--danger)' } }, I.trash())
|
|
513
737
|
)
|
|
514
738
|
)
|
|
515
739
|
);
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
provision,
|
|
3
3
|
runSetupWizard
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DZU6DQ3I.js";
|
|
5
5
|
import {
|
|
6
6
|
AgenticMailManager,
|
|
7
7
|
GoogleEmailProvider,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
requireRole,
|
|
43
43
|
securityHeaders,
|
|
44
44
|
validate
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-PNOFGWIB.js";
|
|
46
46
|
import "./chunk-OF4MUWWS.js";
|
|
47
47
|
import {
|
|
48
48
|
PROVIDER_REGISTRY,
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
import {
|
|
114
114
|
createAdapter,
|
|
115
115
|
getSupportedDatabases
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-Y3WLLVOK.js";
|
|
117
117
|
import {
|
|
118
118
|
AGENTICMAIL_TOOLS,
|
|
119
119
|
ALL_TOOLS,
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import "./chunk-KFQGP6VL.js";
|
|
2
|
+
|
|
3
|
+
// src/admin/page-registry.ts
|
|
4
|
+
var PAGE_REGISTRY = {
|
|
5
|
+
// ─── Overview ────────────────────────────────────
|
|
6
|
+
dashboard: {
|
|
7
|
+
label: "Dashboard",
|
|
8
|
+
section: "overview",
|
|
9
|
+
description: "Main dashboard with key metrics and activity feed"
|
|
10
|
+
},
|
|
11
|
+
// ─── Management ──────────────────────────────────
|
|
12
|
+
agents: {
|
|
13
|
+
label: "Agents",
|
|
14
|
+
section: "management",
|
|
15
|
+
description: "View and manage AI agents",
|
|
16
|
+
tabs: {
|
|
17
|
+
overview: "Overview",
|
|
18
|
+
personal: "Personal Details",
|
|
19
|
+
email: "Email",
|
|
20
|
+
whatsapp: "WhatsApp",
|
|
21
|
+
channels: "Channels",
|
|
22
|
+
configuration: "Configuration",
|
|
23
|
+
manager: "Manager",
|
|
24
|
+
tools: "Tools",
|
|
25
|
+
skills: "Skills",
|
|
26
|
+
permissions: "Permissions",
|
|
27
|
+
activity: "Activity",
|
|
28
|
+
communication: "Communication",
|
|
29
|
+
workforce: "Workforce",
|
|
30
|
+
memory: "Memory",
|
|
31
|
+
guardrails: "Guardrails",
|
|
32
|
+
autonomy: "Autonomy",
|
|
33
|
+
budget: "Budget",
|
|
34
|
+
security: "Security",
|
|
35
|
+
"tool-security": "Tool Security",
|
|
36
|
+
deployment: "Deployment"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
skills: {
|
|
40
|
+
label: "Skills",
|
|
41
|
+
section: "management",
|
|
42
|
+
description: "Manage agent skill packs"
|
|
43
|
+
},
|
|
44
|
+
"community-skills": {
|
|
45
|
+
label: "Community Skills",
|
|
46
|
+
section: "management",
|
|
47
|
+
description: "Browse and install community skill marketplace"
|
|
48
|
+
},
|
|
49
|
+
"skill-connections": {
|
|
50
|
+
label: "Integrations & MCP",
|
|
51
|
+
section: "management",
|
|
52
|
+
description: "MCP servers, built-in integrations, and community skills"
|
|
53
|
+
},
|
|
54
|
+
"database-access": {
|
|
55
|
+
label: "Database Access",
|
|
56
|
+
section: "management",
|
|
57
|
+
description: "Manage database connections and agent access",
|
|
58
|
+
tabs: {
|
|
59
|
+
connections: "Connections",
|
|
60
|
+
access: "Agent Access",
|
|
61
|
+
audit: "Audit Log"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
knowledge: {
|
|
65
|
+
label: "Knowledge Bases",
|
|
66
|
+
section: "management",
|
|
67
|
+
description: "Manage knowledge base documents and collections"
|
|
68
|
+
},
|
|
69
|
+
"knowledge-contributions": {
|
|
70
|
+
label: "Knowledge Hub",
|
|
71
|
+
section: "management",
|
|
72
|
+
description: "Agent contributions to shared knowledge"
|
|
73
|
+
},
|
|
74
|
+
approvals: {
|
|
75
|
+
label: "Approvals",
|
|
76
|
+
section: "management",
|
|
77
|
+
description: "Review and approve pending agent actions"
|
|
78
|
+
},
|
|
79
|
+
"org-chart": {
|
|
80
|
+
label: "Org Chart",
|
|
81
|
+
section: "management",
|
|
82
|
+
description: "Visual agent hierarchy and reporting structure"
|
|
83
|
+
},
|
|
84
|
+
"task-pipeline": {
|
|
85
|
+
label: "Task Pipeline",
|
|
86
|
+
section: "management",
|
|
87
|
+
description: "Track task lifecycle from creation to completion"
|
|
88
|
+
},
|
|
89
|
+
workforce: {
|
|
90
|
+
label: "Workforce",
|
|
91
|
+
section: "management",
|
|
92
|
+
description: "Agent scheduling, workload, and availability"
|
|
93
|
+
},
|
|
94
|
+
messages: {
|
|
95
|
+
label: "Messages",
|
|
96
|
+
section: "management",
|
|
97
|
+
description: "Inter-agent and external message logs"
|
|
98
|
+
},
|
|
99
|
+
guardrails: {
|
|
100
|
+
label: "Guardrails",
|
|
101
|
+
section: "management",
|
|
102
|
+
description: "Global safety policies and content filters"
|
|
103
|
+
},
|
|
104
|
+
journal: {
|
|
105
|
+
label: "Journal",
|
|
106
|
+
section: "management",
|
|
107
|
+
description: "System event journal and decision log"
|
|
108
|
+
},
|
|
109
|
+
// ─── Administration ──────────────────────────────
|
|
110
|
+
dlp: {
|
|
111
|
+
label: "DLP",
|
|
112
|
+
section: "administration",
|
|
113
|
+
description: "Data loss prevention policies and alerts"
|
|
114
|
+
},
|
|
115
|
+
compliance: {
|
|
116
|
+
label: "Compliance",
|
|
117
|
+
section: "administration",
|
|
118
|
+
description: "Regulatory compliance settings and reports"
|
|
119
|
+
},
|
|
120
|
+
"domain-status": {
|
|
121
|
+
label: "Domain",
|
|
122
|
+
section: "administration",
|
|
123
|
+
description: "Domain configuration and deployment status"
|
|
124
|
+
},
|
|
125
|
+
users: {
|
|
126
|
+
label: "Users",
|
|
127
|
+
section: "administration",
|
|
128
|
+
description: "Manage dashboard users, roles, and permissions"
|
|
129
|
+
},
|
|
130
|
+
vault: {
|
|
131
|
+
label: "Vault",
|
|
132
|
+
section: "administration",
|
|
133
|
+
description: "Encrypted credential storage"
|
|
134
|
+
},
|
|
135
|
+
audit: {
|
|
136
|
+
label: "Audit Log",
|
|
137
|
+
section: "administration",
|
|
138
|
+
description: "Full audit trail of all system actions"
|
|
139
|
+
},
|
|
140
|
+
settings: {
|
|
141
|
+
label: "Settings",
|
|
142
|
+
section: "administration",
|
|
143
|
+
description: "Global platform configuration and branding"
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
function getAllPageIds() {
|
|
147
|
+
return Object.keys(PAGE_REGISTRY);
|
|
148
|
+
}
|
|
149
|
+
function getPageTabs(pageId) {
|
|
150
|
+
const page = PAGE_REGISTRY[pageId];
|
|
151
|
+
return page?.tabs ? Object.keys(page.tabs) : [];
|
|
152
|
+
}
|
|
153
|
+
function hasPageAccess(grants, pageId) {
|
|
154
|
+
if (grants === "*") return true;
|
|
155
|
+
return pageId in grants;
|
|
156
|
+
}
|
|
157
|
+
function hasTabAccess(grants, pageId, tabId) {
|
|
158
|
+
if (grants === "*") return true;
|
|
159
|
+
const pageGrant = grants[pageId];
|
|
160
|
+
if (!pageGrant) return false;
|
|
161
|
+
if (pageGrant === true) return true;
|
|
162
|
+
return pageGrant.includes(tabId);
|
|
163
|
+
}
|
|
164
|
+
function getAccessibleTabs(grants, pageId) {
|
|
165
|
+
if (grants === "*") return "all";
|
|
166
|
+
const pageGrant = grants[pageId];
|
|
167
|
+
if (!pageGrant) return [];
|
|
168
|
+
if (pageGrant === true || pageGrant === "*") return "all";
|
|
169
|
+
return Array.isArray(pageGrant) ? pageGrant : [];
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
PAGE_REGISTRY,
|
|
173
|
+
getAccessibleTabs,
|
|
174
|
+
getAllPageIds,
|
|
175
|
+
getPageTabs,
|
|
176
|
+
hasPageAccess,
|
|
177
|
+
hasTabAccess
|
|
178
|
+
};
|