@agenticmail/enterprise 0.5.134 → 0.5.136

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,49 @@
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-AALG4XI4.js";
18
+ import "./chunk-TYW5XTOW.js";
19
+ import "./chunk-AQH4DFYV.js";
20
+ import {
21
+ PROVIDER_REGISTRY,
22
+ listAllProviders,
23
+ resolveApiKeyForProvider,
24
+ resolveProvider
25
+ } from "./chunk-67KZYSLU.js";
26
+ import "./chunk-JLSQOQ5L.js";
27
+ import "./chunk-NRF3YRF7.js";
28
+ import "./chunk-KFQGP6VL.js";
29
+ export {
30
+ AgentRuntime,
31
+ EmailChannel,
32
+ FollowUpScheduler,
33
+ PROVIDER_REGISTRY,
34
+ SessionManager,
35
+ SubAgentManager,
36
+ ToolRegistry,
37
+ callLLM,
38
+ createAgentRuntime,
39
+ createNoopHooks,
40
+ createRuntimeHooks,
41
+ estimateMessageTokens,
42
+ estimateTokens,
43
+ executeTool,
44
+ listAllProviders,
45
+ resolveApiKeyForProvider,
46
+ resolveProvider,
47
+ runAgentLoop,
48
+ toolsToDefinitions
49
+ };
@@ -0,0 +1,49 @@
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-PE3BOJL4.js";
18
+ import "./chunk-TYW5XTOW.js";
19
+ import "./chunk-AQH4DFYV.js";
20
+ import {
21
+ PROVIDER_REGISTRY,
22
+ listAllProviders,
23
+ resolveApiKeyForProvider,
24
+ resolveProvider
25
+ } from "./chunk-67KZYSLU.js";
26
+ import "./chunk-JLSQOQ5L.js";
27
+ import "./chunk-NRF3YRF7.js";
28
+ import "./chunk-KFQGP6VL.js";
29
+ export {
30
+ AgentRuntime,
31
+ EmailChannel,
32
+ FollowUpScheduler,
33
+ PROVIDER_REGISTRY,
34
+ SessionManager,
35
+ SubAgentManager,
36
+ ToolRegistry,
37
+ callLLM,
38
+ createAgentRuntime,
39
+ createNoopHooks,
40
+ createRuntimeHooks,
41
+ estimateMessageTokens,
42
+ estimateTokens,
43
+ executeTool,
44
+ listAllProviders,
45
+ resolveApiKeyForProvider,
46
+ resolveProvider,
47
+ runAgentLoop,
48
+ toolsToDefinitions
49
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-KKRF3VDD.js";
4
+ import "./chunk-3SMTCIR4.js";
5
+ import "./chunk-RO537U6H.js";
6
+ import "./chunk-DRXMYYKN.js";
7
+ import "./chunk-67KZYSLU.js";
8
+ import "./chunk-JLSQOQ5L.js";
9
+ import "./chunk-KFQGP6VL.js";
10
+ export {
11
+ createServer
12
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-ZAYPAHTP.js";
4
+ import "./chunk-3SMTCIR4.js";
5
+ import "./chunk-RO537U6H.js";
6
+ import "./chunk-DRXMYYKN.js";
7
+ import "./chunk-67KZYSLU.js";
8
+ import "./chunk-JLSQOQ5L.js";
9
+ import "./chunk-KFQGP6VL.js";
10
+ export {
11
+ createServer
12
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-6SP2YIDD.js";
10
+ import "./chunk-MHIFVS5L.js";
11
+ import "./chunk-KFQGP6VL.js";
12
+ export {
13
+ promptCompanyInfo,
14
+ promptDatabase,
15
+ promptDeployment,
16
+ promptDomain,
17
+ promptRegistration,
18
+ provision,
19
+ runSetupWizard
20
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-ZKCDXIHF.js";
10
+ import "./chunk-MHIFVS5L.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.134",
3
+ "version": "0.5.136",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -228,11 +228,12 @@ function OverviewSection(props) {
228
228
  var rawTraits = identity.personality_traits || identity.traits || config.personality_traits || {};
229
229
  var traitList = Array.isArray(rawTraits) ? rawTraits : Object.values(rawTraits);
230
230
 
231
- var tokensToday = usageData?.tokensToday || usageData?.today?.tokens || 0;
232
- var costToday = usageData?.costToday || usageData?.today?.cost || 0;
233
- var uptime = usageData?.uptime || usageData?.uptimeSeconds || 0;
234
- var errorRate = usageData?.errorRate || usageData?.today?.errorRate || 0;
235
- var activeSessions = usageData?.activeSessions || usageData?.sessions?.active || 0;
231
+ var uu = usageData?.usage || usageData || {};
232
+ var tokensToday = uu.tokensToday || uu.today?.tokens || 0;
233
+ var costToday = uu.costToday || uu.today?.cost || 0;
234
+ var uptime = uu.uptime || uu.uptimeSeconds || usageData?.uptime || 0;
235
+ var errorRate = uu.errorRate || uu.today?.errorRate || 0;
236
+ var activeSessions = uu.activeSessionCount || uu.activeSessions || uu.sessions?.active || 0;
236
237
 
237
238
  if (loading) {
238
239
  return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading overview...');
@@ -1336,12 +1337,13 @@ function BudgetSection(props) {
1336
1337
 
1337
1338
  // ─── Derived Usage Values ───────────────────────────────
1338
1339
 
1339
- var tokensToday = usageData?.tokensToday || usageData?.today?.tokens || 0;
1340
- var tokensMonth = usageData?.tokensMonth || usageData?.month?.tokens || usageData?.thisMonth?.tokens || 0;
1341
- var costToday = usageData?.costToday || usageData?.today?.cost || 0;
1342
- var costMonth = usageData?.costMonth || usageData?.month?.cost || usageData?.thisMonth?.cost || 0;
1343
- var sessionsToday = usageData?.sessionsToday || usageData?.today?.sessions || 0;
1344
- var errorsToday = usageData?.errorsToday || usageData?.today?.errors || 0;
1340
+ var bu = usageData?.usage || usageData || {};
1341
+ var tokensToday = bu.tokensToday || bu.today?.tokens || 0;
1342
+ var tokensMonth = bu.tokensThisMonth || bu.tokensMonth || bu.month?.tokens || 0;
1343
+ var costToday = bu.costToday || bu.today?.cost || 0;
1344
+ var costMonth = bu.costThisMonth || bu.costMonth || bu.month?.cost || 0;
1345
+ var sessionsToday = bu.sessionsToday || bu.today?.sessions || 0;
1346
+ var errorsToday = bu.errorsToday || bu.today?.errors || 0;
1345
1347
 
1346
1348
  // ─── Budget Limits ──────────────────────────────────────
1347
1349
 
@@ -588,6 +588,7 @@ export function createAgentRoutes(opts: {
588
588
  emailConfig.oauthScopes = [
589
589
  'https://www.googleapis.com/auth/gmail.modify',
590
590
  'https://www.googleapis.com/auth/gmail.send',
591
+ 'https://www.googleapis.com/auth/gmail.settings.basic',
591
592
  'https://www.googleapis.com/auth/calendar',
592
593
  'https://www.googleapis.com/auth/drive',
593
594
  'https://www.googleapis.com/auth/spreadsheets',
@@ -467,6 +467,43 @@ export class AgentLifecycleManager {
467
467
 
468
468
  // ─── Monitoring ─────────────────────────────────────
469
469
 
470
+ /**
471
+ * Record LLM usage (tokens + cost) from an agent session turn.
472
+ */
473
+ recordLLMUsage(agentId: string, opts: {
474
+ inputTokens?: number;
475
+ outputTokens?: number;
476
+ costUsd?: number;
477
+ }) {
478
+ const agent = this.agents.get(agentId);
479
+ if (!agent) return;
480
+
481
+ const totalTokens = (opts.inputTokens || 0) + (opts.outputTokens || 0);
482
+ const usage = agent.usage;
483
+ if (totalTokens > 0) {
484
+ usage.tokensToday += totalTokens;
485
+ usage.tokensThisWeek += totalTokens;
486
+ usage.tokensThisMonth += totalTokens;
487
+ usage.tokensThisYear += totalTokens;
488
+ }
489
+ if (opts.costUsd) {
490
+ usage.costToday += opts.costUsd;
491
+ usage.costThisWeek += opts.costUsd;
492
+ usage.costThisMonth += opts.costUsd;
493
+ usage.costThisYear += opts.costUsd;
494
+ }
495
+ usage.lastUpdated = new Date().toISOString();
496
+
497
+ // Check budget caps
498
+ const budget = agent.budgetConfig;
499
+ if (budget) {
500
+ if (budget.dailyCostCap > 0 && usage.costToday >= budget.dailyCostCap) {
501
+ this.fireBudgetAlert(agent, 'daily_exceeded', 'cost', usage.costToday, budget.dailyCostCap);
502
+ this.stop(agentId, 'system', 'Daily cost budget exceeded').catch(() => {});
503
+ }
504
+ }
505
+ }
506
+
470
507
  /**
471
508
  * Record a tool call for usage tracking with per-agent budget controls
472
509
  */