@agenticmail/enterprise 0.5.262 → 0.5.264

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-JOEBIVIE.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-F5NPN7BG.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-D4SZ5O2E.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.262",
3
+ "version": "0.5.264",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,6 +48,13 @@
48
48
  .back:hover { color: var(--text-primary); }
49
49
  strong { color: var(--text-primary); }
50
50
  </style>
51
+ <script>
52
+ // Sync theme with dashboard (reads from localStorage)
53
+ (function() {
54
+ var t = localStorage.getItem('em_theme') || 'dark';
55
+ document.documentElement.setAttribute('data-theme', t);
56
+ })();
57
+ </script>
51
58
  <script>
52
59
  // Sync theme with dashboard preference
53
60
  (function() {
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Database Access — Agent Tool Bridge
3
+ *
4
+ * Creates tools that agents can use to query databases they have access to.
5
+ * Each agent only sees connections they've been granted access to.
6
+ */
7
+
8
+ import type { DatabaseConnectionManager } from './connection-manager.js';
9
+ import { DATABASE_LABELS } from './types.js';
10
+
11
+ interface ToolDefinition {
12
+ name: string;
13
+ description: string;
14
+ parameters: Record<string, any>;
15
+ execute: (input: any) => Promise<any>;
16
+ category?: string;
17
+ sideEffects?: string[];
18
+ }
19
+
20
+ export function createDatabaseTools(manager: DatabaseConnectionManager, agentId: string): ToolDefinition[] {
21
+ const accessList = manager.getAgentAccess(agentId);
22
+ if (accessList.length === 0) return [];
23
+
24
+ const tools: ToolDefinition[] = [];
25
+
26
+ // Tool 1: List available databases
27
+ tools.push({
28
+ name: 'db_list_connections',
29
+ description: 'List database connections this agent has access to.',
30
+ category: 'database',
31
+ parameters: { type: 'object', properties: {}, required: [] },
32
+ async execute() {
33
+ const connections = accessList.map(a => {
34
+ const conn = manager.getConnection(a.connectionId);
35
+ if (!conn) return null;
36
+ return {
37
+ connectionId: conn.id,
38
+ name: conn.name,
39
+ type: conn.type,
40
+ typeLabel: DATABASE_LABELS[conn.type] || conn.type,
41
+ database: conn.database,
42
+ host: conn.host,
43
+ status: conn.status,
44
+ permissions: a.permissions,
45
+ description: conn.description,
46
+ };
47
+ }).filter(Boolean);
48
+ return { connections };
49
+ },
50
+ });
51
+
52
+ // Tool 2: Execute SQL query
53
+ tools.push({
54
+ name: 'db_query',
55
+ description: 'Execute a SQL query on a connected database. Use db_list_connections first to see available databases.',
56
+ category: 'database',
57
+ sideEffects: ['database_write'],
58
+ parameters: {
59
+ type: 'object',
60
+ properties: {
61
+ connectionId: { type: 'string', description: 'Database connection ID' },
62
+ sql: { type: 'string', description: 'SQL query to execute' },
63
+ params: { type: 'array', items: { type: 'string' }, description: 'Query parameters (for parameterized queries)' },
64
+ },
65
+ required: ['connectionId', 'sql'],
66
+ },
67
+ async execute(input: { connectionId: string; sql: string; params?: any[] }) {
68
+ const result = await manager.executeQuery({
69
+ connectionId: input.connectionId,
70
+ agentId,
71
+ operation: 'read',
72
+ sql: input.sql,
73
+ params: input.params,
74
+ });
75
+
76
+ if (!result.success) {
77
+ return { error: result.error, queryId: result.queryId };
78
+ }
79
+
80
+ return {
81
+ rows: result.rows,
82
+ rowCount: result.rowCount,
83
+ affectedRows: result.affectedRows,
84
+ fields: result.fields,
85
+ executionTimeMs: result.executionTimeMs,
86
+ truncated: result.truncated,
87
+ queryId: result.queryId,
88
+ };
89
+ },
90
+ });
91
+
92
+ // Tool 3: Describe table schema
93
+ tools.push({
94
+ name: 'db_describe_table',
95
+ description: 'Get the schema (columns, types, constraints) of a database table.',
96
+ category: 'database',
97
+ parameters: {
98
+ type: 'object',
99
+ properties: {
100
+ connectionId: { type: 'string', description: 'Database connection ID' },
101
+ table: { type: 'string', description: 'Table name' },
102
+ },
103
+ required: ['connectionId', 'table'],
104
+ },
105
+ async execute(input: { connectionId: string; table: string }) {
106
+ const conn = manager.getConnection(input.connectionId);
107
+ if (!conn) return { error: 'Connection not found' };
108
+
109
+ // Build describe query based on database type
110
+ let sql: string;
111
+ switch (conn.type) {
112
+ case 'postgresql': case 'cockroachdb': case 'supabase': case 'neon':
113
+ sql = `SELECT column_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_name = '${input.table.replace(/'/g, "''")}' ORDER BY ordinal_position`;
114
+ break;
115
+ case 'mysql': case 'mariadb': case 'planetscale':
116
+ sql = `DESCRIBE \`${input.table.replace(/`/g, '``')}\``;
117
+ break;
118
+ case 'sqlite': case 'turso':
119
+ sql = `PRAGMA table_info('${input.table.replace(/'/g, "''")}')`;
120
+ break;
121
+ default:
122
+ return { error: `Schema inspection not supported for ${conn.type}` };
123
+ }
124
+
125
+ return manager.executeQuery({
126
+ connectionId: input.connectionId,
127
+ agentId,
128
+ operation: 'read',
129
+ sql,
130
+ });
131
+ },
132
+ });
133
+
134
+ // Tool 4: List tables
135
+ tools.push({
136
+ name: 'db_list_tables',
137
+ description: 'List all tables in the connected database.',
138
+ category: 'database',
139
+ parameters: {
140
+ type: 'object',
141
+ properties: {
142
+ connectionId: { type: 'string', description: 'Database connection ID' },
143
+ },
144
+ required: ['connectionId'],
145
+ },
146
+ async execute(input: { connectionId: string }) {
147
+ const conn = manager.getConnection(input.connectionId);
148
+ if (!conn) return { error: 'Connection not found' };
149
+
150
+ let sql: string;
151
+ switch (conn.type) {
152
+ case 'postgresql': case 'cockroachdb': case 'supabase': case 'neon':
153
+ sql = `SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name`;
154
+ break;
155
+ case 'mysql': case 'mariadb': case 'planetscale':
156
+ sql = 'SHOW TABLES';
157
+ break;
158
+ case 'sqlite': case 'turso':
159
+ sql = `SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%' ORDER BY name`;
160
+ break;
161
+ case 'mongodb':
162
+ sql = JSON.stringify({ collection: 'system.namespaces', operation: 'find', filter: {} });
163
+ break;
164
+ default:
165
+ return { error: `Table listing not supported for ${conn.type}` };
166
+ }
167
+
168
+ return manager.executeQuery({
169
+ connectionId: input.connectionId,
170
+ agentId,
171
+ operation: 'read',
172
+ sql,
173
+ });
174
+ },
175
+ });
176
+
177
+ return tools;
178
+ }