@agenticmail/enterprise 0.5.240 → 0.5.241

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-POBOGETZ.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-YJ2OELZW.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-3VULBHMF.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.240",
3
+ "version": "0.5.241",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1154,6 +1154,9 @@ export function createAgentRoutes(opts: {
1154
1154
  return c.json({ config: managed.config?.browserConfig || {} });
1155
1155
  });
1156
1156
 
1157
+ // ── In-memory registry of running meeting browsers (survives config save/reload issues) ──
1158
+ const meetingBrowsers = new Map<string, { port: number; cdpUrl: string; pid?: number }>();
1159
+
1157
1160
  /**
1158
1161
  * POST /bridge/agents/:id/browser-config/launch-meeting-browser
1159
1162
  * Launches a meeting-ready headed Chrome instance with virtual display + audio.
@@ -1267,16 +1270,21 @@ export function createAgentRoutes(opts: {
1267
1270
  }, 400);
1268
1271
  }
1269
1272
 
1270
- // Check if a meeting browser is already running for this agent
1271
- const existingPort = (managed.config as any)?.meetingBrowserPort;
1273
+ // Check if a meeting browser is already running for this agent (in-memory registry first, then config fallback)
1274
+ const tracked = meetingBrowsers.get(agentId);
1275
+ const existingPort = tracked?.port || (managed.config as any)?.meetingBrowserPort;
1272
1276
  if (existingPort) {
1273
1277
  try {
1274
1278
  const resp = await fetch(`http://127.0.0.1:${existingPort}/json/version`, { signal: AbortSignal.timeout(2000) });
1275
1279
  if (resp.ok) {
1276
1280
  const data = await resp.json() as any;
1281
+ // Ensure registry is up to date
1282
+ meetingBrowsers.set(agentId, { port: existingPort, cdpUrl: data.webSocketDebuggerUrl, pid: tracked?.pid });
1277
1283
  return c.json({ ok: true, alreadyRunning: true, cdpUrl: data.webSocketDebuggerUrl, port: existingPort, browserVersion: data.Browser });
1278
1284
  }
1279
1285
  } catch { /* not running, will launch new one */ }
1286
+ // Was tracked but not responding — clean up
1287
+ meetingBrowsers.delete(agentId);
1280
1288
  }
1281
1289
 
1282
1290
  // ── Create a realistic browser profile using agent identity ──
@@ -1398,12 +1406,13 @@ export function createAgentRoutes(opts: {
1398
1406
  return c.json({ error: 'Chrome launched but CDP not responding after 15s' });
1399
1407
  }
1400
1408
 
1401
- // Save port to agent config for reuse
1409
+ // Save to in-memory registry (primary) and agent config (backup)
1410
+ meetingBrowsers.set(agentId, { port, cdpUrl, pid: child.pid });
1402
1411
  if (!managed.config) managed.config = {} as any;
1403
1412
  (managed.config as any).meetingBrowserPort = port;
1404
1413
  (managed.config as any).meetingBrowserCdpUrl = cdpUrl;
1405
1414
  managed.updatedAt = new Date().toISOString();
1406
- await lifecycle.saveAgent(agentId);
1415
+ try { await lifecycle.saveAgent(agentId); } catch (e) { console.warn('[meeting-browser] Config save failed (non-fatal):', e); }
1407
1416
 
1408
1417
  return c.json({ ok: true, cdpUrl, port, browserVersion, pid: child.pid });
1409
1418
  } catch (e: any) {
@@ -1421,7 +1430,8 @@ export function createAgentRoutes(opts: {
1421
1430
  if (!managed) return c.json({ error: 'Agent not found' }, 404);
1422
1431
 
1423
1432
  try {
1424
- const port = (managed.config as any)?.meetingBrowserPort;
1433
+ const tracked = meetingBrowsers.get(agentId);
1434
+ const port = tracked?.port || (managed.config as any)?.meetingBrowserPort;
1425
1435
  if (!port) return c.json({ error: 'No meeting browser is tracked for this agent' }, 400);
1426
1436
 
1427
1437
  // Try to close gracefully via CDP
@@ -1440,20 +1450,28 @@ export function createAgentRoutes(opts: {
1440
1450
  }
1441
1451
  } catch { /* not running or not reachable */ }
1442
1452
 
1443
- // Fallback: kill by port
1453
+ // Fallback: kill by PID first (most reliable), then by port
1454
+ if (!closed && tracked?.pid) {
1455
+ try { process.kill(tracked.pid, 'SIGTERM'); closed = true; } catch { /* already dead */ }
1456
+ }
1444
1457
  if (!closed) {
1445
1458
  try {
1446
1459
  const { execSync } = await import('node:child_process');
1447
- execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null || true`, { timeout: 5000 });
1460
+ if (process.platform === 'win32') {
1461
+ execSync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr :${port}') do taskkill /PID %a /F 2>nul`, { timeout: 5000 });
1462
+ } else {
1463
+ execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null || fuser -k ${port}/tcp 2>/dev/null || true`, { timeout: 5000 });
1464
+ }
1448
1465
  closed = true;
1449
1466
  } catch { /* already dead */ }
1450
1467
  }
1451
1468
 
1452
- // Clear config
1469
+ // Clear from registry and config
1470
+ meetingBrowsers.delete(agentId);
1453
1471
  delete (managed.config as any).meetingBrowserPort;
1454
1472
  delete (managed.config as any).meetingBrowserCdpUrl;
1455
1473
  managed.updatedAt = new Date().toISOString();
1456
- await lifecycle.saveAgent(agentId);
1474
+ try { await lifecycle.saveAgent(agentId); } catch (e) { console.warn('[meeting-browser] Config save failed (non-fatal):', e); }
1457
1475
 
1458
1476
  return c.json({ ok: true, stopped: true, port });
1459
1477
  } catch (e: any) {