@agenticmail/enterprise 0.5.253 → 0.5.255

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.
@@ -0,0 +1,114 @@
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-672W7A5B.js");
97
+ const { createServer } = await import("./server-37QX4BUZ.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
+ }
112
+ export {
113
+ runServe
114
+ };
package/dist/cli.js CHANGED
@@ -53,14 +53,14 @@ Skill Development:
53
53
  break;
54
54
  case "serve":
55
55
  case "start":
56
- import("./cli-serve-44IKCXDO.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
56
+ import("./cli-serve-TMYT73ZR.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
57
57
  break;
58
58
  case "agent":
59
- import("./cli-agent-3KZRZBZG.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
59
+ import("./cli-agent-UP7UVQ4S.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
60
60
  break;
61
61
  case "setup":
62
62
  default:
63
- import("./setup-3XCPXDZE.js").then((m) => m.runSetupWizard()).catch(fatal);
63
+ import("./setup-5BEVJLTF.js").then((m) => m.runSetupWizard()).catch(fatal);
64
64
  break;
65
65
  }
66
66
  function fatal(err) {
@@ -208,6 +208,88 @@ function CustomerBadge(props) {
208
208
  }
209
209
 
210
210
  // ─── Task Detail Modal ───────────────────────────────────
211
+ // ─── Activity Log Component ──────────────────────────────
212
+ var ACTIVITY_PAGE_SIZE = 10;
213
+ var ACTIVITY_TYPE_COLORS = {
214
+ created: '#6366f1', assigned: '#f59e0b', started: '#06b6d4', in_progress: '#06b6d4',
215
+ completed: '#15803d', failed: '#ef4444', cancelled: '#6b7394', delegated: '#a855f7',
216
+ compaction: '#8b5cf6', error: '#ef4444',
217
+ };
218
+
219
+ function ActivityLog(props) {
220
+ var entries = props.entries || [];
221
+ var _search = useState(''); var search = _search[0]; var setSearch = _search[1];
222
+ var _typeFilter = useState('all'); var typeFilter = _typeFilter[0]; var setTypeFilter = _typeFilter[1];
223
+ var _page = useState(0); var page = _page[0]; var setPage = _page[1];
224
+
225
+ // Get unique types for filter dropdown
226
+ var types = [];
227
+ var seen = {};
228
+ entries.forEach(function(e) { if (e.type && !seen[e.type]) { seen[e.type] = true; types.push(e.type); } });
229
+
230
+ // Filter
231
+ var filtered = entries.filter(function(e) {
232
+ if (typeFilter !== 'all' && e.type !== typeFilter) return false;
233
+ if (search) {
234
+ var q = search.toLowerCase();
235
+ return (e.type || '').toLowerCase().includes(q) || (e.detail || '').toLowerCase().includes(q) || (e.agent || '').toLowerCase().includes(q);
236
+ }
237
+ return true;
238
+ });
239
+
240
+ var totalPages = Math.max(1, Math.ceil(filtered.length / ACTIVITY_PAGE_SIZE));
241
+ if (page >= totalPages) page = totalPages - 1;
242
+ var pageEntries = filtered.slice(page * ACTIVITY_PAGE_SIZE, (page + 1) * ACTIVITY_PAGE_SIZE);
243
+
244
+ return h('div', { style: { marginBottom: 16 } },
245
+ h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8, gap: 8, flexWrap: 'wrap' } },
246
+ h('div', { style: { fontSize: 12, fontWeight: 600, color: 'var(--text-muted)' } }, 'ACTIVITY LOG (' + filtered.length + ')'),
247
+ h('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
248
+ h('input', {
249
+ placeholder: 'Search...', value: search,
250
+ onChange: function(e) { setSearch(e.target.value); setPage(0); },
251
+ style: { padding: '3px 8px', fontSize: 11, borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', width: 120, outline: 'none' }
252
+ }),
253
+ h('select', {
254
+ value: typeFilter,
255
+ onChange: function(e) { setTypeFilter(e.target.value); setPage(0); },
256
+ style: { padding: '3px 8px', fontSize: 11, borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', outline: 'none' }
257
+ },
258
+ h('option', { value: 'all' }, 'All types'),
259
+ types.map(function(t) { return h('option', { key: t, value: t }, t); })
260
+ )
261
+ )
262
+ ),
263
+ h('div', { style: { border: '1px solid var(--border)', borderRadius: 'var(--radius)', overflow: 'hidden' } },
264
+ pageEntries.map(function(entry, i) {
265
+ var tc = ACTIVITY_TYPE_COLORS[entry.type] || 'var(--text-muted)';
266
+ return h('div', { key: page * ACTIVITY_PAGE_SIZE + i, style: { display: 'flex', gap: 8, padding: '6px 10px', borderBottom: i < pageEntries.length - 1 ? '1px solid var(--border)' : 'none', fontSize: 11, alignItems: 'flex-start' } },
267
+ h('span', { style: { color: 'var(--text-muted)', flexShrink: 0, fontFamily: 'var(--font-mono)', fontSize: 10, minWidth: 65 } }, entry.ts ? new Date(entry.ts).toLocaleTimeString() : ''),
268
+ h('span', { style: { fontWeight: 600, flexShrink: 0, minWidth: 70, color: tc, padding: '0 4px', borderRadius: 4, background: tc + '15' } }, entry.type),
269
+ h('span', { style: { color: 'var(--text-secondary)', wordBreak: 'break-word' } }, entry.detail)
270
+ );
271
+ }),
272
+ pageEntries.length === 0 && h('div', { style: { padding: '12px 10px', fontSize: 11, color: 'var(--text-muted)', textAlign: 'center' } }, 'No matching entries')
273
+ ),
274
+ // Pagination
275
+ totalPages > 1 && h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginTop: 6, fontSize: 11 } },
276
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Page ' + (page + 1) + ' of ' + totalPages),
277
+ h('div', { style: { display: 'flex', gap: 4 } },
278
+ h('button', {
279
+ disabled: page === 0,
280
+ onClick: function() { setPage(page - 1); },
281
+ style: { padding: '2px 8px', fontSize: 11, borderRadius: 4, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: page === 0 ? 'var(--text-muted)' : 'var(--text-primary)', cursor: page === 0 ? 'default' : 'pointer' }
282
+ }, 'Prev'),
283
+ h('button', {
284
+ disabled: page >= totalPages - 1,
285
+ onClick: function() { setPage(page + 1); },
286
+ style: { padding: '2px 8px', fontSize: 11, borderRadius: 4, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: page >= totalPages - 1 ? 'var(--text-muted)' : 'var(--text-primary)', cursor: page >= totalPages - 1 ? 'default' : 'pointer' }
287
+ }, 'Next')
288
+ )
289
+ )
290
+ );
291
+ }
292
+
211
293
  function TaskDetail(props) {
212
294
  var task = props.task;
213
295
  var chain = props.chain;
@@ -279,9 +361,9 @@ function TaskDetail(props) {
279
361
  ),
280
362
  h('div', { style: {
281
363
  padding: '6px 10px', borderRadius: 8, fontSize: 11, flexShrink: 0,
282
- background: isMe ? sc + '22' : 'rgba(255,255,255,0.03)',
283
- border: '1px solid ' + (isMe ? sc : 'rgba(255,255,255,0.1)'),
284
- fontWeight: isMe ? 700 : 400, color: isMe ? sc : 'rgba(255,255,255,0.6)',
364
+ background: isMe ? sc + '22' : 'var(--tp-card)',
365
+ border: '1px solid ' + (isMe ? sc : 'var(--tp-border)'),
366
+ fontWeight: isMe ? 700 : 400, color: isMe ? sc : 'var(--tp-text-dim)',
285
367
  } },
286
368
  h('div', { style: { fontWeight: 600 } }, ct.assignedToName || ct.assignedTo),
287
369
  h('div', { style: { fontSize: 9, marginTop: 2, opacity: 0.6 } }, ct.status.replace('_', ' '))
@@ -291,19 +373,8 @@ function TaskDetail(props) {
291
373
  )
292
374
  ),
293
375
 
294
- // Activity log
295
- task.activityLog && task.activityLog.length > 0 && h('div', { style: { marginBottom: 16 } },
296
- h('div', { style: { fontSize: 12, fontWeight: 600, color: 'var(--text-muted)', marginBottom: 8 } }, 'ACTIVITY LOG'),
297
- h('div', { style: { maxHeight: 180, overflow: 'auto', border: '1px solid var(--border)', borderRadius: 'var(--radius)' } },
298
- task.activityLog.map(function(entry, i) {
299
- return h('div', { key: i, style: { display: 'flex', gap: 8, padding: '6px 10px', borderBottom: '1px solid var(--border)', fontSize: 11 } },
300
- h('span', { style: { color: 'var(--text-muted)', flexShrink: 0, fontFamily: 'var(--font-mono)', fontSize: 10 } }, entry.ts ? new Date(entry.ts).toLocaleTimeString() : ''),
301
- h('span', { style: { fontWeight: 600, flexShrink: 0, minWidth: 60 } }, entry.type),
302
- h('span', { style: { color: 'var(--text-secondary)' } }, entry.detail)
303
- );
304
- })
305
- )
306
- ),
376
+ // Activity log — paginated with filter + search
377
+ task.activityLog && task.activityLog.length > 0 && h(ActivityLog, { entries: task.activityLog }),
307
378
 
308
379
  task.error && h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.1)', border: '1px solid rgba(239,68,68,0.3)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 13, color: '#ef4444' } }, h('strong', null, 'Error: '), task.error),
