@agenticmail/enterprise 0.5.225 → 0.5.227

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-OFDHFNAL.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-QUY235JZ.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-2HW54CJF.js";
10
+ import "./chunk-VQQ4SYYQ.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.225",
3
+ "version": "0.5.227",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli-agent.ts CHANGED
@@ -899,6 +899,7 @@ export async function runAgent(_args: string[]) {
899
899
  task: ctx.messageText,
900
900
  model: config.model || process.env.AGENTICMAIL_MODEL,
901
901
  sessionId: undefined,
902
+ source: ctx.source || 'internal',
902
903
  });
903
904
  } catch (e: any) { /* non-fatal */ }
904
905
 
@@ -55,23 +55,23 @@
55
55
  }
56
56
 
57
57
  [data-theme="light"] {
58
- --bg-primary: #f8f9fb;
59
- --bg-secondary: #ffffff;
60
- --bg-tertiary: #f1f3f8;
61
- --bg-hover: #e8ebf0;
62
- --bg-active: #dde1ea;
63
- --bg-card: #ffffff;
64
- --bg-input: #f1f3f8;
58
+ --bg-primary: #d0c5a0;
59
+ --bg-secondary: #ddd3b2;
60
+ --bg-tertiary: #c8bc94;
61
+ --bg-hover: #c0b488;
62
+ --bg-active: #b8ab7e;
63
+ --bg-card: #ddd3b2;
64
+ --bg-input: #c8bc94;
65
65
  --bg-modal: rgba(0,0,0,0.4);
66
- --border: #e2e5ed;
67
- --border-light: #eceef4;
68
- --text-primary: #111827;
69
- --text-secondary: #4b5563;
70
- --text-muted: #9ca3af;
66
+ --border: #b0a47a;
67
+ --border-light: #c4b890;
68
+ --text-primary: #2c2410;
69
+ --text-secondary: #4a3f28;
70
+ --text-muted: #7a6e50;
71
71
  --text-inverse: #ffffff;
72
- --shadow: 0 1px 3px rgba(0,0,0,0.08);
73
- --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
74
- --shadow-xl: 0 8px 24px rgba(0,0,0,0.12);
72
+ --shadow: 0 1px 3px rgba(44,36,16,0.12);
73
+ --shadow-lg: 0 4px 12px rgba(44,36,16,0.15);
74
+ --shadow-xl: 0 8px 24px rgba(44,36,16,0.18);
75
75
  }
76
76
 
77
77
  /* ═══════════════════════════════════════════════════════════
@@ -14,6 +14,8 @@ var PAD = 16;
14
14
  var STATUS_COLORS = { created: '#6366f1', assigned: '#f59e0b', in_progress: '#06b6d4', completed: '#22c55e', failed: '#ef4444', cancelled: '#6b7394' };
15
15
  var PRIORITY_COLORS = { urgent: '#ef4444', high: '#f59e0b', normal: '#6366f1', low: '#6b7394' };
16
16
  var DELEGATION_COLORS = { delegation: '#6366f1', review: '#f59e0b', revision: '#f97316', escalation: '#ef4444', return: '#22c55e' };
17
+ var SOURCE_META = { telegram: { icon: '\u2708\uFE0F', label: 'Telegram', color: '#0088cc' }, whatsapp: { icon: '\uD83D\uDCAC', label: 'WhatsApp', color: '#25d366' }, email: { icon: '\u2709\uFE0F', label: 'Email', color: '#ea4335' }, google_chat: { icon: '\uD83D\uDDE8\uFE0F', label: 'Google Chat', color: '#1a73e8' }, internal: { icon: '\u2699\uFE0F', label: 'Internal', color: '#6b7394' }, api: { icon: '\uD83D\uDD17', label: 'API', color: '#8b5cf6' } };
18
+ function sourceBadge(src) { var m = SOURCE_META[src] || { icon: '\uD83D\uDCE8', label: src || 'Unknown', color: '#6b7394' }; return h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: 3, fontSize: 9, padding: '1px 5px', borderRadius: 4, background: m.color + '18', color: m.color, fontWeight: 600, whiteSpace: 'nowrap', flexShrink: 0 } }, m.icon + ' ' + m.label); }
17
19
  // Theme-aware: use CSS variables where possible, detect dark/light
18
20
  function isDark() { try { return window.matchMedia('(prefers-color-scheme: dark)').matches || document.documentElement.classList.contains('dark') || document.body.getAttribute('data-theme') === 'dark'; } catch(e) { return true; } }
19
21
  var BG = 'var(--bg-canvas, var(--bg-primary, #0a0c14))';
@@ -225,6 +227,7 @@ function TaskDetail(props) {
225
227
  h('div', { style: { display: 'flex', gap: 6, marginBottom: 16, alignItems: 'center', flexWrap: 'wrap' } },
226
228
  h('span', { style: { padding: '3px 10px', borderRadius: 12, fontSize: 11, fontWeight: 600, background: statusColor + '22', color: statusColor, border: '1px solid ' + statusColor + '44' } }, task.status.replace('_', ' ').toUpperCase()),
227
229
  h('span', { style: { padding: '3px 10px', borderRadius: 12, fontSize: 11, background: (PRIORITY_COLORS[task.priority] || '#6366f1') + '22', color: PRIORITY_COLORS[task.priority] || '#6366f1' } }, task.priority.toUpperCase()),
230
+ task.source && sourceBadge(task.source),
228
231
  task.chainId && h('span', { style: { padding: '3px 10px', borderRadius: 12, fontSize: 11, background: 'rgba(99,102,241,0.1)', color: '#6366f1', fontFamily: 'var(--font-mono)' } }, 'Chain #' + task.chainId.slice(0, 8)),
229
232
  task.delegationType && tag(DELEGATION_COLORS[task.delegationType] || '#6b7394', task.delegationType)
230
233
  ),
@@ -258,7 +261,8 @@ function TaskDetail(props) {
258
261
  h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Created'), h('div', null, task.createdAt ? new Date(task.createdAt).toLocaleString() : '-')),
259
262
  h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Duration'), h('div', null, formatDuration(task.actualDurationMs))),
260
263
  h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Model'), h('div', null, task.modelUsed || task.model || '-')),
261
- h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Tokens / Cost'), h('div', null, (task.tokensUsed || 0).toLocaleString() + ' / $' + (task.costUsd || 0).toFixed(4)))
264
+ h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Tokens / Cost'), h('div', null, (task.tokensUsed || 0).toLocaleString() + ' / $' + (task.costUsd || 0).toFixed(4))),
265
+ h('div', null, h('div', { style: { color: 'var(--text-muted)', fontSize: 11, marginBottom: 2 } }, 'Source'), task.source ? sourceBadge(task.source) : h('div', null, '-'))
262
266
  ),
263
267
 
264
268
  // Task chain timeline (if part of a chain)
@@ -737,6 +741,7 @@ export function TaskPipelinePage() {
737
741
  h('div', { style: { display: 'flex', alignItems: 'center', gap: 4, flexWrap: 'nowrap', overflow: 'hidden' } },
738
742
  tag(sc, t.status.replace('_', ' ')),
739
743
  h('span', { style: { fontSize: 9, color: 'var(--tp-text-dim)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', minWidth: 0 } }, t.assignedToName || t.assignedTo),
744
+ t.source && sourceBadge(t.source),
740
745
  t.delegationType && tag(DELEGATION_COLORS[t.delegationType] || '#6b7394', t.delegationType),
741
746
  h('span', { style: { fontSize: 9, color: 'var(--tp-text-dim)', marginLeft: 'auto' } }, timeAgo(t.createdAt))
742
747
  ),
@@ -840,14 +845,14 @@ export function TaskPipelinePage() {
840
845
  return h('div', {
841
846
  key: i,
842
847
  className: 'tp-node',
843
- onClick: function(e) { e.stopPropagation(); if (step.taskId) { var ct = expandedChain.find(function(c) { return c.id === step.taskId; }); if (ct) openTaskDetail(ct); } },
848
+ onClick: function(e) { e.stopPropagation(); if (step.taskId) { var ct = expandedChain.find(function(c) { return c.id === step.taskId; }); if (ct) openTaskDetail(ct); } else if (expandedChain.length > 0) { openTaskDetail(expandedChain[0]); } },
844
849
  style: {
845
850
  position: 'absolute', left: x, top: 4, width: isTerminal ? 'auto' : STEP_W, minWidth: isTerminal ? 90 : undefined, height: STEP_H,
846
851
  background: isTerminal ? sc + '15' : isMe ? 'rgba(255,255,255,0.06)' : 'rgba(255,255,255,0.02)',
847
852
  border: '1px solid ' + (isTerminal ? sc + '44' : isMe ? sc : 'rgba(255,255,255,0.1)'),
848
853
  borderRadius: isTerminal ? 18 : 6,
849
854
  display: 'flex', alignItems: 'center', gap: 6, padding: '0 8px',
850
- cursor: step.taskId ? 'pointer' : 'default',
855
+ cursor: 'pointer',
851
856
  },
852
857
  },
853
858
  // Avatar
@@ -26,6 +26,7 @@ export interface BeforeSpawnContext {
26
26
  relatedAgentIds?: string[];
27
27
  priority?: TaskPriority;
28
28
  estimatedDurationMs?: number;
29
+ source?: string; // 'telegram' | 'whatsapp' | 'email' | 'google_chat' | 'internal' | 'api'
29
30
  }
30
31
 
31
32
  /**
@@ -100,6 +101,7 @@ export async function beforeSpawn(
100
101
  model: ctx.model,
101
102
  fallbackModel: ctx.fallbackModel,
102
103
  estimatedDurationMs: ctx.estimatedDurationMs,
104
+ source: ctx.source,
103
105
  });
104
106
 
105
107
  // Immediately mark as assigned
@@ -59,6 +59,9 @@ export interface TaskRecord {
59
59
  tokensUsed: number;
60
60
  costUsd: number;
61
61
 
62
+ // Source platform
63
+ source: string | null; // 'telegram' | 'whatsapp' | 'email' | 'google_chat' | 'internal' | 'api'
64
+
62
65
  // Task chain (multi-agent delegation tracking)
63
66
  chainId: string | null; // shared ID across all tasks in a delegation chain
64
67
  chainSeq: number; // sequence number within chain (0 = origin)
@@ -149,7 +152,8 @@ export class TaskQueueManager {
149
152
  delegated_to TEXT,
150
153
  delegation_type TEXT,
151
154
  customer_context TEXT,
152
- activity_log TEXT NOT NULL DEFAULT '[]'
155
+ activity_log TEXT NOT NULL DEFAULT '[]',
156
+ source TEXT
153
157
  )`);
154
158
  await this.db.run(`CREATE INDEX IF NOT EXISTS idx_task_pipeline_org ON task_pipeline(org_id)`);
155
159
  await this.db.run(`CREATE INDEX IF NOT EXISTS idx_task_pipeline_agent ON task_pipeline(assigned_to)`);
@@ -159,7 +163,8 @@ export class TaskQueueManager {
159
163
  for (const col of [
160
164
  ['chain_id', 'TEXT'], ['chain_seq', 'INTEGER DEFAULT 0'], ['delegated_from', 'TEXT'],
161
165
  ['delegated_to', 'TEXT'], ['delegation_type', 'TEXT'], ['customer_context', 'TEXT'],
162
- ['activity_log', 'TEXT DEFAULT \'[]\'']
166
+ ['activity_log', 'TEXT DEFAULT \'[]\''],
167
+ ['source', 'TEXT']
163
168
  ]) {
164
169
  try { await this.db.run(`ALTER TABLE task_pipeline ADD COLUMN ${col[0]} ${col[1]}`); } catch { /* already exists */ }
