@agenticmail/enterprise 0.5.297 → 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-DZU6DQ3I.js +1519 -0
- package/dist/chunk-PNOFGWIB.js +4014 -0
- package/dist/cli-serve-RRKVF3QM.js +143 -0
- package/dist/cli.js +2 -2
- 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 +128 -12
- package/dist/index.js +2 -2
- package/dist/page-registry-NV4AIPCF.js +178 -0
- package/dist/server-CCQIW6GR.js +15 -0
- package/dist/setup-OL4GJ53G.js +20 -0
- package/package.json +1 -1
- package/src/admin/page-registry.ts +11 -5
- package/src/admin/routes.ts +7 -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 +128 -12
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import "./chunk-KFQGP6VL.js";
|
|
2
|
+
|
|
3
|
+
// src/cli-serve.ts
|
|
4
|
+
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
function loadEnvFile() {
|
|
8
|
+
const candidates = [
|
|
9
|
+
join(process.cwd(), ".env"),
|
|
10
|
+
join(homedir(), ".agenticmail", ".env")
|
|
11
|
+
];
|
|
12
|
+
for (const envPath of candidates) {
|
|
13
|
+
if (!existsSync(envPath)) continue;
|
|
14
|
+
try {
|
|
15
|
+
const content = readFileSync(envPath, "utf8");
|
|
16
|
+
for (const line of content.split("\n")) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
19
|
+
const eq = trimmed.indexOf("=");
|
|
20
|
+
if (eq < 0) continue;
|
|
21
|
+
const key = trimmed.slice(0, eq).trim();
|
|
22
|
+
let val = trimmed.slice(eq + 1).trim();
|
|
23
|
+
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
24
|
+
val = val.slice(1, -1);
|
|
25
|
+
}
|
|
26
|
+
if (!process.env[key]) process.env[key] = val;
|
|
27
|
+
}
|
|
28
|
+
console.log(`Loaded config from ${envPath}`);
|
|
29
|
+
return;
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function ensureSecrets() {
|
|
35
|
+
const { randomUUID } = await import("crypto");
|
|
36
|
+
const envDir = join(homedir(), ".agenticmail");
|
|
37
|
+
const envPath = join(envDir, ".env");
|
|
38
|
+
let dirty = false;
|
|
39
|
+
if (!process.env.JWT_SECRET) {
|
|
40
|
+
process.env.JWT_SECRET = randomUUID() + randomUUID();
|
|
41
|
+
dirty = true;
|
|
42
|
+
console.log("[startup] Generated new JWT_SECRET (existing sessions will need to re-login)");
|
|
43
|
+
}
|
|
44
|
+
if (!process.env.AGENTICMAIL_VAULT_KEY) {
|
|
45
|
+
process.env.AGENTICMAIL_VAULT_KEY = randomUUID() + randomUUID();
|
|
46
|
+
dirty = true;
|
|
47
|
+
console.log("[startup] Generated new AGENTICMAIL_VAULT_KEY");
|
|
48
|
+
console.log("[startup] \u26A0\uFE0F Previously encrypted credentials will need to be re-entered in the dashboard");
|
|
49
|
+
}
|
|
50
|
+
if (dirty) {
|
|
51
|
+
try {
|
|
52
|
+
if (!existsSync(envDir)) {
|
|
53
|
+
const { mkdirSync } = await import("fs");
|
|
54
|
+
mkdirSync(envDir, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
const { appendFileSync } = await import("fs");
|
|
57
|
+
const lines = [];
|
|
58
|
+
let existing = "";
|
|
59
|
+
if (existsSync(envPath)) {
|
|
60
|
+
existing = readFileSync(envPath, "utf8");
|
|
61
|
+
}
|
|
62
|
+
if (!existing.includes("JWT_SECRET=")) {
|
|
63
|
+
lines.push(`JWT_SECRET=${process.env.JWT_SECRET}`);
|
|
64
|
+
}
|
|
65
|
+
if (!existing.includes("AGENTICMAIL_VAULT_KEY=")) {
|
|
66
|
+
lines.push(`AGENTICMAIL_VAULT_KEY=${process.env.AGENTICMAIL_VAULT_KEY}`);
|
|
67
|
+
}
|
|
68
|
+
if (lines.length) {
|
|
69
|
+
appendFileSync(envPath, "\n" + lines.join("\n") + "\n", { mode: 384 });
|
|
70
|
+
console.log(`[startup] Saved secrets to ${envPath}`);
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.warn(`[startup] Could not save secrets to ${envPath}: ${e.message}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function runServe(_args) {
|
|
78
|
+
loadEnvFile();
|
|
79
|
+
const DATABASE_URL = process.env.DATABASE_URL;
|
|
80
|
+
const PORT = parseInt(process.env.PORT || "8080", 10);
|
|
81
|
+
await ensureSecrets();
|
|
82
|
+
const JWT_SECRET = process.env.JWT_SECRET;
|
|
83
|
+
const VAULT_KEY = process.env.AGENTICMAIL_VAULT_KEY;
|
|
84
|
+
if (!DATABASE_URL) {
|
|
85
|
+
console.error("ERROR: DATABASE_URL is required.");
|
|
86
|
+
console.error("");
|
|
87
|
+
console.error("Set it via environment variable or .env file:");
|
|
88
|
+
console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db npx @agenticmail/enterprise start");
|
|
89
|
+
console.error("");
|
|
90
|
+
console.error("Or create a .env file (in cwd or ~/.agenticmail/.env):");
|
|
91
|
+
console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db");
|
|
92
|
+
console.error(" JWT_SECRET=your-secret-here");
|
|
93
|
+
console.error(" PORT=3200");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const { createAdapter } = await import("./factory-M6E7YAKW.js");
|
|
97
|
+
const { createServer } = await import("./server-CCQIW6GR.js");
|
|
98
|
+
const db = await createAdapter({
|
|
99
|
+
type: DATABASE_URL.startsWith("postgres") ? "postgres" : "sqlite",
|
|
100
|
+
connectionString: DATABASE_URL
|
|
101
|
+
});
|
|
102
|
+
await db.migrate();
|
|
103
|
+
const server = createServer({
|
|
104
|
+
port: PORT,
|
|
105
|
+
db,
|
|
106
|
+
jwtSecret: JWT_SECRET,
|
|
107
|
+
corsOrigins: ["*"]
|
|
108
|
+
});
|
|
109
|
+
await server.start();
|
|
110
|
+
console.log(`AgenticMail Enterprise server running on :${PORT}`);
|
|
111
|
+
const tunnelToken = process.env.CLOUDFLARED_TOKEN;
|
|
112
|
+
if (tunnelToken) {
|
|
113
|
+
try {
|
|
114
|
+
const { execSync, spawn } = await import("child_process");
|
|
115
|
+
try {
|
|
116
|
+
execSync("which cloudflared", { timeout: 3e3 });
|
|
117
|
+
} catch {
|
|
118
|
+
console.log("[startup] cloudflared not found \u2014 skipping tunnel auto-start");
|
|
119
|
+
console.log("[startup] Install cloudflared to enable tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
execSync('pgrep -f "cloudflared.*tunnel.*run"', { timeout: 3e3 });
|
|
124
|
+
console.log("[startup] cloudflared tunnel already running");
|
|
125
|
+
return;
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
128
|
+
const subdomain = process.env.AGENTICMAIL_SUBDOMAIN || process.env.AGENTICMAIL_DOMAIN || "";
|
|
129
|
+
console.log(`[startup] Starting cloudflared tunnel${subdomain ? ` for ${subdomain}.agenticmail.io` : ""}...`);
|
|
130
|
+
const child = spawn("cloudflared", ["tunnel", "--no-autoupdate", "run", "--token", tunnelToken], {
|
|
131
|
+
detached: true,
|
|
132
|
+
stdio: "ignore"
|
|
133
|
+
});
|
|
134
|
+
child.unref();
|
|
135
|
+
console.log("[startup] cloudflared tunnel started (pid " + child.pid + ")");
|
|
136
|
+
} catch (e) {
|
|
137
|
+
console.warn("[startup] Could not auto-start cloudflared: " + e.message);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
runServe
|
|
143
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -57,14 +57,14 @@ Skill Development:
|
|
|
57
57
|
break;
|
|
58
58
|
case "serve":
|
|
59
59
|
case "start":
|
|
60
|
-
import("./cli-serve-
|
|
60
|
+
import("./cli-serve-RRKVF3QM.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
|
|
61
61
|
break;
|
|
62
62
|
case "agent":
|
|
63
63
|
import("./cli-agent-WSCDFYMU.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
|
|
64
64
|
break;
|
|
65
65
|
case "setup":
|
|
66
66
|
default:
|
|
67
|
-
import("./setup-
|
|
67
|
+
import("./setup-OL4GJ53G.js").then((m) => m.runSetupWizard()).catch(fatal);
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
function fatal(err) {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -143,7 +143,9 @@ function App() {
|
|
|
143
143
|
if (!authed) return;
|
|
144
144
|
engineCall('/approvals/pending').then(d => setPendingCount((d.requests || []).length)).catch(() => {});
|
|
145
145
|
apiCall('/settings').then(d => { const s = d.settings || d || {}; if (s.primaryColor) applyBrandColor(s.primaryColor); if (s.orgId) setOrgId(s.orgId); }).catch(() => {});
|
|
146
|
-
apiCall('/me/permissions').then(d => {
|
|
146
|
+
apiCall('/me/permissions').then(d => {
|
|
147
|
+
if (d && d.permissions) setPermissions(d.permissions);
|
|
148
|
+
}).catch(() => {});
|
|
147
149
|
}, [authed]);
|
|
148
150
|
|
|
149
151
|
const logout = useCallback(() => { authCall('/logout', { method: 'POST' }).catch(() => {}).finally(() => { setAuthed(false); setUser(null); }); }, []);
|
|
@@ -57,6 +57,26 @@ export function AgentDetailPage(props) {
|
|
|
57
57
|
return false;
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
// Check agent-level access
|
|
61
|
+
var allowedAgents = perms === '*' ? '*' : (perms._allowedAgents || '*');
|
|
62
|
+
var hasAgentAccess = allowedAgents === '*' || (Array.isArray(allowedAgents) && allowedAgents.indexOf(agentId) >= 0);
|
|
63
|
+
|
|
64
|
+
if (!hasAgentAccess) {
|
|
65
|
+
return h('div', { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', minHeight: '60vh', textAlign: 'center', padding: 40 } },
|
|
66
|
+
h('div', { style: { width: 64, height: 64, borderRadius: '50%', background: 'var(--danger-soft, rgba(220,38,38,0.1))', display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: 20 } },
|
|
67
|
+
h('svg', { width: 32, height: 32, viewBox: '0 0 24 24', fill: 'none', stroke: 'var(--danger, #dc2626)', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' },
|
|
68
|
+
h('rect', { x: 3, y: 11, width: 18, height: 11, rx: 2, ry: 2 }),
|
|
69
|
+
h('path', { d: 'M7 11V7a5 5 0 0 1 10 0v4' })
|
|
70
|
+
)
|
|
71
|
+
),
|
|
72
|
+
h('h2', { style: { fontSize: 20, fontWeight: 700, marginBottom: 8 } }, 'Agent Access Restricted'),
|
|
73
|
+
h('p', { style: { fontSize: 14, color: 'var(--text-muted)', maxWidth: 400, lineHeight: 1.6 } },
|
|
74
|
+
'You don\'t have permission to access this agent. Contact your organization administrator to request access.'
|
|
75
|
+
),
|
|
76
|
+
h('button', { className: 'btn btn-primary', style: { marginTop: 16 }, onClick: onBack }, 'Back to Agents')
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
60
80
|
var load = function() {
|
|
61
81
|
setLoading(true);
|
|
62
82
|
Promise.all([
|
|
@@ -1125,11 +1125,21 @@ export function CreateAgentWizard({ onClose, onCreated, toast }) {
|
|
|
1125
1125
|
// ════════════════════════════════════════════════════════════
|
|
1126
1126
|
|
|
1127
1127
|
export function AgentsPage({ onSelectAgent }) {
|
|
1128
|
-
const
|
|
1128
|
+
const app = useApp();
|
|
1129
|
+
const toast = app.toast;
|
|
1129
1130
|
const [agents, setAgents] = useState([]);
|
|
1130
1131
|
const [creating, setCreating] = useState(false);
|
|
1131
1132
|
|
|
1132
|
-
const
|
|
1133
|
+
const perms = app.permissions || '*';
|
|
1134
|
+
const allowedAgents = perms === '*' ? '*' : (perms._allowedAgents || '*');
|
|
1135
|
+
|
|
1136
|
+
const load = () => apiCall('/agents').then(d => {
|
|
1137
|
+
var all = d.agents || d || [];
|
|
1138
|
+
if (allowedAgents !== '*' && Array.isArray(allowedAgents)) {
|
|
1139
|
+
all = all.filter(a => allowedAgents.indexOf(a.id) >= 0);
|
|
1140
|
+
}
|
|
1141
|
+
setAgents(all);
|
|
1142
|
+
}).catch(() => {});
|
|
1133
1143
|
useEffect(() => { load(); }, []);
|
|
1134
1144
|
|
|
1135
1145
|
// Delete moved to agent detail overview tab with triple confirmation
|
|
@@ -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,7 +381,30 @@ 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
|
|
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,
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-PNOFGWIB.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-DZU6DQ3I.js";
|
|
10
|
+
import "./chunk-Y3WLLVOK.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|