309
380
 
@@ -895,8 +966,8 @@ export function TaskPipelinePage() {
895
966
  // Hover tooltip
896
967
  hoveredNode && hoveredNode.task && h('div', { style: {
897
968
  position: 'fixed', left: mousePos.x + 16, top: mousePos.y - 10,
898
- background: 'rgba(15,17,23,0.95)', backdropFilter: 'blur(12px)',
899
- border: '1px solid rgba(255,255,255,0.15)', borderRadius: 10,
969
+ background: 'var(--bg-secondary)', backdropFilter: 'blur(12px)',
970
+ border: '1px solid var(--tp-border)', borderRadius: 10, boxShadow: '0 8px 32px rgba(0,0,0,0.2)',
900
971
  padding: '10px 14px', pointerEvents: 'none', zIndex: 1000, minWidth: 180, maxWidth: 280,
901
972
  }},
902
973
  hoveredNode.task.customerContext && h(CustomerBadge, { customer: hoveredNode.task.customerContext }),
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-J6QPL5WN.js";
10
+ } from "./chunk-75FNJLUP.js";
11
11
  import {
12
12
  ValidationError,
13
13
  auditLogger,
@@ -21,7 +21,7 @@ import {
21
21
  requireRole,
22
22
  securityHeaders,
23
23
  validate
24
- } from "./chunk-WXXG3LYY.js";
24
+ } from "./chunk-TOD2HH7L.js";
25
25
  import "./chunk-OF4MUWWS.js";
26
26
  import {
27
27
  AgenticMailManager,
@@ -43,7 +43,7 @@ import {
43
43
  executeTool,
44
44
  runAgentLoop,
45
45
  toolsToDefinitions
46
- } from "./chunk-4IUA4QZE.js";
46
+ } from "./chunk-HE4H2WNG.js";
47
47
  import {
48
48
  PROVIDER_REGISTRY,
49
49
  listAllProviders,