165
170
  }
@@ -243,6 +248,7 @@ export class TaskQueueManager {
243
248
  delegatedTo: null,
244
249
  delegationType: opts.delegationType || null,
245
250
  customerContext: opts.customerContext || null,
251
+ source: opts.source || null,
246
252
  activityLog: [{ ts: now, type: 'created', agent: opts.createdBy || 'system', detail: 'Task created' }],
247
253
  };
248
254
  this.tasks.set(task.id, task);
@@ -495,8 +501,8 @@ export class TaskQueueManager {
495
501
  parent_task_id, related_agent_ids, session_id,
496
502
  model, fallback_model, model_used, tokens_used, cost_usd,
497
503
  chain_id, chain_seq, delegated_from, delegated_to, delegation_type,
498
- customer_context, activity_log
499
- ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
504
+ customer_context, activity_log, source
505
+ ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
500
506
  ON CONFLICT (id) DO UPDATE SET
501
507
  status=EXCLUDED.status, priority=EXCLUDED.priority, progress=EXCLUDED.progress,
502
508
  assigned_at=EXCLUDED.assigned_at, started_at=EXCLUDED.started_at, completed_at=EXCLUDED.completed_at,
@@ -517,6 +523,7 @@ export class TaskQueueManager {
517
523
  task.chainId, task.chainSeq, task.delegatedFrom, task.delegatedTo, task.delegationType,
518
524
  task.customerContext ? JSON.stringify(task.customerContext) : null,
519
525
  JSON.stringify(task.activityLog || []),
526
+ task.source,
520
527
  ]);
521
528
  } catch (e: any) {
522
529
  console.error('[TaskQueue] persist error:', e.message);
@@ -560,6 +567,7 @@ export class TaskQueueManager {
560
567
  delegatedTo: row.delegated_to || null,
561
568
  delegationType: row.delegation_type || null,
562
569
  customerContext: safeJson(row.customer_context, null),
570
+ source: row.source || null,
563
571
  activityLog: safeJson(row.activity_log, []),
564
572
  };
565
573
  }