@agenticmail/enterprise 0.5.400 → 0.5.401

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.
@@ -107,14 +107,16 @@ export function AgentDetailPage(props) {
107
107
  var [liveStatus, setLiveStatus] = useState(null);
108
108
  var [sseConnected, setSseConnected] = useState(false);
109
109
  useEffect(function() {
110
- var fetchStatus = function() {
111
- engineCall('/agent-status/' + encodeURIComponent(agentId))
112
- .then(function(d) { setLiveStatus(d); setSseConnected(true); })
113
- .catch(function() { setSseConnected(false); });
110
+ var es = new EventSource('/api/engine/agent-status-stream?agentId=' + encodeURIComponent(agentId));
111
+ es.onopen = function() { setSseConnected(true); };
112
+ es.onmessage = function(ev) {
113
+ try {
114
+ var d = JSON.parse(ev.data);
115
+ if (d.type === 'status' && d.agentId === agentId) { setLiveStatus(d); }
116
+ } catch(e) {}
114
117
  };
115
- fetchStatus();
116
- var interval = setInterval(fetchStatus, 5000);
117
- return function() { clearInterval(interval); };
118
+ es.onerror = function() { setSseConnected(false); };
119
+ return function() { es.close(); };
118
120
  }, [agentId]);
119
121
 
120
122
  // ─── Derived Values ─────────────────────────────────────
@@ -60,13 +60,15 @@ export function OverviewSection(props) {
60
60
  var rtStatus = _rtStatus[0]; var setRtStatus = _rtStatus[1];
61
61
 
62
62
  useEffect(function() {
63
- // Fetch status via polling (SSE has issues through Cloudflare tunnels)
64
- var fetchStatus = function() {
65
- engineCall('/agent-status/' + agentId).then(function(d) { setRtStatus(d); }).catch(function() {});
63
+ engineCall('/agent-status/' + agentId).then(function(d) { setRtStatus(d); }).catch(function() {});
64
+ var es = new EventSource('/api/engine/agent-status-stream?agentId=' + agentId);
65
+ es.onmessage = function(event) {
66
+ try {
67
+ var data = JSON.parse(event.data);
68
+ if (data.type === 'status') setRtStatus(data);
69
+ } catch {}
66
70
  };
67
- fetchStatus();
68
- var interval = setInterval(fetchStatus, 5000);
69
- return function() { clearInterval(interval); };
71
+ return function() { es.close(); };
70
72
  }, [agentId]);
71
73
 
72
74
  // ─── Action Handlers ───────────────────────────────────
@@ -61,12 +61,15 @@ export function WorkforceSection(props) {
61
61
  var rtStatus = _rtStatus[0]; var setRtStatus = _rtStatus[1];
62
62
 
63
63
  useEffect(function() {
64
- var fetchStatus = function() {
65
- engineCall('/agent-status/' + agentId).then(function(d) { setRtStatus(d); }).catch(function() {});
64
+ engineCall('/agent-status/' + agentId).then(function(d) { setRtStatus(d); }).catch(function() {});
65
+ var es = new EventSource('/api/engine/agent-status-stream?agentId=' + agentId);
66
+ es.onmessage = function(event) {
67
+ try {
68
+ var data = JSON.parse(event.data);
69
+ if (data.type === 'status') setRtStatus(data);
70
+ } catch {}
66
71
  };
67
- fetchStatus();
68
- var interval = setInterval(fetchStatus, 10000);
69
- return function() { clearInterval(interval); };
72
+ return function() { es.close(); };
70
73
  }, [agentId]);
71
74
 
72
75
  var dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
@@ -1134,20 +1134,22 @@ export function AgentsPage({ onSelectAgent }) {
1134
1134
  const [creating, setCreating] = useState(false);
1135
1135
  const [liveStatuses, setLiveStatuses] = useState({});
1136
1136
 
1137
- // Poll agent statuses (SSE has issues through Cloudflare tunnels)
1137
+ // Subscribe to real-time agent status
1138
1138
  useEffect(function() {
1139
- var fetchStatuses = function() {
1140
- engineCall('/agent-status-all').then(function(data) {
1141
- if (data && data.statuses) {
1142
- var map = {};
1143
- data.statuses.forEach(function(s) { if (s.agentId) map[s.agentId] = s; });
1144
- setLiveStatuses(map);
1139
+ var es = new EventSource('/api/engine/agent-status-stream');
1140
+ es.onmessage = function(ev) {
1141
+ try {
1142
+ var d = JSON.parse(ev.data);
1143
+ if (d.type === 'status' && d.agentId) {
1144
+ setLiveStatuses(function(prev) {
1145
+ var next = Object.assign({}, prev);
1146
+ next[d.agentId] = d;
1147
+ return next;
1148
+ });
1145
1149
  }
1146
- }).catch(function() {});
1150
+ } catch(e) {}
1147
1151
  };
1148
- fetchStatuses();
1149
- var interval = setInterval(fetchStatuses, 8000);
1150
- return function() { clearInterval(interval); };
1152
+ return function() { es.close(); };
1151
1153
  }, []);
1152
1154
 
1153
1155
  const perms = app.permissions || '*';
@@ -340,10 +340,26 @@ export function ClusterPage() {
340
340
 
341
341
  useEffect(function() { load(); }, []);
342
342
 
343
- // Poll cluster status
343
+ // Real-time updates via SSE
344
344
  useEffect(function() {
345
- var interval = setInterval(function() { load(); }, 15000);
346
- return function() { clearInterval(interval); };
345
+ var es = new EventSource('/api/engine/cluster/stream');
346
+ es.onmessage = function(ev) {
347
+ try {
348
+ var d = JSON.parse(ev.data);
349
+ if (d.type === 'node') {
350
+ setNodes(function(prev) {
351
+ var idx = prev.findIndex(function(n) { return n.nodeId === d.nodeId; });
352
+ var next = prev.slice();
353
+ if (d.event === 'offline' && idx >= 0) { next[idx] = Object.assign({}, next[idx], { status: 'offline', agents: [] }); }
354
+ else if (idx >= 0) { next[idx] = d; }
355
+ else if (d.event === 'register' || d.event === 'snapshot') { next.push(d); }
356
+ return next;
357
+ });
358
+ engineCall('/cluster/nodes').then(function(dd) { setStats(dd.stats || null); }).catch(function() {});
359
+ }
360
+ } catch(e) {}
361
+ };
362
+ return function() { es.close(); };
347
363
  }, []);
348
364
 
349
365
  var removeNode = function(e, nodeId) {
@@ -257,3 +257,5 @@
257
257
  2026-03-06 03:37:29: 2026-03-06T02:37:29Z ERR Request failed error="stream 565 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=3eecd57d-03ae-440d-8945-5b35f43a8d90 event=0 ip=198.41.200.43 type=http
258
258
  2026-03-06 03:37:30: 2026-03-06T02:37:30Z ERR error="stream 593 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
259
259
  2026-03-06 03:37:30: 2026-03-06T02:37:30Z ERR Request failed error="stream 593 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=3eecd57d-03ae-440d-8945-5b35f43a8d90 event=0 ip=198.41.200.43 type=http
260
+ 2026-03-06 03:40:19: 2026-03-06T02:40:19Z ERR error="stream 673 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
261
+ 2026-03-06 03:40:19: 2026-03-06T02:40:19Z ERR Request failed error="stream 673 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream event=0 ip=198.41.200.43 type=http
@@ -9,3 +9,5 @@
9
9
  2026-03-06 03:24:40: [TaskPoller] spawnForTask error: Cannot find module '/Users/ope/Desktop/projects/agenticmail/enterprise/dist/agent-tools-SXHMNUVO.js' imported from /Users/ope/Desktop/projects/agenticmail/enterprise/dist/chunk-ZG54KN2R.js
10
10
  2026-03-06 03:24:55: [TaskPoller] spawnForTask error: No API key configured for provider: undefined
11
11
  2026-03-06 03:30:50: [TaskPoller] spawnForTask error: No API key configured for provider: undefined
12
+ 2026-03-06 03:39:47: [runtime] Marked stale session: JcWAi0Zj5k3i6A697xteM
13
+ 2026-03-06 03:39:47: [runtime] Marked stale session: i-KTYjRjZVj_FH-jZPf27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.400",
3
+ "version": "0.5.401",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {