@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.
- package/dist/agent-heartbeat-KYZXQEAE.js +510 -0
- package/dist/chunk-OLTC5KIG.js +4466 -0
- package/dist/chunk-QTLKNMY5.js +3778 -0
- package/dist/chunk-TC4SD4GV.js +1224 -0
- package/dist/chunk-WXHYZKM4.js +468 -0
- package/dist/cli-agent-BB4GKQAM.js +1735 -0
- package/dist/cli-serve-GBITKZXM.js +114 -0
- package/dist/cli.js +3 -3
- package/dist/dashboard/pages/skill-connections.js +2 -2
- package/dist/index.js +3 -3
- package/dist/routes-MCPDNAWT.js +13510 -0
- package/dist/runtime-YARRX33S.js +45 -0
- package/dist/server-7VOWIFYS.js +15 -0
- package/dist/setup-LVM34MUC.js +20 -0
- package/package.json +1 -1
- package/src/admin/routes.ts +2 -2
- package/src/cli-agent.ts +1 -1
- package/src/dashboard/pages/skill-connections.js +2 -2
- package/src/db/adapter.ts +8 -0
- package/src/engine/agent-hierarchy.ts +2 -1
- package/src/engine/mcp-process-manager.ts +2 -2
- package/src/engine/routes.ts +16 -16
- package/src/engine/skills.ts +5 -2
- package/src/engine/task-queue.ts +2 -1
- package/src/middleware/index.ts +1 -1
- package/src/server.ts +1 -1
|
@@ -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
package/src/admin/routes.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
package/src/engine/routes.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
555
|
+
await vault.updateSecret(existing.id, value as string);
|
|
556
556
|
} else {
|
|
557
|
-
await vault.storeSecret(
|
|
557
|
+
await vault.storeSecret(orgId, secretName, 'skill_credential', value as string);
|
|
558
558
|
}
|
|
559
559
|
} catch {
|
|
560
|
-
await vault.storeSecret(
|
|
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
|
|
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;
|
package/src/engine/skills.ts
CHANGED
|
@@ -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'
|
|
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';
|
package/src/engine/task-queue.ts
CHANGED
|
@@ -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,
|
package/src/middleware/index.ts
CHANGED
|
@@ -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();
|