@agenticmail/enterprise 0.5.291 → 0.5.293
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/agent-heartbeat-W2XLGPOG.js +510 -0
- package/dist/agent-tools-H7BYL7A6.js +13881 -0
- package/dist/chunk-64SXJMJI.js +3841 -0
- package/dist/chunk-67AD7SKP.js +4739 -0
- package/dist/chunk-I3AODI5Z.js +1519 -0
- package/dist/chunk-NPR5DIPX.js +48 -0
- package/dist/cli-agent-5JNS5J2U.js +1778 -0
- package/dist/cli-recover-2U3N37CE.js +487 -0
- package/dist/cli-serve-QM2D6TYP.js +143 -0
- package/dist/cli-verify-R32RJGVW.js +149 -0
- package/dist/cli.js +5 -5
- package/dist/dashboard/app.js +38 -4
- package/dist/dashboard/components/icons.js +2 -0
- package/dist/dashboard/pages/agent-detail/index.js +11 -1
- package/dist/dashboard/pages/users.js +282 -13
- package/dist/factory-KWNTMIVU.js +9 -0
- package/dist/index.js +17 -17
- package/dist/page-registry-OZYEX3Q3.js +178 -0
- package/dist/postgres-CRAQ7OOV.js +760 -0
- package/dist/routes-6DD25A5C.js +13695 -0
- package/dist/runtime-HKTQ22HR.js +45 -0
- package/dist/server-A37MVNDZ.js +15 -0
- package/dist/setup-XI4ZTR4B.js +20 -0
- package/dist/sqlite-RVBJTDQC.js +495 -0
- package/package.json +1 -1
- package/src/admin/page-registry.ts +204 -0
- package/src/admin/routes.ts +80 -0
- package/src/dashboard/app.js +38 -4
- package/src/dashboard/components/icons.js +2 -0
- package/src/dashboard/pages/agent-detail/index.js +11 -1
- package/src/dashboard/pages/users.js +282 -13
- package/src/db/adapter.ts +1 -0
- package/src/db/postgres.ts +2 -0
- package/src/db/sqlite.ts +4 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DomainLock
|
|
3
|
+
} from "./chunk-UPU23ZRG.js";
|
|
4
|
+
import "./chunk-KFQGP6VL.js";
|
|
5
|
+
|
|
6
|
+
// src/domain-lock/cli-verify.ts
|
|
7
|
+
function getFlag(args, name) {
|
|
8
|
+
const idx = args.indexOf(name);
|
|
9
|
+
if (idx !== -1 && args[idx + 1]) return args[idx + 1];
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
function hasFlag(args, name) {
|
|
13
|
+
return args.includes(name);
|
|
14
|
+
}
|
|
15
|
+
function detectDbType(url) {
|
|
16
|
+
const u = url.toLowerCase().trim();
|
|
17
|
+
if (u.startsWith("postgres") || u.startsWith("pg:")) return "postgres";
|
|
18
|
+
if (u.startsWith("mysql")) return "mysql";
|
|
19
|
+
if (u.startsWith("mongodb")) return "mongodb";
|
|
20
|
+
if (u.startsWith("libsql") || u.includes(".turso.io")) return "turso";
|
|
21
|
+
if (u.endsWith(".db") || u.endsWith(".sqlite") || u.endsWith(".sqlite3") || u.startsWith("file:")) return "sqlite";
|
|
22
|
+
return "postgres";
|
|
23
|
+
}
|
|
24
|
+
async function runVerifyDomain(args) {
|
|
25
|
+
const { default: chalk } = await import("chalk");
|
|
26
|
+
const { default: ora } = await import("ora");
|
|
27
|
+
console.log("");
|
|
28
|
+
console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Verification"));
|
|
29
|
+
console.log("");
|
|
30
|
+
let domain = getFlag(args, "--domain");
|
|
31
|
+
let dnsChallenge;
|
|
32
|
+
let db = null;
|
|
33
|
+
let dbConnected = false;
|
|
34
|
+
const envDbUrl = process.env.DATABASE_URL;
|
|
35
|
+
if (envDbUrl) {
|
|
36
|
+
const dbType = detectDbType(envDbUrl);
|
|
37
|
+
const spinner = ora(`Connecting to database (${dbType})...`).start();
|
|
38
|
+
try {
|
|
39
|
+
const { createAdapter } = await import("./factory-KWNTMIVU.js");
|
|
40
|
+
db = await createAdapter({ type: dbType, connectionString: envDbUrl });
|
|
41
|
+
await db.migrate();
|
|
42
|
+
const settings = await db.getSettings();
|
|
43
|
+
if (!domain && settings?.domain) domain = settings.domain;
|
|
44
|
+
if (settings?.domainDnsChallenge) dnsChallenge = settings.domainDnsChallenge;
|
|
45
|
+
dbConnected = true;
|
|
46
|
+
spinner.succeed(`Connected to ${dbType} database` + (domain ? ` (domain: ${domain})` : ""));
|
|
47
|
+
} catch (err) {
|
|
48
|
+
spinner.warn(`Could not connect via DATABASE_URL: ${err.message}`);
|
|
49
|
+
db = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!dbConnected) {
|
|
53
|
+
const dbPath = getFlag(args, "--db");
|
|
54
|
+
const dbType = getFlag(args, "--db-type") || "sqlite";
|
|
55
|
+
if (dbPath) {
|
|
56
|
+
const spinner = ora(`Connecting to ${dbType} database...`).start();
|
|
57
|
+
try {
|
|
58
|
+
const { createAdapter } = await import("./factory-KWNTMIVU.js");
|
|
59
|
+
db = await createAdapter({ type: dbType, connectionString: dbPath });
|
|
60
|
+
await db.migrate();
|
|
61
|
+
const settings = await db.getSettings();
|
|
62
|
+
if (!domain && settings?.domain) domain = settings.domain;
|
|
63
|
+
if (settings?.domainDnsChallenge) dnsChallenge = settings.domainDnsChallenge;
|
|
64
|
+
dbConnected = true;
|
|
65
|
+
spinner.succeed(`Connected to ${dbType} database`);
|
|
66
|
+
} catch {
|
|
67
|
+
spinner.warn("Could not read local database");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!domain) {
|
|
72
|
+
const { default: inquirer } = await import("inquirer");
|
|
73
|
+
const answer = await inquirer.prompt([{
|
|
74
|
+
type: "input",
|
|
75
|
+
name: "domain",
|
|
76
|
+
message: "Domain to verify:",
|
|
77
|
+
suffix: chalk.dim(" (e.g. agents.yourcompany.com)"),
|
|
78
|
+
validate: (v) => v.includes(".") || "Enter a valid domain",
|
|
79
|
+
filter: (v) => v.trim().toLowerCase()
|
|
80
|
+
}]);
|
|
81
|
+
domain = answer.domain;
|
|
82
|
+
}
|
|
83
|
+
const lock = new DomainLock();
|
|
84
|
+
const maxAttempts = hasFlag(args, "--poll") ? 5 : 1;
|
|
85
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
86
|
+
const spinner = ora(
|
|
87
|
+
maxAttempts > 1 ? `Checking DNS verification (attempt ${attempt}/${maxAttempts})...` : "Checking DNS verification..."
|
|
88
|
+
).start();
|
|
89
|
+
try {
|
|
90
|
+
const result = await lock.checkVerification(domain);
|
|
91
|
+
if (!result.success) {
|
|
92
|
+
spinner.fail("Verification check failed");
|
|
93
|
+
console.log("");
|
|
94
|
+
console.error(chalk.red(` ${result.error}`));
|
|
95
|
+
console.log("");
|
|
96
|
+
if (db) await db.disconnect();
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (result.verified) {
|
|
100
|
+
spinner.succeed("Domain verified!");
|
|
101
|
+
if (dbConnected && db) {
|
|
102
|
+
try {
|
|
103
|
+
await db.updateSettings({
|
|
104
|
+
domainStatus: "verified",
|
|
105
|
+
domainVerifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
106
|
+
});
|
|
107
|
+
console.log(chalk.dim(" Database updated with verified status."));
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
console.log("");
|
|
112
|
+
console.log(chalk.green.bold(` \u2713 ${domain} is verified and protected.`));
|
|
113
|
+
console.log(chalk.dim(" Your deployment domain is locked. No other instance can claim it."));
|
|
114
|
+
console.log(chalk.dim(" The system now operates 100% offline \u2014 no outbound calls are made."));
|
|
115
|
+
console.log("");
|
|
116
|
+
if (db) await db.disconnect();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
} catch (err) {
|
|
120
|
+
spinner.warn(`Check failed: ${err.message}`);
|
|
121
|
+
}
|
|
122
|
+
if (attempt < maxAttempts) {
|
|
123
|
+
const waitSpinner = ora(`DNS record not found yet. Retrying in 10 seconds...`).start();
|
|
124
|
+
await new Promise((r) => setTimeout(r, 1e4));
|
|
125
|
+
waitSpinner.stop();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.log("");
|
|
129
|
+
console.log(chalk.yellow(" DNS record not detected yet."));
|
|
130
|
+
console.log("");
|
|
131
|
+
console.log(chalk.bold(" Make sure this TXT record exists at your DNS provider:"));
|
|
132
|
+
console.log("");
|
|
133
|
+
console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
|
|
134
|
+
console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
|
|
135
|
+
if (dnsChallenge) {
|
|
136
|
+
console.log(` ${chalk.bold("Value:")} ${chalk.cyan(dnsChallenge)}`);
|
|
137
|
+
} else {
|
|
138
|
+
console.log(` ${chalk.bold("Value:")} ${chalk.dim("(check your dashboard or setup output)")}`);
|
|
139
|
+
}
|
|
140
|
+
console.log("");
|
|
141
|
+
console.log(chalk.dim(" DNS propagation can take up to 48 hours."));
|
|
142
|
+
console.log(chalk.dim(" Run with --poll to retry automatically:"));
|
|
143
|
+
console.log(chalk.dim(` npx @agenticmail/enterprise verify-domain --domain ${domain} --poll`));
|
|
144
|
+
console.log("");
|
|
145
|
+
if (db) await db.disconnect();
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
runVerifyDomain
|
|
149
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -14,10 +14,10 @@ switch (command) {
|
|
|
14
14
|
import("./cli-submit-skill-LDFJGSKO.js").then((m) => m.runSubmitSkill(args.slice(1))).catch(fatal);
|
|
15
15
|
break;
|
|
16
16
|
case "recover":
|
|
17
|
-
import("./cli-recover-
|
|
17
|
+
import("./cli-recover-2U3N37CE.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
|
|
18
18
|
break;
|
|
19
19
|
case "verify-domain":
|
|
20
|
-
import("./cli-verify-
|
|
20
|
+
import("./cli-verify-R32RJGVW.js").then((m) => m.runVerifyDomain(args.slice(1))).catch(fatal);
|
|
21
21
|
break;
|
|
22
22
|
case "reset-password":
|
|
23
23
|
import("./cli-reset-password-SO5Y6MW7.js").then((m) => m.runResetPassword(args.slice(1))).catch(fatal);
|
|
@@ -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-QM2D6TYP.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
|
|
61
61
|
break;
|
|
62
62
|
case "agent":
|
|
63
|
-
import("./cli-agent-
|
|
63
|
+
import("./cli-agent-5JNS5J2U.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-XI4ZTR4B.js").then((m) => m.runSetupWizard()).catch(fatal);
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
function fatal(err) {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -93,6 +93,7 @@ function App() {
|
|
|
93
93
|
const [toasts, setToasts] = useState([]);
|
|
94
94
|
const [user, setUser] = useState(null);
|
|
95
95
|
const [pendingCount, setPendingCount] = useState(0);
|
|
96
|
+
const [permissions, setPermissions] = useState('*'); // '*' = full access, or { pageId: true | ['tab1','tab2'] }
|
|
96
97
|
const [needsSetup, setNeedsSetup] = useState(null);
|
|
97
98
|
const [sidebarPinned, setSidebarPinned] = useState(() => localStorage.getItem('em_sidebar_pinned') === 'true');
|
|
98
99
|
const [sidebarHovered, setSidebarHovered] = useState(false);
|
|
@@ -136,6 +137,7 @@ function App() {
|
|
|
136
137
|
if (!authed) return;
|
|
137
138
|
engineCall('/approvals/pending').then(d => setPendingCount((d.requests || []).length)).catch(() => {});
|
|
138
139
|
apiCall('/settings').then(d => { const s = d.settings || d || {}; if (s.primaryColor) applyBrandColor(s.primaryColor); if (s.orgId) setOrgId(s.orgId); }).catch(() => {});
|
|
140
|
+
apiCall('/me/permissions').then(d => { if (d && d.permissions) setPermissions(d.permissions); }).catch(() => {});
|
|
139
141
|
}, [authed]);
|
|
140
142
|
|
|
141
143
|
const logout = useCallback(() => { authCall('/logout', { method: 'POST' }).catch(() => {}).finally(() => { setAuthed(false); setUser(null); }); }, []);
|
|
@@ -208,10 +210,20 @@ function App() {
|
|
|
208
210
|
};
|
|
209
211
|
|
|
210
212
|
const navigateToAgent = (agentId) => { _setSelectedAgentId(agentId); history.pushState(null, '', '/dashboard/agents/' + agentId); };
|
|
211
|
-
|
|
213
|
+
|
|
214
|
+
// Filter nav based on permissions
|
|
215
|
+
const hasAccess = (pageId) => permissions === '*' || (permissions && pageId in permissions);
|
|
216
|
+
const filteredNav = nav.map(section => ({
|
|
217
|
+
...section,
|
|
218
|
+
items: section.items.filter(item => hasAccess(item.id))
|
|
219
|
+
})).filter(section => section.items.length > 0);
|
|
220
|
+
|
|
221
|
+
// Block access to pages user can't see — show unauthorized page
|
|
222
|
+
const canAccessPage = hasAccess(page);
|
|
223
|
+
const PageComponent = canAccessPage ? (pages[page] || DashboardPage) : null;
|
|
212
224
|
const sidebarClass = 'sidebar' + (sidebarPinned ? ' expanded' : sidebarHovered ? ' hover-expanded' : '') + (mobileMenuOpen ? ' mobile-open' : '');
|
|
213
225
|
|
|
214
|
-
return h(AppContext.Provider, { value: { toast, toasts, user, theme, setPage } },
|
|
226
|
+
return h(AppContext.Provider, { value: { toast, toasts, user, theme, setPage, permissions } },
|
|
215
227
|
h('div', { className: 'app-layout' },
|
|
216
228
|
// Mobile hamburger
|
|
217
229
|
h('button', { className: 'mobile-hamburger', onClick: () => setMobileMenuOpen(true) },
|
|
@@ -231,7 +243,7 @@ function App() {
|
|
|
231
243
|
h('button', { className: 'sidebar-toggle' + (sidebarPinned ? ' pinned' : ''), onClick: toggleSidebarPin, title: sidebarPinned ? 'Unpin sidebar' : 'Pin sidebar' }, sidebarPinned ? I.chevronLeft() : I.panelLeft())
|
|
232
244
|
),
|
|
233
245
|
h('div', { className: 'sidebar-nav' },
|
|
234
|
-
|
|
246
|
+
filteredNav.map((section, si) =>
|
|
235
247
|
h('div', { key: section.section + si, className: 'sidebar-section' },
|
|
236
248
|
h('div', { className: 'sidebar-section-title' }, section.section),
|
|
237
249
|
section.items.map(item =>
|
|
@@ -271,7 +283,29 @@ function App() {
|
|
|
271
283
|
? h(AgentDetailPage, { agentId: selectedAgentId, onBack: () => { _setSelectedAgentId(null); _setPage('agents'); history.pushState(null, '', '/dashboard/agents'); } })
|
|
272
284
|
: page === 'agents'
|
|
273
285
|
? h(AgentsPage, { onSelectAgent: navigateToAgent })
|
|
274
|
-
: h(PageComponent)
|
|
286
|
+
: PageComponent ? h(PageComponent)
|
|
287
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', minHeight: '60vh', textAlign: 'center', padding: 40 } },
|
|
288
|
+
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 } },
|
|
289
|
+
h('svg', { width: 32, height: 32, viewBox: '0 0 24 24', fill: 'none', stroke: 'var(--danger, #dc2626)', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' },
|
|
290
|
+
h('rect', { x: 3, y: 11, width: 18, height: 11, rx: 2, ry: 2 }),
|
|
291
|
+
h('path', { d: 'M7 11V7a5 5 0 0 1 10 0v4' })
|
|
292
|
+
)
|
|
293
|
+
),
|
|
294
|
+
h('h2', { style: { fontSize: 20, fontWeight: 700, marginBottom: 8, color: 'var(--text-primary)' } }, 'Access Restricted'),
|
|
295
|
+
h('p', { style: { fontSize: 14, color: 'var(--text-muted)', maxWidth: 400, lineHeight: 1.6, marginBottom: 24 } },
|
|
296
|
+
'You don\'t have permission to access this page. If you believe this is an error, please contact your company administrator to request access.'
|
|
297
|
+
),
|
|
298
|
+
h('div', { style: { display: 'flex', gap: 12 } },
|
|
299
|
+
filteredNav[0]?.items[0] && h('button', {
|
|
300
|
+
className: 'btn btn-primary',
|
|
301
|
+
onClick: () => { setPage(filteredNav[0].items[0].id); history.pushState(null, '', '/dashboard/' + filteredNav[0].items[0].id); }
|
|
302
|
+
}, 'Go to ' + filteredNav[0].items[0].label),
|
|
303
|
+
h('button', {
|
|
304
|
+
className: 'btn btn-secondary',
|
|
305
|
+
onClick: () => { window.location.href = 'mailto:?subject=Access%20Request&body=I%20need%20access%20to%20the%20' + encodeURIComponent(page) + '%20page%20in%20the%20dashboard.'; }
|
|
306
|
+
}, 'Request Access')
|
|
307
|
+
)
|
|
308
|
+
)
|
|
275
309
|
)
|
|
276
310
|
)
|
|
277
311
|
),
|
|
@@ -54,5 +54,7 @@ export const I = {
|
|
|
54
54
|
eyeOff: () => h('svg', S, h('path', { d: 'M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24' }), h('line', { x1: 1, y1: 1, x2: 23, y2: 23 })),
|
|
55
55
|
panelLeft: () => h('svg', S, h('rect', { x: 3, y: 3, width: 18, height: 18, rx: 2 }), h('line', { x1: 9, y1: 3, x2: 9, y2: 21 })),
|
|
56
56
|
chevronLeft: () => h('svg', S, h('polyline', { points: '15 18 9 12 15 6' })),
|
|
57
|
+
chevronRight: () => h('svg', S, h('polyline', { points: '9 18 15 12 9 6' })),
|
|
58
|
+
chevronDown: () => h('svg', S, h('polyline', { points: '6 9 12 15 18 9' })),
|
|
57
59
|
edit: () => h('svg', S, h('path', { d: 'M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7' }), h('path', { d: 'M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z' })),
|
|
58
60
|
};
|
|
@@ -44,9 +44,19 @@ export function AgentDetailPage(props) {
|
|
|
44
44
|
var _agents = useState([]);
|
|
45
45
|
var agents = _agents[0]; var setAgents = _agents[1];
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var ALL_TABS = ['overview', 'personal', 'email', 'whatsapp', 'channels', 'configuration', 'manager', 'tools', 'skills', 'permissions', 'activity', 'communication', 'workforce', 'memory', 'guardrails', 'autonomy', 'budget', 'security', 'tool-security', 'deployment'];
|
|
48
48
|
var TAB_LABELS = { 'security': 'Security', 'tool-security': 'Tool Security', 'manager': 'Manager', 'email': 'Email', 'whatsapp': 'WhatsApp', 'channels': 'Channels', 'tools': 'Tools', 'autonomy': 'Autonomy' };
|
|
49
49
|
|
|
50
|
+
// Filter tabs based on user permissions
|
|
51
|
+
var app = useApp();
|
|
52
|
+
var perms = app.permissions || '*';
|
|
53
|
+
var agentGrant = perms === '*' ? true : (perms.agents || false);
|
|
54
|
+
var TABS = ALL_TABS.filter(function(t) {
|
|
55
|
+
if (perms === '*' || agentGrant === true) return true;
|
|
56
|
+
if (Array.isArray(agentGrant)) return agentGrant.indexOf(t) !== -1;
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
|
|
50
60
|
var load = function() {
|
|
51
61
|
setLoading(true);
|
|
52
62
|
Promise.all([
|