@agenticmail/enterprise 0.5.258 → 0.5.259

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,45 @@
1
+ import {
2
+ AgentRuntime,
3
+ EmailChannel,
4
+ FollowUpScheduler,
5
+ SessionManager,
6
+ SubAgentManager,
7
+ ToolRegistry,
8
+ callLLM,
9
+ createAgentRuntime,
10
+ createNoopHooks,
11
+ createRuntimeHooks,
12
+ estimateMessageTokens,
13
+ estimateTokens,
14
+ executeTool,
15
+ runAgentLoop,
16
+ toolsToDefinitions
17
+ } from "./chunk-FA3RK6I4.js";
18
+ import {
19
+ PROVIDER_REGISTRY,
20
+ listAllProviders,
21
+ resolveApiKeyForProvider,
22
+ resolveProvider
23
+ } from "./chunk-UF3ZJMJO.js";
24
+ import "./chunk-KFQGP6VL.js";
25
+ export {
26
+ AgentRuntime,
27
+ EmailChannel,
28
+ FollowUpScheduler,
29
+ PROVIDER_REGISTRY,
30
+ SessionManager,
31
+ SubAgentManager,
32
+ ToolRegistry,
33
+ callLLM,
34
+ createAgentRuntime,
35
+ createNoopHooks,
36
+ createRuntimeHooks,
37
+ estimateMessageTokens,
38
+ estimateTokens,
39
+ executeTool,
40
+ listAllProviders,
41
+ resolveApiKeyForProvider,
42
+ resolveProvider,
43
+ runAgentLoop,
44
+ toolsToDefinitions
45
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-X2PYK6HH.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-W66ZR4KK.js";
10
+ import "./chunk-ULRBF2T7.js";
11
+ import "./chunk-KFQGP6VL.js";
12
+ export {
13
+ promptCompanyInfo,
14
+ promptDatabase,
15
+ promptDeployment,
16
+ promptDomain,
17
+ promptRegistration,
18
+ provision,
19
+ runSetupWizard
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.258",
3
+ "version": "0.5.259",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -124,10 +124,17 @@ function McpServersSection() {
124
124
  .catch(function(e) { toast(e.message, 'error'); });
125
125
  };
126
126
 
127
- var deleteServer = function(id) {
128
- if (!confirm('Remove this MCP server? Agents will lose access to its tools.')) return;
129
- engineCall('/mcp-servers/' + id, { method: 'DELETE' })
130
- .then(function() { toast('Server removed', 'success'); load(); })
127
+ var _deleteTarget = useState(null); var deleteTarget = _deleteTarget[0]; var setDeleteTarget = _deleteTarget[1];
128
+ var _deleteStep = useState(0); var deleteStep = _deleteStep[0]; var setDeleteStep = _deleteStep[1];
129
+ var _deleteConfirmText = useState(''); var deleteConfirmText = _deleteConfirmText[0]; var setDeleteConfirmText = _deleteConfirmText[1];
130
+
131
+ var startDelete = function(server) { setDeleteTarget(server); setDeleteStep(1); setDeleteConfirmText(''); };
132
+ var cancelDelete = function() { setDeleteTarget(null); setDeleteStep(0); setDeleteConfirmText(''); };
133
+
134
+ var executeDelete = function() {
135
+ if (!deleteTarget) return;
136
+ engineCall('/mcp-servers/' + deleteTarget.id, { method: 'DELETE' })
137
+ .then(function() { toast('MCP server "' + deleteTarget.name + '" permanently deleted', 'success'); cancelDelete(); load(); })
131
138
  .catch(function(e) { toast(e.message, 'error'); });
132
139
  };
133
140
 
@@ -230,7 +237,7 @@ function McpServersSection() {
230
237
  h('button', { className: 'btn btn-ghost btn-sm', title: server.enabled ? 'Disable' : 'Enable', onClick: function() { toggleServer(server); } },
231
238
  server.enabled ? I.pause() : I.play()),
232
239
  h('button', { className: 'btn btn-ghost btn-sm', title: 'Edit', onClick: function() { openEdit(server); } }, I.settings()),
233
- h('button', { className: 'btn btn-ghost btn-sm', title: 'Remove', style: { color: 'var(--danger)' }, onClick: function() { deleteServer(server.id); } }, I.x())
240
+ h('button', { className: 'btn btn-ghost btn-sm', title: 'Remove', style: { color: 'var(--danger)' }, onClick: function() { startDelete(server); } }, I.x())
234
241
  )
235
242
  ),
236
243
  // Show tools if expanded (server has discovered tools)
@@ -472,6 +479,116 @@ function McpServersSection() {
472
479
  )
473
480
  )
474
481
  )
