@agenticmail/enterprise 0.5.284 → 0.5.285
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.
- package/dist/agent-heartbeat-GI6XINBR.js +510 -0
- package/dist/agent-tools-AMOV3TMJ.js +7 -0
- package/dist/agent-tools-LM4ZHP26.js +13881 -0
- package/dist/chunk-BYHI6J56.js +1224 -0
- package/dist/chunk-PGF7LVVJ.js +178 -0
- package/dist/chunk-VXXVAGG3.js +4739 -0
- package/dist/chunk-WPHIEGC2.js +1068 -0
- package/dist/chunk-Z3F5BTKX.js +3780 -0
- package/dist/cli-agent-CEKDOLMO.js +1778 -0
- package/dist/cli-serve-HYXJKPWV.js +114 -0
- package/dist/cli.js +3 -3
- package/dist/connection-manager-7E26LH63.js +7 -0
- package/dist/dashboard/assets/brand-logos.js +1 -0
- package/dist/dashboard/pages/database-access.js +1 -0
- package/dist/index.js +3 -3
- package/dist/routes-NXCGQADV.js +13695 -0
- package/dist/runtime-DNW3ZDHQ.js +45 -0
- package/dist/server-WH4AUQ5D.js +15 -0
- package/dist/setup-AAIQB5FA.js +20 -0
- package/package.json +8 -1
- package/src/dashboard/assets/brand-logos.js +1 -0
- package/src/dashboard/pages/database-access.js +1 -0
- package/src/database-access/connection-manager.ts +29 -0
- package/src/database-access/types.ts +4 -2
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// src/database-access/types.ts
|
|
2
|
+
var DATABASE_LABELS = {
|
|
3
|
+
postgresql: "PostgreSQL",
|
|
4
|
+
mysql: "MySQL",
|
|
5
|
+
mariadb: "MariaDB",
|
|
6
|
+
sqlite: "SQLite",
|
|
7
|
+
mongodb: "MongoDB",
|
|
8
|
+
redis: "Redis",
|
|
9
|
+
mssql: "Microsoft SQL Server",
|
|
10
|
+
oracle: "Oracle",
|
|
11
|
+
cockroachdb: "CockroachDB",
|
|
12
|
+
planetscale: "PlanetScale",
|
|
13
|
+
turso: "Turso / LibSQL",
|
|
14
|
+
dynamodb: "AWS DynamoDB",
|
|
15
|
+
supabase: "Supabase",
|
|
16
|
+
neon: "Neon",
|
|
17
|
+
upstash: "Upstash Redis"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/database-access/agent-tools.ts
|
|
21
|
+
function createDatabaseTools(manager, agentId) {
|
|
22
|
+
const accessList = manager.getAgentAccess(agentId);
|
|
23
|
+
if (accessList.length === 0) return [];
|
|
24
|
+
const tools = [];
|
|
25
|
+
tools.push({
|
|
26
|
+
name: "db_list_connections",
|
|
27
|
+
description: "List database connections this agent has access to.",
|
|
28
|
+
category: "database",
|
|
29
|
+
parameters: { type: "object", properties: {}, required: [] },
|
|
30
|
+
async execute() {
|
|
31
|
+
const connections = accessList.map((a) => {
|
|
32
|
+
const conn = manager.getConnection(a.connectionId);
|
|
33
|
+
if (!conn) return null;
|
|
34
|
+
return {
|
|
35
|
+
connectionId: conn.id,
|
|
36
|
+
name: conn.name,
|
|
37
|
+
type: conn.type,
|
|
38
|
+
typeLabel: DATABASE_LABELS[conn.type] || conn.type,
|
|
39
|
+
database: conn.database,
|
|
40
|
+
host: conn.host,
|
|
41
|
+
status: conn.status,
|
|
42
|
+
permissions: a.permissions,
|
|
43
|
+
description: conn.description
|
|
44
|
+
};
|
|
45
|
+
}).filter(Boolean);
|
|
46
|
+
return { connections };
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
tools.push({
|
|
50
|
+
name: "db_query",
|
|
51
|
+
description: "Execute a SQL query on a connected database. Use db_list_connections first to see available databases.",
|
|
52
|
+
category: "database",
|
|
53
|
+
sideEffects: ["database_write"],
|
|
54
|
+
parameters: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
connectionId: { type: "string", description: "Database connection ID" },
|
|
58
|
+
sql: { type: "string", description: "SQL query to execute" },
|
|
59
|
+
params: { type: "array", items: { type: "string" }, description: "Query parameters (for parameterized queries)" }
|
|
60
|
+
},
|
|
61
|
+
required: ["connectionId", "sql"]
|
|
62
|
+
},
|
|
63
|
+
async execute(input) {
|
|
64
|
+
const result = await manager.executeQuery({
|
|
65
|
+
connectionId: input.connectionId,
|
|
66
|
+
agentId,
|
|
67
|
+
operation: "read",
|
|
68
|
+
sql: input.sql,
|
|
69
|
+
params: input.params
|
|
70
|
+
});
|
|
71
|
+
if (!result.success) {
|
|
72
|
+
return { error: result.error, queryId: result.queryId };
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
rows: result.rows,
|
|
76
|
+
rowCount: result.rowCount,
|
|
77
|
+
affectedRows: result.affectedRows,
|
|
78
|
+
fields: result.fields,
|
|
79
|
+
executionTimeMs: result.executionTimeMs,
|
|
80
|
+
truncated: result.truncated,
|
|
81
|
+
queryId: result.queryId
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
tools.push({
|
|
86
|
+
name: "db_describe_table",
|
|
87
|
+
description: "Get the schema (columns, types, constraints) of a database table.",
|
|
88
|
+
category: "database",
|
|
89
|
+
parameters: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
connectionId: { type: "string", description: "Database connection ID" },
|
|
93
|
+
table: { type: "string", description: "Table name" }
|
|
94
|
+
},
|
|
95
|
+
required: ["connectionId", "table"]
|
|
96
|
+
},
|
|
97
|
+
async execute(input) {
|
|
98
|
+
const conn = manager.getConnection(input.connectionId);
|
|
99
|
+
if (!conn) return { error: "Connection not found" };
|
|
100
|
+
let sql;
|
|
101
|
+
switch (conn.type) {
|
|
102
|
+
case "postgresql":
|
|
103
|
+
case "cockroachdb":
|
|
104
|
+
case "supabase":
|
|
105
|
+
case "neon":
|
|
106
|
+
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`;
|
|
107
|
+
break;
|
|
108
|
+
case "mysql":
|
|
109
|
+
case "mariadb":
|
|
110
|
+
case "planetscale":
|
|
111
|
+
sql = `DESCRIBE \`${input.table.replace(/`/g, "``")}\``;
|
|
112
|
+
break;
|
|
113
|
+
case "sqlite":
|
|
114
|
+
case "turso":
|
|
115
|
+
sql = `PRAGMA table_info('${input.table.replace(/'/g, "''")}')`;
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
return { error: `Schema inspection not supported for ${conn.type}` };
|
|
119
|
+
}
|
|
120
|
+
return manager.executeQuery({
|
|
121
|
+
connectionId: input.connectionId,
|
|
122
|
+
agentId,
|
|
123
|
+
operation: "read",
|
|
124
|
+
sql
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
tools.push({
|
|
129
|
+
name: "db_list_tables",
|
|
130
|
+
description: "List all tables in the connected database.",
|
|
131
|
+
category: "database",
|
|
132
|
+
parameters: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
connectionId: { type: "string", description: "Database connection ID" }
|
|
136
|
+
},
|
|
137
|
+
required: ["connectionId"]
|
|
138
|
+
},
|
|
139
|
+
async execute(input) {
|
|
140
|
+
const conn = manager.getConnection(input.connectionId);
|
|
141
|
+
if (!conn) return { error: "Connection not found" };
|
|
142
|
+
let sql;
|
|
143
|
+
switch (conn.type) {
|
|
144
|
+
case "postgresql":
|
|
145
|
+
case "cockroachdb":
|
|
146
|
+
case "supabase":
|
|
147
|
+
case "neon":
|
|
148
|
+
sql = `SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name`;
|
|
149
|
+
break;
|
|
150
|
+
case "mysql":
|
|
151
|
+
case "mariadb":
|
|
152
|
+
case "planetscale":
|
|
153
|
+
sql = "SHOW TABLES";
|
|
154
|
+
break;
|
|
155
|
+
case "sqlite":
|
|
156
|
+
case "turso":
|
|
157
|
+
sql = `SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%' ORDER BY name`;
|
|
158
|
+
break;
|
|
159
|
+
case "mongodb":
|
|
160
|
+
sql = JSON.stringify({ collection: "system.namespaces", operation: "find", filter: {} });
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
return { error: `Table listing not supported for ${conn.type}` };
|
|
164
|
+
}
|
|
165
|
+
return manager.executeQuery({
|
|
166
|
+
connectionId: input.connectionId,
|
|
167
|
+
agentId,
|
|
168
|
+
operation: "read",
|
|
169
|
+
sql
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return tools;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export {
|
|
177
|
+
createDatabaseTools
|
|
178
|
+
};
|