@agenticmail/enterprise 0.5.249 → 0.5.251

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-OLTC5KIG.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-QTLKNMY5.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-TC4SD4GV.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.249",
3
+ "version": "0.5.251",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1942,7 +1942,7 @@ export function createAdminRoutes(db: DatabaseAdapter) {
1942
1942
  // 5. Update CORS to allow the new domain
1943
1943
  try {
1944
1944
  if (db) {
1945
- const corsRows = await db.query(`SELECT value FROM admin_settings WHERE key = 'cors_origins'`);
1945
+ const corsRows = await (db as any).query(`SELECT value FROM admin_settings WHERE key = 'cors_origins'`);
1946
1946
  let origins: string[] = [];
1947
1947
  if (corsRows?.[0]) {
1948
1948
  try { origins = JSON.parse((corsRows[0] as any).value); } catch { origins = []; }
@@ -1950,7 +1950,7 @@ export function createAdminRoutes(db: DatabaseAdapter) {
1950
1950
  const newOrigin = 'https://' + domain;
1951
1951
  if (!origins.includes(newOrigin)) {
1952
1952
  origins.push(newOrigin);
1953
- await db.execute(
1953
+ await (db as any).execute(
1954
1954
  `INSERT INTO admin_settings (key, value) VALUES ('cors_origins', $1) ON CONFLICT (key) DO UPDATE SET value = $1`,
1955
1955
  [JSON.stringify(origins)]
1956
1956
  );
package/src/cli-agent.ts CHANGED
@@ -916,7 +916,7 @@ export async function runAgent(_args: string[]) {
916
916
  createdBy: ctx.senderEmail || ctx.senderName || 'external',
917
917
  createdByName: ctx.senderName || ctx.senderEmail || 'User',
918
918
  task: ctx.messageText,
919
- model: config.model || process.env.AGENTICMAIL_MODEL,
919
+ model: (config.model ? `${config.model.provider}/${config.model.modelId}` : undefined) || process.env.AGENTICMAIL_MODEL,
920
920
  sessionId: undefined,
921
921
  source: ctx.source || 'internal',
922
922
  });
@@ -1,4 +1,4 @@
1
- import { h, useState, useEffect, useCallback, Fragment, useApp, engineCall, adminCall } from '../components/utils.js';
1
+ import { h, useState, useEffect, useCallback, Fragment, useApp, engineCall, apiCall } from '../components/utils.js';
2
2
  import { I } from '../components/icons.js';
3
3
  import { Modal } from '../components/modal.js';
4
4
  import { HelpButton } from '../components/help-button.js';
@@ -60,7 +60,7 @@ function McpServersSection() {
60
60
 
61
61
  useEffect(function() { load(); }, [load]);
62
62
  useEffect(function() {
63
- adminCall('/agents').then(function(d) { setAgents((d.agents || d || []).filter(function(a) { return a.status !== 'archived'; })); }).catch(function() {});
63
+ apiCall('/agents').then(function(d) { setAgents((d.agents || d || []).filter(function(a) { return a.status !== 'archived'; })); }).catch(function() {});
64
64
  }, []);
65
65
 
66
66
  var resetForm = function() {
package/src/db/adapter.ts CHANGED
@@ -209,6 +209,14 @@ export interface CompanySettings {
209
209
  modelPricingConfig?: ModelPricingConfig;
210
210
  orgEmailConfig?: OrgEmailConfig;
211
211
  platformCapabilities?: PlatformCapabilities;
212
+ branding?: {
213
+ logo?: string;
214
+ favicon?: string;
215
+ login_logo?: string;
216
+ login_bg?: string;
217
+ appleTouchIcon?: string;
218
+ [key: string]: string | undefined;
219
+ };
212
220
  createdAt: Date;
213
221
  updatedAt: Date;
214
222
  }
@@ -788,7 +788,8 @@ export class AgentHierarchyManager {
788
788
  const rows = await this.db.query<any>(`SELECT subject, context FROM agent_escalations WHERE id = $1`, [escalationId]);
789
789
  const original = rows?.[0];
790
790
  if (!original) throw new Error('Escalation not found');
791
- return this.escalate(fromAgentId, original.subject, `[Forwarded] ${original.context}`);
791
+ const result = await this.escalate(fromAgentId, original.subject, `[Forwarded] ${original.context}`);
792
+ return { ...result, newEscalationId: result.escalationId };
792
793
  }
793
794
 
794
795
  async getPendingEscalations(managerId: string): Promise<EscalationRecord[]> {
@@ -109,7 +109,7 @@ export class McpProcessManager extends EventEmitter {
109
109
  return { ...config, id: r.id } as McpServerConfig;
110
110
  });
111
111
 
112
- const enabled = servers.filter(s => s.enabled !== false);
112
+ const enabled = servers.filter((s: McpServerConfig) => s.enabled !== false);
113
113
  if (enabled.length === 0) {
114
114
  console.log('[mcp-manager] No enabled MCP servers found');
115
115
  return;
@@ -118,7 +118,7 @@ export class McpProcessManager extends EventEmitter {
118
118
  console.log(`[mcp-manager] Starting ${enabled.length} MCP server(s)...`);
119
119
 
120
120
  // Connect all in parallel
121
- await Promise.allSettled(enabled.map(s => this.connectServer(s)));
121
+ await Promise.allSettled(enabled.map((s: McpServerConfig) => this.connectServer(s)));
122
122
 
123
123
  // Start health check timer (every 60s)
124
124
  this.healthTimer = setInterval(() => this.healthCheck(), 60000);
@@ -345,7 +345,7 @@ engine.get('/hierarchy/escalations/:agentId', async (c) => {
345
345
  // CRUD for external MCP server connections (stdio, SSE, HTTP)
346
346
  engine.get('/mcp-servers', async (c) => {
347
347
  try {
348
- const rows = await engineDb.query(`SELECT * FROM mcp_servers WHERE org_id = $1 ORDER BY created_at DESC`, ['default']);
348
+ const rows = await _engineDb!.query(`SELECT * FROM mcp_servers WHERE org_id = $1 ORDER BY created_at DESC`, ['default']);
349
349
  const servers = (rows || []).map((r: any) => {
350
350
  const config = typeof r.config === 'string' ? JSON.parse(r.config) : (r.config || {});
351
351
  return { id: r.id, ...config, status: r.status || 'unknown', toolCount: r.tool_count || 0, tools: r.tools ? (typeof r.tools === 'string' ? JSON.parse(r.tools) : r.tools) : [] };
@@ -362,7 +362,7 @@ engine.get('/mcp-servers', async (c) => {
362
362
 
363
363
  engine.post('/mcp-servers', async (c) => {
364
364
  try {
365
- await engineDb.exec(`CREATE TABLE IF NOT EXISTS mcp_servers (
365
+ await _engineDb!.execute(`CREATE TABLE IF NOT EXISTS mcp_servers (
366
366
  id TEXT PRIMARY KEY DEFAULT gen_random_uuid()::text,
367
367
  org_id TEXT NOT NULL DEFAULT 'default',
368
368
  config JSONB NOT NULL DEFAULT '{}',
@@ -374,7 +374,7 @@ engine.post('/mcp-servers', async (c) => {
374
374
  )`);
375
375
  const body = await c.req.json();
376
376
  const id = crypto.randomUUID();
377
- await engineDb.exec(`INSERT INTO mcp_servers (id, org_id, config) VALUES ($1, $2, $3)`, [id, 'default', JSON.stringify(body)]);
377
+ await _engineDb!.execute(`INSERT INTO mcp_servers (id, org_id, config) VALUES ($1, $2, $3)`, [id, 'default', JSON.stringify(body)]);
378
378
  return c.json({ ok: true, id });
379
379
  } catch (e: any) { return c.json({ error: e.message }, 500); }
380
380
  });
@@ -384,18 +384,18 @@ engine.put('/mcp-servers/:id', async (c) => {
384
384
  const id = c.req.param('id');
385
385
  const body = await c.req.json();
386
386
  // Merge with existing config
387
- const rows = await engineDb.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
387
+ const rows = await _engineDb!.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
388
388
  if (!rows?.length) return c.json({ error: 'Server not found' }, 404);
389
389
  const existing = typeof rows[0].config === 'string' ? JSON.parse(rows[0].config) : (rows[0].config || {});
390
390
  const merged = { ...existing, ...body };
391
- await engineDb.exec(`UPDATE mcp_servers SET config = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(merged), id]);
391
+ await _engineDb!.execute(`UPDATE mcp_servers SET config = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(merged), id]);
392
392
  return c.json({ ok: true });
393
393
  } catch (e: any) { return c.json({ error: e.message }, 500); }
394
394
  });
395
395
 
396
396
  engine.delete('/mcp-servers/:id', async (c) => {
397
397
  try {
398
- await engineDb.exec(`DELETE FROM mcp_servers WHERE id = $1`, [c.req.param('id')]);
398
+ await _engineDb!.execute(`DELETE FROM mcp_servers WHERE id = $1`, [c.req.param('id')]);
399
399
  return c.json({ ok: true });
400
400
  } catch (e: any) { return c.json({ error: e.message }, 500); }
401
401
  });
@@ -405,11 +405,11 @@ engine.put('/mcp-servers/:id/agents', async (c) => {
405
405
  try {
406
406
  const id = c.req.param('id');
407
407
  const { agentIds } = await c.req.json<{ agentIds: string[] }>();
408
- const rows = await engineDb.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
408
+ const rows = await _engineDb!.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
409
409
  if (!rows?.length) return c.json({ error: 'Server not found' }, 404);
410
410
  const existing = typeof rows[0].config === 'string' ? JSON.parse(rows[0].config) : (rows[0].config || {});
411
411
  existing.assignedAgents = agentIds || [];
412
- await engineDb.exec(`UPDATE mcp_servers SET config = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(existing), id]);
412
+ await _engineDb!.execute(`UPDATE mcp_servers SET config = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(existing), id]);
413
413
  return c.json({ ok: true });
414
414
  } catch (e: any) { return c.json({ error: e.message }, 500); }
415
415
  });
@@ -426,7 +426,7 @@ engine.post('/mcp-servers/:id/reload', async (c) => {
426
426
  engine.post('/mcp-servers/:id/test', async (c) => {
427
427
  try {
428
428
  const id = c.req.param('id');
429
- const rows = await engineDb.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
429
+ const rows = await _engineDb!.query(`SELECT config FROM mcp_servers WHERE id = $1`, [id]);
430
430
  if (!rows?.length) return c.json({ error: 'Server not found' }, 404);
431
431
  const config = typeof rows[0].config === 'string' ? JSON.parse(rows[0].config) : (rows[0].config || {});
432
432
 
@@ -491,7 +491,7 @@ engine.post('/mcp-servers/:id/test', async (c) => {
491
491
  });
492
492
 
493
493
  // Save discovered tools
494
- await engineDb.exec(`UPDATE mcp_servers SET status = 'connected', tool_count = $1, tools = $2, updated_at = NOW() WHERE id = $3`,
494
+ await _engineDb!.execute(`UPDATE mcp_servers SET status = 'connected', tool_count = $1, tools = $2, updated_at = NOW() WHERE id = $3`,
495
495
  [tools.length, JSON.stringify(tools.map((t: any) => ({ name: t.name, description: t.description }))), id]);
496
496
 
497
497
  return c.json({ ok: true, tools: tools.length, serverInfo: result.result?.serverInfo });
@@ -525,14 +525,14 @@ engine.post('/mcp-servers/:id/test', async (c) => {
525
525
  tools = td.result?.tools || [];
526
526
  }
527
527
 
528
- await engineDb.exec(`UPDATE mcp_servers SET status = 'connected', tool_count = $1, tools = $2, updated_at = NOW() WHERE id = $3`,
528
+ await _engineDb!.execute(`UPDATE mcp_servers SET status = 'connected', tool_count = $1, tools = $2, updated_at = NOW() WHERE id = $3`,
529
529
  [tools.length, JSON.stringify(tools.map((t: any) => ({ name: t.name, description: t.description }))), id]);
530
530
 
531
531
  return c.json({ ok: true, tools: tools.length, serverInfo: data.result?.serverInfo });
532
532
  }
533
533
  } catch (e: any) {
534
534
  // Update status to error
535
- try { await engineDb.exec(`UPDATE mcp_servers SET status = 'error', updated_at = NOW() WHERE id = $1`, [c.req.param('id')]); } catch {}
535
+ try { await _engineDb!.execute(`UPDATE mcp_servers SET status = 'error', updated_at = NOW() WHERE id = $1`, [c.req.param('id')]); } catch {}
536
536
  return c.json({ error: e.message });
537
537
  }
538
538
  });
@@ -552,12 +552,12 @@ engine.put('/integrations/:skillId/credentials', async (c) => {
552
552
  const entries = await vault.getSecretsByOrg(orgId, 'skill_credential');
553
553
  const existing = entries.find((e: any) => e.name === secretName);
554
554
  if (existing) {
555
- await vault.updateSecret(existing.id, { value: value as string });
555
+ await vault.updateSecret(existing.id, value as string);
556
556
  } else {
557
- await vault.storeSecret({ name: secretName, value: value as string, category: 'skill_credential', orgId });
557
+ await vault.storeSecret(orgId, secretName, 'skill_credential', value as string);
558
558
  }
559
559
  } catch {
560
- await vault.storeSecret({ name: secretName, value: value as string, category: 'skill_credential', orgId });
560
+ await vault.storeSecret(orgId, secretName, 'skill_credential', value as string);
561
561
  }
562
562
  }
563
563
  return c.json({ ok: true });
@@ -849,7 +849,7 @@ async function startChatPoller(engineDb: any): Promise<void> {
849
849
  const standaloneAgentPorts: Record<string, number> = {};
850
850
  // Check chat-webhook config for known ports
851
851
  try {
852
- const rows = await engineDb.query(`SELECT key, value FROM engine_settings WHERE key = 'standalone_agents'`);
852
+ const rows = await _engineDb!.query(`SELECT key, value FROM engine_settings WHERE key = 'standalone_agents'`);
853
853
  if (rows?.[0]) {
854
854
  const sa = JSON.parse((rows[0] as any).value);
855
855
  for (const a of sa) standaloneAgentPorts[a.id] = a.port;
@@ -84,7 +84,8 @@ export type ToolCategory =
84
84
  | 'execute' // Runs code/commands
85
85
  | 'communicate' // Sends messages externally
86
86
  | 'destroy' // Deletes data
87
- | 'memory'; // Memory read/write
87
+ | 'memory' // Memory read/write
88
+ | 'utility'; // General-purpose utility
88
89
 
89
90
  export type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
90
91
 
@@ -107,7 +108,9 @@ export type SideEffect =
107
108
  | 'spawns-agent'
108
109
  | 'writes-data'
109
110
  | 'creates-account'
110
- | 'configures-email';
111
+ | 'configures-email'
112
+ | 'database_write'
113
+ | 'external_api';
111
114
 
112
115
  // ─── Individual Skill File Imports ──────────────────────
113
116
  import { Emoji } from './emoji.js';
@@ -209,6 +209,7 @@ export class TaskQueueManager {
209
209
  delegatedFrom?: string;
210
210
  delegationType?: string;
211
211
  customerContext?: TaskRecord['customerContext'];
212
+ source?: string;
212
213
  }): Promise<TaskRecord> {
213
214
  await this.init();
214
215
  const now = new Date().toISOString();
@@ -286,7 +287,7 @@ export class TaskQueueManager {
286
287
  category: source.category,
287
288
  tags: [...source.tags],
288
289
  priority: opts.priority || source.priority,
289
- parentTaskId: source.parentTaskId,
290
+ parentTaskId: source.parentTaskId || undefined,
290
291
  relatedAgentIds: [...new Set([...source.relatedAgentIds, source.assignedTo])],
291
292
  chainId: source.chainId || undefined,
292
293
  chainSeq: (source.chainSeq || 0) + 1,
@@ -245,7 +245,7 @@ export class ValidationError extends Error {
245
245
 
246
246
  type Validator = {
247
247
  field: string;
248
- type: 'string' | 'number' | 'boolean' | 'email' | 'url' | 'uuid';
248
+ type: 'string' | 'number' | 'boolean' | 'email' | 'url' | 'uuid' | 'object';
249
249
  required?: boolean;
250
250
  minLength?: number;
251
251
  maxLength?: number;
package/src/server.ts CHANGED
@@ -632,7 +632,7 @@ export function createServer(config: ServerConfig): ServerInstance {
632
632
  agentMemoryManager: agentMemoryMgr,
633
633
  vault: vaultRef2,
634
634
  permissionEngine: permRef2,
635
- hierarchyManager: (await import('./engine/routes.js')).hierarchyManager,
635
+ hierarchyManager: (await import('./engine/routes.js')).hierarchyManager ?? undefined,
636
636
  });
637
637
  await runtime.start();
638
638
  const runtimeApp = runtime.getApp();