482
+ ),
483
+
484
+ // ─── 3-Step Delete Confirmation Modal ───
485
+ deleteTarget && h('div', { className: 'modal-overlay', onClick: cancelDelete },
486
+ h('div', { className: 'modal', onClick: function(e) { e.stopPropagation(); }, style: { width: 480, maxHeight: '80vh', overflow: 'auto' } },
487
+ h('div', { className: 'modal-header' },
488
+ h('h2', { style: { fontSize: 16, color: 'var(--danger)' } },
489
+ deleteStep === 1 ? 'Delete MCP Server' : deleteStep === 2 ? 'Agent Impact Warning' : 'Final Confirmation'
490
+ ),
491
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: cancelDelete }, '\u00D7')
492
+ ),
493
+ h('div', { className: 'modal-body', style: { padding: 20 } },
494
+ // Step indicator
495
+ h('div', { style: { display: 'flex', gap: 8, marginBottom: 20, justifyContent: 'center' } },
496
+ [1, 2, 3].map(function(s) {
497
+ return h('div', { key: s, style: {
498
+ width: 28, height: 28, borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center',
499
+ fontSize: 12, fontWeight: 700,
500
+ background: s === deleteStep ? 'var(--danger)' : s < deleteStep ? 'var(--success)' : 'var(--bg-tertiary)',
501
+ color: s <= deleteStep ? '#fff' : 'var(--text-muted)',
502
+ border: '2px solid ' + (s === deleteStep ? 'var(--danger)' : s < deleteStep ? 'var(--success)' : 'var(--border)')
503
+ } }, s < deleteStep ? '\u2713' : s);
504
+ })
505
+ ),
506
+
507
+ // Step 1: What you're deleting
508
+ deleteStep === 1 && h(Fragment, null,
509
+ h('div', { style: { padding: 16, background: 'rgba(239,68,68,0.08)', border: '1px solid rgba(239,68,68,0.2)', borderRadius: 'var(--radius)', marginBottom: 16 } },
510
+ h('div', { style: { fontWeight: 700, fontSize: 14, marginBottom: 8 } }, deleteTarget.name),
511
+ h('div', { style: { fontSize: 12, color: 'var(--text-secondary)', marginBottom: 4 } },
512
+ deleteTarget.type === 'stdio'
513
+ ? 'Command: ' + (deleteTarget.command || '') + ' ' + ((deleteTarget.args || []).join(' '))
514
+ : 'URL: ' + (deleteTarget.url || '')
515
+ ),
516
+ deleteTarget.toolCount > 0 && h('div', { style: { fontSize: 12, color: 'var(--text-secondary)' } },
517
+ deleteTarget.toolCount + ' tool(s) will be permanently removed'
518
+ ),
519
+ deleteTarget.tools && deleteTarget.tools.length > 0 && h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 4, marginTop: 8 } },
520
+ deleteTarget.tools.slice(0, 15).map(function(t) {
521
+ return h('span', { key: t.name, style: { padding: '2px 6px', borderRadius: 4, fontSize: 10, background: 'rgba(239,68,68,0.1)', color: 'var(--danger)', border: '1px solid rgba(239,68,68,0.2)' } }, t.name);
522
+ }),
523
+ deleteTarget.tools.length > 15 && h('span', { style: { fontSize: 10, color: 'var(--text-muted)', padding: '2px 4px' } }, '+' + (deleteTarget.tools.length - 15) + ' more')
524
+ )
525
+ ),
526
+ h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', lineHeight: 1.6 } },
527
+ 'This will permanently delete the MCP server configuration and disconnect it from all agents. The server process will be terminated immediately.'
528
+ ),
529
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 20 } },
530
+ h('button', { className: 'btn btn-ghost', onClick: cancelDelete }, 'Cancel'),
531
+ h('button', { className: 'btn btn-danger', onClick: function() { setDeleteStep(2); } }, 'Continue')
532
+ )
533
+ ),
534
+
535
+ // Step 2: Agent impact
536
+ deleteStep === 2 && h(Fragment, null,
537
+ h('div', { style: { padding: 16, background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 'var(--radius)', marginBottom: 16 } },
538
+ h('div', { style: { fontWeight: 700, fontSize: 13, marginBottom: 8, color: '#f59e0b' } }, 'Agent Impact'),
539
+ h('ul', { style: { margin: 0, paddingLeft: 20, fontSize: 12, color: 'var(--text-secondary)', lineHeight: 1.8 } },
540
+ h('li', null, 'Agents currently using these tools will get errors on their next call'),
541
+ h('li', null, 'Agents may have stored tool names in their memory from previous sessions'),
542
+ h('li', null, 'Running tasks that depend on these tools may fail'),
543
+ h('li', null, h('strong', null, 'Any in-progress work using these tools cannot be recovered'))
544
+ )
545
+ ),
546
+ deleteTarget.assignedAgents && deleteTarget.assignedAgents.length > 0 && h('div', { style: { padding: 12, background: 'var(--bg-secondary)', border: '1px solid var(--border)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 12 } },
547
+ h('div', { style: { fontWeight: 600, marginBottom: 6, color: 'var(--text-muted)' } }, 'Affected Agents:'),
548
+ h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 4 } },
549
+ deleteTarget.assignedAgents.map(function(aid) {
550
+ var a = agents.find(function(x) { return x.id === aid; });
551
+ return h('span', { key: aid, style: { padding: '3px 8px', borderRadius: 6, fontSize: 11, background: 'rgba(239,68,68,0.1)', color: 'var(--danger)', border: '1px solid rgba(239,68,68,0.15)' } }, a ? (a.display_name || a.name) : aid.slice(0, 8));
552
+ })
553
+ )
554
+ ),
555
+ h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', lineHeight: 1.6 } },
556
+ 'After deletion, affected agents will be notified that these tools are no longer available. They will not attempt to use them in future sessions.'
557
+ ),
558
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 20 } },
559
+ h('button', { className: 'btn btn-ghost', onClick: function() { setDeleteStep(1); } }, 'Back'),
560
+ h('button', { className: 'btn btn-danger', onClick: function() { setDeleteStep(3); } }, 'I Understand')
561
+ )
562
+ ),
563
+
564
+ // Step 3: Type name to confirm
565
+ deleteStep === 3 && h(Fragment, null,
566
+ h('div', { style: { padding: 16, background: 'rgba(239,68,68,0.08)', border: '1px solid rgba(239,68,68,0.2)', borderRadius: 'var(--radius)', marginBottom: 16, textAlign: 'center' } },
567
+ h('div', { style: { fontSize: 32, marginBottom: 8 } }, '\u26A0\uFE0F'),
568
+ h('div', { style: { fontWeight: 700, fontSize: 14, color: 'var(--danger)' } }, 'This action is irreversible'),
569
+ h('div', { style: { fontSize: 12, color: 'var(--text-secondary)', marginTop: 4 } },
570
+ 'Type "' + deleteTarget.name + '" to confirm deletion'
571
+ )
572
+ ),
573
+ h('input', {
574
+ className: 'input',
575
+ placeholder: 'Type server name to confirm...',
576
+ value: deleteConfirmText,
577
+ onChange: function(e) { setDeleteConfirmText(e.target.value); },
578
+ style: { marginBottom: 16, borderColor: deleteConfirmText === deleteTarget.name ? 'var(--danger)' : 'var(--border)' }
579
+ }),
580
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
581
+ h('button', { className: 'btn btn-ghost', onClick: function() { setDeleteStep(2); } }, 'Back'),
582
+ h('button', {
583
+ className: 'btn btn-danger',
584
+ disabled: deleteConfirmText !== deleteTarget.name,
585
+ onClick: executeDelete,
586
+ style: { opacity: deleteConfirmText === deleteTarget.name ? 1 : 0.4 }
587
+ }, 'Delete Permanently')
588
+ )
589
+ )
590
+ )
591
+ )
475
592
  )
476
593
  );
477
594
  }
@@ -395,7 +395,32 @@ engine.put('/mcp-servers/:id', async (c) => {
395
395
 
396
396
  engine.delete('/mcp-servers/:id', async (c) => {
397
397
  try {
398
- await _engineDb!.execute(`DELETE FROM mcp_servers WHERE id = $1`, [c.req.param('id')]);
398
+ const id = c.req.param('id');
399
+ // Fetch config before deleting (for agent notification)
400
+ const rows = await _engineDb!.query(`SELECT config, tools FROM mcp_servers WHERE id = $1`, [id]);
401
+ const serverConfig = rows?.[0] ? (typeof rows[0].config === 'string' ? JSON.parse(rows[0].config) : rows[0].config) : null;
402
+ const serverTools = rows?.[0]?.tools ? (typeof rows[0].tools === 'string' ? JSON.parse(rows[0].tools) : rows[0].tools) : [];
403
+
404
+ await _engineDb!.execute(`DELETE FROM mcp_servers WHERE id = $1`, [id]);
405
+
406
+ // Write a memory entry for each assigned agent so they know tools were removed
407
+ if (serverConfig?.assignedAgents?.length && memoryManager) {
408
+ const toolNames = (serverTools || []).map((t: any) => t.name).join(', ');
409
+ for (const agentId of serverConfig.assignedAgents) {
410
+ try {
411
+ await memoryManager.createMemory({
412
+ agentId,
413
+ orgId: 'default',
414
+ category: 'system_notice',
415
+ title: `MCP Server "${serverConfig.name}" was deleted`,
416
+ content: `The MCP server "${serverConfig.name}" has been permanently removed by an administrator. The following tools are no longer available and should NOT be called: ${toolNames || 'unknown'}. If a task requires these tools, inform the user that they are no longer available.`,
417
+ source: 'mcp_server_deletion',
418
+ importance: 'high',
419
+ });
420
+ } catch { /* non-fatal */ }
421
+ }
422
+ }
423
+
399
424
  return c.json({ ok: true });
400
425
  } catch (e: any) { return c.json({ error: e.message }, 500); }
401
426
  });